Browse Source

Merge pull request #4949 from nocodb/develop

pull/4950/head 0.104.2
github-actions[bot] 2 years ago committed by GitHub
parent
commit
801ef9cb7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 54
      packages/nc-gui/package-lock.json
  2. 2
      packages/nc-gui/package.json
  3. 4
      packages/nocodb-sdk/package-lock.json
  4. 32
      packages/nocodb/package-lock.json
  5. 4
      packages/nocodb/package.json
  6. 32
      packages/nocodb/src/lib/version-upgrader/ncAttachmentUpgrader.ts

54
packages/nc-gui/package-lock.json generated

@ -29,7 +29,7 @@
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"locale-codes": "^1.3.1", "locale-codes": "^1.3.1",
"monaco-editor": "^0.33.0", "monaco-editor": "^0.33.0",
"nocodb-sdk": "0.104.1", "nocodb-sdk": "file:../nocodb-sdk",
"papaparse": "^5.3.2", "papaparse": "^5.3.2",
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"socket.io-client": "^4.5.1", "socket.io-client": "^4.5.1",
@ -96,8 +96,7 @@
} }
}, },
"../nocodb-sdk": { "../nocodb-sdk": {
"version": "0.104.0", "version": "0.104.1",
"extraneous": true,
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
@ -8545,6 +8544,7 @@
"version": "1.15.1", "version": "1.15.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz",
"integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==",
"devOptional": true,
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
@ -11960,21 +11960,8 @@
} }
}, },
"node_modules/nocodb-sdk": { "node_modules/nocodb-sdk": {
"version": "0.104.1", "resolved": "../nocodb-sdk",
"resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.104.1.tgz", "link": true
"integrity": "sha512-qndWJuPW612FuXBBxrdh31SuvJbvTX3ReqqxM1HIzNXO5G8xmXpBP53Q/ErbB6XkDk1kJV4riZ2K+oUvRF6CFQ==",
"dependencies": {
"axios": "^0.21.1",
"jsep": "^1.3.6"
}
},
"node_modules/nocodb-sdk/node_modules/axios": {
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"dependencies": {
"follow-redirects": "^1.14.0"
}
}, },
"node_modules/node-abi": { "node_modules/node-abi": {
"version": "3.23.0", "version": "3.23.0",
@ -23956,7 +23943,8 @@
"follow-redirects": { "follow-redirects": {
"version": "1.15.1", "version": "1.15.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz",
"integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==",
"devOptional": true
}, },
"form-data": { "form-data": {
"version": "4.0.0", "version": "4.0.0",
@ -26429,22 +26417,22 @@
} }
}, },
"nocodb-sdk": { "nocodb-sdk": {
"version": "0.104.1", "version": "file:../nocodb-sdk",
"resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.104.1.tgz",
"integrity": "sha512-qndWJuPW612FuXBBxrdh31SuvJbvTX3ReqqxM1HIzNXO5G8xmXpBP53Q/ErbB6XkDk1kJV4riZ2K+oUvRF6CFQ==",
"requires": { "requires": {
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"jsep": "^1.3.6" "cspell": "^4.1.0",
}, "eslint": "^7.8.0",
"dependencies": { "eslint-config-prettier": "^6.11.0",
"axios": { "eslint-plugin-eslint-comments": "^3.2.0",
"version": "0.21.4", "eslint-plugin-functional": "^3.0.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", "eslint-plugin-import": "^2.22.0",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "eslint-plugin-prettier": "^4.0.0",
"requires": { "jsep": "^1.3.6",
"follow-redirects": "^1.14.0" "npm-run-all": "^4.1.5",
} "prettier": "^2.1.1",
} "typescript": "^4.0.2"
} }
}, },
"node-abi": { "node-abi": {

2
packages/nc-gui/package.json

@ -52,7 +52,7 @@
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"locale-codes": "^1.3.1", "locale-codes": "^1.3.1",
"monaco-editor": "^0.33.0", "monaco-editor": "^0.33.0",
"nocodb-sdk": "0.104.1", "nocodb-sdk": "file:../nocodb-sdk",
"papaparse": "^5.3.2", "papaparse": "^5.3.2",
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"socket.io-client": "^4.5.1", "socket.io-client": "^4.5.1",

4
packages/nocodb-sdk/package-lock.json generated

@ -1,12 +1,12 @@
{ {
"name": "nocodb-sdk", "name": "nocodb-sdk",
"version": "0.101.2", "version": "0.104.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "nocodb-sdk", "name": "nocodb-sdk",
"version": "0.101.2", "version": "0.104.1",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",

32
packages/nocodb/package-lock.json generated

@ -68,7 +68,7 @@
"nc-lib-gui": "0.104.1", "nc-lib-gui": "0.104.1",
"nc-plugin": "0.1.2", "nc-plugin": "0.1.2",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"nocodb-sdk": "0.104.1", "nocodb-sdk": "file:../nocodb-sdk",
"nodemailer": "^6.4.10", "nodemailer": "^6.4.10",
"object-hash": "^3.0.0", "object-hash": "^3.0.0",
"os-locale": "^5.0.0", "os-locale": "^5.0.0",
@ -153,8 +153,7 @@
} }
}, },
"../nocodb-sdk": { "../nocodb-sdk": {
"version": "0.104.0", "version": "0.104.1",
"extraneous": true,
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
@ -11223,13 +11222,8 @@
"dev": true "dev": true
}, },
"node_modules/nocodb-sdk": { "node_modules/nocodb-sdk": {
"version": "0.104.1", "resolved": "../nocodb-sdk",
"resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.104.1.tgz", "link": true
"integrity": "sha512-qndWJuPW612FuXBBxrdh31SuvJbvTX3ReqqxM1HIzNXO5G8xmXpBP53Q/ErbB6XkDk1kJV4riZ2K+oUvRF6CFQ==",
"dependencies": {
"axios": "^0.21.1",
"jsep": "^1.3.6"
}
}, },
"node_modules/node-abort-controller": { "node_modules/node-abort-controller": {
"version": "3.0.1", "version": "3.0.1",
@ -27742,12 +27736,22 @@
"dev": true "dev": true
}, },
"nocodb-sdk": { "nocodb-sdk": {
"version": "0.104.1", "version": "file:../nocodb-sdk",
"resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.104.1.tgz",
"integrity": "sha512-qndWJuPW612FuXBBxrdh31SuvJbvTX3ReqqxM1HIzNXO5G8xmXpBP53Q/ErbB6XkDk1kJV4riZ2K+oUvRF6CFQ==",
"requires": { "requires": {
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"jsep": "^1.3.6" "cspell": "^4.1.0",
"eslint": "^7.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^3.0.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^4.0.0",
"jsep": "^1.3.6",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"typescript": "^4.0.2"
} }
}, },
"node-abort-controller": { "node-abort-controller": {

4
packages/nocodb/package.json

@ -108,7 +108,7 @@
"nc-lib-gui": "0.104.1", "nc-lib-gui": "0.104.1",
"nc-plugin": "0.1.2", "nc-plugin": "0.1.2",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"nocodb-sdk": "0.104.1", "nocodb-sdk": "file:../nocodb-sdk",
"nodemailer": "^6.4.10", "nodemailer": "^6.4.10",
"object-hash": "^3.0.0", "object-hash": "^3.0.0",
"os-locale": "^5.0.0", "os-locale": "^5.0.0",
@ -183,4 +183,4 @@
"prettier": { "prettier": {
"singleQuote": true "singleQuote": true
} }
} }

