@nextcloud/files 3.0.0-beta.7 → 3.0.0-beta.8
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/fileAction.d.ts +75 -0
- package/dist/files/node.d.ts +4 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.esm.js +114 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +161 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
3
|
+
*
|
|
4
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
5
|
+
*
|
|
6
|
+
* @license AGPL-3.0-or-later
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Affero General Public License as
|
|
10
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
11
|
+
* License, or (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Affero General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
import { Node } from "./files/node";
|
|
23
|
+
interface FileActionData {
|
|
24
|
+
/** Unique ID */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Translatable string displayed in the menu */
|
|
27
|
+
displayName: (files: Node[], view: any) => string;
|
|
28
|
+
/** Svg as inline string. <svg><path fill="..." /></svg> */
|
|
29
|
+
iconSvgInline: (files: Node[], view: any) => string;
|
|
30
|
+
/** Condition wether this action is shown or not */
|
|
31
|
+
enabled?: (files: Node[], view: any) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Function executed on single file action
|
|
34
|
+
* @returns true if the action was executed, false otherwise
|
|
35
|
+
* @throws Error if the action failed
|
|
36
|
+
*/
|
|
37
|
+
exec: (file: Node, view: any) => Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Function executed on multiple files action
|
|
40
|
+
* @returns true if the action was executed, false otherwise
|
|
41
|
+
* @throws Error if the action failed
|
|
42
|
+
*/
|
|
43
|
+
execBatch?: (files: Node[], view: any) => Promise<boolean[]>;
|
|
44
|
+
/** This action order in the list */
|
|
45
|
+
order?: number;
|
|
46
|
+
/** Make this action the default */
|
|
47
|
+
default?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If true, the renderInline function will be called
|
|
50
|
+
*/
|
|
51
|
+
inline?: (file: Node, view: any) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* If defined, the returned html element will be
|
|
54
|
+
* appended before the actions menu.
|
|
55
|
+
*/
|
|
56
|
+
renderInline?: (file: Node, view: any) => HTMLElement;
|
|
57
|
+
}
|
|
58
|
+
export declare class FileAction {
|
|
59
|
+
private _action;
|
|
60
|
+
constructor(action: FileActionData);
|
|
61
|
+
get id(): string;
|
|
62
|
+
get displayName(): (files: Node[], view: any) => string;
|
|
63
|
+
get iconSvgInline(): (files: Node[], view: any) => string;
|
|
64
|
+
get enabled(): ((files: Node[], view: any) => boolean) | undefined;
|
|
65
|
+
get exec(): (file: Node, view: any) => Promise<boolean>;
|
|
66
|
+
get execBatch(): ((files: Node[], view: any) => Promise<boolean[]>) | undefined;
|
|
67
|
+
get order(): number | undefined;
|
|
68
|
+
get default(): boolean | undefined;
|
|
69
|
+
get inline(): ((file: Node, view: any) => boolean) | undefined;
|
|
70
|
+
get renderInline(): ((file: Node, view: any) => HTMLElement) | undefined;
|
|
71
|
+
private validateAction;
|
|
72
|
+
}
|
|
73
|
+
export declare const registerFileAction: (action: FileAction) => void;
|
|
74
|
+
export declare const getFileActions: () => FileAction[];
|
|
75
|
+
export {};
|
package/dist/files/node.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ export declare abstract class Node {
|
|
|
59
59
|
* Get the absolute path of this object relative to the root
|
|
60
60
|
*/
|
|
61
61
|
get path(): string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Get the file id if defined in attributes
|
|
64
|
+
*/
|
|
65
|
+
get fileid(): number | undefined;
|
|
62
66
|
/**
|
|
63
67
|
* Move the node to a new destination
|
|
64
68
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -22,16 +22,19 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export { formatFileSize } from './humanfilesize';
|
|
24
24
|
export { type Entry } from './newFileMenu';
|
|
25
|
+
import { FileAction } from './fileAction';
|
|
25
26
|
import { type Entry, NewFileMenu } from './newFileMenu';
|
|
26
27
|
export { FileType } from './files/fileType';
|
|
27
28
|
export { File } from './files/file';
|
|
28
29
|
export { Folder } from './files/folder';
|
|
29
30
|
export { Node } from './files/node';
|
|
30
31
|
export { Permission, parseWebdavPermissions } from './permissions';
|
|
32
|
+
export { FileAction, registerFileAction, getFileActions } from './fileAction';
|
|
31
33
|
declare global {
|
|
32
34
|
interface Window {
|
|
33
35
|
OC: any;
|
|
34
|
-
_nc_newfilemenu: NewFileMenu;
|
|
36
|
+
_nc_newfilemenu: NewFileMenu | undefined;
|
|
37
|
+
_nc_fileactions: FileAction[] | undefined;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -460,6 +460,12 @@ class Node {
|
|
|
460
460
|
get path() {
|
|
461
461
|
return (this.dirname + '/' + this.basename).replace(/\/\//g, '/');
|
|
462
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* Get the file id if defined in attributes
|
|
465
|
+
*/
|
|
466
|
+
get fileid() {
|
|
467
|
+
return this.attributes?.fileid;
|
|
468
|
+
}
|
|
463
469
|
/**
|
|
464
470
|
* Move the node to a new destination
|
|
465
471
|
*
|
|
@@ -548,6 +554,113 @@ class Folder extends Node {
|
|
|
548
554
|
}
|
|
549
555
|
}
|
|
550
556
|
|
|
557
|
+
/**
|
|
558
|
+
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
559
|
+
*
|
|
560
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
561
|
+
*
|
|
562
|
+
* @license AGPL-3.0-or-later
|
|
563
|
+
*
|
|
564
|
+
* This program is free software: you can redistribute it and/or modify
|
|
565
|
+
* it under the terms of the GNU Affero General Public License as
|
|
566
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
567
|
+
* License, or (at your option) any later version.
|
|
568
|
+
*
|
|
569
|
+
* This program is distributed in the hope that it will be useful,
|
|
570
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
571
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
572
|
+
* GNU Affero General Public License for more details.
|
|
573
|
+
*
|
|
574
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
575
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
576
|
+
*
|
|
577
|
+
*/
|
|
578
|
+
class FileAction {
|
|
579
|
+
_action;
|
|
580
|
+
constructor(action) {
|
|
581
|
+
this.validateAction(action);
|
|
582
|
+
this._action = action;
|
|
583
|
+
}
|
|
584
|
+
get id() {
|
|
585
|
+
return this._action.id;
|
|
586
|
+
}
|
|
587
|
+
get displayName() {
|
|
588
|
+
return this._action.displayName;
|
|
589
|
+
}
|
|
590
|
+
get iconSvgInline() {
|
|
591
|
+
return this._action.iconSvgInline;
|
|
592
|
+
}
|
|
593
|
+
get enabled() {
|
|
594
|
+
return this._action.enabled;
|
|
595
|
+
}
|
|
596
|
+
get exec() {
|
|
597
|
+
return this._action.exec;
|
|
598
|
+
}
|
|
599
|
+
get execBatch() {
|
|
600
|
+
return this._action.execBatch;
|
|
601
|
+
}
|
|
602
|
+
get order() {
|
|
603
|
+
return this._action.order;
|
|
604
|
+
}
|
|
605
|
+
get default() {
|
|
606
|
+
return this._action.default;
|
|
607
|
+
}
|
|
608
|
+
get inline() {
|
|
609
|
+
return this._action.inline;
|
|
610
|
+
}
|
|
611
|
+
get renderInline() {
|
|
612
|
+
return this._action.renderInline;
|
|
613
|
+
}
|
|
614
|
+
validateAction(action) {
|
|
615
|
+
if (!action.id || typeof action.id !== 'string') {
|
|
616
|
+
throw new Error('Invalid id');
|
|
617
|
+
}
|
|
618
|
+
if (!action.displayName || typeof action.displayName !== 'function') {
|
|
619
|
+
throw new Error('Invalid displayName function');
|
|
620
|
+
}
|
|
621
|
+
if (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {
|
|
622
|
+
throw new Error('Invalid iconSvgInline function');
|
|
623
|
+
}
|
|
624
|
+
if (!action.exec || typeof action.exec !== 'function') {
|
|
625
|
+
throw new Error('Invalid exec function');
|
|
626
|
+
}
|
|
627
|
+
// Optional properties --------------------------------------------
|
|
628
|
+
if ('enabled' in action && typeof action.enabled !== 'function') {
|
|
629
|
+
throw new Error('Invalid enabled function');
|
|
630
|
+
}
|
|
631
|
+
if ('execBatch' in action && typeof action.execBatch !== 'function') {
|
|
632
|
+
throw new Error('Invalid execBatch function');
|
|
633
|
+
}
|
|
634
|
+
if ('order' in action && typeof action.order !== 'number') {
|
|
635
|
+
throw new Error('Invalid order');
|
|
636
|
+
}
|
|
637
|
+
if ('default' in action && typeof action.default !== 'boolean') {
|
|
638
|
+
throw new Error('Invalid default');
|
|
639
|
+
}
|
|
640
|
+
if ('inline' in action && typeof action.inline !== 'function') {
|
|
641
|
+
throw new Error('Invalid inline function');
|
|
642
|
+
}
|
|
643
|
+
if ('renderInline' in action && typeof action.renderInline !== 'function') {
|
|
644
|
+
throw new Error('Invalid renderInline function');
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
const registerFileAction = function (action) {
|
|
649
|
+
if (typeof window._nc_fileactions === 'undefined') {
|
|
650
|
+
window._nc_fileactions = [];
|
|
651
|
+
logger.debug('FileActions initialized');
|
|
652
|
+
}
|
|
653
|
+
// Check duplicates
|
|
654
|
+
if (window._nc_fileactions.find(search => search.id === action.id)) {
|
|
655
|
+
logger.error(`FileAction ${action.id} already registered`, { action });
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
window._nc_fileactions.push(action);
|
|
659
|
+
};
|
|
660
|
+
const getFileActions = function () {
|
|
661
|
+
return window._nc_fileactions || [];
|
|
662
|
+
};
|
|
663
|
+
|
|
551
664
|
/**
|
|
552
665
|
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
553
666
|
*
|
|
@@ -594,5 +707,5 @@ const getNewFileMenuEntries = function (context) {
|
|
|
594
707
|
return newFileMenu.getEntries(context);
|
|
595
708
|
};
|
|
596
709
|
|
|
597
|
-
export { File, FileType, Folder, Node, Permission, addNewFileMenuEntry, formatFileSize, getNewFileMenuEntries, parseWebdavPermissions, removeNewFileMenuEntry };
|
|
710
|
+
export { File, FileAction, FileType, Folder, Node, Permission, addNewFileMenuEntry, formatFileSize, getFileActions, getNewFileMenuEntries, parseWebdavPermissions, registerFileAction, removeNewFileMenuEntry };
|
|
598
711
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../lib/humanfilesize.ts","../lib/utils/logger.ts","../lib/newFileMenu.ts","../lib/files/fileType.ts","../lib/permissions.ts","../lib/files/nodeData.ts","../lib/files/node.ts","../lib/files/file.ts","../lib/files/folder.ts","../lib/index.ts"],"sourcesContent":["/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n */\nexport function formatFileSize(size: number|string, skipSmallSizes: boolean = false, binaryPrefixes: boolean = false): string {\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t/*\n\t* @note This block previously used Log base 1024, per IEC 80000-13;\n\t* however, the wrong prefix was used. Now we use decimal calculation\n\t* with base 1000 per the SI. Base 1024 calculation with binary\n\t* prefixes is optional, but has yet to be added to the UI.\n\t*/\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(binaryPrefixes ? 1024 : 1000)) : 0;\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order);\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order];\n\tlet relativeSize = (size / Math.pow(binaryPrefixes ? 1024 : 1000, order)).toFixed(1);\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1]);\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0);\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale());\n\t}\n\n\treturn relativeSize + ' ' + readableFormat;\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCurrentUser } from '@nextcloud/auth'\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nconst getLogger = user => {\n\tif (user === null) {\n\t\treturn getLoggerBuilder()\n\t\t\t.setApp('files')\n\t\t\t.build()\n\t}\n\treturn getLoggerBuilder()\n\t\t.setApp('files')\n\t\t.setUid(user.uid)\n\t\t.build()\n}\n\nexport default getLogger(getCurrentUser())\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport logger from \"./utils/logger\"\n\nexport interface Entry {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\t// Default new file name\n\ttemplateName?: string\n\t// Condition wether this entry is shown or not\n\tif?: (context: Object) => Boolean\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\t/** Existing icon css class */\n\ticonClass?: string\n\t/** Function to be run after creation */\n\thandler?: Function\n}\n\nexport class NewFileMenu {\n\tprivate _entries: Array<Entry> = []\n\t\n\tpublic registerEntry(entry: Entry) {\n\t\tthis.validateEntry(entry)\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: Entry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\t\t\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry , entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\t\n\t/**\n\t * Get the list of registered entries\n\t * \n\t * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n\t */\n\tpublic getEntries(context?: Object): Array<Entry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.if === 'function' ? entry.if(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: Entry) {\n\t\tif (!entry.id || !entry.displayName || !(entry.iconSvgInline || entry.iconClass)) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif ((entry.iconClass && typeof entry.iconClass !== 'string')\n\t\t\t|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.if !== undefined && typeof entry.if !== 'function') {\n\t\t\tthrow new Error('Invalid if property')\n\t\t}\n\n\t\tif (entry.templateName && typeof entry.templateName !== 'string') {\n\t\t\tthrow new Error('Invalid templateName property')\n\t\t}\n\n\t\tif (entry.handler && typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif (!entry.templateName && !entry.handler) {\n\t\t\tthrow new Error('At least a templateName or a handler must be provided')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n}\n\nexport const getNewFileMenu = function(): NewFileMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewFileMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nexport enum FileType {\n\tFolder = 'folder',\n\tFile = 'file',\n}\n","\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport enum Permission {\n\tNONE = 0,\n\tCREATE = 4,\n\tREAD = 1,\n\tUPDATE = 2,\n\tDELETE = 8,\n\tSHARE = 16,\n\tALL = 31,\n}\n\n/**\n * Parse the webdav permission string to a permission enum\n * @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88\n */\nexport const parseWebdavPermissions = function(permString: string = ''): number {\n\tlet permissions = Permission.NONE\n\n\tif (!permString)\n\t\treturn permissions\n\n\tif (permString.includes('C') || permString.includes('K'))\n\t\tpermissions |= Permission.CREATE\n\n\tif (permString.includes('G'))\n\t\tpermissions |= Permission.READ\n\n\tif (permString.includes('W') || permString.includes('N') || permString.includes('V'))\n\t\tpermissions |= Permission.UPDATE\n\n\tif (permString.includes('D'))\n\t\tpermissions |= Permission.DELETE\n\n\tif (permString.includes('R'))\n\t\tpermissions |= Permission.SHARE\n\n\treturn permissions\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Permission } from \"../permissions\"\n\nexport interface Attribute { [key: string]: any }\n\nexport default interface NodeData {\n\t/** Unique ID */\n\tid?: number\n\n\t/**\n\t * URL to the ressource.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t * or https://domain.com/Photos/picture.jpg\n\t */\n\tsource: string\n\n\t/** Last modified time */\n\tmtime?: Date\n\n\t/** Creation time */\n\tcrtime?: Date\n\n\t/** The mime type */\n\tmime?: string\n\n\t/** The node size type */\n\tsize?: number\n\n\t/** The node permissions */\n\tpermissions?: Permission\n\n\t/** The owner UID of this node */\n\towner: string|null\n\n\tattributes?: Attribute\n\n\t/**\n\t * The absolute root of the home relative to the service.\n\t * It is highly recommended to provide that information.\n\t * e.g. /files/emma\n\t */\n\troot?: string\n}\n \n/**\n * Validate Node construct data\n */\nexport const validateData = (data: NodeData) => {\n\tif ('id' in data && (typeof data.id !== 'number' || data.id < 0)) {\n\t\tthrow new Error('Invalid id type of value')\n\t}\n\n\tif (!data.source) {\n\t\tthrow new Error('Missing mandatory source')\n\t}\n\n\tif (!data.source.startsWith('http')) {\n\t\tthrow new Error('Invalid source format')\n\t}\n\n\tif ('mtime' in data && !(data.mtime instanceof Date)) {\n\t\tthrow new Error('Invalid mtime type')\n\t}\n\n\tif ('crtime' in data && !(data.crtime instanceof Date)) {\n\t\tthrow new Error('Invalid crtime type')\n\t}\n\n\tif (!data.mime || typeof data.mime !== 'string'\n\t\t|| !data.mime.match(/^[-\\w.]+\\/[-+\\w.]+$/gi)) {\n\t\tthrow new Error('Missing or invalid mandatory mime')\n\t}\n\n\tif ('size' in data && typeof data.size !== 'number') {\n\t\tthrow new Error('Invalid size type')\n\t}\n\n\tif ('permissions' in data && !(\n\t\t\ttypeof data.permissions === 'number'\n\t\t\t&& data.permissions >= Permission.NONE\n\t\t\t&& data.permissions <= Permission.ALL\n\t\t)) {\n\t\tthrow new Error('Invalid permissions')\n\t}\n\n\tif ('owner' in data\n\t\t&& data.owner !== null\n\t\t&& typeof data.owner !== 'string') {\n\t\tthrow new Error('Invalid owner type')\n\t}\n\n\tif ('attributes' in data && typeof data.attributes !== 'object') {\n\t\tthrow new Error('Invalid attributes format')\n\t}\n\n\tif ('root' in data && typeof data.root !== 'string') {\n\t\tthrow new Error('Invalid root format')\n\t}\n\n\tif (data.root && !data.root.startsWith('/')) {\n\t\tthrow new Error('Root must start with a leading slash')\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { basename, extname, dirname } from 'path'\nimport { Permission } from '../permissions'\nimport { FileType } from './fileType'\nimport NodeData, { Attribute, validateData } from './nodeData'\n\nexport abstract class Node {\n\tprivate _data: NodeData\n\tprivate _attributes: Attribute[]\n\tprivate _knownDavService = /(remote|public)\\.php\\/(web)?dav/i\n\n\tconstructor(data: NodeData, davService?: RegExp) {\n\t\t// Validate data\n\t\tvalidateData(data)\n\n\t\tthis._data = data\n\t\tthis._attributes = data.attributes || {} as any\n\t\tdelete this._data.attributes\n\n\t\tif (davService) {\n\t\t\tthis._knownDavService = davService\n\t\t}\n\t}\n\n\t/**\n\t * Get the source url to this object\n\t */\n\tget source(): string {\n\t\t// strip any ending slash\n\t\treturn this._data.source.replace(/\\/$/i, '')\n\t}\n\n\t/**\n\t * Get this object name\n\t */\n\tget basename(): string {\n\t\treturn basename(this.source)\n\t}\n\n\t/**\n\t * Get this object's extension\n\t */\n\tget extension(): string|null {\n\t\treturn extname(this.source)\n\t}\n\n\t/**\n\t * Get the directory path leading to this object\n\t * Will use the relative path to root if available\n\t */\n\tget dirname(): string {\n\t\tif (this.root) {\n\t\t\treturn dirname(this.source.split(this.root).pop() || '/')\n\t\t}\n\t\treturn dirname(this.source)\n\t}\n\n\t/**\n\t * Is it a file or a folder ?\n\t */\n\tabstract get type(): FileType\n\n\t/**\n\t * Get the file mime\n\t */\n\tget mime(): string|undefined {\n\t\treturn this._data.mime\n\t}\n\n\t/**\n\t * Get the file size\n\t */\n\tget size(): number|undefined {\n\t\treturn this._data.size\n\t}\n\n\t/**\n\t * Get the file attribute\n\t */\n\tget attributes(): Attribute {\n\t\treturn this._attributes\n\t}\n\n\t/**\n\t * Get the file permissions\n\t */\n\tget permissions(): Permission {\n\t\t// If this is not a dav ressource, we can only read it\n\t\tif (this.owner === null && !this.isDavRessource) {\n\t\t\treturn Permission.READ\n\t\t}\n\n\t\treturn this._data.permissions || Permission.READ\n\t}\n\n\t/**\n\t * Get the file owner\n\t */\n\tget owner(): string|null {\n\t\t// Remote ressources have no owner\n\t\tif (!this.isDavRessource) {\n\t\t\treturn null\n\t\t}\n\t\treturn this._data.owner\n\t}\n\n\t/**\n\t * Is this a dav-related ressource ?\n\t */\n\tget isDavRessource(): boolean {\n\t\treturn this.source.match(this._knownDavService) !== null\n\t}\n\n\t/**\n\t * Get the dav root of this object\n\t */\n\tget root(): string|null {\n\t\t// If provided (recommended), use the root and strip away the ending slash\n\t\tif (this._data.root) {\n\t\t\treturn this._data.root.replace(/^(.+)\\/$/, '$1')\n\t\t}\n\n\t\t// Use the source to get the root from the dav service\n\t\tif (this.isDavRessource) {\n\t\t\tconst root = dirname(this.source)\n\t\t\treturn root.split(this._knownDavService).pop() || null\n\t\t}\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Get the absolute path of this object relative to the root\n\t */\n\tget path(): string|null {\n\t\treturn (this.dirname + '/' + this.basename).replace(/\\/\\//g, '/')\n\t}\n\n\t/**\n\t * Move the node to a new destination\n\t *\n\t * @param {string} destination the new source.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t */\n\tmove(destination: string) {\n\t\tthis._data.source = destination\n\t}\n\n\t/**\n\t * Rename the node\n\t * This aliases the move method for easier usage\n\t */\n\trename(basename) {\n\t\tif (basename.includes('/')) {\n\t\t\tthrow new Error('Invalid basename')\n\t\t}\n\t\tthis.move(dirname(this.source) + '/' + basename)\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class File extends Node {\n\tget type(): FileType {\n\t\treturn FileType.File\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\nimport NodeData from './nodeData'\n\nexport class Folder extends Node {\n\tconstructor(data: NodeData) {\n\t\t// enforcing mimes\n\t\tsuper({\n\t\t\t...data,\n\t\t\tmime: 'httpd/unix-directory'\n\t\t})\n\t}\n\n\tget type(): FileType {\n\t\treturn FileType.Folder\n\t}\n\n\tget extension(): string|null {\n\t\treturn null\n\t}\n\n\tget mime(): string {\n\t\treturn 'httpd/unix-directory'\n\t}\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport { formatFileSize } from './humanfilesize'\nexport { type Entry } from './newFileMenu'\nimport { type Entry, getNewFileMenu, NewFileMenu } from './newFileMenu'\n\nexport { FileType } from './files/fileType'\nexport { File } from './files/file'\nexport { Folder } from './files/folder'\nexport { Node } from './files/node'\nexport { Permission, parseWebdavPermissions } from './permissions'\n\ndeclare global {\n\tinterface Window {\n\t\tOC: any;\n\t\t_nc_newfilemenu: NewFileMenu;\n\t}\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n */\nexport const addNewFileMenuEntry = function(entry: Entry) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n */\nexport const removeNewFileMenuEntry = function(entry: Entry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n */\nexport const getNewFileMenuEntries = function(context?: Object) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context)\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAIH,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEjE;;;;;AAKG;AACG,SAAU,cAAc,CAAC,IAAmB,EAAE,cAA0B,GAAA,KAAK,EAAE,cAAA,GAA0B,KAAK,EAAA;AAEnH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACnB,KAAA;AAED;;;;;AAKE;;AAEF,IAAA,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;;IAE/F,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,cAAc,GAAG,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;AAC1F,IAAA,MAAM,cAAc,GAAG,cAAc,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAClF,IAAI,YAAY,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,IA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5BD;;;;;;;;;;;;;;;;;;;;AAoBG;AAKG,MAAO,MAAO,SAAQ,IAAI,CAAA;AAC/B,IAAA,WAAA,CAAY,IAAc,EAAA;;AAEzB,QAAA,KAAK,CAAC;AACL,YAAA,GAAG,IAAI;AACP,YAAA,IAAI,EAAE,sBAAsB;AAC5B,SAAA,CAAC,CAAA;KACF;AAED,IAAA,IAAI,IAAI,GAAA;QACP,OAAO,QAAQ,CAAC,MAAM,CAAA;KACtB;AAED,IAAA,IAAI,SAAS,GAAA;AACZ,QAAA,OAAO,IAAI,CAAA;KACX;AAED,IAAA,IAAI,IAAI,GAAA;AACP,QAAA,OAAO,sBAAsB,CAAA;KAC7B;AACD;;AC7CD;;;;;;;;;;;;;;;;;;;;;AAqBG;AAmBH;;AAEG;AACI,MAAM,mBAAmB,GAAG,UAAS,KAAY,EAAA;AACvD,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACxC,EAAC;AAED;;AAEG;AACI,MAAM,sBAAsB,GAAG,UAAS,KAAqB,EAAA;AACnE,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;AAC1C,EAAC;AAED;;;;AAIG;AACI,MAAM,qBAAqB,GAAG,UAAS,OAAgB,EAAA;AAC7D,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACvC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../lib/humanfilesize.ts","../lib/utils/logger.ts","../lib/newFileMenu.ts","../lib/files/fileType.ts","../lib/permissions.ts","../lib/files/nodeData.ts","../lib/files/node.ts","../lib/files/file.ts","../lib/files/folder.ts","../lib/fileAction.ts","../lib/index.ts"],"sourcesContent":["/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n */\nexport function formatFileSize(size: number|string, skipSmallSizes: boolean = false, binaryPrefixes: boolean = false): string {\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t/*\n\t* @note This block previously used Log base 1024, per IEC 80000-13;\n\t* however, the wrong prefix was used. Now we use decimal calculation\n\t* with base 1000 per the SI. Base 1024 calculation with binary\n\t* prefixes is optional, but has yet to be added to the UI.\n\t*/\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(binaryPrefixes ? 1024 : 1000)) : 0;\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order);\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order];\n\tlet relativeSize = (size / Math.pow(binaryPrefixes ? 1024 : 1000, order)).toFixed(1);\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1]);\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0);\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale());\n\t}\n\n\treturn relativeSize + ' ' + readableFormat;\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCurrentUser } from '@nextcloud/auth'\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nconst getLogger = user => {\n\tif (user === null) {\n\t\treturn getLoggerBuilder()\n\t\t\t.setApp('files')\n\t\t\t.build()\n\t}\n\treturn getLoggerBuilder()\n\t\t.setApp('files')\n\t\t.setUid(user.uid)\n\t\t.build()\n}\n\nexport default getLogger(getCurrentUser())\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport logger from \"./utils/logger\"\n\nexport interface Entry {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\t// Default new file name\n\ttemplateName?: string\n\t// Condition wether this entry is shown or not\n\tif?: (context: Object) => Boolean\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\t/** Existing icon css class */\n\ticonClass?: string\n\t/** Function to be run after creation */\n\thandler?: Function\n}\n\nexport class NewFileMenu {\n\tprivate _entries: Array<Entry> = []\n\t\n\tpublic registerEntry(entry: Entry) {\n\t\tthis.validateEntry(entry)\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: Entry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\t\t\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry , entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\t\n\t/**\n\t * Get the list of registered entries\n\t * \n\t * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n\t */\n\tpublic getEntries(context?: Object): Array<Entry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.if === 'function' ? entry.if(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: Entry) {\n\t\tif (!entry.id || !entry.displayName || !(entry.iconSvgInline || entry.iconClass)) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif ((entry.iconClass && typeof entry.iconClass !== 'string')\n\t\t\t|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.if !== undefined && typeof entry.if !== 'function') {\n\t\t\tthrow new Error('Invalid if property')\n\t\t}\n\n\t\tif (entry.templateName && typeof entry.templateName !== 'string') {\n\t\t\tthrow new Error('Invalid templateName property')\n\t\t}\n\n\t\tif (entry.handler && typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif (!entry.templateName && !entry.handler) {\n\t\t\tthrow new Error('At least a templateName or a handler must be provided')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n}\n\nexport const getNewFileMenu = function(): NewFileMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewFileMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nexport enum FileType {\n\tFolder = 'folder',\n\tFile = 'file',\n}\n","\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport enum Permission {\n\tNONE = 0,\n\tCREATE = 4,\n\tREAD = 1,\n\tUPDATE = 2,\n\tDELETE = 8,\n\tSHARE = 16,\n\tALL = 31,\n}\n\n/**\n * Parse the webdav permission string to a permission enum\n * @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88\n */\nexport const parseWebdavPermissions = function(permString: string = ''): number {\n\tlet permissions = Permission.NONE\n\n\tif (!permString)\n\t\treturn permissions\n\n\tif (permString.includes('C') || permString.includes('K'))\n\t\tpermissions |= Permission.CREATE\n\n\tif (permString.includes('G'))\n\t\tpermissions |= Permission.READ\n\n\tif (permString.includes('W') || permString.includes('N') || permString.includes('V'))\n\t\tpermissions |= Permission.UPDATE\n\n\tif (permString.includes('D'))\n\t\tpermissions |= Permission.DELETE\n\n\tif (permString.includes('R'))\n\t\tpermissions |= Permission.SHARE\n\n\treturn permissions\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Permission } from \"../permissions\"\n\nexport interface Attribute { [key: string]: any }\n\nexport default interface NodeData {\n\t/** Unique ID */\n\tid?: number\n\n\t/**\n\t * URL to the ressource.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t * or https://domain.com/Photos/picture.jpg\n\t */\n\tsource: string\n\n\t/** Last modified time */\n\tmtime?: Date\n\n\t/** Creation time */\n\tcrtime?: Date\n\n\t/** The mime type */\n\tmime?: string\n\n\t/** The node size type */\n\tsize?: number\n\n\t/** The node permissions */\n\tpermissions?: Permission\n\n\t/** The owner UID of this node */\n\towner: string|null\n\n\tattributes?: Attribute\n\n\t/**\n\t * The absolute root of the home relative to the service.\n\t * It is highly recommended to provide that information.\n\t * e.g. /files/emma\n\t */\n\troot?: string\n}\n \n/**\n * Validate Node construct data\n */\nexport const validateData = (data: NodeData) => {\n\tif ('id' in data && (typeof data.id !== 'number' || data.id < 0)) {\n\t\tthrow new Error('Invalid id type of value')\n\t}\n\n\tif (!data.source) {\n\t\tthrow new Error('Missing mandatory source')\n\t}\n\n\tif (!data.source.startsWith('http')) {\n\t\tthrow new Error('Invalid source format')\n\t}\n\n\tif ('mtime' in data && !(data.mtime instanceof Date)) {\n\t\tthrow new Error('Invalid mtime type')\n\t}\n\n\tif ('crtime' in data && !(data.crtime instanceof Date)) {\n\t\tthrow new Error('Invalid crtime type')\n\t}\n\n\tif (!data.mime || typeof data.mime !== 'string'\n\t\t|| !data.mime.match(/^[-\\w.]+\\/[-+\\w.]+$/gi)) {\n\t\tthrow new Error('Missing or invalid mandatory mime')\n\t}\n\n\tif ('size' in data && typeof data.size !== 'number') {\n\t\tthrow new Error('Invalid size type')\n\t}\n\n\tif ('permissions' in data && !(\n\t\t\ttypeof data.permissions === 'number'\n\t\t\t&& data.permissions >= Permission.NONE\n\t\t\t&& data.permissions <= Permission.ALL\n\t\t)) {\n\t\tthrow new Error('Invalid permissions')\n\t}\n\n\tif ('owner' in data\n\t\t&& data.owner !== null\n\t\t&& typeof data.owner !== 'string') {\n\t\tthrow new Error('Invalid owner type')\n\t}\n\n\tif ('attributes' in data && typeof data.attributes !== 'object') {\n\t\tthrow new Error('Invalid attributes format')\n\t}\n\n\tif ('root' in data && typeof data.root !== 'string') {\n\t\tthrow new Error('Invalid root format')\n\t}\n\n\tif (data.root && !data.root.startsWith('/')) {\n\t\tthrow new Error('Root must start with a leading slash')\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { basename, extname, dirname } from 'path'\nimport { Permission } from '../permissions'\nimport { FileType } from './fileType'\nimport NodeData, { Attribute, validateData } from './nodeData'\n\nexport abstract class Node {\n\tprivate _data: NodeData\n\tprivate _attributes: Attribute[]\n\tprivate _knownDavService = /(remote|public)\\.php\\/(web)?dav/i\n\n\tconstructor(data: NodeData, davService?: RegExp) {\n\t\t// Validate data\n\t\tvalidateData(data)\n\n\t\tthis._data = data\n\t\tthis._attributes = data.attributes || {} as any\n\t\tdelete this._data.attributes\n\n\t\tif (davService) {\n\t\t\tthis._knownDavService = davService\n\t\t}\n\t}\n\n\t/**\n\t * Get the source url to this object\n\t */\n\tget source(): string {\n\t\t// strip any ending slash\n\t\treturn this._data.source.replace(/\\/$/i, '')\n\t}\n\n\t/**\n\t * Get this object name\n\t */\n\tget basename(): string {\n\t\treturn basename(this.source)\n\t}\n\n\t/**\n\t * Get this object's extension\n\t */\n\tget extension(): string|null {\n\t\treturn extname(this.source)\n\t}\n\n\t/**\n\t * Get the directory path leading to this object\n\t * Will use the relative path to root if available\n\t */\n\tget dirname(): string {\n\t\tif (this.root) {\n\t\t\treturn dirname(this.source.split(this.root).pop() || '/')\n\t\t}\n\t\treturn dirname(this.source)\n\t}\n\n\t/**\n\t * Is it a file or a folder ?\n\t */\n\tabstract get type(): FileType\n\n\t/**\n\t * Get the file mime\n\t */\n\tget mime(): string|undefined {\n\t\treturn this._data.mime\n\t}\n\n\t/**\n\t * Get the file size\n\t */\n\tget size(): number|undefined {\n\t\treturn this._data.size\n\t}\n\n\t/**\n\t * Get the file attribute\n\t */\n\tget attributes(): Attribute {\n\t\treturn this._attributes\n\t}\n\n\t/**\n\t * Get the file permissions\n\t */\n\tget permissions(): Permission {\n\t\t// If this is not a dav ressource, we can only read it\n\t\tif (this.owner === null && !this.isDavRessource) {\n\t\t\treturn Permission.READ\n\t\t}\n\n\t\treturn this._data.permissions || Permission.READ\n\t}\n\n\t/**\n\t * Get the file owner\n\t */\n\tget owner(): string|null {\n\t\t// Remote ressources have no owner\n\t\tif (!this.isDavRessource) {\n\t\t\treturn null\n\t\t}\n\t\treturn this._data.owner\n\t}\n\n\t/**\n\t * Is this a dav-related ressource ?\n\t */\n\tget isDavRessource(): boolean {\n\t\treturn this.source.match(this._knownDavService) !== null\n\t}\n\n\t/**\n\t * Get the dav root of this object\n\t */\n\tget root(): string|null {\n\t\t// If provided (recommended), use the root and strip away the ending slash\n\t\tif (this._data.root) {\n\t\t\treturn this._data.root.replace(/^(.+)\\/$/, '$1')\n\t\t}\n\n\t\t// Use the source to get the root from the dav service\n\t\tif (this.isDavRessource) {\n\t\t\tconst root = dirname(this.source)\n\t\t\treturn root.split(this._knownDavService).pop() || null\n\t\t}\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Get the absolute path of this object relative to the root\n\t */\n\tget path(): string|null {\n\t\treturn (this.dirname + '/' + this.basename).replace(/\\/\\//g, '/')\n\t}\n\n\t/**\n\t * Get the file id if defined in attributes\n\t */\n\tget fileid(): number|undefined {\n\t\treturn this.attributes?.fileid\n\t}\n\n\t/**\n\t * Move the node to a new destination\n\t *\n\t * @param {string} destination the new source.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t */\n\tmove(destination: string) {\n\t\tthis._data.source = destination\n\t}\n\n\t/**\n\t * Rename the node\n\t * This aliases the move method for easier usage\n\t */\n\trename(basename) {\n\t\tif (basename.includes('/')) {\n\t\t\tthrow new Error('Invalid basename')\n\t\t}\n\t\tthis.move(dirname(this.source) + '/' + basename)\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class File extends Node {\n\tget type(): FileType {\n\t\treturn FileType.File\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\nimport NodeData from './nodeData'\n\nexport class Folder extends Node {\n\tconstructor(data: NodeData) {\n\t\t// enforcing mimes\n\t\tsuper({\n\t\t\t...data,\n\t\t\tmime: 'httpd/unix-directory'\n\t\t})\n\t}\n\n\tget type(): FileType {\n\t\treturn FileType.Folder\n\t}\n\n\tget extension(): string|null {\n\t\treturn null\n\t}\n\n\tget mime(): string {\n\t\treturn 'httpd/unix-directory'\n\t}\n}\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Node } from \"./files/node\"\nimport logger from \"./utils/logger\"\n\ninterface FileActionData {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: (files: Node[], view) => string\n\t/** Svg as inline string. <svg><path fill=\"...\" /></svg> */\n\ticonSvgInline: (files: Node[], view) => string\n\t/** Condition wether this action is shown or not */\n\tenabled?: (files: Node[], view) => boolean\n\t/**\n\t * Function executed on single file action\n\t * @returns true if the action was executed, false otherwise\n\t * @throws Error if the action failed\n\t */\n\texec: (file: Node, view) => Promise<boolean>,\n\t/**\n\t * Function executed on multiple files action\n\t * @returns true if the action was executed, false otherwise\n\t * @throws Error if the action failed\n\t */\n\texecBatch?: (files: Node[], view) => Promise<boolean[]>\n\t/** This action order in the list */\n\torder?: number,\n\t/** Make this action the default */\n\tdefault?: boolean,\n\t/**\n\t * If true, the renderInline function will be called\n\t */\n\tinline?: (file: Node, view) => boolean,\n\t/**\n\t * If defined, the returned html element will be\n\t * appended before the actions menu.\n\t */\n\trenderInline?: (file: Node, view) => HTMLElement,\n}\n\nexport class FileAction {\n\tprivate _action: FileActionData\n\t\n\tconstructor(action: FileActionData) {\n\t\tthis.validateAction(action)\n\t\tthis._action = action\n\t}\n\n\tget id() {\n\t\treturn this._action.id\n\t}\n\n\tget displayName() {\n\t\treturn this._action.displayName\n\t}\n\n\tget iconSvgInline() {\n\t\treturn this._action.iconSvgInline\n\t}\n\n\tget enabled() {\n\t\treturn this._action.enabled\n\t}\n\n\tget exec() {\n\t\treturn this._action.exec\n\t}\n\n\tget execBatch() {\n\t\treturn this._action.execBatch\n\t}\n\n\tget order() {\n\t\treturn this._action.order\n\t}\n\n\tget default() {\n\t\treturn this._action.default\n\t}\n\n\tget inline() {\n\t\treturn this._action.inline\n\t}\n\n\tget renderInline() {\n\t\treturn this._action.renderInline\n\t}\n\n\tprivate validateAction(action: FileActionData) {\n\t\tif (!action.id || typeof action.id !== 'string') {\n\t\t\tthrow new Error('Invalid id')\n\t\t}\n\n\t\tif (!action.displayName || typeof action.displayName !== 'function') {\n\t\t\tthrow new Error('Invalid displayName function')\n\t\t}\n\n\t\tif (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {\n\t\t\tthrow new Error('Invalid iconSvgInline function')\n\t\t}\n\n\t\tif (!action.exec || typeof action.exec !== 'function') {\n\t\t\tthrow new Error('Invalid exec function')\n\t\t}\n\n\t\t// Optional properties --------------------------------------------\n\t\tif ('enabled' in action && typeof action.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled function')\n\t\t}\n\n\t\tif ('execBatch' in action && typeof action.execBatch !== 'function') {\n\t\t\tthrow new Error('Invalid execBatch function')\n\t\t}\n\n\t\tif ('order' in action && typeof action.order !== 'number') {\n\t\t\tthrow new Error('Invalid order')\n\t\t}\n\n\t\tif ('default' in action && typeof action.default !== 'boolean') {\n\t\t\tthrow new Error('Invalid default')\n\t\t}\n\n\t\tif ('inline' in action && typeof action.inline !== 'function') {\n\t\t\tthrow new Error('Invalid inline function')\n\t\t}\n\n\t\tif ('renderInline' in action && typeof action.renderInline !== 'function') {\n\t\t\tthrow new Error('Invalid renderInline function')\n\t\t}\n\t}\n}\n\nexport const registerFileAction = function(action: FileAction): void {\n\tif (typeof window._nc_fileactions === 'undefined') {\n\t\twindow._nc_fileactions = []\n\t\tlogger.debug('FileActions initialized')\n\t}\n\n\t// Check duplicates\n\tif (window._nc_fileactions.find(search => search.id === action.id)) {\n\t\tlogger.error(`FileAction ${action.id} already registered`, { action })\n\t\treturn\n\t}\n\n\twindow._nc_fileactions.push(action)\n}\n\nexport const getFileActions = function(): FileAction[] {\n\treturn window._nc_fileactions || []\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport { formatFileSize } from './humanfilesize'\nexport { type Entry } from './newFileMenu'\nimport { FileAction } from './fileAction'\nimport { type Entry, getNewFileMenu, NewFileMenu } from './newFileMenu'\n\nexport { FileType } from './files/fileType'\nexport { File } from './files/file'\nexport { Folder } from './files/folder'\nexport { Node } from './files/node'\nexport { Permission, parseWebdavPermissions } from './permissions'\nexport { FileAction, registerFileAction, getFileActions } from './fileAction'\n\ndeclare global {\n\tinterface Window {\n\t\tOC: any;\n\t\t_nc_newfilemenu: NewFileMenu | undefined;\n\t\t_nc_fileactions: FileAction[] | undefined;\n\t}\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n */\nexport const addNewFileMenuEntry = function(entry: Entry) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n */\nexport const removeNewFileMenuEntry = function(entry: Entry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n */\nexport const getNewFileMenuEntries = function(context?: Object) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context)\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAIH,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEjE;;;;;AAKG;AACG,SAAU,cAAc,CAAC,IAAmB,EAAE,cAA0B,GAAA,KAAK,EAAE,cAAA,GAA0B,KAAK,EAAA;AAEnH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACnB,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OAAO,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACvC;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var l10n = require('@nextcloud/l10n');
|
|
6
4
|
var auth = require('@nextcloud/auth');
|
|
7
5
|
var logger$1 = require('@nextcloud/logger');
|
|
@@ -558,6 +556,17 @@ var Node = /** @class */ (function () {
|
|
|
558
556
|
enumerable: false,
|
|
559
557
|
configurable: true
|
|
560
558
|
});
|
|
559
|
+
Object.defineProperty(Node.prototype, "fileid", {
|
|
560
|
+
/**
|
|
561
|
+
* Get the file id if defined in attributes
|
|
562
|
+
*/
|
|
563
|
+
get: function () {
|
|
564
|
+
var _a;
|
|
565
|
+
return (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.fileid;
|
|
566
|
+
},
|
|
567
|
+
enumerable: false,
|
|
568
|
+
configurable: true
|
|
569
|
+
});
|
|
561
570
|
/**
|
|
562
571
|
* Move the node to a new destination
|
|
563
572
|
*
|
|
@@ -625,6 +634,153 @@ var Folder = /** @class */ (function (_super) {
|
|
|
625
634
|
return Folder;
|
|
626
635
|
}(Node));
|
|
627
636
|
|
|
637
|
+
/**
|
|
638
|
+
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
639
|
+
*
|
|
640
|
+
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
641
|
+
*
|
|
642
|
+
* @license AGPL-3.0-or-later
|
|
643
|
+
*
|
|
644
|
+
* This program is free software: you can redistribute it and/or modify
|
|
645
|
+
* it under the terms of the GNU Affero General Public License as
|
|
646
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
647
|
+
* License, or (at your option) any later version.
|
|
648
|
+
*
|
|
649
|
+
* This program is distributed in the hope that it will be useful,
|
|
650
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
651
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
652
|
+
* GNU Affero General Public License for more details.
|
|
653
|
+
*
|
|
654
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
655
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
656
|
+
*
|
|
657
|
+
*/
|
|
658
|
+
var FileAction = /** @class */ (function () {
|
|
659
|
+
function FileAction(action) {
|
|
660
|
+
this.validateAction(action);
|
|
661
|
+
this._action = action;
|
|
662
|
+
}
|
|
663
|
+
Object.defineProperty(FileAction.prototype, "id", {
|
|
664
|
+
get: function () {
|
|
665
|
+
return this._action.id;
|
|
666
|
+
},
|
|
667
|
+
enumerable: false,
|
|
668
|
+
configurable: true
|
|
669
|
+
});
|
|
670
|
+
Object.defineProperty(FileAction.prototype, "displayName", {
|
|
671
|
+
get: function () {
|
|
672
|
+
return this._action.displayName;
|
|
673
|
+
},
|
|
674
|
+
enumerable: false,
|
|
675
|
+
configurable: true
|
|
676
|
+
});
|
|
677
|
+
Object.defineProperty(FileAction.prototype, "iconSvgInline", {
|
|
678
|
+
get: function () {
|
|
679
|
+
return this._action.iconSvgInline;
|
|
680
|
+
},
|
|
681
|
+
enumerable: false,
|
|
682
|
+
configurable: true
|
|
683
|
+
});
|
|
684
|
+
Object.defineProperty(FileAction.prototype, "enabled", {
|
|
685
|
+
get: function () {
|
|
686
|
+
return this._action.enabled;
|
|
687
|
+
},
|
|
688
|
+
enumerable: false,
|
|
689
|
+
configurable: true
|
|
690
|
+
});
|
|
691
|
+
Object.defineProperty(FileAction.prototype, "exec", {
|
|
692
|
+
get: function () {
|
|
693
|
+
return this._action.exec;
|
|
694
|
+
},
|
|
695
|
+
enumerable: false,
|
|
696
|
+
configurable: true
|
|
697
|
+
});
|
|
698
|
+
Object.defineProperty(FileAction.prototype, "execBatch", {
|
|
699
|
+
get: function () {
|
|
700
|
+
return this._action.execBatch;
|
|
701
|
+
},
|
|
702
|
+
enumerable: false,
|
|
703
|
+
configurable: true
|
|
704
|
+
});
|
|
705
|
+
Object.defineProperty(FileAction.prototype, "order", {
|
|
706
|
+
get: function () {
|
|
707
|
+
return this._action.order;
|
|
708
|
+
},
|
|
709
|
+
enumerable: false,
|
|
710
|
+
configurable: true
|
|
711
|
+
});
|
|
712
|
+
Object.defineProperty(FileAction.prototype, "default", {
|
|
713
|
+
get: function () {
|
|
714
|
+
return this._action.default;
|
|
715
|
+
},
|
|
716
|
+
enumerable: false,
|
|
717
|
+
configurable: true
|
|
718
|
+
});
|
|
719
|
+
Object.defineProperty(FileAction.prototype, "inline", {
|
|
720
|
+
get: function () {
|
|
721
|
+
return this._action.inline;
|
|
722
|
+
},
|
|
723
|
+
enumerable: false,
|
|
724
|
+
configurable: true
|
|
725
|
+
});
|
|
726
|
+
Object.defineProperty(FileAction.prototype, "renderInline", {
|
|
727
|
+
get: function () {
|
|
728
|
+
return this._action.renderInline;
|
|
729
|
+
},
|
|
730
|
+
enumerable: false,
|
|
731
|
+
configurable: true
|
|
732
|
+
});
|
|
733
|
+
FileAction.prototype.validateAction = function (action) {
|
|
734
|
+
if (!action.id || typeof action.id !== 'string') {
|
|
735
|
+
throw new Error('Invalid id');
|
|
736
|
+
}
|
|
737
|
+
if (!action.displayName || typeof action.displayName !== 'function') {
|
|
738
|
+
throw new Error('Invalid displayName function');
|
|
739
|
+
}
|
|
740
|
+
if (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {
|
|
741
|
+
throw new Error('Invalid iconSvgInline function');
|
|
742
|
+
}
|
|
743
|
+
if (!action.exec || typeof action.exec !== 'function') {
|
|
744
|
+
throw new Error('Invalid exec function');
|
|
745
|
+
}
|
|
746
|
+
// Optional properties --------------------------------------------
|
|
747
|
+
if ('enabled' in action && typeof action.enabled !== 'function') {
|
|
748
|
+
throw new Error('Invalid enabled function');
|
|
749
|
+
}
|
|
750
|
+
if ('execBatch' in action && typeof action.execBatch !== 'function') {
|
|
751
|
+
throw new Error('Invalid execBatch function');
|
|
752
|
+
}
|
|
753
|
+
if ('order' in action && typeof action.order !== 'number') {
|
|
754
|
+
throw new Error('Invalid order');
|
|
755
|
+
}
|
|
756
|
+
if ('default' in action && typeof action.default !== 'boolean') {
|
|
757
|
+
throw new Error('Invalid default');
|
|
758
|
+
}
|
|
759
|
+
if ('inline' in action && typeof action.inline !== 'function') {
|
|
760
|
+
throw new Error('Invalid inline function');
|
|
761
|
+
}
|
|
762
|
+
if ('renderInline' in action && typeof action.renderInline !== 'function') {
|
|
763
|
+
throw new Error('Invalid renderInline function');
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
return FileAction;
|
|
767
|
+
}());
|
|
768
|
+
var registerFileAction = function (action) {
|
|
769
|
+
if (typeof window._nc_fileactions === 'undefined') {
|
|
770
|
+
window._nc_fileactions = [];
|
|
771
|
+
logger.debug('FileActions initialized');
|
|
772
|
+
}
|
|
773
|
+
// Check duplicates
|
|
774
|
+
if (window._nc_fileactions.find(function (search) { return search.id === action.id; })) {
|
|
775
|
+
logger.error("FileAction ".concat(action.id, " already registered"), { action: action });
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
window._nc_fileactions.push(action);
|
|
779
|
+
};
|
|
780
|
+
var getFileActions = function () {
|
|
781
|
+
return window._nc_fileactions || [];
|
|
782
|
+
};
|
|
783
|
+
|
|
628
784
|
/**
|
|
629
785
|
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
630
786
|
*
|
|
@@ -672,11 +828,14 @@ var getNewFileMenuEntries = function (context) {
|
|
|
672
828
|
};
|
|
673
829
|
|
|
674
830
|
exports.File = File;
|
|
831
|
+
exports.FileAction = FileAction;
|
|
675
832
|
exports.Folder = Folder;
|
|
676
833
|
exports.Node = Node;
|
|
677
834
|
exports.addNewFileMenuEntry = addNewFileMenuEntry;
|
|
678
835
|
exports.formatFileSize = formatFileSize;
|
|
836
|
+
exports.getFileActions = getFileActions;
|
|
679
837
|
exports.getNewFileMenuEntries = getNewFileMenuEntries;
|
|
680
838
|
exports.parseWebdavPermissions = parseWebdavPermissions;
|
|
839
|
+
exports.registerFileAction = registerFileAction;
|
|
681
840
|
exports.removeNewFileMenuEntry = removeNewFileMenuEntry;
|
|
682
841
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../lib/humanfilesize.ts","../lib/utils/logger.ts","../lib/newFileMenu.ts","../lib/files/fileType.ts","../node_modules/tslib/tslib.es6.js","../lib/permissions.ts","../lib/files/nodeData.ts","../lib/files/node.ts","../lib/files/file.ts","../lib/files/folder.ts","../lib/index.ts"],"sourcesContent":["/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n */\nexport function formatFileSize(size: number|string, skipSmallSizes: boolean = false, binaryPrefixes: boolean = false): string {\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t/*\n\t* @note This block previously used Log base 1024, per IEC 80000-13;\n\t* however, the wrong prefix was used. Now we use decimal calculation\n\t* with base 1000 per the SI. Base 1024 calculation with binary\n\t* prefixes is optional, but has yet to be added to the UI.\n\t*/\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(binaryPrefixes ? 1024 : 1000)) : 0;\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order);\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order];\n\tlet relativeSize = (size / Math.pow(binaryPrefixes ? 1024 : 1000, order)).toFixed(1);\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1]);\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0);\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale());\n\t}\n\n\treturn relativeSize + ' ' + readableFormat;\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCurrentUser } from '@nextcloud/auth'\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nconst getLogger = user => {\n\tif (user === null) {\n\t\treturn getLoggerBuilder()\n\t\t\t.setApp('files')\n\t\t\t.build()\n\t}\n\treturn getLoggerBuilder()\n\t\t.setApp('files')\n\t\t.setUid(user.uid)\n\t\t.build()\n}\n\nexport default getLogger(getCurrentUser())\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport logger from \"./utils/logger\"\n\nexport interface Entry {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\t// Default new file name\n\ttemplateName?: string\n\t// Condition wether this entry is shown or not\n\tif?: (context: Object) => Boolean\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\t/** Existing icon css class */\n\ticonClass?: string\n\t/** Function to be run after creation */\n\thandler?: Function\n}\n\nexport class NewFileMenu {\n\tprivate _entries: Array<Entry> = []\n\t\n\tpublic registerEntry(entry: Entry) {\n\t\tthis.validateEntry(entry)\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: Entry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\t\t\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry , entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\t\n\t/**\n\t * Get the list of registered entries\n\t * \n\t * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n\t */\n\tpublic getEntries(context?: Object): Array<Entry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.if === 'function' ? entry.if(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: Entry) {\n\t\tif (!entry.id || !entry.displayName || !(entry.iconSvgInline || entry.iconClass)) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif ((entry.iconClass && typeof entry.iconClass !== 'string')\n\t\t\t|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.if !== undefined && typeof entry.if !== 'function') {\n\t\t\tthrow new Error('Invalid if property')\n\t\t}\n\n\t\tif (entry.templateName && typeof entry.templateName !== 'string') {\n\t\t\tthrow new Error('Invalid templateName property')\n\t\t}\n\n\t\tif (entry.handler && typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif (!entry.templateName && !entry.handler) {\n\t\t\tthrow new Error('At least a templateName or a handler must be provided')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n}\n\nexport const getNewFileMenu = function(): NewFileMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewFileMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nexport enum FileType {\n\tFolder = 'folder',\n\tFile = 'file',\n}\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport enum Permission {\n\tNONE = 0,\n\tCREATE = 4,\n\tREAD = 1,\n\tUPDATE = 2,\n\tDELETE = 8,\n\tSHARE = 16,\n\tALL = 31,\n}\n\n/**\n * Parse the webdav permission string to a permission enum\n * @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88\n */\nexport const parseWebdavPermissions = function(permString: string = ''): number {\n\tlet permissions = Permission.NONE\n\n\tif (!permString)\n\t\treturn permissions\n\n\tif (permString.includes('C') || permString.includes('K'))\n\t\tpermissions |= Permission.CREATE\n\n\tif (permString.includes('G'))\n\t\tpermissions |= Permission.READ\n\n\tif (permString.includes('W') || permString.includes('N') || permString.includes('V'))\n\t\tpermissions |= Permission.UPDATE\n\n\tif (permString.includes('D'))\n\t\tpermissions |= Permission.DELETE\n\n\tif (permString.includes('R'))\n\t\tpermissions |= Permission.SHARE\n\n\treturn permissions\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Permission } from \"../permissions\"\n\nexport interface Attribute { [key: string]: any }\n\nexport default interface NodeData {\n\t/** Unique ID */\n\tid?: number\n\n\t/**\n\t * URL to the ressource.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t * or https://domain.com/Photos/picture.jpg\n\t */\n\tsource: string\n\n\t/** Last modified time */\n\tmtime?: Date\n\n\t/** Creation time */\n\tcrtime?: Date\n\n\t/** The mime type */\n\tmime?: string\n\n\t/** The node size type */\n\tsize?: number\n\n\t/** The node permissions */\n\tpermissions?: Permission\n\n\t/** The owner UID of this node */\n\towner: string|null\n\n\tattributes?: Attribute\n\n\t/**\n\t * The absolute root of the home relative to the service.\n\t * It is highly recommended to provide that information.\n\t * e.g. /files/emma\n\t */\n\troot?: string\n}\n \n/**\n * Validate Node construct data\n */\nexport const validateData = (data: NodeData) => {\n\tif ('id' in data && (typeof data.id !== 'number' || data.id < 0)) {\n\t\tthrow new Error('Invalid id type of value')\n\t}\n\n\tif (!data.source) {\n\t\tthrow new Error('Missing mandatory source')\n\t}\n\n\tif (!data.source.startsWith('http')) {\n\t\tthrow new Error('Invalid source format')\n\t}\n\n\tif ('mtime' in data && !(data.mtime instanceof Date)) {\n\t\tthrow new Error('Invalid mtime type')\n\t}\n\n\tif ('crtime' in data && !(data.crtime instanceof Date)) {\n\t\tthrow new Error('Invalid crtime type')\n\t}\n\n\tif (!data.mime || typeof data.mime !== 'string'\n\t\t|| !data.mime.match(/^[-\\w.]+\\/[-+\\w.]+$/gi)) {\n\t\tthrow new Error('Missing or invalid mandatory mime')\n\t}\n\n\tif ('size' in data && typeof data.size !== 'number') {\n\t\tthrow new Error('Invalid size type')\n\t}\n\n\tif ('permissions' in data && !(\n\t\t\ttypeof data.permissions === 'number'\n\t\t\t&& data.permissions >= Permission.NONE\n\t\t\t&& data.permissions <= Permission.ALL\n\t\t)) {\n\t\tthrow new Error('Invalid permissions')\n\t}\n\n\tif ('owner' in data\n\t\t&& data.owner !== null\n\t\t&& typeof data.owner !== 'string') {\n\t\tthrow new Error('Invalid owner type')\n\t}\n\n\tif ('attributes' in data && typeof data.attributes !== 'object') {\n\t\tthrow new Error('Invalid attributes format')\n\t}\n\n\tif ('root' in data && typeof data.root !== 'string') {\n\t\tthrow new Error('Invalid root format')\n\t}\n\n\tif (data.root && !data.root.startsWith('/')) {\n\t\tthrow new Error('Root must start with a leading slash')\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { basename, extname, dirname } from 'path'\nimport { Permission } from '../permissions'\nimport { FileType } from './fileType'\nimport NodeData, { Attribute, validateData } from './nodeData'\n\nexport abstract class Node {\n\tprivate _data: NodeData\n\tprivate _attributes: Attribute[]\n\tprivate _knownDavService = /(remote|public)\\.php\\/(web)?dav/i\n\n\tconstructor(data: NodeData, davService?: RegExp) {\n\t\t// Validate data\n\t\tvalidateData(data)\n\n\t\tthis._data = data\n\t\tthis._attributes = data.attributes || {} as any\n\t\tdelete this._data.attributes\n\n\t\tif (davService) {\n\t\t\tthis._knownDavService = davService\n\t\t}\n\t}\n\n\t/**\n\t * Get the source url to this object\n\t */\n\tget source(): string {\n\t\t// strip any ending slash\n\t\treturn this._data.source.replace(/\\/$/i, '')\n\t}\n\n\t/**\n\t * Get this object name\n\t */\n\tget basename(): string {\n\t\treturn basename(this.source)\n\t}\n\n\t/**\n\t * Get this object's extension\n\t */\n\tget extension(): string|null {\n\t\treturn extname(this.source)\n\t}\n\n\t/**\n\t * Get the directory path leading to this object\n\t * Will use the relative path to root if available\n\t */\n\tget dirname(): string {\n\t\tif (this.root) {\n\t\t\treturn dirname(this.source.split(this.root).pop() || '/')\n\t\t}\n\t\treturn dirname(this.source)\n\t}\n\n\t/**\n\t * Is it a file or a folder ?\n\t */\n\tabstract get type(): FileType\n\n\t/**\n\t * Get the file mime\n\t */\n\tget mime(): string|undefined {\n\t\treturn this._data.mime\n\t}\n\n\t/**\n\t * Get the file size\n\t */\n\tget size(): number|undefined {\n\t\treturn this._data.size\n\t}\n\n\t/**\n\t * Get the file attribute\n\t */\n\tget attributes(): Attribute {\n\t\treturn this._attributes\n\t}\n\n\t/**\n\t * Get the file permissions\n\t */\n\tget permissions(): Permission {\n\t\t// If this is not a dav ressource, we can only read it\n\t\tif (this.owner === null && !this.isDavRessource) {\n\t\t\treturn Permission.READ\n\t\t}\n\n\t\treturn this._data.permissions || Permission.READ\n\t}\n\n\t/**\n\t * Get the file owner\n\t */\n\tget owner(): string|null {\n\t\t// Remote ressources have no owner\n\t\tif (!this.isDavRessource) {\n\t\t\treturn null\n\t\t}\n\t\treturn this._data.owner\n\t}\n\n\t/**\n\t * Is this a dav-related ressource ?\n\t */\n\tget isDavRessource(): boolean {\n\t\treturn this.source.match(this._knownDavService) !== null\n\t}\n\n\t/**\n\t * Get the dav root of this object\n\t */\n\tget root(): string|null {\n\t\t// If provided (recommended), use the root and strip away the ending slash\n\t\tif (this._data.root) {\n\t\t\treturn this._data.root.replace(/^(.+)\\/$/, '$1')\n\t\t}\n\n\t\t// Use the source to get the root from the dav service\n\t\tif (this.isDavRessource) {\n\t\t\tconst root = dirname(this.source)\n\t\t\treturn root.split(this._knownDavService).pop() || null\n\t\t}\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Get the absolute path of this object relative to the root\n\t */\n\tget path(): string|null {\n\t\treturn (this.dirname + '/' + this.basename).replace(/\\/\\//g, '/')\n\t}\n\n\t/**\n\t * Move the node to a new destination\n\t *\n\t * @param {string} destination the new source.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t */\n\tmove(destination: string) {\n\t\tthis._data.source = destination\n\t}\n\n\t/**\n\t * Rename the node\n\t * This aliases the move method for easier usage\n\t */\n\trename(basename) {\n\t\tif (basename.includes('/')) {\n\t\t\tthrow new Error('Invalid basename')\n\t\t}\n\t\tthis.move(dirname(this.source) + '/' + basename)\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class File extends Node {\n\tget type(): FileType {\n\t\treturn FileType.File\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\nimport NodeData from './nodeData'\n\nexport class Folder extends Node {\n\tconstructor(data: NodeData) {\n\t\t// enforcing mimes\n\t\tsuper({\n\t\t\t...data,\n\t\t\tmime: 'httpd/unix-directory'\n\t\t})\n\t}\n\n\tget type(): FileType {\n\t\treturn FileType.Folder\n\t}\n\n\tget extension(): string|null {\n\t\treturn null\n\t}\n\n\tget mime(): string {\n\t\treturn 'httpd/unix-directory'\n\t}\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport { formatFileSize } from './humanfilesize'\nexport { type Entry } from './newFileMenu'\nimport { type Entry, getNewFileMenu, NewFileMenu } from './newFileMenu'\n\nexport { FileType } from './files/fileType'\nexport { File } from './files/file'\nexport { Folder } from './files/folder'\nexport { Node } from './files/node'\nexport { Permission, parseWebdavPermissions } from './permissions'\n\ndeclare global {\n\tinterface Window {\n\t\tOC: any;\n\t\t_nc_newfilemenu: NewFileMenu;\n\t}\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n */\nexport const addNewFileMenuEntry = function(entry: Entry) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n */\nexport const removeNewFileMenuEntry = function(entry: Entry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n */\nexport const getNewFileMenuEntries = function(context?: Object) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context)\n}\n"],"names":["getCanonicalLocale","getLoggerBuilder","getCurrentUser","FileType","Permission","basename","extname","dirname"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAIH,IAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,IAAM,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEjE;;;;;AAKG;SACa,cAAc,CAAC,IAAmB,EAAE,cAA+B,EAAE,cAA+B,EAAA;AAAhE,IAAA,IAAA,cAAA,KAAA,KAAA,CAAA,EAAA,EAAA,cAA+B,GAAA,KAAA,CAAA,EAAA;AAAE,IAAA,IAAA,cAAA,KAAA,KAAA,CAAA,EAAA,EAAA,cAA+B,GAAA,KAAA,CAAA,EAAA;AAEnH,IAAA,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A;AAED,IAAA,MAAA,CAAA,cAAA,CAAI,MAAS,CAAA,SAAA,EAAA,WAAA,EAAA;AAAb,QAAA,GAAA,EAAA,YAAA;AACC,YAAA,OAAO,IAAI,CAAA;SACX;;;AAAA,KAAA,CAAA,CAAA;AAED,IAAA,MAAA,CAAA,cAAA,CAAI,MAAI,CAAA,SAAA,EAAA,MAAA,EAAA;AAAR,QAAA,GAAA,EAAA,YAAA;AACC,YAAA,OAAO,sBAAsB,CAAA;SAC7B;;;AAAA,KAAA,CAAA,CAAA;IACF,OAAC,MAAA,CAAA;AAAD,CApBA,CAA4B,IAAI,CAoB/B;;AC7CD;;;;;;;;;;;;;;;;;;;;;AAqBG;AAmBH;;AAEG;AACI,IAAM,mBAAmB,GAAG,UAAS,KAAY,EAAA;AACvD,IAAA,IAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACxC,EAAC;AAED;;AAEG;AACI,IAAM,sBAAsB,GAAG,UAAS,KAAqB,EAAA;AACnE,IAAA,IAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;AAC1C,EAAC;AAED;;;;AAIG;AACI,IAAM,qBAAqB,GAAG,UAAS,OAAgB,EAAA;AAC7D,IAAA,IAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACvC;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../lib/humanfilesize.ts","../lib/utils/logger.ts","../lib/newFileMenu.ts","../lib/files/fileType.ts","../node_modules/tslib/tslib.es6.js","../lib/permissions.ts","../lib/files/nodeData.ts","../lib/files/node.ts","../lib/files/file.ts","../lib/files/folder.ts","../lib/fileAction.ts","../lib/index.ts"],"sourcesContent":["/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCanonicalLocale } from '@nextcloud/l10n'\n\nconst humanList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\nconst humanListBinary = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];\n\n/**\n * Format a file size in a human-like format. e.g. 42GB\n *\n * @param size in bytes\n * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead\n */\nexport function formatFileSize(size: number|string, skipSmallSizes: boolean = false, binaryPrefixes: boolean = false): string {\n\n\tif (typeof size === 'string') {\n\t\tsize = Number(size)\n\t}\n\n\t/*\n\t* @note This block previously used Log base 1024, per IEC 80000-13;\n\t* however, the wrong prefix was used. Now we use decimal calculation\n\t* with base 1000 per the SI. Base 1024 calculation with binary\n\t* prefixes is optional, but has yet to be added to the UI.\n\t*/\n\t// Calculate Log with base 1024 or 1000: size = base ** order\n\tlet order = size > 0 ? Math.floor(Math.log(size) / Math.log(binaryPrefixes ? 1024 : 1000)) : 0;\n\t// Stay in range of the byte sizes that are defined\n\torder = Math.min((binaryPrefixes ? humanListBinary.length : humanList.length) - 1, order);\n\tconst readableFormat = binaryPrefixes ? humanListBinary[order] : humanList[order];\n\tlet relativeSize = (size / Math.pow(binaryPrefixes ? 1024 : 1000, order)).toFixed(1);\n\n\tif (skipSmallSizes === true && order === 0) {\n\t\treturn (relativeSize !== '0.0' ? '< 1 ' : '0 ') + (binaryPrefixes ? humanListBinary[1] : humanList[1]);\n\t}\n\n\tif (order < 2) {\n\t\trelativeSize = parseFloat(relativeSize).toFixed(0);\n\t} else {\n\t\trelativeSize = parseFloat(relativeSize).toLocaleString(getCanonicalLocale());\n\t}\n\n\treturn relativeSize + ' ' + readableFormat;\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { getCurrentUser } from '@nextcloud/auth'\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nconst getLogger = user => {\n\tif (user === null) {\n\t\treturn getLoggerBuilder()\n\t\t\t.setApp('files')\n\t\t\t.build()\n\t}\n\treturn getLoggerBuilder()\n\t\t.setApp('files')\n\t\t.setUid(user.uid)\n\t\t.build()\n}\n\nexport default getLogger(getCurrentUser())\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport logger from \"./utils/logger\"\n\nexport interface Entry {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: string\n\t// Default new file name\n\ttemplateName?: string\n\t// Condition wether this entry is shown or not\n\tif?: (context: Object) => Boolean\n\t/**\n\t * Either iconSvgInline or iconClass must be defined\n\t * Svg as inline string. <svg><path fill=\"...\" /></svg>\n\t */\n\ticonSvgInline?: string\n\t/** Existing icon css class */\n\ticonClass?: string\n\t/** Function to be run after creation */\n\thandler?: Function\n}\n\nexport class NewFileMenu {\n\tprivate _entries: Array<Entry> = []\n\t\n\tpublic registerEntry(entry: Entry) {\n\t\tthis.validateEntry(entry)\n\t\tthis._entries.push(entry)\n\t}\n\n\tpublic unregisterEntry(entry: Entry | string) {\n\t\tconst entryIndex = typeof entry === 'string'\n\t\t\t? this.getEntryIndex(entry)\n\t\t\t: this.getEntryIndex(entry.id)\n\t\t\n\t\tif (entryIndex === -1) {\n\t\t\tlogger.warn('Entry not found, nothing removed', { entry , entries: this.getEntries() })\n\t\t\treturn\n\t\t}\n\n\t\tthis._entries.splice(entryIndex, 1)\n\t}\n\t\n\t/**\n\t * Get the list of registered entries\n\t * \n\t * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n\t */\n\tpublic getEntries(context?: Object): Array<Entry> {\n\t\tif (context) {\n\t\t\treturn this._entries\n\t\t\t\t.filter(entry => typeof entry.if === 'function' ? entry.if(context) : true)\n\t\t}\n\t\treturn this._entries\n\t}\n\n\tprivate getEntryIndex(id: string): number {\n\t\treturn this._entries.findIndex(entry => entry.id === id)\n\t}\n\n\tprivate validateEntry(entry: Entry) {\n\t\tif (!entry.id || !entry.displayName || !(entry.iconSvgInline || entry.iconClass)) {\n\t\t\tthrow new Error('Invalid entry')\n\t\t}\n\n\t\tif (typeof entry.id !== 'string'\n\t\t\t|| typeof entry.displayName !== 'string') {\n\t\t\tthrow new Error('Invalid id or displayName property')\n\t\t}\n\n\t\tif ((entry.iconClass && typeof entry.iconClass !== 'string')\n\t\t\t|| (entry.iconSvgInline && typeof entry.iconSvgInline !== 'string')) {\n\t\t\tthrow new Error('Invalid icon provided')\n\t\t}\n\n\t\tif (entry.if !== undefined && typeof entry.if !== 'function') {\n\t\t\tthrow new Error('Invalid if property')\n\t\t}\n\n\t\tif (entry.templateName && typeof entry.templateName !== 'string') {\n\t\t\tthrow new Error('Invalid templateName property')\n\t\t}\n\n\t\tif (entry.handler && typeof entry.handler !== 'function') {\n\t\t\tthrow new Error('Invalid handler property')\n\t\t}\n\n\t\tif (!entry.templateName && !entry.handler) {\n\t\t\tthrow new Error('At least a templateName or a handler must be provided')\n\t\t}\n\n\t\tif (this.getEntryIndex(entry.id) !== -1) {\n\t\t\tthrow new Error('Duplicate entry')\n\t\t}\n\t}\n}\n\nexport const getNewFileMenu = function(): NewFileMenu {\n\tif (typeof window._nc_newfilemenu === 'undefined') {\n\t\twindow._nc_newfilemenu = new NewFileMenu()\n\t\tlogger.debug('NewFileMenu initialized')\n\t}\n\treturn window._nc_newfilemenu\n}","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nexport enum FileType {\n\tFolder = 'folder',\n\tFile = 'file',\n}\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport enum Permission {\n\tNONE = 0,\n\tCREATE = 4,\n\tREAD = 1,\n\tUPDATE = 2,\n\tDELETE = 8,\n\tSHARE = 16,\n\tALL = 31,\n}\n\n/**\n * Parse the webdav permission string to a permission enum\n * @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88\n */\nexport const parseWebdavPermissions = function(permString: string = ''): number {\n\tlet permissions = Permission.NONE\n\n\tif (!permString)\n\t\treturn permissions\n\n\tif (permString.includes('C') || permString.includes('K'))\n\t\tpermissions |= Permission.CREATE\n\n\tif (permString.includes('G'))\n\t\tpermissions |= Permission.READ\n\n\tif (permString.includes('W') || permString.includes('N') || permString.includes('V'))\n\t\tpermissions |= Permission.UPDATE\n\n\tif (permString.includes('D'))\n\t\tpermissions |= Permission.DELETE\n\n\tif (permString.includes('R'))\n\t\tpermissions |= Permission.SHARE\n\n\treturn permissions\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Permission } from \"../permissions\"\n\nexport interface Attribute { [key: string]: any }\n\nexport default interface NodeData {\n\t/** Unique ID */\n\tid?: number\n\n\t/**\n\t * URL to the ressource.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t * or https://domain.com/Photos/picture.jpg\n\t */\n\tsource: string\n\n\t/** Last modified time */\n\tmtime?: Date\n\n\t/** Creation time */\n\tcrtime?: Date\n\n\t/** The mime type */\n\tmime?: string\n\n\t/** The node size type */\n\tsize?: number\n\n\t/** The node permissions */\n\tpermissions?: Permission\n\n\t/** The owner UID of this node */\n\towner: string|null\n\n\tattributes?: Attribute\n\n\t/**\n\t * The absolute root of the home relative to the service.\n\t * It is highly recommended to provide that information.\n\t * e.g. /files/emma\n\t */\n\troot?: string\n}\n \n/**\n * Validate Node construct data\n */\nexport const validateData = (data: NodeData) => {\n\tif ('id' in data && (typeof data.id !== 'number' || data.id < 0)) {\n\t\tthrow new Error('Invalid id type of value')\n\t}\n\n\tif (!data.source) {\n\t\tthrow new Error('Missing mandatory source')\n\t}\n\n\tif (!data.source.startsWith('http')) {\n\t\tthrow new Error('Invalid source format')\n\t}\n\n\tif ('mtime' in data && !(data.mtime instanceof Date)) {\n\t\tthrow new Error('Invalid mtime type')\n\t}\n\n\tif ('crtime' in data && !(data.crtime instanceof Date)) {\n\t\tthrow new Error('Invalid crtime type')\n\t}\n\n\tif (!data.mime || typeof data.mime !== 'string'\n\t\t|| !data.mime.match(/^[-\\w.]+\\/[-+\\w.]+$/gi)) {\n\t\tthrow new Error('Missing or invalid mandatory mime')\n\t}\n\n\tif ('size' in data && typeof data.size !== 'number') {\n\t\tthrow new Error('Invalid size type')\n\t}\n\n\tif ('permissions' in data && !(\n\t\t\ttypeof data.permissions === 'number'\n\t\t\t&& data.permissions >= Permission.NONE\n\t\t\t&& data.permissions <= Permission.ALL\n\t\t)) {\n\t\tthrow new Error('Invalid permissions')\n\t}\n\n\tif ('owner' in data\n\t\t&& data.owner !== null\n\t\t&& typeof data.owner !== 'string') {\n\t\tthrow new Error('Invalid owner type')\n\t}\n\n\tif ('attributes' in data && typeof data.attributes !== 'object') {\n\t\tthrow new Error('Invalid attributes format')\n\t}\n\n\tif ('root' in data && typeof data.root !== 'string') {\n\t\tthrow new Error('Invalid root format')\n\t}\n\n\tif (data.root && !data.root.startsWith('/')) {\n\t\tthrow new Error('Root must start with a leading slash')\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { basename, extname, dirname } from 'path'\nimport { Permission } from '../permissions'\nimport { FileType } from './fileType'\nimport NodeData, { Attribute, validateData } from './nodeData'\n\nexport abstract class Node {\n\tprivate _data: NodeData\n\tprivate _attributes: Attribute[]\n\tprivate _knownDavService = /(remote|public)\\.php\\/(web)?dav/i\n\n\tconstructor(data: NodeData, davService?: RegExp) {\n\t\t// Validate data\n\t\tvalidateData(data)\n\n\t\tthis._data = data\n\t\tthis._attributes = data.attributes || {} as any\n\t\tdelete this._data.attributes\n\n\t\tif (davService) {\n\t\t\tthis._knownDavService = davService\n\t\t}\n\t}\n\n\t/**\n\t * Get the source url to this object\n\t */\n\tget source(): string {\n\t\t// strip any ending slash\n\t\treturn this._data.source.replace(/\\/$/i, '')\n\t}\n\n\t/**\n\t * Get this object name\n\t */\n\tget basename(): string {\n\t\treturn basename(this.source)\n\t}\n\n\t/**\n\t * Get this object's extension\n\t */\n\tget extension(): string|null {\n\t\treturn extname(this.source)\n\t}\n\n\t/**\n\t * Get the directory path leading to this object\n\t * Will use the relative path to root if available\n\t */\n\tget dirname(): string {\n\t\tif (this.root) {\n\t\t\treturn dirname(this.source.split(this.root).pop() || '/')\n\t\t}\n\t\treturn dirname(this.source)\n\t}\n\n\t/**\n\t * Is it a file or a folder ?\n\t */\n\tabstract get type(): FileType\n\n\t/**\n\t * Get the file mime\n\t */\n\tget mime(): string|undefined {\n\t\treturn this._data.mime\n\t}\n\n\t/**\n\t * Get the file size\n\t */\n\tget size(): number|undefined {\n\t\treturn this._data.size\n\t}\n\n\t/**\n\t * Get the file attribute\n\t */\n\tget attributes(): Attribute {\n\t\treturn this._attributes\n\t}\n\n\t/**\n\t * Get the file permissions\n\t */\n\tget permissions(): Permission {\n\t\t// If this is not a dav ressource, we can only read it\n\t\tif (this.owner === null && !this.isDavRessource) {\n\t\t\treturn Permission.READ\n\t\t}\n\n\t\treturn this._data.permissions || Permission.READ\n\t}\n\n\t/**\n\t * Get the file owner\n\t */\n\tget owner(): string|null {\n\t\t// Remote ressources have no owner\n\t\tif (!this.isDavRessource) {\n\t\t\treturn null\n\t\t}\n\t\treturn this._data.owner\n\t}\n\n\t/**\n\t * Is this a dav-related ressource ?\n\t */\n\tget isDavRessource(): boolean {\n\t\treturn this.source.match(this._knownDavService) !== null\n\t}\n\n\t/**\n\t * Get the dav root of this object\n\t */\n\tget root(): string|null {\n\t\t// If provided (recommended), use the root and strip away the ending slash\n\t\tif (this._data.root) {\n\t\t\treturn this._data.root.replace(/^(.+)\\/$/, '$1')\n\t\t}\n\n\t\t// Use the source to get the root from the dav service\n\t\tif (this.isDavRessource) {\n\t\t\tconst root = dirname(this.source)\n\t\t\treturn root.split(this._knownDavService).pop() || null\n\t\t}\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Get the absolute path of this object relative to the root\n\t */\n\tget path(): string|null {\n\t\treturn (this.dirname + '/' + this.basename).replace(/\\/\\//g, '/')\n\t}\n\n\t/**\n\t * Get the file id if defined in attributes\n\t */\n\tget fileid(): number|undefined {\n\t\treturn this.attributes?.fileid\n\t}\n\n\t/**\n\t * Move the node to a new destination\n\t *\n\t * @param {string} destination the new source.\n\t * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n\t */\n\tmove(destination: string) {\n\t\tthis._data.source = destination\n\t}\n\n\t/**\n\t * Rename the node\n\t * This aliases the move method for easier usage\n\t */\n\trename(basename) {\n\t\tif (basename.includes('/')) {\n\t\t\tthrow new Error('Invalid basename')\n\t\t}\n\t\tthis.move(dirname(this.source) + '/' + basename)\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class File extends Node {\n\tget type(): FileType {\n\t\treturn FileType.File\n\t}\n}\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { FileType } from './fileType'\nimport { Node } from './node'\nimport NodeData from './nodeData'\n\nexport class Folder extends Node {\n\tconstructor(data: NodeData) {\n\t\t// enforcing mimes\n\t\tsuper({\n\t\t\t...data,\n\t\t\tmime: 'httpd/unix-directory'\n\t\t})\n\t}\n\n\tget type(): FileType {\n\t\treturn FileType.Folder\n\t}\n\n\tget extension(): string|null {\n\t\treturn null\n\t}\n\n\tget mime(): string {\n\t\treturn 'httpd/unix-directory'\n\t}\n}\n","/**\n * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { Node } from \"./files/node\"\nimport logger from \"./utils/logger\"\n\ninterface FileActionData {\n\t/** Unique ID */\n\tid: string\n\t/** Translatable string displayed in the menu */\n\tdisplayName: (files: Node[], view) => string\n\t/** Svg as inline string. <svg><path fill=\"...\" /></svg> */\n\ticonSvgInline: (files: Node[], view) => string\n\t/** Condition wether this action is shown or not */\n\tenabled?: (files: Node[], view) => boolean\n\t/**\n\t * Function executed on single file action\n\t * @returns true if the action was executed, false otherwise\n\t * @throws Error if the action failed\n\t */\n\texec: (file: Node, view) => Promise<boolean>,\n\t/**\n\t * Function executed on multiple files action\n\t * @returns true if the action was executed, false otherwise\n\t * @throws Error if the action failed\n\t */\n\texecBatch?: (files: Node[], view) => Promise<boolean[]>\n\t/** This action order in the list */\n\torder?: number,\n\t/** Make this action the default */\n\tdefault?: boolean,\n\t/**\n\t * If true, the renderInline function will be called\n\t */\n\tinline?: (file: Node, view) => boolean,\n\t/**\n\t * If defined, the returned html element will be\n\t * appended before the actions menu.\n\t */\n\trenderInline?: (file: Node, view) => HTMLElement,\n}\n\nexport class FileAction {\n\tprivate _action: FileActionData\n\t\n\tconstructor(action: FileActionData) {\n\t\tthis.validateAction(action)\n\t\tthis._action = action\n\t}\n\n\tget id() {\n\t\treturn this._action.id\n\t}\n\n\tget displayName() {\n\t\treturn this._action.displayName\n\t}\n\n\tget iconSvgInline() {\n\t\treturn this._action.iconSvgInline\n\t}\n\n\tget enabled() {\n\t\treturn this._action.enabled\n\t}\n\n\tget exec() {\n\t\treturn this._action.exec\n\t}\n\n\tget execBatch() {\n\t\treturn this._action.execBatch\n\t}\n\n\tget order() {\n\t\treturn this._action.order\n\t}\n\n\tget default() {\n\t\treturn this._action.default\n\t}\n\n\tget inline() {\n\t\treturn this._action.inline\n\t}\n\n\tget renderInline() {\n\t\treturn this._action.renderInline\n\t}\n\n\tprivate validateAction(action: FileActionData) {\n\t\tif (!action.id || typeof action.id !== 'string') {\n\t\t\tthrow new Error('Invalid id')\n\t\t}\n\n\t\tif (!action.displayName || typeof action.displayName !== 'function') {\n\t\t\tthrow new Error('Invalid displayName function')\n\t\t}\n\n\t\tif (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {\n\t\t\tthrow new Error('Invalid iconSvgInline function')\n\t\t}\n\n\t\tif (!action.exec || typeof action.exec !== 'function') {\n\t\t\tthrow new Error('Invalid exec function')\n\t\t}\n\n\t\t// Optional properties --------------------------------------------\n\t\tif ('enabled' in action && typeof action.enabled !== 'function') {\n\t\t\tthrow new Error('Invalid enabled function')\n\t\t}\n\n\t\tif ('execBatch' in action && typeof action.execBatch !== 'function') {\n\t\t\tthrow new Error('Invalid execBatch function')\n\t\t}\n\n\t\tif ('order' in action && typeof action.order !== 'number') {\n\t\t\tthrow new Error('Invalid order')\n\t\t}\n\n\t\tif ('default' in action && typeof action.default !== 'boolean') {\n\t\t\tthrow new Error('Invalid default')\n\t\t}\n\n\t\tif ('inline' in action && typeof action.inline !== 'function') {\n\t\t\tthrow new Error('Invalid inline function')\n\t\t}\n\n\t\tif ('renderInline' in action && typeof action.renderInline !== 'function') {\n\t\t\tthrow new Error('Invalid renderInline function')\n\t\t}\n\t}\n}\n\nexport const registerFileAction = function(action: FileAction): void {\n\tif (typeof window._nc_fileactions === 'undefined') {\n\t\twindow._nc_fileactions = []\n\t\tlogger.debug('FileActions initialized')\n\t}\n\n\t// Check duplicates\n\tif (window._nc_fileactions.find(search => search.id === action.id)) {\n\t\tlogger.error(`FileAction ${action.id} already registered`, { action })\n\t\treturn\n\t}\n\n\twindow._nc_fileactions.push(action)\n}\n\nexport const getFileActions = function(): FileAction[] {\n\treturn window._nc_fileactions || []\n}\n","/**\n * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>\n *\n * @author Christoph Wurst <christoph@winzerhof-wurst.at>\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nexport { formatFileSize } from './humanfilesize'\nexport { type Entry } from './newFileMenu'\nimport { FileAction } from './fileAction'\nimport { type Entry, getNewFileMenu, NewFileMenu } from './newFileMenu'\n\nexport { FileType } from './files/fileType'\nexport { File } from './files/file'\nexport { Folder } from './files/folder'\nexport { Node } from './files/node'\nexport { Permission, parseWebdavPermissions } from './permissions'\nexport { FileAction, registerFileAction, getFileActions } from './fileAction'\n\ndeclare global {\n\tinterface Window {\n\t\tOC: any;\n\t\t_nc_newfilemenu: NewFileMenu | undefined;\n\t\t_nc_fileactions: FileAction[] | undefined;\n\t}\n}\n\n/**\n * Add a new menu entry to the upload manager menu\n */\nexport const addNewFileMenuEntry = function(entry: Entry) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.registerEntry(entry)\n}\n\n/**\n * Remove a previously registered entry from the upload menu\n */\nexport const removeNewFileMenuEntry = function(entry: Entry | string) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.unregisterEntry(entry)\n}\n\n/**\n * Get the list of registered entries from the upload menu\n *\n * @param {FileInfo} context the creation context. Usually the current folder FileInfo\n */\nexport const getNewFileMenuEntries = function(context?: Object) {\n\tconst newFileMenu = getNewFileMenu()\n\treturn newFileMenu.getEntries(context)\n}\n"],"names":["getCanonicalLocale","getLoggerBuilder","getCurrentUser","FileType","Permission","basename","extname","dirname"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAIH,IAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,IAAM,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEjE;;;;;AAKG;SACa,cAAc,CAAC,IAAmB,EAAE,cAA+B,EAAE,cAA+B,EAAA;AAAhE,IAAA,IAAA,cAAA,KAAA,KAAA,CAAA,EAAA,EAAA,cAA+B,GAAA,KAAA,CAAA,EAAA;AAAE,IAAA,IAAA,cAAA,KAAA,KAAA,CAAA,EAAA,EAAA,cAA+B,GAAA,KAAA,CAAA,EAAA;AAEnH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CA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cAAc,GAAG,YAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,eAAe,IAAI,EAAE,CAAA;AACpC;;AC1KA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAsBH;;AAEG;AACI,IAAM,mBAAmB,GAAG,UAAS,KAAY,EAAA;AACvD,IAAA,IAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACxC,EAAC;AAED;;AAEG;AACI,IAAM,sBAAsB,GAAG,UAAS,KAAqB,EAAA;AACnE,IAAA,IAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;AAC1C,EAAC;AAED;;;;AAIG;AACI,IAAM,qBAAqB,GAAG,UAAS,OAAgB,EAAA;AAC7D,IAAA,IAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,IAAA,OAAO,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACvC;;;;;;;;;;;;;;","x_google_ignoreList":[4]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.8",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"library"
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "rollup --config rollup.config.
|
|
28
|
+
"build": "rollup --config rollup.config.mjs",
|
|
29
29
|
"build:doc": "typedoc --out dist/doc lib && touch dist/doc/.nojekyll",
|
|
30
30
|
"dev": "echo 'No dev build available, production only' && npm run build",
|
|
31
|
-
"watch": "rollup --config rollup.config.
|
|
31
|
+
"watch": "rollup --config rollup.config.mjs --watch",
|
|
32
32
|
"test": "jest",
|
|
33
33
|
"test:watch": "jest --watchAll --verbose true",
|
|
34
34
|
"test:coverage": "jest --coverage"
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
"@types/node": "^18.11.18",
|
|
59
59
|
"jest": "^29.4.0",
|
|
60
60
|
"jest-environment-jsdom": "^29.4.0",
|
|
61
|
-
"rollup": "^
|
|
61
|
+
"rollup": "^3.20.2",
|
|
62
62
|
"ts-jest": "^29.0.5",
|
|
63
63
|
"tslib": "^2.4.1",
|
|
64
64
|
"typedoc": "^0.23.24",
|
|
65
|
-
"typescript": "^
|
|
65
|
+
"typescript": "^5.0.3"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@nextcloud/auth": "^2.0.0",
|
|
69
|
-
"@nextcloud/l10n": "^2.0
|
|
70
|
-
"@nextcloud/logger": "^2.
|
|
69
|
+
"@nextcloud/l10n": "^2.1.0",
|
|
70
|
+
"@nextcloud/logger": "^2.5.0"
|
|
71
71
|
}
|
|
72
72
|
}
|