@nextcloud/files 3.6.0 → 3.7.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/dist/fileListFilters.d.ts +86 -0
- package/dist/index.cjs +549 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.mjs +549 -13
- package/dist/index.mjs.map +1 -1
- package/dist/navigation/index.d.ts +7 -0
- package/dist/utils/fileSorting.d.ts +2 -1
- package/dist/utils/sorting.d.ts +1 -1
- package/dist/vendor.LICENSE.txt +8 -0
- package/package.json +8 -6
package/dist/index.cjs
CHANGED
|
@@ -871,7 +871,8 @@ const davResultToNode = function(node, filesRoot = davRootPath, remoteURL = davR
|
|
|
871
871
|
source: `${remoteURL}${node.filename}`,
|
|
872
872
|
mtime: new Date(Date.parse(node.lastmod)),
|
|
873
873
|
mime: node.mime || "application/octet-stream",
|
|
874
|
-
|
|
874
|
+
// Manually cast to work around for https://github.com/perry-mitchell/webdav-client/pull/380
|
|
875
|
+
displayname: props.displayname !== void 0 ? String(props.displayname) : void 0,
|
|
875
876
|
size: props?.size || Number.parseInt(props.getcontentlength || "0"),
|
|
876
877
|
// The fileid is set to -1 for failed requests
|
|
877
878
|
status: id < 0 ? NodeStatus.FAILED : void 0,
|
|
@@ -1028,10 +1029,10 @@ function stringify(value) {
|
|
|
1028
1029
|
}
|
|
1029
1030
|
return String(value);
|
|
1030
1031
|
}
|
|
1031
|
-
function orderBy(collection,
|
|
1032
|
-
|
|
1032
|
+
function orderBy(collection, identifiers2, orders) {
|
|
1033
|
+
identifiers2 = identifiers2 ?? [(value) => value];
|
|
1033
1034
|
orders = orders ?? [];
|
|
1034
|
-
const sorting =
|
|
1035
|
+
const sorting = identifiers2.map((_, index) => (orders[index] ?? "asc") === "asc" ? 1 : -1);
|
|
1035
1036
|
const collator = Intl.Collator(
|
|
1036
1037
|
[l10n.getLanguage(), l10n.getCanonicalLocale()],
|
|
1037
1038
|
{
|
|
@@ -1041,7 +1042,7 @@ function orderBy(collection, identifiers, orders) {
|
|
|
1041
1042
|
}
|
|
1042
1043
|
);
|
|
1043
1044
|
return [...collection].sort((a, b) => {
|
|
1044
|
-
for (const [index, identifier] of
|
|
1045
|
+
for (const [index, identifier] of identifiers2.entries()) {
|
|
1045
1046
|
const value = collator.compare(stringify(identifier(a)), stringify(identifier(b)));
|
|
1046
1047
|
if (value !== 0) {
|
|
1047
1048
|
return value * sorting[index];
|
|
@@ -1065,14 +1066,14 @@ function sortNodes(nodes, options = {}) {
|
|
|
1065
1066
|
...options
|
|
1066
1067
|
};
|
|
1067
1068
|
const basename = (name) => name.lastIndexOf(".") > 0 ? name.slice(0, name.lastIndexOf(".")) : name;
|
|
1068
|
-
const
|
|
1069
|
+
const identifiers2 = [
|
|
1069
1070
|
// 1: Sort favorites first if enabled
|
|
1070
1071
|
...sortingOptions.sortFavoritesFirst ? [(v) => v.attributes?.favorite !== 1] : [],
|
|
1071
1072
|
// 2: Sort folders first if sorting by name
|
|
1072
1073
|
...sortingOptions.sortFoldersFirst ? [(v) => v.type !== "folder"] : [],
|
|
1073
|
-
// 3: Use sorting mode if NOT basename (to be able to use
|
|
1074
|
+
// 3: Use sorting mode if NOT basename (to be able to use display name too)
|
|
1074
1075
|
...sortingOptions.sortingMode !== "basename" ? [(v) => v[sortingOptions.sortingMode]] : [],
|
|
1075
|
-
// 4: Use
|
|
1076
|
+
// 4: Use display name if available, fallback to name
|
|
1076
1077
|
(v) => basename(v.attributes?.displayname || v.basename),
|
|
1077
1078
|
// 5: Finally, use basename if all previous sorting methods failed
|
|
1078
1079
|
(v) => v.basename
|
|
@@ -1091,7 +1092,7 @@ function sortNodes(nodes, options = {}) {
|
|
|
1091
1092
|
// for 5: use configured sorting direction
|
|
1092
1093
|
sortingOptions.sortingOrder
|
|
1093
1094
|
];
|
|
1094
|
-
return orderBy(nodes,
|
|
1095
|
+
return orderBy(nodes, identifiers2, orders);
|
|
1095
1096
|
}
|
|
1096
1097
|
class Navigation extends typescriptEventTarget.TypedEventTarget {
|
|
1097
1098
|
_views = [];
|
|
@@ -1189,6 +1190,9 @@ const isValidColumn = function(column) {
|
|
|
1189
1190
|
}
|
|
1190
1191
|
return true;
|
|
1191
1192
|
};
|
|
1193
|
+
function getDefaultExportFromCjs(x) {
|
|
1194
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1195
|
+
}
|
|
1192
1196
|
var validator$2 = {};
|
|
1193
1197
|
var util$3 = {};
|
|
1194
1198
|
(function(exports2) {
|
|
@@ -1382,7 +1386,7 @@ validator$2.validate = function(xmlData, options) {
|
|
|
1382
1386
|
} else if (tags.length == 1) {
|
|
1383
1387
|
return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
|
|
1384
1388
|
} else if (tags.length > 0) {
|
|
1385
|
-
return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((
|
|
1389
|
+
return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t2) => t2.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
1386
1390
|
}
|
|
1387
1391
|
return true;
|
|
1388
1392
|
};
|
|
@@ -1492,15 +1496,15 @@ function validateAttributeString(attrStr, options) {
|
|
|
1492
1496
|
return true;
|
|
1493
1497
|
}
|
|
1494
1498
|
function validateNumberAmpersand(xmlData, i) {
|
|
1495
|
-
let
|
|
1499
|
+
let re2 = /\d/;
|
|
1496
1500
|
if (xmlData[i] === "x") {
|
|
1497
1501
|
i++;
|
|
1498
|
-
|
|
1502
|
+
re2 = /[\da-fA-F]/;
|
|
1499
1503
|
}
|
|
1500
1504
|
for (; i < xmlData.length; i++) {
|
|
1501
1505
|
if (xmlData[i] === ";")
|
|
1502
1506
|
return i;
|
|
1503
|
-
if (!xmlData[i].match(
|
|
1507
|
+
if (!xmlData[i].match(re2))
|
|
1504
1508
|
break;
|
|
1505
1509
|
}
|
|
1506
1510
|
return -1;
|
|
@@ -2882,6 +2886,534 @@ const isValidView = function(view) {
|
|
|
2882
2886
|
}
|
|
2883
2887
|
return true;
|
|
2884
2888
|
};
|
|
2889
|
+
const debug$1 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
2890
|
+
};
|
|
2891
|
+
var debug_1 = debug$1;
|
|
2892
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
2893
|
+
const MAX_LENGTH$1 = 256;
|
|
2894
|
+
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
2895
|
+
9007199254740991;
|
|
2896
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
2897
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
|
2898
|
+
const RELEASE_TYPES = [
|
|
2899
|
+
"major",
|
|
2900
|
+
"premajor",
|
|
2901
|
+
"minor",
|
|
2902
|
+
"preminor",
|
|
2903
|
+
"patch",
|
|
2904
|
+
"prepatch",
|
|
2905
|
+
"prerelease"
|
|
2906
|
+
];
|
|
2907
|
+
var constants = {
|
|
2908
|
+
MAX_LENGTH: MAX_LENGTH$1,
|
|
2909
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
2910
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
2911
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
|
2912
|
+
RELEASE_TYPES,
|
|
2913
|
+
SEMVER_SPEC_VERSION,
|
|
2914
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
2915
|
+
FLAG_LOOSE: 2
|
|
2916
|
+
};
|
|
2917
|
+
var re$1 = { exports: {} };
|
|
2918
|
+
(function(module2, exports2) {
|
|
2919
|
+
const {
|
|
2920
|
+
MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH2,
|
|
2921
|
+
MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH2,
|
|
2922
|
+
MAX_LENGTH: MAX_LENGTH2
|
|
2923
|
+
} = constants;
|
|
2924
|
+
const debug2 = debug_1;
|
|
2925
|
+
exports2 = module2.exports = {};
|
|
2926
|
+
const re2 = exports2.re = [];
|
|
2927
|
+
const safeRe = exports2.safeRe = [];
|
|
2928
|
+
const src = exports2.src = [];
|
|
2929
|
+
const t2 = exports2.t = {};
|
|
2930
|
+
let R = 0;
|
|
2931
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
2932
|
+
const safeRegexReplacements = [
|
|
2933
|
+
["\\s", 1],
|
|
2934
|
+
["\\d", MAX_LENGTH2],
|
|
2935
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH2]
|
|
2936
|
+
];
|
|
2937
|
+
const makeSafeRegex = (value) => {
|
|
2938
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
2939
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
2940
|
+
}
|
|
2941
|
+
return value;
|
|
2942
|
+
};
|
|
2943
|
+
const createToken = (name, value, isGlobal) => {
|
|
2944
|
+
const safe = makeSafeRegex(value);
|
|
2945
|
+
const index = R++;
|
|
2946
|
+
debug2(name, index, value);
|
|
2947
|
+
t2[name] = index;
|
|
2948
|
+
src[index] = value;
|
|
2949
|
+
re2[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
2950
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
2951
|
+
};
|
|
2952
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
2953
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
2954
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
2955
|
+
createToken("MAINVERSION", `(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})`);
|
|
2956
|
+
createToken("MAINVERSIONLOOSE", `(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})`);
|
|
2957
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NUMERICIDENTIFIER]}|${src[t2.NONNUMERICIDENTIFIER]})`);
|
|
2958
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NUMERICIDENTIFIERLOOSE]}|${src[t2.NONNUMERICIDENTIFIER]})`);
|
|
2959
|
+
createToken("PRERELEASE", `(?:-(${src[t2.PRERELEASEIDENTIFIER]}(?:\\.${src[t2.PRERELEASEIDENTIFIER]})*))`);
|
|
2960
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t2.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t2.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
2961
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
2962
|
+
createToken("BUILD", `(?:\\+(${src[t2.BUILDIDENTIFIER]}(?:\\.${src[t2.BUILDIDENTIFIER]})*))`);
|
|
2963
|
+
createToken("FULLPLAIN", `v?${src[t2.MAINVERSION]}${src[t2.PRERELEASE]}?${src[t2.BUILD]}?`);
|
|
2964
|
+
createToken("FULL", `^${src[t2.FULLPLAIN]}$`);
|
|
2965
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t2.MAINVERSIONLOOSE]}${src[t2.PRERELEASELOOSE]}?${src[t2.BUILD]}?`);
|
|
2966
|
+
createToken("LOOSE", `^${src[t2.LOOSEPLAIN]}$`);
|
|
2967
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
2968
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t2.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
2969
|
+
createToken("XRANGEIDENTIFIER", `${src[t2.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
2970
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:${src[t2.PRERELEASE]})?${src[t2.BUILD]}?)?)?`);
|
|
2971
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:${src[t2.PRERELEASELOOSE]})?${src[t2.BUILD]}?)?)?`);
|
|
2972
|
+
createToken("XRANGE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAIN]}$`);
|
|
2973
|
+
createToken("XRANGELOOSE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
2974
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?`);
|
|
2975
|
+
createToken("COERCE", `${src[t2.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
2976
|
+
createToken("COERCEFULL", src[t2.COERCEPLAIN] + `(?:${src[t2.PRERELEASE]})?(?:${src[t2.BUILD]})?(?:$|[^\\d])`);
|
|
2977
|
+
createToken("COERCERTL", src[t2.COERCE], true);
|
|
2978
|
+
createToken("COERCERTLFULL", src[t2.COERCEFULL], true);
|
|
2979
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
2980
|
+
createToken("TILDETRIM", `(\\s*)${src[t2.LONETILDE]}\\s+`, true);
|
|
2981
|
+
exports2.tildeTrimReplace = "$1~";
|
|
2982
|
+
createToken("TILDE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAIN]}$`);
|
|
2983
|
+
createToken("TILDELOOSE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
2984
|
+
createToken("LONECARET", "(?:\\^)");
|
|
2985
|
+
createToken("CARETTRIM", `(\\s*)${src[t2.LONECARET]}\\s+`, true);
|
|
2986
|
+
exports2.caretTrimReplace = "$1^";
|
|
2987
|
+
createToken("CARET", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAIN]}$`);
|
|
2988
|
+
createToken("CARETLOOSE", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
2989
|
+
createToken("COMPARATORLOOSE", `^${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]})$|^$`);
|
|
2990
|
+
createToken("COMPARATOR", `^${src[t2.GTLT]}\\s*(${src[t2.FULLPLAIN]})$|^$`);
|
|
2991
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]}|${src[t2.XRANGEPLAIN]})`, true);
|
|
2992
|
+
exports2.comparatorTrimReplace = "$1$2$3";
|
|
2993
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t2.XRANGEPLAIN]})\\s+-\\s+(${src[t2.XRANGEPLAIN]})\\s*$`);
|
|
2994
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t2.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t2.XRANGEPLAINLOOSE]})\\s*$`);
|
|
2995
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
2996
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
2997
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
2998
|
+
})(re$1, re$1.exports);
|
|
2999
|
+
var reExports = re$1.exports;
|
|
3000
|
+
const looseOption = Object.freeze({ loose: true });
|
|
3001
|
+
const emptyOpts = Object.freeze({});
|
|
3002
|
+
const parseOptions$1 = (options) => {
|
|
3003
|
+
if (!options) {
|
|
3004
|
+
return emptyOpts;
|
|
3005
|
+
}
|
|
3006
|
+
if (typeof options !== "object") {
|
|
3007
|
+
return looseOption;
|
|
3008
|
+
}
|
|
3009
|
+
return options;
|
|
3010
|
+
};
|
|
3011
|
+
var parseOptions_1 = parseOptions$1;
|
|
3012
|
+
const numeric = /^[0-9]+$/;
|
|
3013
|
+
const compareIdentifiers$1 = (a, b) => {
|
|
3014
|
+
const anum = numeric.test(a);
|
|
3015
|
+
const bnum = numeric.test(b);
|
|
3016
|
+
if (anum && bnum) {
|
|
3017
|
+
a = +a;
|
|
3018
|
+
b = +b;
|
|
3019
|
+
}
|
|
3020
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
3021
|
+
};
|
|
3022
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
|
3023
|
+
var identifiers = {
|
|
3024
|
+
compareIdentifiers: compareIdentifiers$1,
|
|
3025
|
+
rcompareIdentifiers
|
|
3026
|
+
};
|
|
3027
|
+
const debug = debug_1;
|
|
3028
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants;
|
|
3029
|
+
const { safeRe: re, t } = reExports;
|
|
3030
|
+
const parseOptions = parseOptions_1;
|
|
3031
|
+
const { compareIdentifiers } = identifiers;
|
|
3032
|
+
let SemVer$2 = class SemVer {
|
|
3033
|
+
constructor(version, options) {
|
|
3034
|
+
options = parseOptions(options);
|
|
3035
|
+
if (version instanceof SemVer) {
|
|
3036
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
3037
|
+
return version;
|
|
3038
|
+
} else {
|
|
3039
|
+
version = version.version;
|
|
3040
|
+
}
|
|
3041
|
+
} else if (typeof version !== "string") {
|
|
3042
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
3043
|
+
}
|
|
3044
|
+
if (version.length > MAX_LENGTH) {
|
|
3045
|
+
throw new TypeError(
|
|
3046
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
3047
|
+
);
|
|
3048
|
+
}
|
|
3049
|
+
debug("SemVer", version, options);
|
|
3050
|
+
this.options = options;
|
|
3051
|
+
this.loose = !!options.loose;
|
|
3052
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
3053
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
3054
|
+
if (!m) {
|
|
3055
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
3056
|
+
}
|
|
3057
|
+
this.raw = version;
|
|
3058
|
+
this.major = +m[1];
|
|
3059
|
+
this.minor = +m[2];
|
|
3060
|
+
this.patch = +m[3];
|
|
3061
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
3062
|
+
throw new TypeError("Invalid major version");
|
|
3063
|
+
}
|
|
3064
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
3065
|
+
throw new TypeError("Invalid minor version");
|
|
3066
|
+
}
|
|
3067
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
3068
|
+
throw new TypeError("Invalid patch version");
|
|
3069
|
+
}
|
|
3070
|
+
if (!m[4]) {
|
|
3071
|
+
this.prerelease = [];
|
|
3072
|
+
} else {
|
|
3073
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
3074
|
+
if (/^[0-9]+$/.test(id)) {
|
|
3075
|
+
const num = +id;
|
|
3076
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
3077
|
+
return num;
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
return id;
|
|
3081
|
+
});
|
|
3082
|
+
}
|
|
3083
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
3084
|
+
this.format();
|
|
3085
|
+
}
|
|
3086
|
+
format() {
|
|
3087
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
3088
|
+
if (this.prerelease.length) {
|
|
3089
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
3090
|
+
}
|
|
3091
|
+
return this.version;
|
|
3092
|
+
}
|
|
3093
|
+
toString() {
|
|
3094
|
+
return this.version;
|
|
3095
|
+
}
|
|
3096
|
+
compare(other) {
|
|
3097
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
3098
|
+
if (!(other instanceof SemVer)) {
|
|
3099
|
+
if (typeof other === "string" && other === this.version) {
|
|
3100
|
+
return 0;
|
|
3101
|
+
}
|
|
3102
|
+
other = new SemVer(other, this.options);
|
|
3103
|
+
}
|
|
3104
|
+
if (other.version === this.version) {
|
|
3105
|
+
return 0;
|
|
3106
|
+
}
|
|
3107
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
3108
|
+
}
|
|
3109
|
+
compareMain(other) {
|
|
3110
|
+
if (!(other instanceof SemVer)) {
|
|
3111
|
+
other = new SemVer(other, this.options);
|
|
3112
|
+
}
|
|
3113
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
3114
|
+
}
|
|
3115
|
+
comparePre(other) {
|
|
3116
|
+
if (!(other instanceof SemVer)) {
|
|
3117
|
+
other = new SemVer(other, this.options);
|
|
3118
|
+
}
|
|
3119
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
3120
|
+
return -1;
|
|
3121
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
3122
|
+
return 1;
|
|
3123
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
3124
|
+
return 0;
|
|
3125
|
+
}
|
|
3126
|
+
let i = 0;
|
|
3127
|
+
do {
|
|
3128
|
+
const a = this.prerelease[i];
|
|
3129
|
+
const b = other.prerelease[i];
|
|
3130
|
+
debug("prerelease compare", i, a, b);
|
|
3131
|
+
if (a === void 0 && b === void 0) {
|
|
3132
|
+
return 0;
|
|
3133
|
+
} else if (b === void 0) {
|
|
3134
|
+
return 1;
|
|
3135
|
+
} else if (a === void 0) {
|
|
3136
|
+
return -1;
|
|
3137
|
+
} else if (a === b) {
|
|
3138
|
+
continue;
|
|
3139
|
+
} else {
|
|
3140
|
+
return compareIdentifiers(a, b);
|
|
3141
|
+
}
|
|
3142
|
+
} while (++i);
|
|
3143
|
+
}
|
|
3144
|
+
compareBuild(other) {
|
|
3145
|
+
if (!(other instanceof SemVer)) {
|
|
3146
|
+
other = new SemVer(other, this.options);
|
|
3147
|
+
}
|
|
3148
|
+
let i = 0;
|
|
3149
|
+
do {
|
|
3150
|
+
const a = this.build[i];
|
|
3151
|
+
const b = other.build[i];
|
|
3152
|
+
debug("build compare", i, a, b);
|
|
3153
|
+
if (a === void 0 && b === void 0) {
|
|
3154
|
+
return 0;
|
|
3155
|
+
} else if (b === void 0) {
|
|
3156
|
+
return 1;
|
|
3157
|
+
} else if (a === void 0) {
|
|
3158
|
+
return -1;
|
|
3159
|
+
} else if (a === b) {
|
|
3160
|
+
continue;
|
|
3161
|
+
} else {
|
|
3162
|
+
return compareIdentifiers(a, b);
|
|
3163
|
+
}
|
|
3164
|
+
} while (++i);
|
|
3165
|
+
}
|
|
3166
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
3167
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
3168
|
+
inc(release, identifier, identifierBase) {
|
|
3169
|
+
switch (release) {
|
|
3170
|
+
case "premajor":
|
|
3171
|
+
this.prerelease.length = 0;
|
|
3172
|
+
this.patch = 0;
|
|
3173
|
+
this.minor = 0;
|
|
3174
|
+
this.major++;
|
|
3175
|
+
this.inc("pre", identifier, identifierBase);
|
|
3176
|
+
break;
|
|
3177
|
+
case "preminor":
|
|
3178
|
+
this.prerelease.length = 0;
|
|
3179
|
+
this.patch = 0;
|
|
3180
|
+
this.minor++;
|
|
3181
|
+
this.inc("pre", identifier, identifierBase);
|
|
3182
|
+
break;
|
|
3183
|
+
case "prepatch":
|
|
3184
|
+
this.prerelease.length = 0;
|
|
3185
|
+
this.inc("patch", identifier, identifierBase);
|
|
3186
|
+
this.inc("pre", identifier, identifierBase);
|
|
3187
|
+
break;
|
|
3188
|
+
case "prerelease":
|
|
3189
|
+
if (this.prerelease.length === 0) {
|
|
3190
|
+
this.inc("patch", identifier, identifierBase);
|
|
3191
|
+
}
|
|
3192
|
+
this.inc("pre", identifier, identifierBase);
|
|
3193
|
+
break;
|
|
3194
|
+
case "major":
|
|
3195
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
3196
|
+
this.major++;
|
|
3197
|
+
}
|
|
3198
|
+
this.minor = 0;
|
|
3199
|
+
this.patch = 0;
|
|
3200
|
+
this.prerelease = [];
|
|
3201
|
+
break;
|
|
3202
|
+
case "minor":
|
|
3203
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
3204
|
+
this.minor++;
|
|
3205
|
+
}
|
|
3206
|
+
this.patch = 0;
|
|
3207
|
+
this.prerelease = [];
|
|
3208
|
+
break;
|
|
3209
|
+
case "patch":
|
|
3210
|
+
if (this.prerelease.length === 0) {
|
|
3211
|
+
this.patch++;
|
|
3212
|
+
}
|
|
3213
|
+
this.prerelease = [];
|
|
3214
|
+
break;
|
|
3215
|
+
case "pre": {
|
|
3216
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
3217
|
+
if (!identifier && identifierBase === false) {
|
|
3218
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
3219
|
+
}
|
|
3220
|
+
if (this.prerelease.length === 0) {
|
|
3221
|
+
this.prerelease = [base];
|
|
3222
|
+
} else {
|
|
3223
|
+
let i = this.prerelease.length;
|
|
3224
|
+
while (--i >= 0) {
|
|
3225
|
+
if (typeof this.prerelease[i] === "number") {
|
|
3226
|
+
this.prerelease[i]++;
|
|
3227
|
+
i = -2;
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
if (i === -1) {
|
|
3231
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
3232
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
3233
|
+
}
|
|
3234
|
+
this.prerelease.push(base);
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
if (identifier) {
|
|
3238
|
+
let prerelease = [identifier, base];
|
|
3239
|
+
if (identifierBase === false) {
|
|
3240
|
+
prerelease = [identifier];
|
|
3241
|
+
}
|
|
3242
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
3243
|
+
if (isNaN(this.prerelease[1])) {
|
|
3244
|
+
this.prerelease = prerelease;
|
|
3245
|
+
}
|
|
3246
|
+
} else {
|
|
3247
|
+
this.prerelease = prerelease;
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
break;
|
|
3251
|
+
}
|
|
3252
|
+
default:
|
|
3253
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
3254
|
+
}
|
|
3255
|
+
this.raw = this.format();
|
|
3256
|
+
if (this.build.length) {
|
|
3257
|
+
this.raw += `+${this.build.join(".")}`;
|
|
3258
|
+
}
|
|
3259
|
+
return this;
|
|
3260
|
+
}
|
|
3261
|
+
};
|
|
3262
|
+
var semver = SemVer$2;
|
|
3263
|
+
const SemVer$1 = semver;
|
|
3264
|
+
const parse$1 = (version, options, throwErrors = false) => {
|
|
3265
|
+
if (version instanceof SemVer$1) {
|
|
3266
|
+
return version;
|
|
3267
|
+
}
|
|
3268
|
+
try {
|
|
3269
|
+
return new SemVer$1(version, options);
|
|
3270
|
+
} catch (er) {
|
|
3271
|
+
if (!throwErrors) {
|
|
3272
|
+
return null;
|
|
3273
|
+
}
|
|
3274
|
+
throw er;
|
|
3275
|
+
}
|
|
3276
|
+
};
|
|
3277
|
+
var parse_1 = parse$1;
|
|
3278
|
+
const parse = parse_1;
|
|
3279
|
+
const valid = (version, options) => {
|
|
3280
|
+
const v = parse(version, options);
|
|
3281
|
+
return v ? v.version : null;
|
|
3282
|
+
};
|
|
3283
|
+
var valid_1 = valid;
|
|
3284
|
+
const valid$1 = /* @__PURE__ */ getDefaultExportFromCjs(valid_1);
|
|
3285
|
+
const SemVer2 = semver;
|
|
3286
|
+
const major = (a, loose) => new SemVer2(a, loose).major;
|
|
3287
|
+
var major_1 = major;
|
|
3288
|
+
const major$1 = /* @__PURE__ */ getDefaultExportFromCjs(major_1);
|
|
3289
|
+
class ProxyBus {
|
|
3290
|
+
bus;
|
|
3291
|
+
constructor(bus2) {
|
|
3292
|
+
if (typeof bus2.getVersion !== "function" || !valid$1(bus2.getVersion())) {
|
|
3293
|
+
console.warn("Proxying an event bus with an unknown or invalid version");
|
|
3294
|
+
} else if (major$1(bus2.getVersion()) !== major$1(this.getVersion())) {
|
|
3295
|
+
console.warn(
|
|
3296
|
+
"Proxying an event bus of version " + bus2.getVersion() + " with " + this.getVersion()
|
|
3297
|
+
);
|
|
3298
|
+
}
|
|
3299
|
+
this.bus = bus2;
|
|
3300
|
+
}
|
|
3301
|
+
getVersion() {
|
|
3302
|
+
return "3.3.1";
|
|
3303
|
+
}
|
|
3304
|
+
subscribe(name, handler) {
|
|
3305
|
+
this.bus.subscribe(name, handler);
|
|
3306
|
+
}
|
|
3307
|
+
unsubscribe(name, handler) {
|
|
3308
|
+
this.bus.unsubscribe(name, handler);
|
|
3309
|
+
}
|
|
3310
|
+
emit(name, event) {
|
|
3311
|
+
this.bus.emit(name, event);
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
class SimpleBus {
|
|
3315
|
+
handlers = /* @__PURE__ */ new Map();
|
|
3316
|
+
getVersion() {
|
|
3317
|
+
return "3.3.1";
|
|
3318
|
+
}
|
|
3319
|
+
subscribe(name, handler) {
|
|
3320
|
+
this.handlers.set(
|
|
3321
|
+
name,
|
|
3322
|
+
(this.handlers.get(name) || []).concat(
|
|
3323
|
+
handler
|
|
3324
|
+
)
|
|
3325
|
+
);
|
|
3326
|
+
}
|
|
3327
|
+
unsubscribe(name, handler) {
|
|
3328
|
+
this.handlers.set(
|
|
3329
|
+
name,
|
|
3330
|
+
(this.handlers.get(name) || []).filter((h) => h !== handler)
|
|
3331
|
+
);
|
|
3332
|
+
}
|
|
3333
|
+
emit(name, event) {
|
|
3334
|
+
(this.handlers.get(name) || []).forEach((h) => {
|
|
3335
|
+
try {
|
|
3336
|
+
h(event);
|
|
3337
|
+
} catch (e) {
|
|
3338
|
+
console.error("could not invoke event listener", e);
|
|
3339
|
+
}
|
|
3340
|
+
});
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
let bus = null;
|
|
3344
|
+
function getBus() {
|
|
3345
|
+
if (bus !== null) {
|
|
3346
|
+
return bus;
|
|
3347
|
+
}
|
|
3348
|
+
if (typeof window === "undefined") {
|
|
3349
|
+
return new Proxy({}, {
|
|
3350
|
+
get: () => {
|
|
3351
|
+
return () => console.error(
|
|
3352
|
+
"Window not available, EventBus can not be established!"
|
|
3353
|
+
);
|
|
3354
|
+
}
|
|
3355
|
+
});
|
|
3356
|
+
}
|
|
3357
|
+
if (window.OC?._eventBus && typeof window._nc_event_bus === "undefined") {
|
|
3358
|
+
console.warn(
|
|
3359
|
+
"found old event bus instance at OC._eventBus. Update your version!"
|
|
3360
|
+
);
|
|
3361
|
+
window._nc_event_bus = window.OC._eventBus;
|
|
3362
|
+
}
|
|
3363
|
+
if (typeof window?._nc_event_bus !== "undefined") {
|
|
3364
|
+
bus = new ProxyBus(window._nc_event_bus);
|
|
3365
|
+
} else {
|
|
3366
|
+
bus = window._nc_event_bus = new SimpleBus();
|
|
3367
|
+
}
|
|
3368
|
+
return bus;
|
|
3369
|
+
}
|
|
3370
|
+
function emit(name, event) {
|
|
3371
|
+
getBus().emit(name, event);
|
|
3372
|
+
}
|
|
3373
|
+
/*!
|
|
3374
|
+
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
|
3375
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3376
|
+
*/
|
|
3377
|
+
class FileListFilter extends typescriptEventTarget.TypedEventTarget {
|
|
3378
|
+
id;
|
|
3379
|
+
order;
|
|
3380
|
+
constructor(id, order = 100) {
|
|
3381
|
+
super();
|
|
3382
|
+
this.id = id;
|
|
3383
|
+
this.order = order;
|
|
3384
|
+
}
|
|
3385
|
+
filter(nodes) {
|
|
3386
|
+
throw new Error("Not implemented");
|
|
3387
|
+
}
|
|
3388
|
+
updateChips(chips) {
|
|
3389
|
+
this.dispatchTypedEvent("update:chips", new CustomEvent("update:chips", { detail: chips }));
|
|
3390
|
+
}
|
|
3391
|
+
filterUpdated() {
|
|
3392
|
+
this.dispatchTypedEvent("update:filter", new CustomEvent("update:filter"));
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
function registerFileListFilter(filter) {
|
|
3396
|
+
if (!window._nc_filelist_filters) {
|
|
3397
|
+
window._nc_filelist_filters = /* @__PURE__ */ new Map();
|
|
3398
|
+
}
|
|
3399
|
+
if (window._nc_filelist_filters.has(filter.id)) {
|
|
3400
|
+
throw new Error(`File list filter "${filter.id}" already registered`);
|
|
3401
|
+
}
|
|
3402
|
+
window._nc_filelist_filters.set(filter.id, filter);
|
|
3403
|
+
emit("files:filter:added", filter);
|
|
3404
|
+
}
|
|
3405
|
+
function unregisterFileListFilter(filterId) {
|
|
3406
|
+
if (window._nc_filelist_filters && window._nc_filelist_filters.has(filterId)) {
|
|
3407
|
+
window._nc_filelist_filters.delete(filterId);
|
|
3408
|
+
emit("files:filter:removed", filterId);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
function getFileListFilters() {
|
|
3412
|
+
if (!window._nc_filelist_filters) {
|
|
3413
|
+
return [];
|
|
3414
|
+
}
|
|
3415
|
+
return [...window._nc_filelist_filters.values()];
|
|
3416
|
+
}
|
|
2885
3417
|
const addNewFileMenuEntry = function(entry) {
|
|
2886
3418
|
const newFileMenu = getNewFileMenu();
|
|
2887
3419
|
return newFileMenu.registerEntry(entry);
|
|
@@ -2903,6 +3435,7 @@ exports.Column = Column;
|
|
|
2903
3435
|
exports.DefaultType = DefaultType;
|
|
2904
3436
|
exports.File = File;
|
|
2905
3437
|
exports.FileAction = FileAction;
|
|
3438
|
+
exports.FileListFilter = FileListFilter;
|
|
2906
3439
|
exports.FileType = FileType;
|
|
2907
3440
|
exports.FilesSortingMode = FilesSortingMode;
|
|
2908
3441
|
exports.Folder = Folder;
|
|
@@ -2933,6 +3466,7 @@ exports.getDavNameSpaces = getDavNameSpaces;
|
|
|
2933
3466
|
exports.getDavProperties = getDavProperties;
|
|
2934
3467
|
exports.getFavoriteNodes = getFavoriteNodes;
|
|
2935
3468
|
exports.getFileActions = getFileActions;
|
|
3469
|
+
exports.getFileListFilters = getFileListFilters;
|
|
2936
3470
|
exports.getFileListHeaders = getFileListHeaders;
|
|
2937
3471
|
exports.getNavigation = getNavigation;
|
|
2938
3472
|
exports.getNewFileMenuEntries = getNewFileMenuEntries;
|
|
@@ -2942,7 +3476,9 @@ exports.orderBy = orderBy;
|
|
|
2942
3476
|
exports.parseFileSize = parseFileSize;
|
|
2943
3477
|
exports.registerDavProperty = registerDavProperty;
|
|
2944
3478
|
exports.registerFileAction = registerFileAction;
|
|
3479
|
+
exports.registerFileListFilter = registerFileListFilter;
|
|
2945
3480
|
exports.registerFileListHeaders = registerFileListHeaders;
|
|
2946
3481
|
exports.removeNewFileMenuEntry = removeNewFileMenuEntry;
|
|
2947
3482
|
exports.sortNodes = sortNodes;
|
|
3483
|
+
exports.unregisterFileListFilter = unregisterFileListFilter;
|
|
2948
3484
|
exports.validateFilename = validateFilename;
|