32
packages/nocodb/src/lib/version-upgrader/ncAttachmentUpgrader.ts

@ -4,7 +4,7 @@ import Base from '../models/Base';
import Model from '../models/Model'; import Model from '../models/Model';
import { XKnex } from '../db/sql-data-mapper/index'; import { XKnex } from '../db/sql-data-mapper/index';
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2';
import { UITypes } from 'nocodb-sdk'; import { BaseType, UITypes } from 'nocodb-sdk'
// before 0.103.0, an attachment object was like // before 0.103.0, an attachment object was like
// [{ // [{
@ -42,12 +42,13 @@ function getTnPath(knex: XKnex, tb: Model) {
} }
export default async function ({ ncMeta }: NcUpgraderCtx) { export default async function ({ ncMeta }: NcUpgraderCtx) {
const bases: Base[] = await ncMeta.metaList2(null, null, MetaTable.BASES); const bases: BaseType[] = await ncMeta.metaList2(null, null, MetaTable.BASES);
for (const base of bases) { for (const _base of bases) {
const base = new Base(_base);
const knex: XKnex = base.is_meta const knex: XKnex = base.is_meta
? ncMeta.knexConnection ? ncMeta.knexConnection
: NcConnectionMgrv2.get(base); : NcConnectionMgrv2.get(base);
const models = await (await Base.get(base.id, ncMeta)).getModels(ncMeta); const models = await base.getModels(ncMeta);
for (const model of models) { for (const model of models) {
const updateRecords = []; const updateRecords = [];
const columns = await ( const columns = await (
@ -66,14 +67,27 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
]); ]);
for (const record of records) { for (const record of records) {
for (const attachmentColumn of attachmentColumns) { for (const attachmentColumn of attachmentColumns) {
const attachmentMeta = let attachmentMeta: Array<{
typeof record[attachmentColumn] === 'string' url: string;
? JSON.parse(record[attachmentColumn]) }>;
: record[attachmentColumn];
// if parsing failed ignore the cell
try {
attachmentMeta =
typeof record[attachmentColumn] === 'string'
? JSON.parse(record[attachmentColumn])
: record[attachmentColumn];
} catch {}
// if cell data is not an array, ignore it
if (!Array.isArray(attachmentMeta)) {
continue;
}
if (attachmentMeta) { if (attachmentMeta) {
const newAttachmentMeta = []; const newAttachmentMeta = [];
for (const attachment of attachmentMeta) { for (const attachment of attachmentMeta) {
if ('url' in attachment) { if ('url' in attachment && typeof attachment.url === 'string') {
const match = attachment.url.match(/^(.*)\/download\/(.*)$/); const match = attachment.url.match(/^(.*)\/download\/(.*)$/);
if (match) { if (match) {
// e.g. http://localhost:8080/download/noco/xcdb/Sheet-1/title5/ee2G8p_nute_gunray.png // e.g. http://localhost:8080/download/noco/xcdb/Sheet-1/title5/ee2G8p_nute_gunray.png

Loading…
Cancel
Save