Comparing version 5.0.0-r1 to 5.0.0-r2
# WebDAV-Client changelog | ||
## v5.0.0-r1 | ||
## v5.0.0 | ||
_2022-11-30_ | ||
@@ -8,3 +8,4 @@ | ||
* [#326](https://github.com/perry-mitchell/webdav-client/issues/326) Build output is now ESM only (read [this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)) | ||
* [#269](https://github.com/perry-mitchell/webdav-client/issues/269) Axios replaced with Fetch | ||
* ~~[#269](https://github.com/perry-mitchell/webdav-client/issues/269)~~ [#335](https://github.com/perry-mitchell/webdav-client/pull/335) Axios replaced with Fetch | ||
* [#178](https://github.com/perry-mitchell/webdav-client/issues/178) Support returning current directory info for `getDirectoryContents` | ||
* **Bugfix**: | ||
@@ -11,0 +12,0 @@ * [#204](https://github.com/perry-mitchell/webdav-client/issues/204) Missing engine restriction for Node |
@@ -1,4 +0,4 @@ | ||
import { DigestContext } from "../types.js"; | ||
import { DigestContext, Response } from "../types.js"; | ||
export declare function createDigestContext(username: string, password: string): DigestContext; | ||
export declare function generateDigestAuthHeader(options: any, digest: DigestContext): string; | ||
export declare function parseDigestAuth(response: Response, _digest: DigestContext): boolean; |
@@ -1,2 +0,2 @@ | ||
import { RequestOptionsCustom, WebDAVClientContext } from "../types.js"; | ||
import { RequestOptionsCustom, Response, WebDAVClientContext } from "../types.js"; | ||
export declare function customRequest(context: WebDAVClientContext, remotePath: string, requestOptions: RequestOptionsCustom): Promise<Response>; |
@@ -24,3 +24,3 @@ import pathPosix from "path-posix"; | ||
const _remotePath = remotePath.startsWith("/") ? remotePath : "/" + remotePath; | ||
let files = getDirectoryFiles(davResp, context.remotePath, _remotePath, options.details); | ||
let files = getDirectoryFiles(davResp, context.remotePath, _remotePath, options.details, options.includeSelf); | ||
if (options.glob) { | ||
@@ -31,9 +31,8 @@ files = processGlobFilter(files, options.glob); | ||
} | ||
function getDirectoryFiles(result, serverBasePath, requestPath, isDetailed = false) { | ||
function getDirectoryFiles(result, serverBasePath, requestPath, isDetailed = false, includeSelf = false) { | ||
const serverBase = pathPosix.join(serverBasePath, "/"); | ||
// Extract the response items (directory contents) | ||
const { multistatus: { response: responseItems } } = result; | ||
return (responseItems | ||
// Map all items to a consistent output structure (results) | ||
.map(item => { | ||
// Map all items to a consistent output structure (results) | ||
const nodes = responseItems.map(item => { | ||
// HREF is the file path (in full) | ||
@@ -48,6 +47,10 @@ const href = normaliseHREF(item.href); | ||
return prepareFileFromProps(props, filename, isDetailed); | ||
}) | ||
// Filter out the item pointing to the current directory (not needed) | ||
.filter(item => item.basename && | ||
(item.type === "file" || item.filename !== requestPath.replace(/\/$/, "")))); | ||
}); | ||
// If specified, also return the current directory | ||
if (includeSelf) { | ||
return nodes; | ||
} | ||
// Else, filter out the item pointing to the current directory (not needed) | ||
return nodes.filter(item => item.basename && | ||
(item.type === "file" || item.filename !== requestPath.replace(/\/$/, ""))); | ||
} |
@@ -1,3 +0,3 @@ | ||
import { RequestOptionsCustom, RequestOptionsWithState, WebDAVClientContext, WebDAVMethodOptions } from "./types.js"; | ||
import { RequestOptionsCustom, RequestOptionsWithState, Response, WebDAVClientContext, WebDAVMethodOptions } from "./types.js"; | ||
export declare function prepareRequestOptions(requestOptions: RequestOptionsCustom | RequestOptionsWithState, context: WebDAVClientContext, userOptions: WebDAVMethodOptions): RequestOptionsWithState; | ||
export declare function request(requestOptions: RequestOptionsWithState): Promise<Response>; |
import { Agent as HTTPAgent } from "http"; | ||
import { Agent as HTTPSAgent } from "https"; | ||
import fetch from "cross-fetch"; | ||
import { fetch } from "@buttercup/fetch"; | ||
import { getPatcher } from "./compat/patcher.js"; | ||
@@ -5,0 +5,0 @@ import { isWeb } from "./compat/env.js"; |
@@ -1,2 +0,2 @@ | ||
import { FileStat, ResponseDataDetailed, WebDAVClientContext } from "./types.js"; | ||
import { FileStat, Response, ResponseDataDetailed, WebDAVClientContext } from "./types.js"; | ||
export declare function createErrorFromResponse(response: Response, prefix?: string): Error; | ||
@@ -3,0 +3,0 @@ export declare function handleResponseCode(context: WebDAVClientContext, response: Response): Response; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import Stream from "node:stream"; | ||
import { Response } from "cross-fetch"; | ||
export type { Response }; | ||
import { Response } from "@buttercup/fetch"; | ||
export { Request, Response } from "@buttercup/fetch"; | ||
export type AuthHeader = string; | ||
@@ -95,2 +95,3 @@ export declare enum AuthType { | ||
glob?: string; | ||
includeSelf?: boolean; | ||
} | ||
@@ -97,0 +98,0 @@ export interface GetFileContentsOptions extends WebDAVMethodOptions { |
@@ -0,1 +1,2 @@ | ||
export { Request, Response } from "@buttercup/fetch"; | ||
export var AuthType; | ||
@@ -2,0 +3,0 @@ (function (AuthType) { |
{ | ||
"name": "webdav", | ||
"version": "5.0.0-r1", | ||
"version": "5.0.0-r2", | ||
"description": "WebDAV client for NodeJS", | ||
@@ -65,5 +65,5 @@ "exports": { | ||
"dependencies": { | ||
"@buttercup/fetch": "^0.1.0", | ||
"base-64": "^1.0.0", | ||
"byte-length": "^1.0.2", | ||
"cross-fetch": "^3.1.5", | ||
"fast-xml-parser": "^3.19.0", | ||
@@ -70,0 +70,0 @@ "he": "^1.2.0", |
@@ -28,3 +28,3 @@  | ||
This library uses [`cross-fetch`](https://github.com/lquixada/cross-fetch) to make requests in a cross-platform manner. It uses the browser's native `fetch` if present, or a polyfill if not. In Node and other environments it uses [`node-fetch`](https://github.com/node-fetch/node-fetch). | ||
This library uses [`@buttercup/fetch`](https://github.com/buttercup/fetch) to make requests in a cross-platform manner. It uses the browser's native `fetch` if present, or a polyfill if not. In Node and other environments it uses [`node-fetch`](https://github.com/node-fetch/node-fetch). | ||
@@ -660,3 +660,3 @@ Versions before v5 used Axios for requests. | ||
It is a known issue that ownCloud and Nextcloud servers by default don't return friendly CORS headers, making working with this library within a browser context impossible. You can of course force the addition of CORS headers (Apache or Nginx configs) yourself, but do this at your own risk. | ||
It is a known issue that Nextcloud servers by default don't return friendly CORS headers, making working with this library within a browser context impossible. You can of course force the addition of CORS headers (Apache or Nginx configs) yourself, but do this at your own risk. | ||
@@ -663,0 +663,0 @@ ## Projects using this WebDAV client |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1654
3
209275
+ Added@buttercup/fetch@^0.1.0
+ Added@buttercup/fetch@0.1.2(transitive)
+ Addeddata-uri-to-buffer@4.0.1(transitive)
+ Addedfetch-blob@3.2.0(transitive)
+ Addedformdata-polyfill@4.0.10(transitive)
+ Addednode-domexception@1.0.0(transitive)
+ Addednode-fetch@3.3.2(transitive)
+ Addedweb-streams-polyfill@3.3.3(transitive)
- Removedcross-fetch@^3.1.5
- Removedcross-fetch@3.2.0(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)