@nextcloud/files 3.0.0-beta.6 → 3.0.0-beta.7

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.
@@ -20,7 +20,7 @@
20
20
  *
21
21
  */
22
22
  import { FileType } from './fileType';
23
- import Node from './node';
23
+ import { Node } from './node';
24
24
  export declare class File extends Node {
25
25
  get type(): FileType;
26
26
  }
@@ -20,7 +20,7 @@
20
20
  *
21
21
  */
22
22
  import { FileType } from './fileType';
23
- import Node from './node';
23
+ import { Node } from './node';
24
24
  import NodeData from './nodeData';
25
25
  export declare class Folder extends Node {
26
26
  constructor(data: NodeData);
@@ -1,7 +1,7 @@
1
1
  import { Permission } from '../permissions';
2
2
  import { FileType } from './fileType';
3
3
  import NodeData, { Attribute } from './nodeData';
4
- export default abstract class Node {
4
+ export declare abstract class Node {
5
5
  private _data;
6
6
  private _attributes;
7
7
  private _knownDavService;
@@ -20,6 +20,7 @@ export default abstract class Node {
20
20
  get extension(): string | null;
21
21
  /**
22
22
  * Get the directory path leading to this object
23
+ * Will use the relative path to root if available
23
24
  */
24
25
  get dirname(): string;
25
26
  /**
@@ -54,6 +55,10 @@ export default abstract class Node {
54
55
  * Get the dav root of this object
55
56
  */
56
57
  get root(): string | null;
58
+ /**
59
+ * Get the absolute path of this object relative to the root
60
+ */
61
+ get path(): string | null;
57
62
  /**
58
63
  * Move the node to a new destination
59
64
  *
@@ -26,7 +26,8 @@ export interface Attribute {
26
26
  export default interface NodeData {
27
27
  /** Unique ID */
28
28
  id?: number;
29
- /** URL to the ressource
29
+ /**
30
+ * URL to the ressource.
30
31
  * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
31
32
  * or https://domain.com/Photos/picture.jpg
32
33
  */
@@ -44,6 +45,12 @@ export default interface NodeData {
44
45
  /** The owner UID of this node */
45
46
  owner: string | null;
46
47
  attributes?: Attribute;
48
+ /**
49
+ * The absolute root of the home relative to the service.
50
+ * It is highly recommended to provide that information.
51
+ * e.g. /files/emma
52
+ */
53
+ root?: string;
47
54
  }
48
55
  /**
49
56
  * Validate Node construct data
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ import { type Entry, NewFileMenu } from './newFileMenu';
26
26
  export { FileType } from './files/fileType';
27
27
  export { File } from './files/file';
28
28
  export { Folder } from './files/folder';
29
+ export { Node } from './files/node';
29
30
  export { Permission, parseWebdavPermissions } from './permissions';
30
31
  declare global {
31
32
  interface Window {
package/dist/index.esm.js CHANGED
@@ -323,6 +323,12 @@ const validateData = (data) => {
323
323
  if ('attributes' in data && typeof data.attributes !== 'object') {
324
324
  throw new Error('Invalid attributes format');
325
325
  }
326
+ if ('root' in data && typeof data.root !== 'string') {
327
+ throw new Error('Invalid root format');
328
+ }
329
+ if (data.root && !data.root.startsWith('/')) {
330
+ throw new Error('Root must start with a leading slash');
331
+ }
326
332
  };
327
333
 
328
334
  /**
@@ -381,8 +387,12 @@ class Node {
381
387
  }
382
388
  /**
383
389
  * Get the directory path leading to this object
390
+ * Will use the relative path to root if available
384
391
  */
385
392
  get dirname() {
393
+ if (this.root) {
394
+ return dirname(this.source.split(this.root).pop() || '/');
395
+ }
386
396
  return dirname(this.source);
387
397
  }
388
398
  /**
@@ -433,11 +443,23 @@ class Node {
433
443
  * Get the dav root of this object
434
444
  */
435
445
  get root() {
446
+ // If provided (recommended), use the root and strip away the ending slash
447
+ if (this._data.root) {
448
+ return this._data.root.replace(/^(.+)\/$/, '$1');
449
+ }
450
+ // Use the source to get the root from the dav service
436
451
  if (this.isDavRessource) {
437
- return this.dirname.split(this._knownDavService).pop() || null;
452
+ const root = dirname(this.source);
453
+ return root.split(this._knownDavService).pop() || null;
438
454
  }
439
455
  return null;
440
456
  }
457
+ /**
458
+ * Get the absolute path of this object relative to the root
459
+ */
460
+ get path() {
461
+ return (this.dirname + '/' + this.basename).replace(/\/\//g, '/');
462
+ }
441
463
  /**
442
464
  * Move the node to a new destination
443
465
  *
@@ -455,7 +477,7 @@ class Node {
455
477
  if (basename.includes('/')) {
456
478
  throw new Error('Invalid basename');
457
479
  }
458
- this.move(this.dirname + '/' + basename);
480
+ this.move(dirname(this.source) + '/' + basename);
459
481
  }
460
482
  }
461
483
 
@@ -572,5 +594,5 @@ const getNewFileMenuEntries = function (context) {
572
594
  return newFileMenu.getEntries(context);
573
595
  };
574
596
 
575
- export { File, FileType, Folder, Permission, addNewFileMenuEntry, formatFileSize, getNewFileMenuEntries, parseWebdavPermissions, removeNewFileMenuEntry };
597
+ export { File, FileType, Folder, Node, Permission, addNewFileMenuEntry, formatFileSize, getNewFileMenuEntries, parseWebdavPermissions, removeNewFileMenuEntry };
576
598
  //# sourceMappingURL=index.esm.js.map
@@ -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/** 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 \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","/**\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 default 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 */\n\tget dirname(): string {\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\tif (this.isDavRessource) {\n\t\t\treturn this.dirname.split(this._knownDavService).pop() || null\n\t\t}\n\t\treturn null\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(this.dirname + '/' + 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 { 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,GA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AM,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/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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Y,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;;;;"}
package/dist/index.js CHANGED
@@ -375,6 +375,12 @@ var validateData = function (data) {
375
375
  if ('attributes' in data && typeof data.attributes !== 'object') {
376
376
  throw new Error('Invalid attributes format');
377
377
  }
378
+ if ('root' in data && typeof data.root !== 'string') {
379
+ throw new Error('Invalid root format');
380
+ }
381
+ if (data.root && !data.root.startsWith('/')) {
382
+ throw new Error('Root must start with a leading slash');
383
+ }
378
384
  };
379
385
 
380
386
  /**
@@ -444,8 +450,12 @@ var Node = /** @class */ (function () {
444
450
  Object.defineProperty(Node.prototype, "dirname", {
445
451
  /**
446
452
  * Get the directory path leading to this object
453
+ * Will use the relative path to root if available
447
454
  */
448
455
  get: function () {
456
+ if (this.root) {
457
+ return path.dirname(this.source.split(this.root).pop() || '/');
458
+ }
449
459
  return path.dirname(this.source);
450
460
  },
451
461
  enumerable: false,
@@ -524,14 +534,30 @@ var Node = /** @class */ (function () {
524
534
  * Get the dav root of this object
525
535
  */
526
536
  get: function () {
537
+ // If provided (recommended), use the root and strip away the ending slash
538
+ if (this._data.root) {
539
+ return this._data.root.replace(/^(.+)\/$/, '$1');
540
+ }
541
+ // Use the source to get the root from the dav service
527
542
  if (this.isDavRessource) {
528
- return this.dirname.split(this._knownDavService).pop() || null;
543
+ var root = path.dirname(this.source);
544
+ return root.split(this._knownDavService).pop() || null;
529
545
  }
530
546
  return null;
531
547
  },
532
548
  enumerable: false,
533
549
  configurable: true
534
550
  });
551
+ Object.defineProperty(Node.prototype, "path", {
552
+ /**
553
+ * Get the absolute path of this object relative to the root
554
+ */
555
+ get: function () {
556
+ return (this.dirname + '/' + this.basename).replace(/\/\//g, '/');
557
+ },
558
+ enumerable: false,
559
+ configurable: true
560
+ });
535
561
  /**
536
562
  * Move the node to a new destination
537
563
  *
@@ -549,7 +575,7 @@ var Node = /** @class */ (function () {
549
575
  if (basename.includes('/')) {
550
576
  throw new Error('Invalid basename');
551
577
  }
552
- this.move(this.dirname + '/' + basename);
578
+ this.move(path.dirname(this.source) + '/' + basename);
553
579
  };
554
580
  return Node;
555
581
  }());
@@ -647,6 +673,7 @@ var getNewFileMenuEntries = function (context) {
647
673
 
648
674
  exports.File = File;
649
675
  exports.Folder = Folder;
676
+ exports.Node = Node;
650
677
  exports.addNewFileMenuEntry = addNewFileMenuEntry;
651
678
  exports.formatFileSize = formatFileSize;
652
679
  exports.getNewFileMenuEntries = getNewFileMenuEntries;
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 __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: n === \"return\" } : 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/** 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 \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","/**\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 default 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 */\n\tget dirname(): string {\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\tif (this.isDavRessource) {\n\t\t\treturn this.dirname.split(this._knownDavService).pop() || null\n\t\t}\n\t\treturn null\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(this.dirname + '/' + 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 { 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,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACnB,KAAA;AAED;;;;;AAKE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AAR,QAAA,GAAA,EAAA,YAAA;YACC,OAAOA,gBAAQ,CAAC,MAAM,CAAA;SACtB;;;AAAA,KAAA,CAAA,CAAA;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;AAkBH;;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/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,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,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C7CD;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextcloud/files",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "description": "Nextcloud files utils",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -54,14 +54,15 @@
54
54
  "@rollup/plugin-commonjs": "^24.0.1",
55
55
  "@rollup/plugin-node-resolve": "^15.0.1",
56
56
  "@rollup/plugin-typescript": "^11.0.0",
57
- "@types/jest": "^28.1.1",
58
- "jest": "^28.1.1",
59
- "jest-environment-jsdom": "^29.0.1",
57
+ "@types/jest": "^29.4.0",
58
+ "@types/node": "^18.11.18",
59
+ "jest": "^29.4.0",
60
+ "jest-environment-jsdom": "^29.4.0",
60
61
  "rollup": "^2.75.6",
61
- "ts-jest": "^28.0.4",
62
- "tslib": "^2.4.0",
63
- "typedoc": "^0.23.4",
64
- "typescript": "^4.7.3"
62
+ "ts-jest": "^29.0.5",
63
+ "tslib": "^2.4.1",
64
+ "typedoc": "^0.23.24",
65
+ "typescript": "^4.9.4"
65
66
  },
66
67
  "dependencies": {
67
68
  "@nextcloud/auth": "^2.0.0",