Comparing version 5.2.0 to 5.2.1
# WebDAV-Client changelog | ||
## v5.2.1 | ||
_2023-06-18_ | ||
* **Bugfix**: | ||
* [#339](https://github.com/perry-mitchell/webdav-client/issues/339) Regression: `processResponsePayload` and other methods not exposed in exports | ||
## v5.2.0 | ||
@@ -4,0 +10,0 @@ _2023-06-18_ |
export { createClient } from "./factory.js"; | ||
export { getPatcher } from "./compat/patcher.js"; | ||
export * from "./types.js"; | ||
export { parseStat, parseXML } from "./tools/dav.js"; | ||
export { parseStat, parseXML, translateDiskSpace } from "./tools/dav.js"; | ||
export { processResponsePayload } from "./response.js"; |
export { createClient } from "./factory.js"; | ||
export { getPatcher } from "./compat/patcher.js"; | ||
export * from "./types.js"; | ||
export { parseStat, parseXML } from "./tools/dav.js"; | ||
export { parseStat, parseXML, translateDiskSpace } from "./tools/dav.js"; | ||
export { processResponsePayload } from "./response.js"; |
@@ -5,2 +5,13 @@ import { FileStat, Response, ResponseDataDetailed, WebDAVClientContext } from "./types.js"; | ||
export declare function processGlobFilter(files: Array<FileStat>, glob: string): Array<FileStat>; | ||
/** | ||
* Process a response payload (eg. from `customRequest`) and | ||
* prepare it for further processing. Exposed for custom | ||
* request handling. | ||
* @param response The response for a request | ||
* @param data The data returned | ||
* @param isDetailed Whether or not a detailed result is | ||
* requested | ||
* @returns The response data, or a detailed response object | ||
* if required | ||
*/ | ||
export declare function processResponsePayload<T>(response: Response, data: T, isDetailed?: boolean): ResponseDataDetailed<T> | T; |
@@ -22,2 +22,13 @@ import minimatch from "minimatch"; | ||
} | ||
/** | ||
* Process a response payload (eg. from `customRequest`) and | ||
* prepare it for further processing. Exposed for custom | ||
* request handling. | ||
* @param response The response for a request | ||
* @param data The data returned | ||
* @param isDetailed Whether or not a detailed result is | ||
* requested | ||
* @returns The response data, or a detailed response object | ||
* if required | ||
*/ | ||
export function processResponsePayload(response, data, isDetailed = false) { | ||
@@ -24,0 +35,0 @@ return isDetailed |
import { DAVResult, DAVResultResponseProps, DiskQuotaAvailable, FileStat } from "../types.js"; | ||
/** | ||
* Parse an XML response from a WebDAV service, | ||
* converting it to an internal DAV result | ||
* @param xml The raw XML string | ||
* @returns A parsed and processed DAV result | ||
*/ | ||
export declare function parseXML(xml: string): Promise<DAVResult>; | ||
export declare function prepareFileFromProps(props: DAVResultResponseProps, rawFilename: string, isDetailed?: boolean): FileStat; | ||
/** | ||
* Parse a DAV result for file stats | ||
* @param result The resulting DAV response | ||
* @param filename The filename that was stat'd | ||
* @param isDetailed Whether or not the raw props of | ||
* the resource should be returned | ||
* @returns A file stat result | ||
*/ | ||
export declare function parseStat(result: DAVResult, filename: string, isDetailed?: boolean): FileStat; | ||
/** | ||
* Translate a disk quota indicator to a recognised | ||
* value (includes "unlimited" and "unknown") | ||
* @param value The quota indicator, eg. "-3" | ||
* @returns The value in bytes, or another indicator | ||
*/ | ||
export declare function translateDiskSpace(value: string | number): DiskQuotaAvailable; |
@@ -12,2 +12,15 @@ import path from "path-posix"; | ||
})(PropertyType || (PropertyType = {})); | ||
function getParser() { | ||
return new XMLParser({ | ||
removeNSPrefix: true, | ||
numberParseOptions: { | ||
hex: true, | ||
leadingZeros: false | ||
} | ||
// // We don't use the processors here as decoding is done manually | ||
// // later on - decoding early would break some path checks. | ||
// attributeValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val)), | ||
// tagValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val)) | ||
}); | ||
} | ||
function getPropertyOfType(obj, prop, type = PropertyType.Original) { | ||
@@ -48,15 +61,8 @@ const val = nestedProp.get(obj, prop); | ||
} | ||
function getParser() { | ||
return new XMLParser({ | ||
removeNSPrefix: true, | ||
numberParseOptions: { | ||
hex: true, | ||
leadingZeros: false | ||
} | ||
// // We don't use the processors here as decoding is done manually | ||
// // later on - decoding early would break some path checks. | ||
// attributeValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val)), | ||
// tagValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val)) | ||
}); | ||
} | ||
/** | ||
* Parse an XML response from a WebDAV service, | ||
* converting it to an internal DAV result | ||
* @param xml The raw XML string | ||
* @returns A parsed and processed DAV result | ||
*/ | ||
export function parseXML(xml) { | ||
@@ -93,2 +99,10 @@ return new Promise(resolve => { | ||
} | ||
/** | ||
* Parse a DAV result for file stats | ||
* @param result The resulting DAV response | ||
* @param filename The filename that was stat'd | ||
* @param isDetailed Whether or not the raw props of | ||
* the resource should be returned | ||
* @returns A file stat result | ||
*/ | ||
export function parseStat(result, filename, isDetailed = false) { | ||
@@ -117,2 +131,8 @@ let responseItem = null; | ||
} | ||
/** | ||
* Translate a disk quota indicator to a recognised | ||
* value (includes "unlimited" and "unknown") | ||
* @param value The quota indicator, eg. "-3" | ||
* @returns The value in bytes, or another indicator | ||
*/ | ||
export function translateDiskSpace(value) { | ||
@@ -119,0 +139,0 @@ switch (value.toString()) { |
{ | ||
"name": "webdav", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"description": "WebDAV client for NodeJS", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is too big to display
222529
1738