update dependencies

This commit is contained in:
Ell 2023-11-22 14:56:56 +01:00
parent f8e0017340
commit e8d484828e
3 changed files with 34 additions and 67 deletions

View file

@ -9,8 +9,8 @@
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"glob": "^10.3.1", "glob": "^10.3.10",
"nextcloud-chunk-file-upload": "^1.1.1", "nextcloud-chunk-file-upload": "^1.2.3",
"xml2json": "^0.12.0" "xml2json": "^0.12.0"
} }
}, },
@ -135,9 +135,9 @@
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
}, },
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.15.2", "version": "1.15.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
@ -169,18 +169,18 @@
} }
}, },
"node_modules/glob": { "node_modules/glob": {
"version": "10.3.3", "version": "10.3.10",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz",
"integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==",
"dependencies": { "dependencies": {
"foreground-child": "^3.1.0", "foreground-child": "^3.1.0",
"jackspeak": "^2.0.3", "jackspeak": "^2.3.5",
"minimatch": "^9.0.1", "minimatch": "^9.0.1",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
"path-scurry": "^1.10.1" "path-scurry": "^1.10.1"
}, },
"bin": { "bin": {
"glob": "dist/cjs/src/bin.js" "glob": "dist/esm/bin.mjs"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.17"
@ -223,9 +223,9 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
}, },
"node_modules/jackspeak": { "node_modules/jackspeak": {
"version": "2.2.1", "version": "2.3.6",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz",
"integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==",
"dependencies": { "dependencies": {
"@isaacs/cliui": "^8.0.2" "@isaacs/cliui": "^8.0.2"
}, },
@ -263,9 +263,9 @@
} }
}, },
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "10.0.0", "version": "10.0.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.3.tgz",
"integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", "integrity": "sha512-B7gr+F6MkqB3uzINHXNctGieGsRTMwIBgxkp0yq/5BwcuDzD4A8wQpHQW6vDAm1uKSLQghmRdD9sKqf2vJ1cEg==",
"engines": { "engines": {
"node": "14 || >=16.14" "node": "14 || >=16.14"
} }
@ -285,22 +285,22 @@
} }
}, },
"node_modules/minipass": { "node_modules/minipass": {
"version": "7.0.2", "version": "7.0.4",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.2.tgz", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
"integrity": "sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==", "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.17"
} }
}, },
"node_modules/nan": { "node_modules/nan": {
"version": "2.17.0", "version": "2.18.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
}, },
"node_modules/nextcloud-chunk-file-upload": { "node_modules/nextcloud-chunk-file-upload": {
"version": "1.2.0", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/nextcloud-chunk-file-upload/-/nextcloud-chunk-file-upload-1.2.0.tgz", "resolved": "https://registry.npmjs.org/nextcloud-chunk-file-upload/-/nextcloud-chunk-file-upload-1.2.3.tgz",
"integrity": "sha512-C0vyCi2WV7B6mfwsYnIpqbKqSFHZSs9KxRdGFik4ey9Zm9YBtMqYAOT1Pkm/+ZUg4N0TdMuvFcAr5GgYqWcRvQ==", "integrity": "sha512-82Wz011qxKvDha7z/PcP7moULn14HeKJV2PPRJdnOwWMqbSnbAhYp4pjXi2mQzdJlqKxV6n01uXSBxZSvMt3Iw==",
"dependencies": { "dependencies": {
"axios": "^0.24.0" "axios": "^0.24.0"
} }
@ -339,9 +339,9 @@
} }
}, },
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.0", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"engines": { "engines": {
"node": ">=6" "node": ">=6"
} }
@ -366,9 +366,9 @@
} }
}, },
"node_modules/signal-exit": { "node_modules/signal-exit": {
"version": "4.0.2", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"engines": { "engines": {
"node": ">=14" "node": ">=14"
}, },

View file

@ -9,8 +9,8 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"glob": "^10.3.1", "glob": "^10.3.10",
"nextcloud-chunk-file-upload": "^1.1.1", "nextcloud-chunk-file-upload": "^1.2.3",
"xml2json": "^0.12.0" "xml2json": "^0.12.0"
} }
} }

View file

@ -150,43 +150,10 @@ async function upload() {
file = file.replaceAll("\\", "/"); file = file.replaceAll("\\", "/");
let fileName = file.split("/").pop(); let fileName = file.split("/").pop();
let dest = `${destEnv}/${flatten ? fileName : file}`; let dest = `${destEnv}/${flatten ? fileName : file}`;
// we have to explicitly create any directories that don't exist yet
// (https://github.com/shiftpi/nextcloud-chunk-file-upload/issues/22)
let currDir = "";
for (let dir of dest.split("/").slice(0, -1)) {
currDir += `${dir}/`;
try {
let response = await axios.request({
method: 'mkcol',
url: `${basePath}/files/${userEnv}/${currDir}`,
auth: {
username: userEnv,
password: tokenEnv
},
// 405 means the directory already exists
validateStatus: s => s == 201 || s == 405
});
if (response.status != 405) {
if (!quiet)
console.log(`Created directory ${dir}`);
// add tags to directory too
if (tagIds)
await addTags(basePath, tagIds, dir, currDir);
}
} catch (error) {
console.log(`Failed to create directory ${dir} (${error})`);
process.exit(1);
}
}
// use lib to upload file // use lib to upload file
if (!quiet) if (!quiet)
console.log(`Uploading ${fileName} to ${dest}`); console.log(`Uploading ${fileName} to ${dest}`);
await upload.uploadFile(`${baseDir}/${file}`, dest, parseInt(chunkSizeEnv)).then(e => { await upload.uploadFile(`${baseDir}/${file}`, dest, parseInt(chunkSizeEnv), 5, true).then(() => {
if (!quiet) if (!quiet)
console.log(`Uploaded ${fileName} to ${dest}`); console.log(`Uploaded ${fileName} to ${dest}`);
}).catch(e => { }).catch(e => {