@nextcloud/files 3.5.1 → 3.6.0
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 +18 -1
- package/dist/files/node.d.ts +11 -0
- package/dist/files/nodeData.d.ts +2 -0
- package/dist/index.cjs +106 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +107 -10
- package/dist/index.mjs.map +1 -1
- package/dist/utils/filename-validation.d.ts +51 -0
- package/dist/utils/filename.d.ts +0 -6
- package/package.json +11 -10
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later
|
|
4
|
+
*/
|
|
5
|
+
export declare enum InvalidFilenameErrorReason {
|
|
6
|
+
ReservedName = "reserved name",
|
|
7
|
+
Character = "character",
|
|
8
|
+
Extension = "extension"
|
|
9
|
+
}
|
|
10
|
+
interface InvalidFilenameErrorOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The filename that was validated
|
|
13
|
+
*/
|
|
14
|
+
filename: string;
|
|
15
|
+
/**
|
|
16
|
+
* Reason why the validation failed
|
|
17
|
+
*/
|
|
18
|
+
reason: InvalidFilenameErrorReason;
|
|
19
|
+
/**
|
|
20
|
+
* Part of the filename that caused this error
|
|
21
|
+
*/
|
|
22
|
+
segment: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class InvalidFilenameError extends Error {
|
|
25
|
+
constructor(options: InvalidFilenameErrorOptions);
|
|
26
|
+
/**
|
|
27
|
+
* The filename that was validated
|
|
28
|
+
*/
|
|
29
|
+
get filename(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Reason why the validation failed
|
|
32
|
+
*/
|
|
33
|
+
get reason(): InvalidFilenameErrorReason;
|
|
34
|
+
/**
|
|
35
|
+
* Part of the filename that caused this error
|
|
36
|
+
*/
|
|
37
|
+
get segment(): string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate a given filename
|
|
41
|
+
* @param filename The filename to check
|
|
42
|
+
* @throws {InvalidFilenameError}
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateFilename(filename: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Check the validity of a filename
|
|
47
|
+
* This is a convinient wrapper for `checkFilenameValidity` to only return a boolean for the valid
|
|
48
|
+
* @param filename Filename to check validity
|
|
49
|
+
*/
|
|
50
|
+
export declare function isFilenameValid(filename: string): boolean;
|
|
51
|
+
export {};
|
package/dist/utils/filename.d.ts
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
* SPDX-FileCopyrightText: Ferdinand Thiessen <opensource@fthiessen.de>
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* Check the validity of a filename
|
|
7
|
-
* This is a convinient wrapper for `checkFilenameValidity` to only return a boolean for the valid
|
|
8
|
-
* @param filename Filename to check validity
|
|
9
|
-
*/
|
|
10
|
-
export declare function isFilenameValid(filename: string): boolean;
|
|
11
5
|
interface UniqueNameOptions {
|
|
12
6
|
/**
|
|
13
7
|
* A function that takes an index and returns a suffix to add to the file name, defaults to '(index)'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -53,25 +53,26 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@codecov/vite-plugin": "^0.0.1-beta.10",
|
|
55
55
|
"@nextcloud/eslint-config": "^8.4.1",
|
|
56
|
-
"@nextcloud/typings": "^1.
|
|
57
|
-
"@nextcloud/vite-config": "^2.0
|
|
58
|
-
"@types/node": "^20.14.
|
|
59
|
-
"@vitest/coverage-istanbul": "^
|
|
56
|
+
"@nextcloud/typings": "^1.9.1",
|
|
57
|
+
"@nextcloud/vite-config": "^2.1.0",
|
|
58
|
+
"@types/node": "^20.14.10",
|
|
59
|
+
"@vitest/coverage-istanbul": "^2.0.2",
|
|
60
60
|
"fast-xml-parser": "^4.4.0",
|
|
61
61
|
"jsdom": "^24.1.0",
|
|
62
62
|
"tslib": "^2.6.3",
|
|
63
|
-
"typedoc": "^0.
|
|
64
|
-
"typescript": "^5.
|
|
65
|
-
"vite": "^5.3.
|
|
66
|
-
"vitest": "^
|
|
63
|
+
"typedoc": "^0.26.4",
|
|
64
|
+
"typescript": "^5.5.3",
|
|
65
|
+
"vite": "^5.3.3",
|
|
66
|
+
"vitest": "^2.0.2"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@nextcloud/auth": "^2.3.0",
|
|
70
|
+
"@nextcloud/capabilities": "^1.2.0",
|
|
70
71
|
"@nextcloud/l10n": "^3.1.0",
|
|
71
72
|
"@nextcloud/logger": "^3.0.2",
|
|
72
73
|
"@nextcloud/paths": "^2.1.0",
|
|
73
74
|
"@nextcloud/router": "^3.0.1",
|
|
74
|
-
"@nextcloud/sharing": "^0.2.
|
|
75
|
+
"@nextcloud/sharing": "^0.2.2",
|
|
75
76
|
"cancelable-promise": "^4.3.1",
|
|
76
77
|
"is-svg": "^5.0.1",
|
|
77
78
|
"typescript-event-target": "^1.1.1",
|