fix(webdav-client): correct directory listing path handling and update tooling for current package dependencies
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmRegistryUrl": "registry.npmjs.org"
|
||||
},
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartwebdav",
|
||||
"shortDescription": "WebDAV client utilities",
|
||||
"description": "A TypeScript library for easy interaction with WebDAV servers, including file and directory management.",
|
||||
"npmPackagename": "@push.rocks/smartwebdav",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"WebDAV client",
|
||||
"file upload",
|
||||
"directory management",
|
||||
"remote file system",
|
||||
"smartfile integration",
|
||||
"TypeScript library",
|
||||
"node.js",
|
||||
"smartpath",
|
||||
"authentication",
|
||||
"secure file transfer"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"registries": [
|
||||
"https://verdaccio.lossless.digital",
|
||||
"https://registry.npmjs.org"
|
||||
],
|
||||
"accessLevel": "public"
|
||||
}
|
||||
},
|
||||
"@git.zone/tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-05-01 - 1.1.3 - fix(webdav-client)
|
||||
correct directory listing path handling and update tooling for current package dependencies
|
||||
|
||||
- Fix listDirectory() to request the provided path instead of always reading the root directory
|
||||
- Adapt SmartFile creation to the current @push.rocks/smartfile API in getDirectoryAsSmartfileArray()
|
||||
- Replace the old test setup with a gated Node integration test using @git.zone/tstest
|
||||
- Add package exports and refresh build, test, and dependency configuration for newer toolchain versions
|
||||
|
||||
## 2024-05-29 - 1.1.2 - maintenance
|
||||
Project metadata and maintenance updates.
|
||||
|
||||
- Updated project description.
|
||||
- Versions 1.1.0 through 1.1.2 also included minor core update fixes.
|
||||
|
||||
## 2024-04-22 - 1.0.4 - webdavclient
|
||||
Added directory retrieval support for smart file arrays.
|
||||
|
||||
- Added a `webdavclient` method for getting a directory as a smartfilearray.
|
||||
|
||||
## 2024-04-20 - 1.0.2-1.0.3 - core
|
||||
Minor core maintenance updates across patch releases.
|
||||
|
||||
- Applied small core update fixes in versions 1.0.2 and 1.0.3.
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2026 Task Venture Capital GmbH <hello@task.vc>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+15
-8
@@ -1,14 +1,18 @@
|
||||
{
|
||||
"gitzone": {
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmRegistryUrl": "registry.npmjs.org"
|
||||
},
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartwebdav",
|
||||
"shortDescription": "WebDAV client utilities",
|
||||
"description": "A TypeScript library for easy interaction with WebDAV servers, including file and directory management.",
|
||||
"npmPackagename": "@push.rocks/smartwebdav",
|
||||
"license": "MIT",
|
||||
"projectDomain": "push.rocks",
|
||||
"keywords": [
|
||||
"WebDAV client",
|
||||
"file upload",
|
||||
@@ -21,13 +25,16 @@
|
||||
"authentication",
|
||||
"secure file transfer"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"registries": [
|
||||
"https://verdaccio.lossless.digital",
|
||||
"https://registry.npmjs.org"
|
||||
],
|
||||
"accessLevel": "public"
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"tsdoc": {
|
||||
"@git.zone/tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
-15
@@ -3,29 +3,29 @@
|
||||
"version": "1.1.2",
|
||||
"private": false,
|
||||
"description": "A TypeScript library for easy interaction with WebDAV servers, including file and directory management.",
|
||||
"exports": {
|
||||
".": "./dist_ts/index.js"
|
||||
},
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
"author": "Task Venture Capital GmbH",
|
||||
"author": "Task Venture Capital GmbH <hello@task.vc>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web --allowimplicitany)",
|
||||
"buildDocs": "(tsdoc)"
|
||||
"test": "tstest test/",
|
||||
"build": "tsbuild --web",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.25",
|
||||
"@git.zone/tsbundle": "^2.0.5",
|
||||
"@git.zone/tsrun": "^1.2.46",
|
||||
"@git.zone/tstest": "^1.0.44",
|
||||
"@push.rocks/qenv": "^6.0.5",
|
||||
"@push.rocks/tapbundle": "^5.0.15",
|
||||
"@types/node": "^20.8.7"
|
||||
"@git.zone/tsbuild": "^4.4.0",
|
||||
"@git.zone/tstest": "^3.6.3",
|
||||
"@push.rocks/qenv": "^6.1.4",
|
||||
"@types/node": "^25.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@push.rocks/smartfile": "^11.0.14",
|
||||
"@push.rocks/smartpath": "^5.0.16",
|
||||
"webdav": "^5.5.0"
|
||||
"@push.rocks/smartfile": "^13.1.3",
|
||||
"@push.rocks/smartpath": "^6.0.0",
|
||||
"webdav": "^5.9.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -47,6 +47,8 @@
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
".smartconfig.json",
|
||||
"license",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
@@ -62,4 +64,4 @@
|
||||
"authentication",
|
||||
"secure file transfer"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+6901
-3953
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
import { tap } from '@git.zone/tstest/tapbundle';
|
||||
import * as smartwebdav from '../ts/index.js';
|
||||
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
|
||||
let webdavClient: smartwebdav.WebdavClient;
|
||||
const testQenv = new qenv.Qenv('./', './.nogit/');
|
||||
|
||||
const requireEnv = async (envNameArg: string): Promise<string> => {
|
||||
const envValue = await testQenv.getEnvVarOnDemand(envNameArg);
|
||||
if (!envValue) {
|
||||
throw new Error(`Missing required environment variable: ${envNameArg}`);
|
||||
}
|
||||
return envValue;
|
||||
};
|
||||
|
||||
tap.test('should run WebDAV integration flow', async () => {
|
||||
if (process.env.SMARTWEBDAV_RUN_INTEGRATION_TESTS !== 'true') {
|
||||
console.log('Skipping WebDAV integration test. Set SMARTWEBDAV_RUN_INTEGRATION_TESTS=true to run it.');
|
||||
return;
|
||||
}
|
||||
|
||||
webdavClient = new smartwebdav.WebdavClient({
|
||||
serverUrl: await requireEnv('SERVER_URL'),
|
||||
authType: smartwebdav.authType.Password,
|
||||
password: await requireEnv('SERVER_TOKEN'),
|
||||
});
|
||||
|
||||
const directoryListed = await webdavClient.listDirectory('/testdir');
|
||||
console.log(directoryListed);
|
||||
|
||||
const smartfileFactory = new smartfile.SmartFileFactory(undefined);
|
||||
const smartfile1 = smartfileFactory.fromString('./testdir/so/awesome/hello.txt', 'hello there', 'utf8');
|
||||
const smartfile2 = smartfileFactory.fromString('./testdir/so/awesome/hello2.txt', 'hello there 2', 'utf8');
|
||||
|
||||
await webdavClient.uploadSmartFileArray([smartfile1, smartfile2]);
|
||||
await webdavClient.ensureDirectory('/testdir/another/dirctory');
|
||||
await webdavClient.deleteDirectory('/testdir/another');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
@@ -1,36 +0,0 @@
|
||||
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||||
import * as smartwebdav from '../ts/index.js'
|
||||
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
const testQenv = new qenv.Qenv('./', './.nogit/');
|
||||
|
||||
let webdavClient: smartwebdav.WebdavClient;
|
||||
|
||||
tap.test('should', async () => {
|
||||
webdavClient = new smartwebdav.WebdavClient({
|
||||
serverUrl: await testQenv.getEnvVarOnDemand('SERVER_URL'),
|
||||
authType: smartwebdav.authType.Password,
|
||||
password: await testQenv.getEnvVarOnDemand('SERVER_TOKEN'),
|
||||
});
|
||||
|
||||
const directoryListed = await webdavClient.listDirectory('/testdir');
|
||||
console.log(directoryListed);
|
||||
});
|
||||
|
||||
tap.test('should upload smartfiles', async () => {
|
||||
const smartfile1 = await smartfile.SmartFile.fromString('./testdir/so/awesome/hello.txt', 'hello there', 'utf8');
|
||||
const smartfile2 = await smartfile.SmartFile.fromString('./testdir/so/awesome/hello2.txt', 'hello there 2', 'utf8');
|
||||
|
||||
await webdavClient.uploadSmartFileArray([smartfile1, smartfile2]);
|
||||
});
|
||||
|
||||
tap.test('should ensure directory', async () => {
|
||||
await webdavClient.ensureDirectory('/testdir/another/dirctory');
|
||||
})
|
||||
|
||||
tap.test('should delete a directory', async () => {
|
||||
await webdavClient.deleteDirectory('/testdir/another');
|
||||
})
|
||||
|
||||
export default tap.start()
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartwebdav',
|
||||
version: '1.1.2',
|
||||
version: '1.1.3',
|
||||
description: 'A TypeScript library for easy interaction with WebDAV servers, including file and directory management.'
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { isFile } from '@push.rocks/smartpath/dist_ts/smartpath.check.js';
|
||||
import * as plugins from './plugins.js';
|
||||
|
||||
export interface IWebdavClientOptions {
|
||||
@@ -30,8 +29,8 @@ export class WebdavClient {
|
||||
});
|
||||
}
|
||||
|
||||
public async listDirectory(pathArg: string) {
|
||||
const result = await this.wdClient.getDirectoryContents('/');
|
||||
public async listDirectory(pathArg: string): Promise<plugins.webdav.FileStat[]> {
|
||||
const result = await this.wdClient.getDirectoryContents(pathArg);
|
||||
return result as plugins.webdav.FileStat[];
|
||||
}
|
||||
|
||||
@@ -42,7 +41,11 @@ export class WebdavClient {
|
||||
const fileContents = (await this.wdClient.getFileContents(file.filename, {
|
||||
format: 'binary',
|
||||
})) as Buffer;
|
||||
smartfileArray.push(await plugins.smartfile.SmartFile.fromBuffer(file.filename, fileContents));
|
||||
smartfileArray.push(new plugins.smartfile.SmartFile({
|
||||
path: file.filename,
|
||||
contentBuffer: fileContents,
|
||||
base: process.cwd(),
|
||||
}));
|
||||
}
|
||||
return smartfileArray;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,15 +1,15 @@
|
||||
// @push.rocks scope
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartpath from '@push.rocks/smartpath'
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
|
||||
export {
|
||||
smartfile,
|
||||
smartpath,
|
||||
}
|
||||
};
|
||||
|
||||
// third party scope
|
||||
import * as webdav from 'webdav';
|
||||
|
||||
export {
|
||||
webdav,
|
||||
}
|
||||
};
|
||||
|
||||
+3
-1
@@ -5,8 +5,10 @@
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
|
||||
Reference in New Issue
Block a user