Browse Source

Merge pull request #6362 from nocodb/fix/deprecated-dependencies

fix: deprecated dependencies / install warnings
pull/6377/head
աɨռɢӄաօռɢ 1 year ago committed by GitHub
parent
commit
1530562429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/nc-gui/package.json
  2. 20
      packages/nocodb/package.json
  3. 29
      packages/nocodb/src/plugins/backblaze/Backblaze.ts
  4. 22
      packages/nocodb/src/plugins/gcs/Gcs.ts
  5. 28
      packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
  6. 27
      packages/nocodb/src/plugins/mino/Minio.ts
  7. 28
      packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts
  8. 28
      packages/nocodb/src/plugins/s3/S3.ts
  9. 28
      packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  10. 28
      packages/nocodb/src/plugins/spaces/Spaces.ts
  11. 28
      packages/nocodb/src/plugins/upcloud/UpoCloud.ts
  12. 28
      packages/nocodb/src/plugins/vultr/Vultr.ts
  13. 1997
      pnpm-lock.yaml

4
packages/nc-gui/package.json

@ -37,7 +37,6 @@
"dependencies": { "dependencies": {
"@braks/revue-draggable": "^0.4.3", "@braks/revue-draggable": "^0.4.3",
"@ckpack/vue-color": "^1.2.0", "@ckpack/vue-color": "^1.2.0",
"@fingerprintjs/fingerprintjs": "^3.4.1",
"@iconify/vue": "^4.1.1", "@iconify/vue": "^4.1.1",
"@pinia/nuxt": "^0.4.11", "@pinia/nuxt": "^0.4.11",
"@vue-flow/additional-components": "^1.2.0", "@vue-flow/additional-components": "^1.2.0",
@ -55,7 +54,7 @@
"emoji-mart-vue-fast": "^15.0.0", "emoji-mart-vue-fast": "^15.0.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"httpsnippet": "^2.0.0", "httpsnippet": "^3.0.1",
"jsbarcode": "^3.11.5", "jsbarcode": "^3.11.5",
"jsep": "^1.3.6", "jsep": "^1.3.6",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
@ -116,7 +115,6 @@
"@iconify-json/vscode-icons": "^1.1.28", "@iconify-json/vscode-icons": "^1.1.28",
"@intlify/unplugin-vue-i18n": "^0.12.2", "@intlify/unplugin-vue-i18n": "^0.12.2",
"@nuxt/image-edge": "^1.0.0-rc.1-28217290.de85e17", "@nuxt/image-edge": "^1.0.0-rc.1-28217290.de85e17",
"@types/axios": "^0.14.0",
"@types/d3-scale": "^4.0.3", "@types/d3-scale": "^4.0.3",
"@types/dagre": "^0.7.48", "@types/dagre": "^0.7.48",
"@types/file-saver": "^2.0.5", "@types/file-saver": "^2.0.5",

20
packages/nocodb/package.json

@ -45,8 +45,8 @@
"docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js" "docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js"
}, },
"dependencies": { "dependencies": {
"@aws-sdk/client-kafka": "^3.332.0", "@aws-sdk/client-kafka": "^3.410.0",
"@google-cloud/storage": "^5.7.2", "@google-cloud/storage": "^7.1.0",
"@graphql-tools/merge": "^6.0.12", "@graphql-tools/merge": "^6.0.12",
"@jm18457/kafkajs-msk-iam-authentication-mechanism": "^3.1.2", "@jm18457/kafkajs-msk-iam-authentication-mechanism": "^3.1.2",
"@nestjs/bull": "^10.0.1", "@nestjs/bull": "^10.0.1",
@ -71,12 +71,12 @@
"archiver": "^5.0.2", "archiver": "^5.0.2",
"auto-bind": "^4.0.0", "auto-bind": "^4.0.0",
"aws-kcl": "^2.2.2", "aws-kcl": "^2.2.2",
"aws-sdk": "^2.1419.0", "aws-sdk": "^2.1455.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"body-parser": "^1.20.1", "body-parser": "^1.20.1",
"boxen": "^5.1.0", "boxen": "^5.1.0",
"bull": "^4.10.4", "bull": "^4.11.3",
"bullmq": "^1.81.1", "bullmq": "^1.81.1",
"clear": "^0.1.0", "clear": "^0.1.0",
"clickhouse": "^2.6.0", "clickhouse": "^2.6.0",
@ -89,12 +89,11 @@
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"dataloader": "^2.0.0", "dataloader": "^2.0.0",
"dayjs": "^1.11.9", "dayjs": "^1.11.9",
"debug": "^4.2.0", "debug": "^4.3.4",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"ejs": "^3.1.3", "ejs": "^3.1.3",
"emittery": "^0.7.1", "emittery": "^0.7.1",
"express": "^4.18.1", "express": "^4.18.1",
"express-graphql": "^0.11.0",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
"fast-levenshtein": "^2.0.6", "fast-levenshtein": "^2.0.6",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
@ -109,7 +108,7 @@
"ioredis": "^5.3.2", "ioredis": "^5.3.2",
"ioredis-mock": "^8.8.3", "ioredis-mock": "^8.8.3",
"is-docker": "^2.2.1", "is-docker": "^2.2.1",
"isomorphic-dompurify": "^0.19.0", "isomorphic-dompurify": "^1.8.0",
"jsep": "^1.3.6", "jsep": "^1.3.6",
"json5": "^2.2.3", "json5": "^2.2.3",
"jsonfile": "^6.1.0", "jsonfile": "^6.1.0",
@ -124,11 +123,11 @@
"minio": "^7.0.18", "minio": "^7.0.18",
"mkdirp": "^2.1.3", "mkdirp": "^2.1.3",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"mssql": "^6.2.0", "mssql": "^10.0.0",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",
"mysql2": "^3.2.0", "mysql2": "^3.2.0",
"nanoid": "^3.1.20", "nanoid": "^3.1.20",
"nc-help": "0.3.0", "nc-help": "0.3.1",
"nc-lib-gui": "0.111.4", "nc-lib-gui": "0.111.4",
"nc-plugin": "^0.1.3", "nc-plugin": "^0.1.3",
"ncp": "^2.0.0", "ncp": "^2.0.0",
@ -153,7 +152,6 @@
"pg": "^8.10.0", "pg": "^8.10.0",
"redlock": "^5.0.0-beta.2", "redlock": "^5.0.0-beta.2",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"request": "^2.88.2",
"request-ip": "^2.1.3", "request-ip": "^2.1.3",
"rmdir": "^1.2.0", "rmdir": "^1.2.0",
"rxjs": "^7.2.0", "rxjs": "^7.2.0",
@ -162,7 +160,7 @@
"socket.io": "^4.4.1", "socket.io": "^4.4.1",
"sql-query-identifier": "^2.5.0", "sql-query-identifier": "^2.5.0",
"sqlite3": "^5.1.6", "sqlite3": "^5.1.6",
"tedious": "^16.1.0", "tedious": "^16.4.0",
"tinycolor2": "^1.4.2", "tinycolor2": "^1.4.2",
"twilio": "^3.55.1", "twilio": "^3.55.1",
"unique-names-generator": "^4.3.1", "unique-names-generator": "^4.3.1",

29
packages/nocodb/src/plugins/backblaze/Backblaze.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -47,32 +47,29 @@ export default class Backblaze implements IStorageAdapterV2 {
const uploadParams: any = { const uploadParams: any = {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

22
packages/nocodb/src/plugins/gcs/Gcs.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import { Storage } from '@google-cloud/storage'; import { Storage } from '@google-cloud/storage';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import type { StorageOptions } from '@google-cloud/storage'; import type { StorageOptions } from '@google-cloud/storage';
@ -105,23 +105,19 @@ export default class Gcs implements IStorageAdapterV2 {
fileCreateByUrl(destPath: string, url: string): Promise<any> { fileCreateByUrl(destPath: string, url: string): Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url,
encoding: null,
},
(err, _, body) => {
if (err) return reject(err);
this.storageClient this.storageClient
.bucket(this.bucketName) .bucket(this.bucketName)
.file(destPath) .file(destPath)
.save(body) .save(response.data)
.then((res) => resolve(res)) .then((res) => resolve(res))
.catch(reject); .catch(reject);
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

28
packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -48,31 +48,27 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

27
packages/nocodb/src/plugins/mino/Minio.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import { Client as MinioClient } from 'minio'; import { Client as MinioClient } from 'minio';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -95,20 +95,13 @@ export default class Minio implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, _, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = response.headers['content-type'];
// uploadParams.Body = fileStream;
// uploadParams.Key = key;
const metaData = { const metaData = {
// 'Content-Type': file.mimetype // 'Content-Type': file.mimetype
// 'X-Amz-Meta-Testing': 1234, // 'X-Amz-Meta-Testing': 1234,
@ -116,7 +109,7 @@ export default class Minio implements IStorageAdapterV2 {
}; };
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.minioClient this.minioClient
.putObject(this.input?.bucket, key, body, metaData) .putObject(this.input?.bucket, key, response.data, metaData)
.then(() => { .then(() => {
resolve( resolve(
`http${this.input.useSSL ? 's' : ''}://${this.input.endPoint}:${ `http${this.input.useSSL ? 's' : ''}://${this.input.endPoint}:${
@ -125,8 +118,10 @@ export default class Minio implements IStorageAdapterV2 {
); );
}) })
.catch(reject); .catch(reject);
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

28
packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -48,31 +48,27 @@ export default class OvhCloud implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

28
packages/nocodb/src/plugins/s3/S3.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -47,31 +47,27 @@ export default class S3 implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

28
packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -98,31 +98,27 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

28
packages/nocodb/src/plugins/spaces/Spaces.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -48,31 +48,27 @@ export default class Spaces implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

28
packages/nocodb/src/plugins/upcloud/UpoCloud.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -48,31 +48,27 @@ export default class UpoCloud implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

28
packages/nocodb/src/plugins/vultr/Vultr.ts

@ -1,7 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import { promisify } from 'util'; import { promisify } from 'util';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import axios from 'axios';
import type { IStorageAdapterV2, XcFile } from 'nc-plugin'; import type { IStorageAdapterV2, XcFile } from 'nc-plugin';
import type { Readable } from 'stream'; import type { Readable } from 'stream';
import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils'; import { generateTempFilePath, waitForStreamClose } from '~/utils/pluginUtils';
@ -48,31 +48,27 @@ export default class Vultr implements IStorageAdapterV2 {
ACL: 'public-read', ACL: 'public-read',
}; };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Configure the file stream and obtain the upload parameters axios
request( .get(url)
{ .then((response) => {
url: url, uploadParams.Body = response.data;
encoding: null,
},
(err, httpResponse, body) => {
if (err) return reject(err);
uploadParams.Body = body;
uploadParams.Key = key; uploadParams.Key = key;
uploadParams.ContentType = httpResponse.headers['content-type']; uploadParams.ContentType = response.headers['content-type'];
// call S3 to retrieve upload file to specified bucket // call S3 to retrieve upload file to specified bucket
this.s3Client.upload(uploadParams, (err1, data) => { this.s3Client.upload(uploadParams, (err1, data) => {
if (err) { if (err1) {
console.log('Error', err); console.log('Error', err1);
reject(err1); reject(err1);
} }
if (data) { if (data) {
resolve(data.Location); resolve(data.Location);
} }
}); });
}, })
); .catch((error) => {
reject(error);
});
}); });
} }

1997
pnpm-lock.yaml

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save