@nextcloud/files 4.0.0-beta.0 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,6 +13,15 @@ This library provides three kinds of utils:
13
13
  2. Geneal purpose function related to files or folders, like filename validation.
14
14
  3. Functions and classes to interact with the Nextcloud **files** app, like registering a new view or a file action.
15
15
 
16
+ ## Compatibility
17
+
18
+ | `@nextcloud/files` version | Supported | Nextcloud version |
19
+ |----------------------------|-----------|-------------------|
20
+ | 4.x | ✅ | 30+ |
21
+ | 3.x | ✅ | 26+ |
22
+ | 2.x | ❌ | 23-25 |
23
+ | 1.x | ❌ | 20-22 |
24
+
16
25
  ## Usage examples
17
26
 
18
27
  ### Files app
@@ -1,4 +1,4 @@
1
- import { ActionContext, ActionContextSingle } from '../types';
1
+ import { ActionContext, ActionContextSingle } from '../types.ts';
2
2
  export declare enum DefaultType {
3
3
  DEFAULT = "default",
4
4
  HIDDEN = "hidden"
@@ -1,4 +1,4 @@
1
- import { ActionContext, ViewActionContext } from '../types';
1
+ import { ActionContext, ViewActionContext } from '../types.ts';
2
2
  interface FileListActionData {
3
3
  /** Unique ID */
4
4
  id: string;
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- const auth = require("@nextcloud/auth");
3
- const _public = require("@nextcloud/sharing/public");
4
- const router = require("@nextcloud/router");
5
- const cancelablePromise = require("cancelable-promise");
6
- const webdav = require("webdav");
7
2
  const logger$1 = require("@nextcloud/logger");
8
3
  const path = require("path");
9
4
  const paths = require("@nextcloud/paths");
@@ -455,283 +450,11 @@ class Folder extends Node {
455
450
  return "httpd/unix-directory";
456
451
  }
457
452
  }
458
- const parsePermissions = function(permString = "") {
459
- let permissions = Permission.NONE;
460
- if (!permString) {
461
- return permissions;
462
- }
463
- if (permString.includes("C") || permString.includes("K")) {
464
- permissions |= Permission.CREATE;
465
- }
466
- if (permString.includes("G")) {
467
- permissions |= Permission.READ;
468
- }
469
- if (permString.includes("W") || permString.includes("N") || permString.includes("V")) {
470
- permissions |= Permission.UPDATE;
471
- }
472
- if (permString.includes("D")) {
473
- permissions |= Permission.DELETE;
474
- }
475
- if (permString.includes("R")) {
476
- permissions |= Permission.SHARE;
477
- }
478
- return permissions;
479
- };
480
- const defaultDavProperties = [
481
- "d:getcontentlength",
482
- "d:getcontenttype",
483
- "d:getetag",
484
- "d:getlastmodified",
485
- "d:creationdate",
486
- "d:displayname",
487
- "d:quota-available-bytes",
488
- "d:resourcetype",
489
- "nc:has-preview",
490
- "nc:is-encrypted",
491
- "nc:mount-type",
492
- "oc:comments-unread",
493
- "oc:favorite",
494
- "oc:fileid",
495
- "oc:owner-display-name",
496
- "oc:owner-id",
497
- "oc:permissions",
498
- "oc:size"
499
- ];
500
- const defaultDavNamespaces = {
501
- d: "DAV:",
502
- nc: "http://nextcloud.org/ns",
503
- oc: "http://owncloud.org/ns",
504
- ocs: "http://open-collaboration-services.org/ns"
505
- };
506
- const registerDavProperty = function(prop, namespace = { nc: "http://nextcloud.org/ns" }) {
507
- if (typeof window._nc_dav_properties === "undefined") {
508
- window._nc_dav_properties = [...defaultDavProperties];
509
- window._nc_dav_namespaces = { ...defaultDavNamespaces };
510
- }
511
- const namespaces = { ...window._nc_dav_namespaces, ...namespace };
512
- if (window._nc_dav_properties.find((search) => search === prop)) {
513
- logger.warn(`${prop} already registered`, { prop });
514
- return false;
515
- }
516
- if (prop.startsWith("<") || prop.split(":").length !== 2) {
517
- logger.error(`${prop} is not valid. See example: 'oc:fileid'`, { prop });
518
- return false;
519
- }
520
- const ns = prop.split(":")[0];
521
- if (!namespaces[ns]) {
522
- logger.error(`${prop} namespace unknown`, { prop, namespaces });
523
- return false;
524
- }
525
- window._nc_dav_properties.push(prop);
526
- window._nc_dav_namespaces = namespaces;
527
- return true;
528
- };
529
- const getDavProperties = function() {
530
- if (typeof window._nc_dav_properties === "undefined") {
531
- window._nc_dav_properties = [...defaultDavProperties];
532
- }
533
- return window._nc_dav_properties.map((prop) => `<${prop} />`).join(" ");
534
- };
535
- const getDavNameSpaces = function() {
536
- if (typeof window._nc_dav_namespaces === "undefined") {
537
- window._nc_dav_namespaces = { ...defaultDavNamespaces };
538
- }
539
- return Object.keys(window._nc_dav_namespaces).map((ns) => `xmlns:${ns}="${window._nc_dav_namespaces?.[ns]}"`).join(" ");
540
- };
541
- const getDefaultPropfind = function() {
542
- return `<?xml version="1.0"?>
543
- <d:propfind ${getDavNameSpaces()}>
544
- <d:prop>
545
- ${getDavProperties()}
546
- </d:prop>
547
- </d:propfind>`;
548
- };
549
- const getFavoritesReport = function() {
550
- return `<?xml version="1.0"?>
551
- <oc:filter-files ${getDavNameSpaces()}>
552
- <d:prop>
553
- ${getDavProperties()}
554
- </d:prop>
555
- <oc:filter-rules>
556
- <oc:favorite>1</oc:favorite>
557
- </oc:filter-rules>
558
- </oc:filter-files>`;
559
- };
560
- const getRecentSearch = function(lastModified) {
561
- return `<?xml version="1.0" encoding="UTF-8"?>
562
- <d:searchrequest ${getDavNameSpaces()}
563
- xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
564
- <d:basicsearch>
565
- <d:select>
566
- <d:prop>
567
- ${getDavProperties()}
568
- </d:prop>
569
- </d:select>
570
- <d:from>
571
- <d:scope>
572
- <d:href>/files/${auth.getCurrentUser()?.uid}/</d:href>
573
- <d:depth>infinity</d:depth>
574
- </d:scope>
575
- </d:from>
576
- <d:where>
577
- <d:and>
578
- <d:or>
579
- <d:not>
580
- <d:eq>
581
- <d:prop>
582
- <d:getcontenttype/>
583
- </d:prop>
584
- <d:literal>httpd/unix-directory</d:literal>
585
- </d:eq>
586
- </d:not>
587
- <d:eq>
588
- <d:prop>
589
- <oc:size/>
590
- </d:prop>
591
- <d:literal>0</d:literal>
592
- </d:eq>
593
- </d:or>
594
- <d:gt>
595
- <d:prop>
596
- <d:getlastmodified/>
597
- </d:prop>
598
- <d:literal>${lastModified}</d:literal>
599
- </d:gt>
600
- </d:and>
601
- </d:where>
602
- <d:orderby>
603
- <d:order>
604
- <d:prop>
605
- <d:getlastmodified/>
606
- </d:prop>
607
- <d:descending/>
608
- </d:order>
609
- </d:orderby>
610
- <d:limit>
611
- <d:nresults>100</d:nresults>
612
- <ns:firstresult>0</ns:firstresult>
613
- </d:limit>
614
- </d:basicsearch>
615
- </d:searchrequest>`;
616
- };
617
- function getRootPath() {
618
- if (_public.isPublicShare()) {
619
- return `/files/${_public.getSharingToken()}`;
620
- }
621
- return `/files/${auth.getCurrentUser()?.uid}`;
622
- }
623
- const defaultRootPath = getRootPath();
624
- function getRemoteURL() {
625
- const url = router.generateRemoteUrl("dav");
626
- if (_public.isPublicShare()) {
627
- return url.replace("remote.php", "public.php");
628
- }
629
- return url;
630
- }
631
- const defaultRemoteURL = getRemoteURL();
632
- const getClient = function(remoteURL = defaultRemoteURL, headers = {}) {
633
- const client = webdav.createClient(remoteURL, { headers });
634
- function setHeaders(token) {
635
- client.setHeaders({
636
- ...headers,
637
- // Add this so the server knows it is an request from the browser
638
- "X-Requested-With": "XMLHttpRequest",
639
- // Inject user auth
640
- requesttoken: token ?? ""
641
- });
642
- }
643
- auth.onRequestTokenUpdate(setHeaders);
644
- setHeaders(auth.getRequestToken());
645
- const patcher = webdav.getPatcher();
646
- patcher.patch("fetch", (url, options) => {
647
- const headers2 = options.headers;
648
- if (headers2?.method) {
649
- options.method = headers2.method;
650
- delete headers2.method;
651
- }
652
- return fetch(url, options);
653
- });
654
- return client;
655
- };
656
- const getFavoriteNodes = (davClient, path2 = "/", davRoot = defaultRootPath) => {
657
- const controller = new AbortController();
658
- return new cancelablePromise.CancelablePromise(async (resolve, reject, onCancel) => {
659
- onCancel(() => controller.abort());
660
- try {
661
- const contentsResponse = await davClient.getDirectoryContents(`${davRoot}${path2}`, {
662
- signal: controller.signal,
663
- details: true,
664
- data: getFavoritesReport(),
665
- headers: {
666
- // see getClient for patched webdav client
667
- method: "REPORT"
668
- },
669
- includeSelf: true
670
- });
671
- const nodes = contentsResponse.data.filter((node) => node.filename !== path2).map((result) => resultToNode(result, davRoot));
672
- resolve(nodes);
673
- } catch (error) {
674
- reject(error);
675
- }
676
- });
677
- };
678
- const resultToNode = function(node, filesRoot = defaultRootPath, remoteURL = defaultRemoteURL) {
679
- let userId = auth.getCurrentUser()?.uid;
680
- if (_public.isPublicShare()) {
681
- userId = userId ?? "anonymous";
682
- } else if (!userId) {
683
- throw new Error("No user id found");
684
- }
685
- const props = node.props;
686
- const permissions = parsePermissions(props?.permissions);
687
- const owner = String(props?.["owner-id"] || userId);
688
- const id = props.fileid || 0;
689
- const mtime = new Date(Date.parse(node.lastmod));
690
- const crtime = new Date(Date.parse(props.creationdate));
691
- const nodeData = {
692
- id,
693
- source: `${remoteURL}${node.filename}`,
694
- mtime: !isNaN(mtime.getTime()) && mtime.getTime() !== 0 ? mtime : void 0,
695
- crtime: !isNaN(crtime.getTime()) && crtime.getTime() !== 0 ? crtime : void 0,
696
- mime: node.mime || "application/octet-stream",
697
- // Manually cast to work around for https://github.com/perry-mitchell/webdav-client/pull/380
698
- displayname: props.displayname !== void 0 ? String(props.displayname) : void 0,
699
- size: props?.size || Number.parseInt(props.getcontentlength || "0"),
700
- // The fileid is set to -1 for failed requests
701
- status: id < 0 ? NodeStatus.FAILED : void 0,
702
- permissions,
703
- owner,
704
- root: filesRoot,
705
- attributes: {
706
- ...node,
707
- ...props,
708
- hasPreview: props?.["has-preview"]
709
- }
710
- };
711
- delete nodeData.attributes?.props;
712
- return node.type === "file" ? new File(nodeData) : new Folder(nodeData);
713
- };
714
453
  exports.File = File;
715
454
  exports.FileType = FileType;
716
455
  exports.Folder = Folder;
717
456
  exports.Node = Node;
718
457
  exports.NodeStatus = NodeStatus;
719
458
  exports.Permission = Permission;
720
- exports.defaultDavNamespaces = defaultDavNamespaces;
721
- exports.defaultDavProperties = defaultDavProperties;
722
- exports.defaultRemoteURL = defaultRemoteURL;
723
- exports.defaultRootPath = defaultRootPath;
724
- exports.getClient = getClient;
725
- exports.getDavNameSpaces = getDavNameSpaces;
726
- exports.getDavProperties = getDavProperties;
727
- exports.getDefaultPropfind = getDefaultPropfind;
728
- exports.getFavoriteNodes = getFavoriteNodes;
729
- exports.getFavoritesReport = getFavoritesReport;
730
- exports.getRecentSearch = getRecentSearch;
731
- exports.getRemoteURL = getRemoteURL;
732
- exports.getRootPath = getRootPath;
733
459
  exports.logger = logger;
734
- exports.parsePermissions = parsePermissions;
735
- exports.registerDavProperty = registerDavProperty;
736
- exports.resultToNode = resultToNode;
737
- //# sourceMappingURL=dav-D7e9ysFW.cjs.map
460
+ //# sourceMappingURL=folder-C3yiKTSb.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folder-C3yiKTSb.cjs","sources":["../../lib/utils/logger.ts","../../lib/node/fileType.ts","../../lib/permissions.ts","../../lib/node/nodeData.ts","../../lib/node/node.ts","../../lib/node/file.ts","../../lib/node/folder.ts"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nexport default getLoggerBuilder()\n\t.setApp('@nextcloud/files')\n\t.detectUser()\n\t.build()\n","/**\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nexport enum FileType {\n\tFolder = 'folder',\n\tFile = 'file',\n}\n","/**\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Node permissions\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 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { join } from 'path'\n\nimport { Permission } from '../permissions'\nimport { NodeStatus } from './node'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface Attribute { [key: string]: any }\n\nexport interface NodeData {\n\t/** Unique ID */\n\tid?: number\n\n\t/**\n\t * URL to the resource.\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 Optional for folders only */\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\t/** Optional the displayname of this node */\n\tdisplayname?: string\n\n\t/** The node attributes */\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\t/** The node status */\n\tstatus?: NodeStatus\n}\n\n/**\n * Check if a node source is from a specific DAV service\n *\n * @param source The source to check\n * @param davService Pattern to check if source is DAV resource\n */\nexport const isDavResource = function(source: string, davService: RegExp): boolean {\n\treturn source.match(davService) !== null\n}\n\n/**\n * Validate Node construct data\n *\n * @param data The node data\n * @param davService Pattern to check if source is DAV ressource\n */\nexport const validateData = (data: NodeData, davService: RegExp) => {\n\tif (data.id && typeof data.id !== 'number') {\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\ttry {\n\t\t// eslint-disable-next-line no-new\n\t\tnew URL(data.source)\n\t} catch (e) {\n\t\tthrow new Error('Invalid source format, source must be a valid URL')\n\t}\n\n\tif (!data.source.startsWith('http')) {\n\t\tthrow new Error('Invalid source format, only http(s) is supported')\n\t}\n\n\tif (data.displayname && typeof data.displayname !== 'string') {\n\t\tthrow new Error('Invalid displayname type')\n\t}\n\n\tif (data.mtime && !(data.mtime instanceof Date)) {\n\t\tthrow new Error('Invalid mtime type')\n\t}\n\n\tif (data.crtime && !(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\t// Allow size to be 0\n\tif ('size' in data && typeof data.size !== 'number' && data.size !== undefined) {\n\t\tthrow new Error('Invalid size type')\n\t}\n\n\t// Allow permissions to be 0\n\tif ('permissions' in data\n\t\t&& data.permissions !== undefined\n\t\t&& !(typeof 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 (data.owner\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 (data.attributes && typeof data.attributes !== 'object') {\n\t\tthrow new Error('Invalid attributes type')\n\t}\n\n\tif (data.root && typeof data.root !== 'string') {\n\t\tthrow new Error('Invalid root type')\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\tif (data.root && !data.source.includes(data.root)) {\n\t\tthrow new Error('Root must be part of the source')\n\t}\n\n\tif (data.root && isDavResource(data.source, davService)) {\n\t\tconst service = data.source.match(davService)![0]\n\t\tif (!data.source.includes(join(service, data.root))) {\n\t\t\tthrow new Error('The root must be relative to the service. e.g /files/emma')\n\t\t}\n\t}\n\n\tif (data.status && !Object.values(NodeStatus).includes(data.status)) {\n\t\tthrow new Error('Status must be a valid NodeStatus')\n\t}\n}\n\n/**\n * In case we try to create a node from deserialized data,\n * we need to fix date types.\n *\n * @param data The internal node data\n */\nexport const fixDates = (data: NodeData) => {\n\tif (data.mtime && typeof data.mtime === 'string') {\n\t\tif (!isNaN(Date.parse(data.mtime))\n\t\t\t&& JSON.stringify(new Date(data.mtime)) === JSON.stringify(data.mtime)) {\n\t\t\tdata.mtime = new Date(data.mtime)\n\t\t}\n\t}\n\n\tif (data.crtime && typeof data.crtime === 'string') {\n\t\tif (!isNaN(Date.parse(data.crtime))\n\t\t\t&& JSON.stringify(new Date(data.crtime)) === JSON.stringify(data.crtime)) {\n\t\t\tdata.crtime = new Date(data.crtime)\n\t\t}\n\t}\n}\n\n/**\n * Fix a RegExp pattern from string or RegExp to RegExp\n *\n * @param pattern The pattern as string or RegExp\n */\nexport const fixRegExp = (pattern: string | RegExp): RegExp => {\n\tif (pattern instanceof RegExp) {\n\t\treturn pattern\n\t}\n\n\t// Extract the pattern and flags if it's a string\n\t// Pulled from https://www.npmjs.com/package/regex-parser\n\tconst matches = pattern.match(/(\\/?)(.+)\\1([a-z]*)/i)\n\n\t// If there's no match, throw an error\n\tif (!matches) {\n\t\tthrow new Error('Invalid regular expression format.')\n\t}\n\n\t// Filter valid flags: 'g', 'i', 'm', 's', 'u', and 'y'\n\tconst validFlags = Array.from(new Set(matches[3]))\n\t\t.filter((flag) => 'gimsuy'.includes(flag))\n\t\t.join('')\n\n\t// Create the regular expression\n\treturn new RegExp(matches[2], validFlags)\n}\n","/**\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { basename, extname, dirname } from 'path'\nimport { encodePath } from '@nextcloud/paths'\n\nimport { Permission } from '../permissions'\nimport { FileType } from './fileType'\nimport { Attribute, fixDates, fixRegExp, isDavResource, NodeData, validateData } from './nodeData'\n\nexport enum NodeStatus {\n\t/** This is a new node and it doesn't exists on the filesystem yet */\n\tNEW = 'new',\n\t/** This node has failed and is unavailable */\n\tFAILED = 'failed',\n\t/** This node is currently loading or have an operation in progress */\n\tLOADING = 'loading',\n\t/** This node is locked and cannot be modified */\n\tLOCKED = 'locked',\n}\n\nexport type NodeConstructorData = [NodeData, RegExp?]\n\nexport abstract class Node {\n\n\tprivate _attributes: Attribute\n\n\tprotected _data: NodeData\n\tprotected _knownDavService = /(remote|public)\\.php\\/(web)?dav/i\n\n\tprivate readonlyAttributes = Object.entries(Object.getOwnPropertyDescriptors(Node.prototype))\n\t\t.filter(e => typeof e[1].get === 'function' && e[0] !== '__proto__')\n\t\t.map(e => e[0])\n\n\tprivate handler = {\n\t\tset: (target: Attribute, prop: string, value: unknown): boolean => {\n\t\t\tif (this.readonlyAttributes.includes(prop)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\t// Apply original changes\n\t\t\treturn Reflect.set(target, prop, value)\n\t\t},\n\t\tdeleteProperty: (target: Attribute, prop: string): boolean => {\n\t\t\tif (this.readonlyAttributes.includes(prop)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\t// Apply original changes\n\t\t\treturn Reflect.deleteProperty(target, prop)\n\t\t},\n\t} as ProxyHandler<Attribute>\n\n\tprotected constructor(...[data, davService]: NodeConstructorData) {\n\t\tif (!data.mime) {\n\t\t\tdata.mime = 'application/octet-stream'\n\t\t}\n\n\t\t// Fix primitive types if needed\n\t\tfixDates(data)\n\t\tdavService = fixRegExp(davService || this._knownDavService)\n\n\t\t// Validate data\n\t\tvalidateData(data, davService)\n\n\t\tthis._data = {\n\t\t\t...data,\n\t\t\tattributes: {},\n\t\t}\n\n\t\t// Proxy the attributes to update the mtime on change\n\t\tthis._attributes = new Proxy(this._data.attributes!, this.handler)\n\n\t\t// Update attributes, this sanitizes the attributes to only contain valid attributes\n\t\tthis.update(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 * There is no setter as the source is not meant to be changed manually.\n\t * You can use the rename or move method to change the source.\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 the encoded source url to this object for requests purposes\n\t */\n\tget encodedSource(): string {\n\t\tconst { origin } = new URL(this.source)\n\t\treturn origin + encodePath(this.source.slice(origin.length))\n\t}\n\n\t/**\n\t * Get this object name\n\t * There is no setter as the source is not meant to be changed manually.\n\t * You can use the rename or move method to change the source.\n\t */\n\tget basename(): string {\n\t\treturn basename(this.source)\n\t}\n\n\t/**\n\t * The nodes displayname\n\t * By default the display name and the `basename` are identical,\n\t * but it is possible to have a different name. This happens\n\t * on the files app for example for shared folders.\n\t */\n\tget displayname(): string {\n\t\treturn this._data.displayname || this.basename\n\t}\n\n\t/**\n\t * Set the displayname\n\t */\n\tset displayname(displayname: string) {\n\t\tvalidateData({ ...this._data, displayname }, this._knownDavService)\n\t\tthis._data.displayname = displayname\n\t}\n\n\t/**\n\t * Get this object's extension\n\t * There is no setter as the source is not meant to be changed manually.\n\t * You can use the rename or move method to change the source.\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\t * There is no setter as the source is not meant to be changed manually.\n\t * You can use the rename or move method to change the source.\n\t */\n\tget dirname(): string {\n\t\tif (this.root) {\n\t\t\tlet source = this.source\n\t\t\tif (this.isDavResource) {\n\t\t\t\t// ensure we only work on the real path in case root is not distinct\n\t\t\t\tsource = source.split(this._knownDavService).pop()!\n\t\t\t}\n\t\t\t// Using replace would remove all part matching root\n\t\t\tconst firstMatch = source.indexOf(this.root)\n\t\t\t// Ensure we do not remove the leading slash\n\t\t\tconst root = this.root.replace(/\\/$/, '')\n\t\t\treturn dirname(source.slice(firstMatch + root.length) || '/')\n\t\t}\n\n\t\t// This should always be a valid URL\n\t\t// as this is tested in the constructor\n\t\tconst url = new URL(this.source)\n\t\treturn dirname(url.pathname)\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 {\n\t\treturn this._data.mime || 'application/octet-stream'\n\t}\n\n\t/**\n\t * Set the file mime\n\t * Removing the mime type will set it to `application/octet-stream`\n\t */\n\tset mime(mime: string|undefined) {\n\t\tmime ??= 'application/octet-stream'\n\n\t\tvalidateData({ ...this._data, mime }, this._knownDavService)\n\t\tthis._data.mime = mime\n\t}\n\n\t/**\n\t * Get the file modification time\n\t */\n\tget mtime(): Date|undefined {\n\t\treturn this._data.mtime\n\t}\n\n\t/**\n\t * Set the file modification time\n\t */\n\tset mtime(mtime: Date|undefined) {\n\t\tvalidateData({ ...this._data, mtime }, this._knownDavService)\n\t\tthis._data.mtime = mtime\n\t}\n\n\t/**\n\t * Get the file creation time\n\t * There is no setter as the creation time is not meant to be changed\n\t */\n\tget crtime(): Date|undefined {\n\t\treturn this._data.crtime\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 * Set the file size\n\t */\n\tset size(size: number|undefined) {\n\t\tvalidateData({ ...this._data, size }, this._knownDavService)\n\t\tthis.updateMtime()\n\t\tthis._data.size = size\n\t}\n\n\t/**\n\t * Get the file attribute\n\t * This contains all additional attributes not provided by the Node class\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 resource, we can only read it\n\t\tif (this.owner === null && !this.isDavResource) {\n\t\t\treturn Permission.READ\n\t\t}\n\n\t\t// If the permissions are not defined, we have none\n\t\treturn this._data.permissions !== undefined\n\t\t\t? this._data.permissions\n\t\t\t: Permission.NONE\n\t}\n\n\t/**\n\t * Set the file permissions\n\t */\n\tset permissions(permissions: Permission) {\n\t\tvalidateData({ ...this._data, permissions }, this._knownDavService)\n\t\tthis.updateMtime()\n\t\tthis._data.permissions = permissions\n\t}\n\n\t/**\n\t * Get the file owner\n\t * There is no setter as the owner is not meant to be changed\n\t */\n\tget owner(): string|null {\n\t\t// Remote resources have no owner\n\t\tif (!this.isDavResource) {\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 resource ?\n\t */\n\tget isDavResource(): boolean {\n\t\treturn isDavResource(this.source, this._knownDavService)\n\t}\n\n\t/**\n\t * @deprecated use `isDavResource` instead - will be removed in next major version.\n\t */\n\tget isDavRessource(): boolean {\n\t\treturn this.isDavResource\n\t}\n\n\t/**\n\t * Get the dav root of this object\n\t * There is no setter as the root is not meant to be changed\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.isDavResource) {\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 {\n\t\tif (this.root) {\n\t\t\tlet source = this.source\n\t\t\tif (this.isDavResource) {\n\t\t\t\t// ensure we only work on the real path in case root is not distinct\n\t\t\t\tsource = source.split(this._knownDavService).pop()!\n\t\t\t}\n\t\t\t// Using replace would remove all part matching root\n\t\t\tconst firstMatch = source.indexOf(this.root)\n\t\t\t// Ensure we do not remove the leading slash\n\t\t\tconst root = this.root.replace(/\\/$/, '')\n\t\t\treturn source.slice(firstMatch + root.length) || '/'\n\t\t}\n\t\treturn (this.dirname + '/' + this.basename).replace(/\\/\\//g, '/')\n\t}\n\n\t/**\n\t * Get the node id if defined.\n\t * There is no setter as the fileid is not meant to be changed\n\t */\n\tget fileid(): number|undefined {\n\t\treturn this._data?.id\n\t}\n\n\t/**\n\t * Get the node status.\n\t */\n\tget status(): NodeStatus|undefined {\n\t\treturn this._data?.status\n\t}\n\n\t/**\n\t * Set the node status.\n\t */\n\tset status(status: NodeStatus|undefined) {\n\t\tvalidateData({ ...this._data, status }, this._knownDavService)\n\t\tthis._data.status = status\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\tvalidateData({ ...this._data, source: destination }, this._knownDavService)\n\t\tconst oldBasename = this.basename\n\n\t\tthis._data.source = destination\n\t\t// Check if the displayname and the (old) basename were the same\n\t\t// meaning no special displayname was set but just a fallback to the basename by Nextcloud's WebDAV server\n\t\tif (this.displayname === oldBasename\n\t\t\t&& this.basename !== oldBasename) {\n\t\t\t// We have to assume that the displayname was not set but just a copy of the basename\n\t\t\t// this can not be guaranteed, so to be sure users should better refetch the node\n\t\t\tthis.displayname = this.basename\n\t\t}\n\t}\n\n\t/**\n\t * Rename the node\n\t * This aliases the move method for easier usage\n\t *\n\t * @param basename The new name of the node\n\t */\n\trename(basename: string) {\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\t/**\n\t * Update the mtime if exists\n\t */\n\tupdateMtime() {\n\t\tif (this._data.mtime) {\n\t\t\tthis._data.mtime = new Date()\n\t\t}\n\t}\n\n\t/**\n\t * Update the attributes of the node\n\t * Warning, updating attributes will NOT automatically update the mtime.\n\t *\n\t * @param attributes The new attributes to update on the Node attributes\n\t */\n\tupdate(attributes: Attribute) {\n\t\tfor (const [name, value] of Object.entries(attributes)) {\n\t\t\ttry {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tdelete this.attributes[name]\n\t\t\t\t} else {\n\t\t\t\t\tthis.attributes[name] = value\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t// Ignore readonly attributes\n\t\t\t\tif (e instanceof TypeError) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Throw all other exceptions\n\t\t\t\tthrow e\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns a clone of the node\n\t */\n\tclone(): this {\n\t\t// @ts-expect-error -- this class is abstract and cannot be instantiated directly but all its children can\n\t\treturn new this.constructor(structuredClone(this._data), this._knownDavService)\n\t}\n\n\t/**\n\t * JSON representation of the node\n\t */\n\ttoJSON(): string {\n\t\treturn JSON.stringify([structuredClone(this._data), this._knownDavService.toString()])\n\t}\n\n}\n\n/**\n * Interface of the node class\n */\nexport type INode = Pick<Node, keyof Node>\n","/**\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { NodeConstructorData } from './node'\n\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class File extends Node {\n\n\tpublic constructor(...[data, davService]: NodeConstructorData) {\n\t\tsuper(data, davService)\n\t}\n\n\tget type(): FileType.File {\n\t\treturn FileType.File\n\t}\n\n}\n\n/**\n * Interface of the File class\n */\nexport type IFile = Pick<File, keyof File>\n","/**\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { NodeConstructorData } from './node'\n\nimport { FileType } from './fileType'\nimport { Node } from './node'\n\nexport class Folder extends Node {\n\n\tconstructor(...[data, davService]: NodeConstructorData) {\n\t\t// enforcing mimes\n\t\tsuper({\n\t\t\t...data,\n\t\t\tmime: 'httpd/unix-directory',\n\t\t}, davService)\n\t}\n\n\tget type(): FileType.Folder {\n\t\treturn FileType.Folder\n\t}\n\n\tget extension(): null {\n\t\treturn null\n\t}\n\n\tget mime(): 'httpd/unix-directory' {\n\t\treturn 'httpd/unix-directory'\n\t}\n\n}\n\n/**\n * Interface of the folder class\n */\nexport type IFolder = Pick<Folder, keyof Folder>\n"],"names":["getLoggerBuilder","FileType","Permission","join","NodeStatus","encodePath","basename","extname","dirname"],"mappings":";;;;AAMA,MAAA,SAAeA,SAAAA,mBACb,OAAO,kBAAkB,EACzB,WAAA,EACA,MAAA;ACJK,IAAK,6BAAAC,cAAL;AACNA,YAAA,QAAA,IAAS;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