diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ffa1250480..ce8c3e689d 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -58,10 +58,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-pg-restViews-run-cache: runs-on: ubuntu-20.04 @@ -102,10 +103,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-pg-restRoles-run-cache: runs-on: ubuntu-20.04 @@ -146,10 +148,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-pg-restMisc-run-cache: runs-on: ubuntu-20.04 @@ -190,10 +193,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-restTableOps-run-cache: runs-on: ubuntu-20.04 @@ -225,7 +229,7 @@ jobs: uses: cypress-io/github-action@v2 with: start: | - npm run build:common + npm run build:common npm run start:api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d @@ -234,10 +238,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-restViews-run-cache: runs-on: ubuntu-20.04 @@ -278,10 +283,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-restRoles-run-cache: runs-on: ubuntu-20.04 @@ -322,10 +328,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-restMisc-run-cache: runs-on: ubuntu-20.04 @@ -366,10 +373,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-xcdb-restTableOps-run-cache: runs-on: ubuntu-20.04 @@ -410,10 +418,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-xcdb-restViews-run-cache: runs-on: ubuntu-20.04 @@ -454,10 +463,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-xcdb-restRoles-run-cache: runs-on: ubuntu-20.04 @@ -498,10 +508,11 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 cypress-xcdb-restMisc-run-cache: runs-on: ubuntu-20.04 @@ -542,38 +553,39 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots - path: scripts/cypress/videos + path: scripts/cypress/screenshots retention-days: 2 - docker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Check for update - run: | - echo "CHANGED=$([[ $(lerna ls --since ${{github.event.before}} | grep nocodb) = nocodb ]] && echo 'OK')" >> $GITHUB_ENV - - name: Test Mysql REST APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-mysql - - name: Test Mysql GraphQL APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mysql - - # - name: Test MSSQL REST APIs - # run: cd ./packages/nocodb/ && docker-compose run xc-test-mssql - # - name: Test MSSQL GraphQL APIs - # run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mssql - # - - name: Test PostgreSQL REST APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-pg - - name: Test PostgreSQL GraphQL APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-pg +# docker: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# - name: Check for update +# run: | +# echo "CHANGED=$([[ $(lerna ls --since ${{github.event.before}} | grep nocodb) = nocodb ]] && echo 'OK')" >> $GITHUB_ENV +# - name: Test Mysql REST APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-mysql +# - name: Test Mysql GraphQL APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mysql +# +# # - name: Test MSSQL REST APIs +# # run: cd ./packages/nocodb/ && docker-compose run xc-test-mssql +# # - name: Test MSSQL GraphQL APIs +# # run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mssql +# # +# - name: Test PostgreSQL REST APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-pg +# - name: Test PostgreSQL GraphQL APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-pg # # - name: Test SQLite3 REST APIs # run: cd ./packages/nocodb/ && docker-compose run xc-test-sqlite diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 0fb8da4fbf..093f064809 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -42,7 +42,7 @@ jobs: working-directory: ./packages/nocodb strategy: matrix: - node-version: [12] + node-version: [14] steps: - name: Get Docker Repository id: get-docker-repository @@ -73,6 +73,20 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: upgrade packages for nightly build + if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }} + run: | + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js + cd packages/nocodb-sdk + npm install && npm run build + cd ../.. + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js + cd packages/nc-gui + npm install + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy + cd ../.. + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui.js + - uses: bahmutov/npm-install@v1 with: working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/release-nightly-dev.yml b/.github/workflows/release-nightly-dev.yml index 8485655feb..6cbbe5ab08 100644 --- a/.github/workflows/release-nightly-dev.yml +++ b/.github/workflows/release-nightly-dev.yml @@ -12,8 +12,8 @@ on: - DEV # - PROD schedule: - # at the end of every day - - cron: '0 0 * * *' + # every 6 hours + - cron: '0 */6 * * *' jobs: # enrich tag for nightly auto release @@ -26,11 +26,11 @@ jobs: # Get current date CURRENT_DATE=$(date +"%Y%m%d") CURRENT_TIME=$(date +"%H%M") - TAG_NAME=${CURRENT_DATE} + TAG_NAME=${CURRENT_DATE}-${CURRENT_TIME} IS_DAILY='Y' # Set the tag if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then - TAG_NAME=${TAG_NAME}-${CURRENT_TIME} + TAG_NAME=${TAG_NAME} IS_DAILY='N' fi echo "::set-output name=NIGHTLY_BUILD_TAG::${TAG_NAME}" diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index b2bbf985e6..024e23f59a 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -37,27 +37,27 @@ jobs: working-directory: ./packages/nocodb strategy: matrix: - node-version: [12] + node-version: [14] steps: - - uses: actions/checkout@v2 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v2 + - name: Checkout + uses: actions/checkout@v2 + - name: NPM Setup and Publish with ${{ matrix.node-version }} + # Setup .npmrc file to publish to npm + uses: actions/setup-node@v2 with: - node-version: '16.x' + node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - run: | + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js cd packages/nocodb-sdk - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node ../../scripts/bumpNocodbSdkVersion.js - npm install && npm run build - npm publish + npm install && npm run build && npm publish cd ../.. targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js cd packages/nc-gui npm install targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:jsdeliver cd ../.. - npm install - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/upgradeNcGui.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Create Pull Request diff --git a/.run/Clear metadb.run.xml b/.run/Clear metadb.run.xml new file mode 100644 index 0000000000..2fc4fdd987 --- /dev/null +++ b/.run/Clear metadb.run.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/.run/build.run.xml b/.run/build.run.xml new file mode 100644 index 0000000000..81aa853d99 --- /dev/null +++ b/.run/build.run.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/packages/nc-gui/helpers/sqlUi/MssqlUi.js b/packages/nc-gui/helpers/sqlUi/MssqlUi.js index 9568ce3f50..f68231635f 100644 --- a/packages/nc-gui/helpers/sqlUi/MssqlUi.js +++ b/packages/nc-gui/helpers/sqlUi/MssqlUi.js @@ -570,16 +570,9 @@ export class MssqlUi { } static onCheckboxChangeAI(col) { - console.log(col) if (col.dt === 'int' || col.dt === 'bigint' || col.dt === 'smallint' || col.dt === 'tinyint') { col.altered = col.altered || 2 } - - // if (!col.ai) { - // col.dtx = 'specificType' - // } else { - // col.dtx = '' - // } } static showScale(columnObj) { @@ -596,7 +589,6 @@ export class MssqlUi { columns[i].un = false console.log('>> resetting unsigned value', columns[i].column_name) } - console.log(columns[i].column_name) } } @@ -617,8 +609,6 @@ export class MssqlUi { } static handleRawOutput(result, headers) { - console.log(result) - if (Array.isArray(result) && result[0]) { const keys = Object.keys(result[0]) // set headers before settings result diff --git a/packages/nc-gui/layouts/default.vue b/packages/nc-gui/layouts/default.vue index bbc770cea4..6739f9fea5 100644 --- a/packages/nc-gui/layouts/default.vue +++ b/packages/nc-gui/layouts/default.vue @@ -33,7 +33,7 @@ }}) - {{ brandName }} + {{ brandName }} @@ -657,7 +657,7 @@ export default { }, async copyProjectInfo() { try { - const data = (await this.$api.project.metaGet(this.$store.state.project.projectId))// await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'ncProjectInfo']) + const data = (await this.$api.project.metaGet(this.$store.state.project.projectId)) copyTextToClipboard(Object.entries(data).map(([k, v]) => `${k}: **${v}**`).join('\n')) this.$toast.info('Copied project info to clipboard').goAway(3000) } catch (e) { diff --git a/packages/nc-gui/mixins/colors.js b/packages/nc-gui/mixins/colors.js index c05f118b43..e15010f642 100644 --- a/packages/nc-gui/mixins/colors.js +++ b/packages/nc-gui/mixins/colors.js @@ -8,5 +8,13 @@ export default { textColors() { return this.$store.state.windows.darkTheme ? colors.light : colors.dark } + }, + methods: { + getColor(i) { + return this.colors[i % this.colors.length] + }, + getTextColor(i) { + return this.textColors[i % this.textColors.length] + } } } diff --git a/packages/nc-gui/mixins/device.js b/packages/nc-gui/mixins/device.js index 09e062e8cf..9e40525e7e 100644 --- a/packages/nc-gui/mixins/device.js +++ b/packages/nc-gui/mixins/device.js @@ -52,7 +52,9 @@ export default { return zhLan.some(l => browserLan.includes(l)) }, ...mapGetters({ - _isUIAllowed: 'users/GtrIsUIAllowed' + _isUIAllowed: 'users/GtrIsUIAllowed', + projectName: 'project/GtrProjectName', + projectId: 'project/GtrProjectId' }) }, mounted() { diff --git a/packages/nc-gui/package-lock.json b/packages/nc-gui/package-lock.json index 6c82583641..b81a35b561 100644 --- a/packages/nc-gui/package-lock.json +++ b/packages/nc-gui/package-lock.json @@ -26,12 +26,12 @@ "monaco-editor": "^0.19.3", "monaco-themes": "^0.2.5", "nano-assign": "^1.0.1", - "nocodb-sdk": "0.0.9", + "nocodb-sdk": "file:../nocodb-sdk", "nuxt": "^2.14.0", "odometer": "^0.4.8", "papaparse": "^5.3.1", "secure-ls": "^1.2.6", - "socket.io-client": "^2.3.0", + "socket.io-client": "^4.4.1", "splitpanes": "^2.2.1", "sql-formatter": "^2.3.3", "unique-names-generator": "^4.3.1", @@ -69,6 +69,42 @@ "vue-eslint-parser": "^7.9.0" } }, + "../nocodb-sdk": { + "version": "0.0.9", + "license": "MIT", + "dependencies": { + "axios": "^0.21.1", + "jsep": "^0.4.0" + }, + "devDependencies": { + "@ava/typescript": "^1.1.1", + "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@typescript-eslint/eslint-plugin": "^4.0.1", + "@typescript-eslint/parser": "^4.0.1", + "ava": "^3.12.1", + "codecov": "^3.5.0", + "cspell": "^4.1.0", + "cz-conventional-changelog": "^3.3.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", + "gh-pages": "^3.1.0", + "npm-run-all": "^4.1.5", + "nyc": "^15.1.0", + "open-cli": "^6.0.1", + "prettier": "^2.1.1", + "standard-version": "^9.0.0", + "ts-node": "^9.0.0", + "typedoc": "^0.19.0", + "typescript": "^4.0.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@ampproject/remapping": { "version": "2.1.2", "license": "Apache-2.0", @@ -2923,6 +2959,19 @@ "version": "1.0.0-next.21", "license": "MIT" }, + "node_modules/@socket.io/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.0.0.tgz", + "integrity": "sha512-2pTGuibAXJswAPJjaKisthqS/NOK5ypG4LYT6tEAV0S/mxW0zOIvYvGK0V8w8+SHxAm6vRMSjqSalFXeBAqs+Q==" + }, "node_modules/@types/html-minifier-terser": { "version": "5.1.2", "license": "MIT" @@ -3520,10 +3569,6 @@ "node": ">=0.8" } }, - "node_modules/after": { - "version": "0.8.2", - "license": "MIT" - }, "node_modules/aggregate-error": { "version": "3.1.0", "license": "MIT", @@ -3721,10 +3766,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/arraybuffer.slice": { - "version": "0.0.7", - "license": "MIT" - }, "node_modules/asn1.js": { "version": "5.4.1", "license": "MIT", @@ -3980,12 +4021,6 @@ "node": ">=0.10.0" } }, - "node_modules/base64-arraybuffer": { - "version": "0.1.4", - "engines": { - "node": ">= 0.6.0" - } - }, "node_modules/base64-js": { "version": "1.5.1", "funding": [ @@ -4026,10 +4061,6 @@ "file-uri-to-path": "1.0.0" } }, - "node_modules/blob": { - "version": "0.0.5", - "license": "MIT" - }, "node_modules/bluebird": { "version": "3.7.2", "license": "MIT" @@ -4822,16 +4853,10 @@ "version": "1.0.1", "license": "MIT" }, - "node_modules/component-bind": { - "version": "1.0.0" - }, "node_modules/component-emitter": { "version": "1.3.0", "license": "MIT" }, - "node_modules/component-inherit": { - "version": "0.0.3" - }, "node_modules/compressible": { "version": "2.0.18", "license": "MIT", @@ -5851,38 +5876,27 @@ } }, "node_modules/engine.io-client": { - "version": "3.5.2", - "license": "MIT", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.1.1.tgz", + "integrity": "sha512-V05mmDo4gjimYW+FGujoGmmmxRaDsrVr7AXA3ZIfa04MWM1jOfZfUwou0oNqhNwy/votUDvGDt4JA4QF4e0b4g==", "dependencies": { - "component-emitter": "~1.3.0", - "component-inherit": "0.0.3", - "debug": "~3.1.0", - "engine.io-parser": "~2.2.0", + "@socket.io/component-emitter": "~3.0.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.0.0", "has-cors": "1.1.0", - "indexof": "0.0.1", "parseqs": "0.0.6", "parseuri": "0.0.6", - "ws": "~7.4.2", - "xmlhttprequest-ssl": "~1.6.2", + "ws": "~8.2.3", + "xmlhttprequest-ssl": "~2.0.0", "yeast": "0.1.2" } }, - "node_modules/engine.io-client/node_modules/debug": { - "version": "3.1.0", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/engine.io-client/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, "node_modules/engine.io-client/node_modules/ws": { - "version": "7.4.6", - "license": "MIT", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", "engines": { - "node": ">=8.3.0" + "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", @@ -5898,14 +5912,14 @@ } }, "node_modules/engine.io-parser": { - "version": "2.2.1", - "license": "MIT", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz", + "integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==", "dependencies": { - "after": "0.8.2", - "arraybuffer.slice": "~0.0.7", - "base64-arraybuffer": "0.1.4", - "blob": "0.0.5", - "has-binary2": "~1.0.2" + "@socket.io/base64-arraybuffer": "~1.0.2" + }, + "engines": { + "node": ">=10.0.0" } }, "node_modules/enhanced-resolve": { @@ -7769,20 +7783,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-binary2": { - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "isarray": "2.0.1" - } - }, - "node_modules/has-binary2/node_modules/isarray": { - "version": "2.0.1", - "license": "MIT" - }, "node_modules/has-cors": { "version": "1.1.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" }, "node_modules/has-flag": { "version": "3.0.0", @@ -8302,9 +8306,6 @@ "version": "1.0.1", "license": "MIT" }, - "node_modules/indexof": { - "version": "0.0.1" - }, "node_modules/infer-owner": { "version": "1.0.4", "license": "ISC" @@ -9576,16 +9577,8 @@ } }, "node_modules/nocodb-sdk": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.0.9.tgz", - "integrity": "sha512-MwvHh9WtplJtB2z41DbDUF09bYRLX4WBA+IytgPRWr5e3s8UEBzKZiKN7sLcVnmiY6a9ctT4Ad0CS4viwExoQw==", - "dependencies": { - "axios": "^0.21.1", - "jsep": "^0.4.0" - }, - "engines": { - "node": ">=10" - } + "resolved": "../nocodb-sdk", + "link": true }, "node_modules/node-fetch": { "version": "2.6.7", @@ -10228,11 +10221,13 @@ }, "node_modules/parseqs": { "version": "0.0.6", - "license": "MIT" + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", + "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" }, "node_modules/parseuri": { "version": "0.0.6", - "license": "MIT" + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", + "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" }, "node_modules/parseurl": { "version": "1.3.3", @@ -12660,57 +12655,33 @@ "license": "MIT" }, "node_modules/socket.io-client": { - "version": "2.4.0", - "license": "MIT", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.4.1.tgz", + "integrity": "sha512-N5C/L5fLNha5Ojd7Yeb/puKcPWWcoB/A09fEjjNsg91EDVr5twk/OEyO6VT9dlLSUNY85NpW6KBhVMvaLKQ3vQ==", "dependencies": { - "backo2": "1.0.2", - "component-bind": "1.0.0", - "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "engine.io-client": "~3.5.0", - "has-binary2": "~1.0.2", - "indexof": "0.0.1", - "parseqs": "0.0.6", + "@socket.io/component-emitter": "~3.0.0", + "backo2": "~1.0.2", + "debug": "~4.3.2", + "engine.io-client": "~6.1.1", "parseuri": "0.0.6", - "socket.io-parser": "~3.3.0", - "to-array": "0.1.4" - } - }, - "node_modules/socket.io-client/node_modules/debug": { - "version": "3.1.0", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" + "socket.io-parser": "~4.1.1" + }, + "engines": { + "node": ">=10.0.0" } }, - "node_modules/socket.io-client/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, "node_modules/socket.io-parser": { - "version": "3.3.2", - "license": "MIT", - "dependencies": { - "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "isarray": "2.0.1" - } - }, - "node_modules/socket.io-parser/node_modules/debug": { - "version": "3.1.0", - "license": "MIT", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.1.2.tgz", + "integrity": "sha512-j3kk71QLJuyQ/hh5F/L2t1goqzdTL0gvDzuhTuNSwihfuFUrcSji0qFZmJJPtG6Rmug153eOPsUizeirf1IIog==", "dependencies": { - "ms": "2.0.0" + "@socket.io/component-emitter": "~3.0.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" } }, - "node_modules/socket.io-parser/node_modules/isarray": { - "version": "2.0.1", - "license": "MIT" - }, - "node_modules/socket.io-parser/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, "node_modules/sort-keys": { "version": "1.1.2", "license": "MIT", @@ -13422,9 +13393,6 @@ "node": ">=0.6.0" } }, - "node_modules/to-array": { - "version": "0.1.4" - }, "node_modules/to-arraybuffer": { "version": "1.0.1", "license": "MIT" @@ -15376,7 +15344,9 @@ } }, "node_modules/xmlhttprequest-ssl": { - "version": "1.6.3", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==", "engines": { "node": ">=0.4.0" } @@ -15449,7 +15419,8 @@ }, "node_modules/yeast": { "version": "0.1.2", - "license": "MIT" + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" }, "node_modules/yocto-queue": { "version": "0.1.0", @@ -17252,6 +17223,16 @@ "@polka/url": { "version": "1.0.0-next.21" }, + "@socket.io/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ==" + }, + "@socket.io/component-emitter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.0.0.tgz", + "integrity": "sha512-2pTGuibAXJswAPJjaKisthqS/NOK5ypG4LYT6tEAV0S/mxW0zOIvYvGK0V8w8+SHxAm6vRMSjqSalFXeBAqs+Q==" + }, "@types/html-minifier-terser": { "version": "5.1.2" }, @@ -17669,9 +17650,6 @@ "printj": "~1.1.0" } }, - "after": { - "version": "0.8.2" - }, "aggregate-error": { "version": "3.1.0", "requires": { @@ -17784,9 +17762,6 @@ "es-abstract": "^1.19.0" } }, - "arraybuffer.slice": { - "version": "0.0.7" - }, "asn1.js": { "version": "5.4.1", "requires": { @@ -17963,9 +17938,6 @@ } } }, - "base64-arraybuffer": { - "version": "0.1.4" - }, "base64-js": { "version": "1.5.1" }, @@ -17982,9 +17954,6 @@ "file-uri-to-path": "1.0.0" } }, - "blob": { - "version": "0.0.5" - }, "bluebird": { "version": "3.7.2" }, @@ -18477,15 +18446,9 @@ "commondir": { "version": "1.0.1" }, - "component-bind": { - "version": "1.0.0" - }, "component-emitter": { "version": "1.3.0" }, - "component-inherit": { - "version": "0.0.3" - }, "compressible": { "version": "2.0.18", "requires": { @@ -19164,44 +19127,35 @@ } }, "engine.io-client": { - "version": "3.5.2", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.1.1.tgz", + "integrity": "sha512-V05mmDo4gjimYW+FGujoGmmmxRaDsrVr7AXA3ZIfa04MWM1jOfZfUwou0oNqhNwy/votUDvGDt4JA4QF4e0b4g==", "requires": { - "component-emitter": "~1.3.0", - "component-inherit": "0.0.3", - "debug": "~3.1.0", - "engine.io-parser": "~2.2.0", + "@socket.io/component-emitter": "~3.0.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.0.0", "has-cors": "1.1.0", - "indexof": "0.0.1", "parseqs": "0.0.6", "parseuri": "0.0.6", - "ws": "~7.4.2", - "xmlhttprequest-ssl": "~1.6.2", + "ws": "~8.2.3", + "xmlhttprequest-ssl": "~2.0.0", "yeast": "0.1.2" }, "dependencies": { - "debug": { - "version": "3.1.0", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0" - }, "ws": { - "version": "7.4.6", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", "requires": {} } } }, "engine.io-parser": { - "version": "2.2.1", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz", + "integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==", "requires": { - "after": "0.8.2", - "arraybuffer.slice": "~0.0.7", - "base64-arraybuffer": "0.1.4", - "blob": "0.0.5", - "has-binary2": "~1.0.2" + "@socket.io/base64-arraybuffer": "~1.0.2" } }, "enhanced-resolve": { @@ -20359,19 +20313,10 @@ "has-bigints": { "version": "1.0.1" }, - "has-binary2": { - "version": "1.0.3", - "requires": { - "isarray": "2.0.1" - }, - "dependencies": { - "isarray": { - "version": "2.0.1" - } - } - }, "has-cors": { - "version": "1.1.0" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" }, "has-flag": { "version": "3.0.0" @@ -20693,9 +20638,6 @@ "indexes-of": { "version": "1.0.1" }, - "indexof": { - "version": "0.0.1" - }, "infer-owner": { "version": "1.0.4" }, @@ -21483,12 +21425,33 @@ } }, "nocodb-sdk": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.0.9.tgz", - "integrity": "sha512-MwvHh9WtplJtB2z41DbDUF09bYRLX4WBA+IytgPRWr5e3s8UEBzKZiKN7sLcVnmiY6a9ctT4Ad0CS4viwExoQw==", + "version": "file:../nocodb-sdk", "requires": { + "@ava/typescript": "^1.1.1", + "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@typescript-eslint/eslint-plugin": "^4.0.1", + "@typescript-eslint/parser": "^4.0.1", + "ava": "^3.12.1", "axios": "^0.21.1", - "jsep": "^0.4.0" + "codecov": "^3.5.0", + "cspell": "^4.1.0", + "cz-conventional-changelog": "^3.3.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", + "gh-pages": "^3.1.0", + "jsep": "^0.4.0", + "npm-run-all": "^4.1.5", + "nyc": "^15.1.0", + "open-cli": "^6.0.1", + "prettier": "^2.1.1", + "standard-version": "^9.0.0", + "ts-node": "^9.0.0", + "typedoc": "^0.19.0", + "typescript": "^4.0.2" } }, "node-fetch": { @@ -21905,10 +21868,14 @@ "dev": true }, "parseqs": { - "version": "0.0.6" + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", + "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" }, "parseuri": { - "version": "0.0.6" + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", + "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" }, "parseurl": { "version": "1.3.3" @@ -23521,52 +23488,25 @@ } }, "socket.io-client": { - "version": "2.4.0", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.4.1.tgz", + "integrity": "sha512-N5C/L5fLNha5Ojd7Yeb/puKcPWWcoB/A09fEjjNsg91EDVr5twk/OEyO6VT9dlLSUNY85NpW6KBhVMvaLKQ3vQ==", "requires": { - "backo2": "1.0.2", - "component-bind": "1.0.0", - "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "engine.io-client": "~3.5.0", - "has-binary2": "~1.0.2", - "indexof": "0.0.1", - "parseqs": "0.0.6", + "@socket.io/component-emitter": "~3.0.0", + "backo2": "~1.0.2", + "debug": "~4.3.2", + "engine.io-client": "~6.1.1", "parseuri": "0.0.6", - "socket.io-parser": "~3.3.0", - "to-array": "0.1.4" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0" - } + "socket.io-parser": "~4.1.1" } }, "socket.io-parser": { - "version": "3.3.2", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.1.2.tgz", + "integrity": "sha512-j3kk71QLJuyQ/hh5F/L2t1goqzdTL0gvDzuhTuNSwihfuFUrcSji0qFZmJJPtG6Rmug153eOPsUizeirf1IIog==", "requires": { - "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "isarray": "2.0.1" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "requires": { - "ms": "2.0.0" - } - }, - "isarray": { - "version": "2.0.1" - }, - "ms": { - "version": "2.0.0" - } + "@socket.io/component-emitter": "~3.0.0", + "debug": "~4.3.1" } }, "sort-keys": { @@ -24031,9 +23971,6 @@ "os-tmpdir": "~1.0.2" } }, - "to-array": { - "version": "0.1.4" - }, "to-arraybuffer": { "version": "1.0.1" }, @@ -25317,7 +25254,9 @@ } }, "xmlhttprequest-ssl": { - "version": "1.6.3" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==" }, "xstate": { "version": "4.30.6" @@ -25362,7 +25301,9 @@ } }, "yeast": { - "version": "0.1.2" + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" }, "yocto-queue": { "version": "0.1.0" diff --git a/packages/nc-gui/package.json b/packages/nc-gui/package.json index 50e5d91a67..67e5eb682c 100644 --- a/packages/nc-gui/package.json +++ b/packages/nc-gui/package.json @@ -29,12 +29,12 @@ "monaco-editor": "^0.19.3", "monaco-themes": "^0.2.5", "nano-assign": "^1.0.1", - "nocodb-sdk": "0.0.9", + "nocodb-sdk": "file:../nocodb-sdk", "nuxt": "^2.14.0", "odometer": "^0.4.8", "papaparse": "^5.3.1", "secure-ls": "^1.2.6", - "socket.io-client": "^2.3.0", + "socket.io-client": "^4.4.1", "splitpanes": "^2.2.1", "sql-formatter": "^2.3.3", "unique-names-generator": "^4.3.1", diff --git a/packages/nc-gui/pages/projects/list.vue b/packages/nc-gui/pages/projects/list.vue new file mode 100644 index 0000000000..66fb582761 --- /dev/null +++ b/packages/nc-gui/pages/projects/list.vue @@ -0,0 +1,229 @@ + + + + + diff --git a/packages/nc-gui/plugins/tele.js b/packages/nc-gui/plugins/tele.js index e810c4ff83..2d4244ddb2 100644 --- a/packages/nc-gui/plugins/tele.js +++ b/packages/nc-gui/plugins/tele.js @@ -9,31 +9,45 @@ export default function({ }, inject) { let socket - const init = () => { - if (socket) { return } + const init = async(token) => { + try { + if (socket) { + socket.disconnect() + } + const isUrl = $axios.defaults.baseURL.startsWith('http') + const url = isUrl ? $axios.defaults.baseURL : window.location.origin + const path = isUrl ? undefined : ($axios.defaults.baseURL === '..' ? window.location.pathname.split('/').slice(0, -1).join('/') : $axios.defaults.baseURL) - socket = io($axios.defaults.baseURL) + socket = io(url, { + path, + extraHeaders: { 'xc-auth': token } + }) - app.router.onReady(() => { - app.router.afterEach(function(to, from) { - if (to.path === from.path && (to.query && to.query.type) === (from.query && from.query.type)) { - return - } - socket.emit('page', { - id: store.state.users.user && store.state.users.user.id, - path: to.matched[0].path + (to.query && to.query.type ? `?type=${to.query.type}` : '') - }) + socket.on('connect_error', () => { + socket.disconnect() + socket = null }) + } catch { } + } + + app.router.onReady(() => { + app.router.afterEach(function(to, from) { + if (!socket || (to.path === from.path && (to.query && to.query.type) === (from.query && from.query.type))) { + return + } socket.emit('page', { id: store.state.users.user && store.state.users.user.id, - path: route.matched[0].path + (route.query && route.query.type ? `?type=${route.query.type}` : '') + path: to.matched[0].path + (to.query && to.query.type ? `?type=${to.query.type}` : '') }) }) + if (socket) { + socket.emit('page', { + id: store.state.users.user && store.state.users.user.id, + path: route.matched[0].path + (route.query && route.query.type ? `?type=${route.query.type}` : '') + }) + } + }) - // socket.on('connect_error', () => { - // socket.disconnect() - // }) - } const tele = { emit(evt, data) { if (socket) { @@ -51,11 +65,11 @@ export default function({ function getListener(binding) { return function(e) { + if (!socket) { return } const cat = window.location.hash.replace(/\d+\/(?=dashboard)/, '') const event = binding.value && binding.value[0] const data = binding.value && binding.value[1] const extra = binding.value && binding.value.slice(2) - tele.emit(event, { cat, @@ -75,10 +89,17 @@ export default function({ } }) - store.watch(state => state.project.projectInfo && state.project.projectInfo.teleEnabled, (value) => { - if (value) { init() } + store.watch(state => state.project.projectInfo && state.project.projectInfo.teleEnabled && state.users.token, (token) => { + if (token) { + init(token).then(() => {}) + } else if (socket) { + socket.disconnect() + socket = null + } }) - if (store.state.project.projectInfo && store.state.project.projectInfo.teleEnabled) { init() } + if (store.state.project.projectInfo && store.state.project.projectInfo.teleEnabled && store.state.users.token) { + init(store.state.users.token).then(() => {}) + } } function gatPath(app) { diff --git a/packages/nc-gui/store/project.js b/packages/nc-gui/store/project.js index 931fe19538..d43cb088af 100644 --- a/packages/nc-gui/store/project.js +++ b/packages/nc-gui/store/project.js @@ -192,10 +192,13 @@ export const getters = { return data }, GtrProjectName(state) { - return state.project && state.project.title// state.unserializedList && state.unserializedList[0] ? state.unserializedList[0].projectJson.title : "__project__"; + return state.project && state.project.title + }, + GtrProjectId(state) { + return state.project && state.project.id }, GtrProjectPrefix(state) { - return state.project && state.project.prefix//state.unserializedList && state.unserializedList[0] ? state.unserializedList[0].projectJson.prefix : null; + return state.project && state.project.prefix }, GtrApiEnvironment(state) { @@ -368,7 +371,6 @@ export const actions = { const tables = (await this.$api.dbTable.list( state.projectId, - state.project.bases[0].id, { includeM2M: rootState.windows.includeM2M || '' })).list diff --git a/packages/nocodb-sdk/package-lock.json b/packages/nocodb-sdk/package-lock.json index 433a4e01e6..5778a0a8c6 100644 --- a/packages/nocodb-sdk/package-lock.json +++ b/packages/nocodb-sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "nocodb-sdk", - "version": "0.0.6", + "version": "0.0.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "nocodb-sdk", - "version": "0.0.6", + "version": "0.0.9", "license": "MIT", "dependencies": { "axios": "^0.21.1", diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index a54c149304..6efcb4712f 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -34,6 +34,12 @@ export interface UserType { createDate?: string; } +export interface PageReqQueryParamsType { + offset?: number; + limit?: number; + query?: string; +} + export interface UserListType { users: { list: UserType; pageInfo: PaginatedType }; } @@ -944,27 +950,6 @@ export class Api< ...params, }), - /** - * No description - * - * @tags Auth - * @name TokenVerify - * @summary Password Verify - * @request POST:/auth/token/verify - * @response `200` `void` OK - */ - tokenVerify: ( - data: { token?: string; email?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/auth/token/verify`, - method: 'POST', - body: data, - type: ContentType.Json, - ...params, - }), - /** * No description * @@ -987,7 +972,7 @@ export class Api< * @tags Auth * @name ProjectUserList * @summary Project Users - * @request GET:/projects/{projectId}/users + * @request GET:/api/v1/db/meta/projects/{projectId}/users * @response `200` `{ users?: { list: (UserType)[], pageInfo: PaginatedType } }` OK */ projectUserList: (projectId: string, params: RequestParams = {}) => @@ -995,7 +980,7 @@ export class Api< { users?: { list: UserType[]; pageInfo: PaginatedType } }, any >({ - path: `/projects/${projectId}/users`, + path: `/api/v1/db/meta/projects/${projectId}/users`, method: 'GET', format: 'json', ...params, @@ -1007,7 +992,7 @@ export class Api< * @tags Auth * @name ProjectUserAdd * @summary Project User Add - * @request POST:/projects/{projectId}/users + * @request POST:/api/v1/db/meta/projects/{projectId}/users * @response `200` `any` OK */ projectUserAdd: ( @@ -1016,7 +1001,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/users`, + path: `/api/v1/db/meta/projects/${projectId}/users`, method: 'POST', body: data, type: ContentType.Json, @@ -1030,7 +1015,7 @@ export class Api< * @tags Auth * @name ProjectUserUpdate * @summary Project User Update - * @request PUT:/projects/{projectId}/users/{userId} + * @request PATCH:/api/v1/db/meta/projects/{projectId}/users/{userId} * @response `200` `any` OK */ projectUserUpdate: ( @@ -1040,8 +1025,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/users/${userId}`, - method: 'PUT', + path: `/api/v1/db/meta/projects/${projectId}/users/${userId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -1054,7 +1039,7 @@ export class Api< * @tags Auth * @name ProjectUserRemove * @summary Project User Remove - * @request DELETE:/projects/{projectId}/users/{userId} + * @request DELETE:/api/v1/db/meta/projects/{projectId}/users/{userId} * @response `200` `any` OK */ projectUserRemove: ( @@ -1063,7 +1048,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/users/${userId}`, + path: `/api/v1/db/meta/projects/${projectId}/users/${userId}`, method: 'DELETE', format: 'json', ...params, @@ -1076,7 +1061,7 @@ export class Api< * @tags Project * @name MetaGet * @summary Project Info - * @request GET:/projects/{projectId}/info + * @request GET:/api/v1/db/meta/projects/{projectId}/info * @response `200` `{ Node?: string, Arch?: string, Platform?: string, Docker?: boolean, Database?: string, ProjectOnRootDB?: string, RootDB?: string, PackageVersion?: string }` OK */ metaGet: (projectId: string, params: RequestParams = {}) => @@ -1093,7 +1078,7 @@ export class Api< }, any >({ - path: `/projects/${projectId}/info`, + path: `/api/v1/db/meta/projects/${projectId}/info`, method: 'GET', format: 'json', ...params, @@ -1105,7 +1090,7 @@ export class Api< * @tags Project * @name ModelVisibilityList * @summary UI ACL - * @request GET:/projects/{projectId}/modelVisibility + * @request GET:/api/v1/db/meta/projects/{projectId}/visibility-rules * @response `200` `(any)[]` OK */ modelVisibilityList: ( @@ -1114,7 +1099,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/modelVisibility`, + path: `/api/v1/db/meta/projects/${projectId}/visibility-rules`, method: 'GET', query: query, format: 'json', @@ -1126,7 +1111,7 @@ export class Api< * * @tags Project * @name ModelVisibilitySet - * @request POST:/projects/{projectId}/modelVisibility + * @request POST:/api/v1/db/meta/projects/{projectId}/visibility-rules * @response `200` `any` OK */ modelVisibilitySet: ( @@ -1135,7 +1120,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/modelVisibility`, + path: `/api/v1/db/meta/projects/${projectId}/visibility-rules`, method: 'POST', body: data, type: ContentType.Json, @@ -1148,7 +1133,7 @@ export class Api< * * @tags Project * @name List - * @request GET:/projects/ + * @request GET:/api/v1/db/meta/projects/ * @response `201` `ProjectListType` */ list: ( @@ -1156,7 +1141,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/`, + path: `/api/v1/db/meta/projects/`, method: 'GET', query: query, ...params, @@ -1167,7 +1152,7 @@ export class Api< * * @tags Project * @name Create - * @request POST:/projects/ + * @request POST:/api/v1/db/meta/projects/ * @response `200` `ProjectType` OK */ create: ( @@ -1175,7 +1160,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/`, + path: `/api/v1/db/meta/projects/`, method: 'POST', body: data, type: ContentType.Json, @@ -1188,12 +1173,12 @@ export class Api< * * @tags Project * @name Read - * @request GET:/projects/{projectId} + * @request GET:/api/v1/db/meta/projects/{projectId} * @response `200` `object` OK */ read: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}`, + path: `/api/v1/db/meta/projects/${projectId}`, method: 'GET', format: 'json', ...params, @@ -1204,12 +1189,12 @@ export class Api< * * @tags Project * @name Delete - * @request DELETE:/projects/{projectId} + * @request DELETE:/api/v1/db/meta/projects/{projectId} * @response `200` `void` OK */ delete: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}`, + path: `/api/v1/db/meta/projects/${projectId}`, method: 'DELETE', ...params, }), @@ -1219,12 +1204,12 @@ export class Api< * * @tags Project * @name SharedBaseGet - * @request GET:/projects/{projectId}/sharedBase + * @request GET:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `{ uuid?: string, url?: string }` OK */ sharedBaseGet: (projectId: string, params: RequestParams = {}) => this.request<{ uuid?: string; url?: string }, any>({ - path: `/projects/${projectId}/sharedBase`, + path: `/api/v1/db/meta/projects/${projectId}/shared`, method: 'GET', format: 'json', ...params, @@ -1235,12 +1220,12 @@ export class Api< * * @tags Project * @name SharedBaseDisable - * @request DELETE:/projects/{projectId}/sharedBase + * @request DELETE:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `void` OK */ sharedBaseDisable: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/sharedBase`, + path: `/api/v1/db/meta/projects/${projectId}/shared`, method: 'DELETE', ...params, }), @@ -1250,7 +1235,7 @@ export class Api< * * @tags Project * @name SharedBaseCreate - * @request POST:/projects/{projectId}/sharedBase + * @request POST:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `{ url?: string, uuid?: string }` OK */ sharedBaseCreate: ( @@ -1259,7 +1244,7 @@ export class Api< params: RequestParams = {} ) => this.request<{ url?: string; uuid?: string }, any>({ - path: `/projects/${projectId}/sharedBase`, + path: `/api/v1/db/meta/projects/${projectId}/shared`, method: 'POST', body: data, type: ContentType.Json, @@ -1272,7 +1257,7 @@ export class Api< * * @tags Project * @name SharedBaseUpdate - * @request PUT:/projects/{projectId}/sharedBase + * @request PATCH:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `void` OK */ sharedBaseUpdate: ( @@ -1281,8 +1266,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/sharedBase`, - method: 'PUT', + path: `/api/v1/db/meta/projects/${projectId}/shared`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -1293,12 +1278,12 @@ export class Api< * * @tags Project * @name MetaDiffSync - * @request POST:/projects/{projectId}/metaDiff + * @request POST:/api/v1/db/meta/projects/{projectId}/meta-diff * @response `200` `any` OK */ metaDiffSync: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/metaDiff`, + path: `/api/v1/db/meta/projects/${projectId}/meta-diff`, method: 'POST', format: 'json', ...params, @@ -1309,12 +1294,12 @@ export class Api< * * @tags Project * @name MetaDiffGet - * @request GET:/projects/{projectId}/metaDiff + * @request GET:/api/v1/db/meta/projects/{projectId}/meta-diff * @response `200` `any` OK */ metaDiffGet: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/metaDiff`, + path: `/api/v1/db/meta/projects/${projectId}/meta-diff`, method: 'GET', format: 'json', ...params, @@ -1325,7 +1310,7 @@ export class Api< * * @tags Project * @name AuditList - * @request GET:project/{projectId}/audits + * @request GET:/api/v1/db/meta/project/{projectId}/audits * @response `200` `{ list: (AuditType)[], pageInfo: PaginatedType }` OK */ auditList: ( @@ -1334,48 +1319,30 @@ export class Api< params: RequestParams = {} ) => this.request<{ list: AuditType[]; pageInfo: PaginatedType }, any>({ - path: `project/${projectId}/audits`, + path: `/api/v1/db/meta/project/${projectId}/audits`, method: 'GET', query: query, format: 'json', ...params, }), }; - public = { - /** - * @description Read project details - * - * @tags Public - * @name SharedBaseGet - * @request GET:/public/sharedBase/{sharedBaseUuid} - * @response `200` `{ project_id?: string }` OK - */ - sharedBaseGet: (sharedBaseUuid: string, params: RequestParams = {}) => - this.request<{ project_id?: string }, any>({ - path: `/public/sharedBase/${sharedBaseUuid}`, - method: 'GET', - format: 'json', - ...params, - }), - + dbTable = { /** * No description * - * @tags Public - * @name DataList - * @request POST:/public/data/{uuid}/list - * @response `200` `any` OK + * @tags DB Table + * @name Create + * @request POST:/api/v1/db/meta/projects/{projectId}/tables + * @response `200` `TableType` OK */ - dataList: ( - uuid: string, - data: { password?: string; sorts?: SortType[]; filters?: FilterType[] }, - query?: { limit?: string; offset?: string }, + create: ( + projectId: string, + data: TableReqType, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/list`, + this.request({ + path: `/api/v1/db/meta/projects/${projectId}/tables`, method: 'POST', - query: query, body: data, type: ContentType.Json, format: 'json', @@ -1385,47 +1352,40 @@ export class Api< /** * No description * - * @tags Public - * @name DataNestedList - * @request GET:/public/data/{uuid}/{rowId}/{relationType}/{columnId} - * @response `200` `any` OK + * @tags DB Table + * @name List + * @request GET:/api/v1/db/meta/projects/{projectId}/tables + * @response `200` `TableListType` */ - dataNestedList: ( - uuid: string, - rowId: string, - relationType: 'mm' | 'hm', - columnId: string, - query?: { limit?: string; offset?: string }, + list: ( + projectId: string, + query?: { + page?: number; + pageSize?: number; + sort?: string; + includeM2M?: boolean; + }, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/${rowId}/${relationType}/${columnId}`, + this.request({ + path: `/api/v1/db/meta/projects/${projectId}/tables`, method: 'GET', query: query, - format: 'json', ...params, }), /** * No description * - * @tags Public - * @name DataNestedExcludedList - * @request GET:/public/data/{uuid}/{rowId}/{relationType}/{columnId}/exclude - * @response `200` `any` OK + * @tags DB Table + * @name Read + * @request GET:/api/v1/db/meta/tables/{tableId} + * @response `200` `TableInfoType` OK */ - dataNestedExcludedList: ( - uuid: string, - rowId: string, - relationType: 'mm' | 'hm', - columnId: string, - query?: { limit?: string; offset?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/public/data/${uuid}/${rowId}/${relationType}/${columnId}/exclude`, + read: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}`, method: 'GET', - query: query, format: 'json', ...params, }), @@ -1433,21 +1393,21 @@ export class Api< /** * No description * - * @tags Public - * @name DataCreate - * @request POST:/public/data/{uuid}/create + * @tags DB Table + * @name Update + * @request PATCH:/api/v1/db/meta/tables/{tableId} * @response `200` `any` OK */ - dataCreate: ( - uuid: string, - data: { data?: any; password?: string }, + update: ( + tableId: string, + data: { title?: string }, params: RequestParams = {} ) => this.request({ - path: `/public/data/${uuid}/create`, - method: 'POST', + path: `/api/v1/db/meta/tables/${tableId}`, + method: 'PATCH', body: data, - type: ContentType.FormData, + type: ContentType.Json, format: 'json', ...params, }), @@ -1455,93 +1415,128 @@ export class Api< /** * No description * - * @tags Public - * @name CsvExport - * @request POST:/public/data/{uuid}/export/{type} - * @response `200` `any` OK + * @tags DB Table + * @name Delete + * @request DELETE:/api/v1/db/meta/tables/{tableId} + * @response `200` `void` OK */ - csvExport: ( - uuid: string, - type: 'csv' | 'excel', - data: { password?: string; filters?: FilterType[]; sorts?: SortType[] }, + delete: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}`, + method: 'DELETE', + ...params, + }), + + /** + * No description + * + * @tags DB Table + * @name Reorder + * @request POST:/api/v1/db/meta/tables/{tableId}/reorder + * @response `200` `void` OK + */ + reorder: ( + tableId: string, + data: { order?: string }, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/export/${type}`, + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/reorder`, method: 'POST', body: data, type: ContentType.Json, - wrapped: true, ...params, }), - + }; + dbTableColumn = { /** * No description * - * @tags Public - * @name DataRelationList - * @request POST:/public/data/{uuid}/relationTable/{relationColumnId} - * @response `200` `any` OK + * @tags DB Table column + * @name Create + * @summary Column create + * @request POST:/api/v1/db/meta/tables/{tableId}/columns + * @response `200` `void` OK */ - dataRelationList: ( - uuid: string, - relationColumnId: string, - data: { password?: string }, - query?: { limit?: string; offset?: string }, + create: ( + tableId: string, + data: ColumnReqType, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/relationTable/${relationColumnId}`, + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/columns`, method: 'POST', - query: query, body: data, type: ContentType.Json, - format: 'json', ...params, }), /** * No description * - * @tags Public - * @name SharedViewMetaGet - * @request POST:/public/meta/{uuid} - * @response `200` `object` OK + * @tags DB Table column + * @name Update + * @summary Column Update + * @request PATCH:/api/v1/db/meta/columns/{columnId} + * @response `200` `ColumnType` OK */ - sharedViewMetaGet: ( - uuid: string, - data: { password?: string }, + update: ( + columnId: string, + data: ColumnReqType, params: RequestParams = {} ) => - this.request({ - path: `/public/meta/${uuid}`, - method: 'POST', + this.request({ + path: `/api/v1/db/meta/columns/${columnId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', ...params, }), + + /** + * No description + * + * @tags DB Table column + * @name Delete + * @request DELETE:/api/v1/db/meta/columns/{columnId} + * @response `200` `void` OK + */ + delete: (columnId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/columns/${columnId}`, + method: 'DELETE', + ...params, + }), + + /** + * No description + * + * @tags DB Table column + * @name PrimaryColumnSet + * @request POST:/api/v1/db/meta/columns/{columnId}/primary + * @response `200` `void` OK + */ + primaryColumnSet: (columnId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/columns/${columnId}/primary`, + method: 'POST', + ...params, + }), }; dbView = { /** * No description * * @tags DB View - * @name Upload - * @summary Attachment - * @request POST:/projects/{projectId}/views/{viewId}/upload + * @name List + * @request GET:/api/v1/db/meta/tables/{tableId}/views + * @response `200` `ViewListType` */ - upload: ( - projectId: string, - viewId: string, - data: { files?: any; json?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/projects/${projectId}/views/${viewId}/upload`, - method: 'POST', - body: data, - type: ContentType.FormData, + list: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/views`, + method: 'GET', ...params, }), @@ -1550,7 +1545,7 @@ export class Api< * * @tags DB View * @name Update - * @request PUT:/views/{viewId} + * @request PATCH:/api/v1/db/meta/views/{viewId} * @response `200` `void` OK */ update: ( @@ -1564,8 +1559,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/views/${viewId}`, - method: 'PUT', + path: `/api/v1/db/meta/views/${viewId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -1576,12 +1571,12 @@ export class Api< * * @tags DB View * @name Delete - * @request DELETE:/views/{viewId} + * @request DELETE:/api/v1/db/meta/views/{viewId} * @response `200` `void` OK */ delete: (viewId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}`, + path: `/api/v1/db/meta/views/${viewId}`, method: 'DELETE', ...params, }), @@ -1591,7 +1586,7 @@ export class Api< * * @tags DB View * @name ShowAllColumn - * @request POST:/views/{viewId}/showAll + * @request POST:/api/v1/db/meta/views/{viewId}/show-all * @response `200` `void` OK */ showAllColumn: ( @@ -1600,7 +1595,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/views/${viewId}/showAll`, + path: `/api/v1/db/meta/views/${viewId}/show-all`, method: 'POST', query: query, ...params, @@ -1611,7 +1606,7 @@ export class Api< * * @tags DB View * @name HideAllColumn - * @request POST:/views/{viewId}/hideAll + * @request POST:/api/v1/db/meta/views/{viewId}/hide-all * @response `200` `void` OK */ hideAllColumn: ( @@ -1620,7 +1615,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/views/${viewId}/hideAll`, + path: `/api/v1/db/meta/views/${viewId}/hide-all`, method: 'POST', query: query, ...params, @@ -1631,12 +1626,12 @@ export class Api< * * @tags DB View * @name GridCreate - * @request POST:/tables/{tableId}/grids + * @request POST:/api/v1/db/meta/tables/{tableId}/grids * @response `200` `GridType` OK */ gridCreate: (tableId: string, data: GridType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/grids`, + path: `/api/v1/db/meta/tables/${tableId}/grids`, method: 'POST', body: data, type: ContentType.Json, @@ -1644,62 +1639,17 @@ export class Api< ...params, }), - /** - * No description - * - * @tags DB View - * @name GridUpdate - * @request PUT:/tables/{tableId}/grids/{gridId} - * @response `200` `void` OK - */ - gridUpdate: (tableId: string, gridId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/grids/${gridId}`, - method: 'PUT', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name GridDelete - * @request DELETE:/tables/{tableId}/grids/{gridId} - * @response `200` `void` OK - */ - gridDelete: (tableId: string, gridId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/grids/${gridId}`, - method: 'DELETE', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name GridRead - * @request GET:/tables/{tableId}/grids/{gridId} - * @response `200` `void` OK - */ - gridRead: (tableId: string, gridId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/grids/${gridId}`, - method: 'GET', - ...params, - }), - /** * No description * * @tags DB View * @name FormCreate - * @request POST:/tables/{tableId}/forms + * @request POST:/api/v1/db/meta/tables/{tableId}/forms * @response `200` `FormType` OK */ formCreate: (tableId: string, data: FormType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/forms`, + path: `/api/v1/db/meta/tables/${tableId}/forms`, method: 'POST', body: data, type: ContentType.Json, @@ -1712,13 +1662,13 @@ export class Api< * * @tags DB View * @name FormUpdate - * @request PUT:/forms/{formId} + * @request PATCH:/api/v1/db/meta/forms/{formId} * @response `200` `void` OK */ formUpdate: (formId: string, data: FormType, params: RequestParams = {}) => this.request({ - path: `/forms/${formId}`, - method: 'PUT', + path: `/api/v1/db/meta/forms/${formId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -1729,12 +1679,12 @@ export class Api< * * @tags DB View * @name FormRead - * @request GET:/forms/{formId} + * @request GET:/api/v1/db/meta/forms/{formId} * @response `200` `FormType` OK */ formRead: (formId: string, params: RequestParams = {}) => this.request({ - path: `/forms/${formId}`, + path: `/api/v1/db/meta/forms/${formId}`, method: 'GET', format: 'json', ...params, @@ -1745,17 +1695,17 @@ export class Api< * * @tags DB View * @name FormColumnUpdate - * @request PUT:/formColumns/{columnId} + * @request PATCH:/api/v1/db/meta/form-columns/{formViewColumnId} * @response `200` `any` OK */ formColumnUpdate: ( - columnId: string, + formViewColumnId: string, data: FormColumnType, params: RequestParams = {} ) => this.request({ - path: `/formColumns/${columnId}`, - method: 'PUT', + path: `/api/v1/db/meta/form-columns/${formViewColumnId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -1767,12 +1717,12 @@ export class Api< * * @tags DB View * @name GridColumnsList - * @request GET:/grid/{gidId}/gridColumns + * @request GET:/api/v1/db/meta/grids/{gridId}/grid-columns * @response `200` `(GridColumnType)[]` OK */ - gridColumnsList: (gidId: string, params: RequestParams = {}) => + gridColumnsList: (gridId: string, params: RequestParams = {}) => this.request({ - path: `/grid/${gidId}/gridColumns`, + path: `/api/v1/db/meta/grids/${gridId}/grid-columns`, method: 'GET', format: 'json', ...params, @@ -1783,7 +1733,7 @@ export class Api< * * @tags DB View * @name GridColumnUpdate - * @request PUT:/gridColumns/{columnId} + * @request PATCH:/api/v1/db/meta/grid-columns/{columnId} * @response `200` `any` OK */ gridColumnUpdate: ( @@ -1792,8 +1742,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/gridColumns/${columnId}`, - method: 'PUT', + path: `/api/v1/db/meta/grid-columns/${columnId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -1805,7 +1755,7 @@ export class Api< * * @tags DB View * @name GalleryCreate - * @request POST:/tables/{tableId}/galleries + * @request POST:/api/v1/db/meta/tables/{tableId}/galleries * @response `200` `object` OK */ galleryCreate: ( @@ -1814,7 +1764,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/tables/${tableId}/galleries`, + path: `/api/v1/db/meta/tables/${tableId}/galleries`, method: 'POST', body: data, type: ContentType.Json, @@ -1827,7 +1777,7 @@ export class Api< * * @tags DB View * @name GalleryUpdate - * @request PUT:/galleries/{galleryId} + * @request PATCH:/api/v1/db/meta/galleries/{galleryId} * @response `200` `void` OK */ galleryUpdate: ( @@ -1836,192 +1786,42 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/galleries/${galleryId}`, - method: 'PUT', + path: `/api/v1/db/meta/galleries/${galleryId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, }), - /** - * No description - * - * @tags DB View - * @name GalleryDelete - * @request DELETE:/galleries/{galleryId} - * @response `200` `void` OK - */ - galleryDelete: (galleryId: string, params: RequestParams = {}) => - this.request({ - path: `/galleries/${galleryId}`, - method: 'DELETE', - ...params, - }), - /** * No description * * @tags DB View * @name GalleryRead - * @request GET:/galleries/{galleryId} + * @request GET:/api/v1/db/meta/galleries/{galleryId} * @response `200` `GalleryType` OK */ galleryRead: (galleryId: string, params: RequestParams = {}) => this.request({ - path: `/galleries/${galleryId}`, + path: `/api/v1/db/meta/galleries/${galleryId}`, method: 'GET', format: 'json', ...params, }), - + }; + dbViewShare = { /** * No description * - * @tags DB View - * @name KanbanCreate - * @request POST:/tables/{tableId}/kanbans - * @response `200` `void` OK - */ - kanbanCreate: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/kanbans`, - method: 'POST', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name KanbanUpdate - * @request PUT:/tables/{tableId}/kanbans/{kanbanId} - * @response `200` `void` OK - */ - kanbanUpdate: ( - tableId: string, - kanbanId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/kanbans/${kanbanId}`, - method: 'PUT', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name KanbanDelete - * @request DELETE:/tables/{tableId}/kanbans/{kanbanId} - * @response `200` `void` OK - */ - kanbanDelete: ( - tableId: string, - kanbanId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/kanbans/${kanbanId}`, - method: 'DELETE', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name KanbanRead - * @request GET:/tables/{tableId}/kanbans/{kanbanId} - * @response `200` `void` OK - */ - kanbanRead: ( - tableId: string, - kanbanId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/kanbans/${kanbanId}`, - method: 'GET', - ...params, - }), - - /** - * No description - * - * @tags DB View + * @tags DB View Share * @name List - * @request GET:/tables/{tableId}/views - * @response `200` `ViewListType` + * @summary Shared view list + * @request GET:/api/v1/db/meta/tables/{tableId}/share + * @response `200` `(any)[]` OK */ list: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/views`, - method: 'GET', - ...params, - }), - }; - dbTable = { - /** - * No description - * - * @tags DB Table - * @name Create - * @request POST:/projects/{projectId}/{baseId}/tables - * @response `200` `TableType` OK - */ - create: ( - projectId: string, - baseId: string, - data: TableReqType, - params: RequestParams = {} - ) => - this.request({ - path: `/projects/${projectId}/${baseId}/tables`, - method: 'POST', - body: data, - type: ContentType.Json, - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB Table - * @name List - * @request GET:/projects/{projectId}/{baseId}/tables - * @response `200` `TableListType` - */ - list: ( - projectId: string, - baseId: string, - query?: { - page?: number; - pageSize?: number; - sort?: string; - includeM2M?: boolean; - }, - params: RequestParams = {} - ) => - this.request({ - path: `/projects/${projectId}/${baseId}/tables`, - method: 'GET', - query: query, - ...params, - }), - - /** - * No description - * - * @tags DB Table - * @name Read - * @request GET:/tables/{tableId} - * @response `200` `TableInfoType` OK - */ - read: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}`, + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/share`, method: 'GET', format: 'json', ...params, @@ -2030,114 +1830,15 @@ export class Api< /** * No description * - * @tags DB Table - * @name Update - * @request PUT:/tables/{tableId} - * @response `200` `any` OK - */ - update: ( - tableId: string, - data: { title?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}`, - method: 'PUT', - body: data, - type: ContentType.Json, - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB Table - * @name Delete - * @request DELETE:/tables/{tableId} - * @response `200` `void` OK - */ - delete: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}`, - method: 'DELETE', - ...params, - }), - - /** - * No description - * - * @tags DB Table - * @name Reorder - * @request POST:/tables/{tableId}/reorder - * @response `200` `void` OK - */ - reorder: ( - tableId: string, - data: { order?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/reorder`, - method: 'POST', - body: data, - type: ContentType.Json, - ...params, - }), - }; - dbTableColumn = { - /** - * @description Read project details - * - * @tags DB Table column - * @name List - * @summary Column List - * @request GET:/tables/{tableId}/columns - * @response `200` `ColumnListType` - * @response `201` `ColumnType` Created - */ - list: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/columns`, - method: 'GET', - ...params, - }), - - /** - * No description - * - * @tags DB Table column + * @tags DB View Share * @name Create - * @summary Column create - * @request POST:/tables/{tableId}/columns - * @response `200` `void` OK + * @request POST:/api/v1/db/meta/views/{viewId}/share + * @response `200` `{ uuid?: string }` OK */ - create: ( - tableId: string, - data: ColumnReqType, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/columns`, + create: (viewId: string, params: RequestParams = {}) => + this.request<{ uuid?: string }, any>({ + path: `/api/v1/db/meta/views/${viewId}/share`, method: 'POST', - body: data, - type: ContentType.Json, - ...params, - }), - - /** - * @description Read project details - * - * @tags DB Table column - * @name Read - * @summary Column Read - * @request GET:/tables/{tableId}/columns/{columnId} - * @response `200` `ColumnType` OK - */ - read: (tableId: string, columnId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/columns/${columnId}`, - method: 'GET', format: 'json', ...params, }), @@ -2145,21 +1846,19 @@ export class Api< /** * No description * - * @tags DB Table column + * @tags DB View Share * @name Update - * @summary Column Update - * @request PUT:/tables/{tableId}/columns/{columnId} - * @response `200` `ColumnType` OK + * @request PATCH:/api/v1/db/meta/views/{viewId}/share + * @response `200` `SharedViewType` OK */ update: ( - tableId: string, - columnId: string, - data: ColumnReqType, + viewId: string, + data: { password?: string }, params: RequestParams = {} ) => - this.request({ - path: `/tables/${tableId}/columns/${columnId}`, - method: 'PUT', + this.request({ + path: `/api/v1/db/meta/views/${viewId}/share`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -2169,174 +1868,69 @@ export class Api< /** * No description * - * @tags DB Table column + * @tags DB View Share * @name Delete - * @request DELETE:/tables/{tableId}/columns/{columnId} + * @request DELETE:/api/v1/db/meta/views/{viewId}/share * @response `200` `void` OK */ - delete: (tableId: string, columnId: string, params: RequestParams = {}) => + delete: (viewId: string, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/columns/${columnId}`, + path: `/api/v1/db/meta/views/${viewId}/share`, method: 'DELETE', ...params, }), - - /** - * No description - * - * @tags DB Table column - * @name PrimaryColumnSet - * @request POST:/tables/{tableId}/columns/{columnId}/primary - * @response `200` `void` OK - */ - primaryColumnSet: ( - tableId: string, - columnId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/columns/${columnId}/primary`, - method: 'POST', - ...params, - }), }; dbViewColumn = { /** * No description * - * @tags DB View Column - * @name List - * @request GET:/views/{viewId}/columns - */ - list: (viewId: string, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/columns`, - method: 'GET', - ...params, - }), - - /** - * No description - * - * @tags DB View Column - * @name Create - * @request POST:/views/{viewId}/columns - * @response `200` `void` OK - */ - create: (viewId: string, data: any, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/columns`, - method: 'POST', - body: data, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags DB View Column - * @name Read - * @request GET:/views/{viewId}/columns/{columnId} - * @response `200` `any` OK - */ - read: (viewId: string, columnId: string, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/columns/${columnId}`, - method: 'GET', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB View Column - * @name Update - * @request PUT:/views/{viewId}/columns/{columnId} - * @response `200` `void` OK - */ - update: ( - viewId: string, - columnId: string, - data: any, - params: RequestParams = {} - ) => - this.request({ - path: `/views/${viewId}/columns/${columnId}`, - method: 'PUT', - body: data, - type: ContentType.Json, - ...params, - }), - }; - dbViewShare = { - /** - * No description - * - * @tags DB View Share - * @name Create - * @request POST:/views/{viewId}/share - * @response `200` `{ uuid?: string }` OK - */ - create: (viewId: string, params: RequestParams = {}) => - this.request<{ uuid?: string }, any>({ - path: `/views/${viewId}/share`, - method: 'POST', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB View Share - * @name Update - * @request PUT:/views/{viewId}/share - * @response `200` `SharedViewType` OK - */ - update: ( - viewId: string, - data: { password?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/views/${viewId}/share`, - method: 'PUT', - body: data, - type: ContentType.Json, - format: 'json', + * @tags DB View Column + * @name List + * @request GET:/api/v1/db/meta/views/{viewId}/columns + */ + list: (viewId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/views/${viewId}/columns`, + method: 'GET', ...params, }), /** * No description * - * @tags DB View Share - * @name Delete - * @request DELETE:/views/{viewId}/share + * @tags DB View Column + * @name Create + * @request POST:/api/v1/db/meta/views/{viewId}/columns * @response `200` `void` OK */ - delete: (viewId: string, params: RequestParams = {}) => + create: (viewId: string, data: any, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/share`, - method: 'DELETE', + path: `/api/v1/db/meta/views/${viewId}/columns`, + method: 'POST', + body: data, + type: ContentType.Json, ...params, }), /** * No description * - * @tags DB View Share - * @name List - * @request GET:/tables/{viewId}/share - * @response `200` `(any)[]` OK + * @tags DB View Column + * @name Update + * @request PATCH:/api/v1/db/meta/views/{viewId}/columns/{columnId} + * @response `200` `void` OK */ - list: (viewId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${viewId}/share`, - method: 'GET', - format: 'json', + update: ( + viewId: string, + columnId: string, + data: any, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/meta/views/${viewId}/columns/${columnId}`, + method: 'PATCH', + body: data, + type: ContentType.Json, ...params, }), }; @@ -2346,12 +1940,12 @@ export class Api< * * @tags DB Table Sort * @name List - * @request GET:/views/{viewId}/sorts + * @request GET:/api/v1/db/meta/views/{viewId}/sorts * @response `200` `{ uuid?: string, url?: string }` OK */ list: (viewId: string, params: RequestParams = {}) => this.request<{ uuid?: string; url?: string }, any>({ - path: `/views/${viewId}/sorts`, + path: `/api/v1/db/meta/views/${viewId}/sorts`, method: 'GET', format: 'json', ...params, @@ -2362,12 +1956,12 @@ export class Api< * * @tags DB Table Sort * @name Create - * @request POST:/views/{viewId}/sorts + * @request POST:/api/v1/db/meta/views/{viewId}/sorts * @response `200` `void` OK */ create: (viewId: string, data: SortType, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/sorts`, + path: `/api/v1/db/meta/views/${viewId}/sorts`, method: 'POST', body: data, type: ContentType.Json, @@ -2379,12 +1973,12 @@ export class Api< * * @tags DB Table Sort * @name Get - * @request GET:/views/{viewId}/sorts/{sortId} + * @request GET:/api/v1/db/meta/sorts/{sortId} * @response `200` `SortType` OK */ - get: (viewId: string, sortId: string, params: RequestParams = {}) => + get: (sortId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/sorts/${sortId}`, + path: `/api/v1/db/meta/sorts/${sortId}`, method: 'GET', format: 'json', ...params, @@ -2395,18 +1989,13 @@ export class Api< * * @tags DB Table Sort * @name Update - * @request PUT:/views/{viewId}/sorts/{sortId} + * @request PATCH:/api/v1/db/meta/sorts/{sortId} * @response `200` `void` OK */ - update: ( - viewId: string, - sortId: string, - data: SortType, - params: RequestParams = {} - ) => + update: (sortId: string, data: SortType, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/sorts/${sortId}`, - method: 'PUT', + path: `/api/v1/db/meta/sorts/${sortId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -2417,12 +2006,12 @@ export class Api< * * @tags DB Table Sort * @name Delete - * @request DELETE:/views/{viewId}/sorts/{sortId} + * @request DELETE:/api/v1/db/meta/sorts/{sortId} * @response `200` `void` OK */ - delete: (viewId: string, sortId: string, params: RequestParams = {}) => + delete: (sortId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/sorts/${sortId}`, + path: `/api/v1/db/meta/sorts/${sortId}`, method: 'DELETE', ...params, }), @@ -2433,12 +2022,12 @@ export class Api< * * @tags DB Table Filter * @name Read - * @request GET:/views/{viewId}/filters + * @request GET:/api/v1/db/meta/views/{viewId}/filters * @response `200` `FilterListType` */ read: (viewId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters`, + path: `/api/v1/db/meta/views/${viewId}/filters`, method: 'GET', ...params, }), @@ -2448,12 +2037,12 @@ export class Api< * * @tags DB Table Filter * @name Create - * @request POST:/views/{viewId}/filters + * @request POST:/api/v1/db/meta/views/{viewId}/filters * @response `200` `void` OK */ create: (viewId: string, data: FilterType, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters`, + path: `/api/v1/db/meta/views/${viewId}/filters`, method: 'POST', body: data, type: ContentType.Json, @@ -2465,12 +2054,12 @@ export class Api< * * @tags DB Table Filter * @name Get - * @request GET:/views/{viewId}/filters/{filterId} + * @request GET:/api/v1/db/meta/filters/{filterId} * @response `200` `FilterType` OK */ - get: (viewId: string, filterId: string, params: RequestParams = {}) => + get: (filterId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterId}`, + path: `/api/v1/db/meta/filters/${filterId}`, method: 'GET', format: 'json', ...params, @@ -2481,18 +2070,13 @@ export class Api< * * @tags DB Table Filter * @name Update - * @request PUT:/views/{viewId}/filters/{filterId} + * @request PATCH:/api/v1/db/meta/filters/{filterId} * @response `200` `void` OK */ - update: ( - viewId: string, - filterId: string, - data: FilterType, - params: RequestParams = {} - ) => + update: (filterId: string, data: FilterType, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterId}`, - method: 'PUT', + path: `/api/v1/db/meta/filters/${filterId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -2503,12 +2087,12 @@ export class Api< * * @tags DB Table Filter * @name Delete - * @request DELETE:/views/{viewId}/filters/{filterId} + * @request DELETE:/api/v1/db/meta/filters/{filterId} * @response `200` `void` OK */ - delete: (viewId: string, filterId: string, params: RequestParams = {}) => + delete: (filterId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterId}`, + path: `/api/v1/db/meta/filters/${filterId}`, method: 'DELETE', ...params, }), @@ -2518,16 +2102,12 @@ export class Api< * * @tags DB Table Filter * @name ChildrenRead - * @request GET:/views/{viewId}/filters/{filterParentId}/children + * @request GET:/api/v1/db/meta/filters/{filterGroupId}/children * @response `200` `FilterType` OK */ - childrenRead: ( - viewId: string, - filterParentId: string, - params: RequestParams = {} - ) => + childrenRead: (filterGroupId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterParentId}/children`, + path: `/api/v1/db/meta/filters/${filterGroupId}/children`, method: 'GET', format: 'json', ...params, @@ -2539,12 +2119,12 @@ export class Api< * * @tags DB Table Webhook Filter * @name Read - * @request GET:/hooks/{hookId}/filters + * @request GET:/api/v1/db/meta/hooks/{hookId}/filters * @response `200` `FilterListType` */ read: (hookId: string, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}/filters`, + path: `/api/v1/db/meta/hooks/${hookId}/filters`, method: 'GET', ...params, }), @@ -2554,104 +2134,38 @@ export class Api< * * @tags DB Table Webhook Filter * @name Create - * @request POST:/hooks/{hookId}/filters + * @request POST:/api/v1/db/meta/hooks/{hookId}/filters * @response `200` `void` OK */ create: (hookId: string, data: FilterType, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}/filters`, + path: `/api/v1/db/meta/hooks/${hookId}/filters`, method: 'POST', body: data, type: ContentType.Json, ...params, }), - - /** - * No description - * - * @tags DB Table Webhook Filter - * @name Get - * @request GET:/hooks/{viewId}/filters/{filterId} - * @response `200` `FilterType` OK - */ - get: (viewId: string, filterId: string, params: RequestParams = {}) => - this.request({ - path: `/hooks/${viewId}/filters/${filterId}`, - method: 'GET', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB Table Webhook Filter - * @name Update - * @request PUT:/hooks/{viewId}/filters/{filterId} - * @response `200` `void` OK - */ - update: ( - viewId: string, - filterId: string, - data: FilterType, - params: RequestParams = {} - ) => - this.request({ - path: `/hooks/${viewId}/filters/${filterId}`, - method: 'PUT', - body: data, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags DB Table Webhook Filter - * @name Delete - * @request DELETE:/hooks/{viewId}/filters/{filterId} - * @response `200` `void` OK - */ - delete: (viewId: string, filterId: string, params: RequestParams = {}) => - this.request({ - path: `/hooks/${viewId}/filters/${filterId}`, - method: 'DELETE', - ...params, - }), - - /** - * No description - * - * @tags DB Table Webhook Filter - * @name ChildrenRead - * @request GET:/hooks/{viewId}/filters/{filterParentId}/children - * @response `200` `FilterType` OK - */ - childrenRead: ( - viewId: string, - filterParentId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/hooks/${viewId}/filters/${filterParentId}/children`, - method: 'GET', - format: 'json', - ...params, - }), }; - data = { + dbTableRow = { /** * No description * - * @tags Data + * @tags DB Table Row * @name List - * @request GET:/data/{tableId} + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName} * @response `200` `any` OK */ - list: (tableId: string, params: RequestParams = {}) => + list: ( + orgs: string, + projectName: string, + tableName: string, + query?: { fields?: any[]; sort?: any[]; where?: string }, + params: RequestParams = {} + ) => this.request({ - path: `/data/${tableId}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}`, method: 'GET', + query: query, format: 'json', ...params, }), @@ -2659,14 +2173,20 @@ export class Api< /** * No description * - * @tags Data + * @tags DB Table Row * @name Create - * @request POST:/data/{tableId} + * @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName} * @response `200` `any` OK */ - create: (tableId: string, data: any, params: RequestParams = {}) => + create: ( + orgs: string, + projectName: string, + tableName: string, + data: any, + params: RequestParams = {} + ) => this.request({ - path: `/data/${tableId}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}`, method: 'POST', body: data, type: ContentType.Json, @@ -2675,43 +2195,48 @@ export class Api< }), /** - * @description CSV or Excel export + * No description * - * @tags Data - * @name CsvExport - * @request GET:/data/{tableId}/export/{type} - * @response `200` `any` OK + * @tags DB Table Row + * @name Read + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} + * @response `201` `any` Created */ - csvExport: ( - tableId: string, - type: 'csv' | 'excel', + read: ( + orgs: string, + projectName: string, + tableName: string, + rowId: string, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/export/${type}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}`, method: 'GET', - wrapped: true, + format: 'json', ...params, }), /** * No description * - * @tags Data - * @name NestedList - * @request GET:/data/{tableId}/{rowId}/{relationType}/{colId} - * @response `201` `any` Created + * @tags DB Table Row + * @name Update + * @request PATCH:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} + * @response `200` `any` OK */ - nestedList: ( - tableId: string, + update: ( + orgs: string, + projectName: string, + tableName: string, rowId: string, - colId: string, - relationType: string, + data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}`, - method: 'GET', + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}`, + method: 'PATCH', + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -2719,44 +2244,44 @@ export class Api< /** * No description * - * @tags Data - * @name NestedExcludedList - * @request GET:/data/{tableId}/{rowId}/{relationType}/{colId}/exclude - * @response `201` `any` Created + * @tags DB Table Row + * @name ModelDelete + * @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} + * @response `200` `void` OK */ - nestedExcludedList: ( - tableId: string, + modelDelete: ( + orgs: string, + projectName: string, + tableName: string, rowId: string, - colId: string, - relationType: string, params: RequestParams = {} ) => - this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}/exclude`, - method: 'GET', - format: 'json', + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}`, + method: 'DELETE', ...params, }), /** * No description * - * @tags Data - * @name NestedAdd - * @request POST:/data/{tableId}/{rowId}/{relationType}/{colId}/{referenceTableRowId} - * @response `201` `any` Created + * @tags DB Table Row + * @name BulkCreate + * @request POST:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName} + * @response `200` `any` OK */ - nestedAdd: ( - tableId: string, - rowId: string, - colId: string, - relationType: string, - referenceTableRowId: string, + bulkCreate: ( + orgs: string, + projectName: string, + tableName: string, + data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}/${referenceTableRowId}`, + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}`, method: 'POST', + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -2764,37 +2289,51 @@ export class Api< /** * No description * - * @tags Data - * @name NestedDelete - * @request DELETE:/data/{tableId}/{rowId}/{relationType}/{colId}/{referenceTableRowId} - * @response `200` `void` OK + * @tags DB Table Row + * @name BulkCreate2 + * @request PATCH:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName} + * @originalName bulkCreate + * @duplicate + * @response `200` `any` OK */ - nestedDelete: ( - tableId: string, - rowId: string, - colId: string, - relationType: string, - referenceTableRowId: string, + bulkCreate2: ( + orgs: string, + projectName: string, + tableName: string, + data: any, params: RequestParams = {} ) => - this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}/${referenceTableRowId}`, - method: 'DELETE', + this.request({ + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}`, + method: 'PATCH', + body: data, + type: ContentType.Json, + format: 'json', ...params, }), /** * No description * - * @tags Data - * @name Read - * @request GET:/data/{tableId}/{rowId} - * @response `201` `any` Created + * @tags DB Table Row + * @name BulkCreate3 + * @request DELETE:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName} + * @originalName bulkCreate + * @duplicate + * @response `200` `any` OK */ - read: (tableId: string, rowId: string, params: RequestParams = {}) => + bulkCreate3: ( + orgs: string, + projectName: string, + tableName: string, + data: any, + params: RequestParams = {} + ) => this.request({ - path: `/data/${tableId}/${rowId}`, - method: 'GET', + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}`, + method: 'DELETE', + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -2802,20 +2341,23 @@ export class Api< /** * No description * - * @tags Data - * @name Update - * @request PUT:/data/{tableId}/{rowId} + * @tags DB Table Row + * @name Create2 + * @request PATCH:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all + * @originalName create + * @duplicate * @response `200` `any` OK */ - update: ( - tableId: string, - rowId: string, + create2: ( + orgs: string, + projectName: string, + tableName: string, data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/${rowId}`, - method: 'PUT', + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}/all`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -2825,62 +2367,73 @@ export class Api< /** * No description * - * @tags Data - * @name Delete - * @request DELETE:/data/{tableId}/{rowId} - * @response `200` `void` OK + * @tags DB Table Row + * @name Create3 + * @request DELETE:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all + * @originalName create + * @duplicate + * @response `200` `any` OK */ - delete: (tableId: string, rowId: string, params: RequestParams = {}) => - this.request({ - path: `/data/${tableId}/${rowId}`, + create3: ( + orgs: string, + projectName: string, + tableName: string, + data: any, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}/all`, method: 'DELETE', + body: data, + type: ContentType.Json, + format: 'json', ...params, }), - }; - dbTableRow = { + /** - * No description + * @description CSV or Excel export * - * @tags DB Table Row - * @name List - * @request GET:/data/{orgs}/{projectName}/{tableAlias} + * @tags DB table row + * @name CsvExport + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/export/{type} * @response `200` `any` OK */ - list: ( + csvExport: ( orgs: string, projectName: string, - tableAlias: string, - query?: { fields?: any[]; sort?: any[]; where?: string }, + tableName: string, + type: 'csv' | 'excel', params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/export/${type}`, method: 'GET', - query: query, - format: 'json', + wrapped: true, ...params, }), /** * No description * - * @tags DB Table Row - * @name Create - * @request POST:/data/{orgs}/{projectName}/{tableAlias} + * @tags DB table row + * @name NestedList + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName} * @response `200` `any` OK */ - create: ( + nestedList: ( orgs: string, projectName: string, - tableAlias: string, - data: any, + tableName: string, + rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}`, - method: 'POST', - body: data, - type: ContentType.Json, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}`, + method: 'GET', + query: query, format: 'json', ...params, }), @@ -2888,21 +2441,26 @@ export class Api< /** * No description * - * @tags DB Table Row - * @name Read - * @request GET:/data/{orgs}/{projectName}/{tableAlias}/{rowId} - * @response `201` `any` Created + * @tags DB table row + * @name NestedAdd + * @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId} + * @response `200` `any` OK */ - read: ( + nestedAdd: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + refRowId: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/${rowId}`, - method: 'GET', + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/${refRowId}`, + method: 'POST', + query: query, format: 'json', ...params, }), @@ -2910,24 +2468,24 @@ export class Api< /** * No description * - * @tags DB Table Row - * @name Update - * @request PUT:/data/{orgs}/{projectName}/{tableAlias}/{rowId} + * @tags DB table row + * @name NestedDelete + * @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId} * @response `200` `any` OK */ - update: ( + nestedDelete: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, rowId: string, - data: any, + relationType: 'mm' | 'hm', + columnName: string, + refRowId: string, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/${rowId}`, - method: 'PUT', - body: data, - type: ContentType.Json, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/${refRowId}`, + method: 'DELETE', format: 'json', ...params, }), @@ -2935,21 +2493,26 @@ export class Api< /** * No description * - * @tags DB Table Row - * @name ModelDelete - * @request DELETE:/data/{orgs}/{projectName}/{tableAlias}/{rowId} - * @response `200` `void` OK + * @tags DB table row + * @name NestedChildrenExcludedList + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude + * @response `200` `any` OK */ - modelDelete: ( + nestedChildrenExcludedList: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => - this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/${rowId}`, - method: 'DELETE', + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/exclude`, + method: 'GET', + query: query, + format: 'json', ...params, }), @@ -2958,18 +2521,18 @@ export class Api< * * @tags DB Table Row * @name BulkDelete - * @request DELETE:/bulkData/{orgs}/{projectName}/{tableAlias}/ + * @request DELETE:/bulkData/{orgs}/{projectName}/{tableName}/ * @response `200` `void` OK */ bulkDelete: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, data: any[], params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/`, + path: `/bulkData/${orgs}/${projectName}/${tableName}/`, method: 'DELETE', body: data, type: ContentType.Json, @@ -2981,18 +2544,18 @@ export class Api< * * @tags DB Table Row * @name BulkInsert - * @request POST:/bulkData/{orgs}/{projectName}/{tableAlias}/ + * @request POST:/bulkData/{orgs}/{projectName}/{tableName}/ * @response `200` `void` OK */ bulkInsert: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, data: any[], params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/`, + path: `/bulkData/${orgs}/${projectName}/${tableName}/`, method: 'POST', body: data, type: ContentType.Json, @@ -3004,18 +2567,18 @@ export class Api< * * @tags DB Table Row * @name BulkUpdate - * @request PATCH:/bulkData/{orgs}/{projectName}/{tableAlias}/ + * @request PATCH:/bulkData/{orgs}/{projectName}/{tableName}/ * @response `200` `any` OK */ bulkUpdate: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, data: object[], params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/`, + path: `/bulkData/${orgs}/${projectName}/${tableName}/`, method: 'PATCH', body: data, type: ContentType.Json, @@ -3028,19 +2591,19 @@ export class Api< * * @tags DB Table Row * @name BulkUpdateAll - * @request PATCH:/bulkData/{orgs}/{projectName}/{tableAlias}/all + * @request PATCH:/bulkData/{orgs}/{projectName}/{tableName}/all * @response `200` `any` OK */ bulkUpdateAll: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, data: object, query?: { where?: string }, params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/all`, + path: `/bulkData/${orgs}/${projectName}/${tableName}/all`, method: 'PATCH', query: query, body: data, @@ -3054,18 +2617,18 @@ export class Api< * * @tags DB Table Row * @name BulkDeleteAll - * @request DELETE:/bulkData/{orgs}/{projectName}/{tableAlias}/all + * @request DELETE:/bulkData/{orgs}/{projectName}/{tableName}/all * @response `200` `any` OK */ bulkDeleteAll: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, query?: { where?: string }, params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/all`, + path: `/bulkData/${orgs}/${projectName}/${tableName}/all`, method: 'DELETE', query: query, format: 'json', @@ -3078,19 +2641,19 @@ export class Api< * * @tags DB View Row * @name List - * @request GET:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName} + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName} * @response `200` `any` OK */ list: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, viewName: string, query?: { fields?: any[]; sort?: any[]; where?: string; nested?: any }, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}`, method: 'GET', query: query, format: 'json', @@ -3102,19 +2665,19 @@ export class Api< * * @tags DB View Row * @name Create - * @request POST:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName} + * @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName} * @response `200` `any` OK */ create: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, viewName: string, data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}`, method: 'POST', body: data, type: ContentType.Json, @@ -3151,19 +2714,19 @@ export class Api< * * @tags DB View Row * @name Read - * @request GET:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId} + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} * @response `201` `any` Created */ read: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, viewName: string, rowId: string, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}/${rowId}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/${rowId}`, method: 'GET', format: 'json', ...params, @@ -3174,21 +2737,21 @@ export class Api< * * @tags DB View Row * @name Update - * @request PUT:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId} + * @request PATCH:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} * @response `200` `any` OK */ update: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, viewName: string, rowId: string, data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}/${rowId}`, - method: 'PUT', + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/${rowId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -3200,22 +2763,187 @@ export class Api< * * @tags DB View Row * @name Delete - * @request DELETE:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId} + * @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} * @response `200` `void` OK */ delete: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, viewName: string, rowId: string, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}/${rowId}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/${rowId}`, method: 'DELETE', ...params, }), + + /** + * @description CSV or Excel export + * + * @tags DB view row + * @name Export + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/export/{type} + * @response `200` `any` OK + */ + export: ( + orgs: string, + projectName: string, + tableName: string, + viewName: string, + type: 'csv' | 'excel', + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/export/${type}`, + method: 'GET', + wrapped: true, + ...params, + }), + }; + public = { + /** + * No description + * + * @tags Public + * @name DataList + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows + * @response `200` `any` OK + */ + dataList: ( + sharedViewUuid: string, + query?: { limit?: string; offset?: string }, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows`, + method: 'GET', + query: query, + format: 'json', + ...params, + }), + + /** + * No description + * + * @tags Public + * @name DataCreate + * @request POST:/api/v1/db/public/shared-view/{sharedViewUuid}/rows + * @response `200` `any` OK + */ + dataCreate: ( + sharedViewUuid: string, + data: object, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows`, + method: 'POST', + body: data, + type: ContentType.FormData, + format: 'json', + ...params, + }), + + /** + * No description + * + * @tags Public + * @name DataNestedList + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName} + * @response `200` `any` OK + */ + dataNestedList: ( + sharedViewUuid: string, + rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + query?: { limit?: string; offset?: string }, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows/${rowId}/${relationType}/${columnName}`, + method: 'GET', + query: query, + format: 'json', + ...params, + }), + + /** + * No description + * + * @tags Public + * @name CsvExport + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/export/{type} + * @response `200` `any` OK + */ + csvExport: ( + sharedViewUuid: string, + type: 'csv' | 'excel', + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows/export/${type}`, + method: 'GET', + wrapped: true, + ...params, + }), + + /** + * No description + * + * @tags Public + * @name DataRelationList + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/nested/{columnName} + * @response `200` `any` OK + */ + dataRelationList: ( + sharedViewUuid: string, + columnName: string, + query?: { limit?: string; offset?: string }, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/nested/${columnName}`, + method: 'GET', + query: query, + format: 'json', + ...params, + }), + + /** + * No description + * + * @tags Public + * @name SharedViewMetaGet + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/meta + * @response `200` `object` OK + */ + sharedViewMetaGet: (sharedViewUuid: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/meta`, + method: 'GET', + format: 'json', + ...params, + }), + + /** + * @description Read project details + * + * @tags Public + * @name SharedBaseGet + * @request GET:/api/v1/db/public/shared-base/{sharedBaseUuid}/meta + * @response `200` `{ project_id?: string }` OK + */ + sharedBaseGet: (sharedBaseUuid: string, params: RequestParams = {}) => + this.request<{ project_id?: string }, any>({ + path: `/api/v1/db/public/shared-base/${sharedBaseUuid}/meta`, + method: 'GET', + format: 'json', + ...params, + }), }; utils = { /** @@ -3223,7 +2951,7 @@ export class Api< * * @tags Utils * @name CommentList - * @request GET:/audits/comments + * @request GET:/api/v1/db/meta/audits/comments * @response `201` `any` Created */ commentList: ( @@ -3231,7 +2959,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/comments`, + path: `/api/v1/db/meta/audits/comments`, method: 'GET', query: query, format: 'json', @@ -3243,7 +2971,7 @@ export class Api< * * @tags Utils * @name CommentRow - * @request POST:/audits/comments + * @request POST:/api/v1/db/meta/audits/comments * @response `200` `void` OK */ commentRow: ( @@ -3251,7 +2979,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/comments`, + path: `/api/v1/db/meta/audits/comments`, method: 'POST', body: data, type: ContentType.Json, @@ -3263,7 +2991,7 @@ export class Api< * * @tags Utils * @name CommentCount - * @request GET:/audits/comments/count + * @request GET:/api/v1/db/meta/audits/comments/count * @response `201` `any` Created */ commentCount: ( @@ -3271,7 +2999,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/comments/count`, + path: `/api/v1/db/meta/audits/comments/count`, method: 'GET', query: query, format: 'json', @@ -3283,10 +3011,11 @@ export class Api< * * @tags Utils * @name AuditRowUpdate - * @request POST:/audits/rowUpdate + * @request POST:/api/v1/db/meta/audits/rows/{rowId}/update * @response `200` `void` OK */ auditRowUpdate: ( + rowId: string, data: { fk_model_id?: string; column_name?: string; @@ -3297,7 +3026,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/rowUpdate`, + path: `/api/v1/db/meta/audits/rows/${rowId}/update`, method: 'POST', body: data, type: ContentType.Json, @@ -3309,12 +3038,12 @@ export class Api< * * @tags Utils * @name TestConnection - * @request POST:/testConnection + * @request POST:/api/v1/db/meta/connection/test * @response `200` `{ code?: number, message?: string }` OK */ testConnection: (data: any, params: RequestParams = {}) => this.request<{ code?: number; message?: string }, any>({ - path: `/testConnection`, + path: `/api/v1/db/meta/connection/test`, method: 'POST', body: data, type: ContentType.Json, @@ -3327,12 +3056,12 @@ export class Api< * * @tags Utils * @name AppInfo - * @request GET:/appInfo + * @request GET:/api/v1/db/meta/nocodb/info * @response `200` `any` OK */ appInfo: (params: RequestParams = {}) => this.request({ - path: `/appInfo`, + path: `/api/v1/db/meta/nocodb/info`, method: 'GET', format: 'json', ...params, @@ -3344,11 +3073,11 @@ export class Api< * @tags Utils * @name CacheGet * @summary Your GET endpoint - * @request GET:/cache + * @request GET:/api/v1/db/meta/cache */ cacheGet: (params: RequestParams = {}) => this.request({ - path: `/cache`, + path: `/api/v1/db/meta/cache`, method: 'GET', ...params, }), @@ -3358,12 +3087,12 @@ export class Api< * * @tags Utils * @name CacheDelete - * @request DELETE:/cache + * @request DELETE:/api/v1/db/meta/cache * @response `200` `void` OK */ cacheDelete: (params: RequestParams = {}) => this.request({ - path: `/cache`, + path: `/api/v1/db/meta/cache`, method: 'DELETE', ...params, }), @@ -3374,12 +3103,12 @@ export class Api< * * @tags DB Table Webhook * @name List - * @request GET:/tables/{tableId}/hooks + * @request GET:/api/v1/db/meta/tables/{tableId}/hooks * @response `200` `{ list: (HookType)[], pageInfo: PaginatedType }` OK */ list: (tableId: string, params: RequestParams = {}) => this.request<{ list: HookType[]; pageInfo: PaginatedType }, any>({ - path: `/tables/${tableId}/hooks`, + path: `/api/v1/db/meta/tables/${tableId}/hooks`, method: 'GET', format: 'json', ...params, @@ -3390,12 +3119,12 @@ export class Api< * * @tags DB Table Webhook * @name Create - * @request POST:/tables/{tableId}/hooks + * @request POST:/api/v1/db/meta/tables/{tableId}/hooks * @response `200` `AuditType` OK */ create: (tableId: string, data: AuditType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/hooks`, + path: `/api/v1/db/meta/tables/${tableId}/hooks`, method: 'POST', body: data, type: ContentType.Json, @@ -3408,7 +3137,7 @@ export class Api< * * @tags DB Table Webhook * @name Test - * @request POST:/tables/{tableId}/hooks/test + * @request POST:/api/v1/db/meta/tables/{tableId}/hooks/test * @response `200` `any` OK */ test: ( @@ -3417,7 +3146,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/tables/${tableId}/hooks/test`, + path: `/api/v1/db/meta/tables/${tableId}/hooks/test`, method: 'POST', body: data, type: ContentType.Json, @@ -3425,18 +3154,41 @@ export class Api< ...params, }), + /** + * No description + * + * @tags DB Table Webhook + * @name SamplePayloadGet + * @request GET:/api/v1/db/meta/tables/{tableId}/hooks/samplePayload/{operation} + * @response `200` `{ plugins?: { list: (PluginType)[], pageInfo: PaginatedType } }` OK + */ + samplePayloadGet: ( + tableId: string, + operation: 'update' | 'delete' | 'insert', + params: RequestParams = {} + ) => + this.request< + { plugins?: { list: PluginType[]; pageInfo: PaginatedType } }, + any + >({ + path: `/api/v1/db/meta/tables/${tableId}/hooks/samplePayload/${operation}`, + method: 'GET', + format: 'json', + ...params, + }), + /** * No description * * @tags DB Table Webhook * @name Update - * @request PUT:/hooks/{hookId} + * @request PATCH:/api/v1/db/meta/hooks/{hookId} * @response `200` `HookType` OK */ update: (hookId: string, data: HookType, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}`, - method: 'PUT', + path: `/api/v1/db/meta/hooks/${hookId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -3448,38 +3200,15 @@ export class Api< * * @tags DB Table Webhook * @name Delete - * @request DELETE:/hooks/{hookId} + * @request DELETE:/api/v1/db/meta/hooks/{hookId} * @response `200` `void` OK */ delete: (hookId: string, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}`, + path: `/api/v1/db/meta/hooks/${hookId}`, method: 'DELETE', ...params, }), - - /** - * No description - * - * @tags DB Table Webhook - * @name SamplePayloadGet - * @request GET:/tables/{tableId}/hooks/samplePayload/{operation} - * @response `200` `{ plugins?: { list: (PluginType)[], pageInfo: PaginatedType } }` OK - */ - samplePayloadGet: ( - tableId: string, - operation: 'update' | 'delete' | 'insert', - params: RequestParams = {} - ) => - this.request< - { plugins?: { list: PluginType[]; pageInfo: PaginatedType } }, - any - >({ - path: `/tables/${tableId}/hooks/samplePayload/${operation}`, - method: 'GET', - format: 'json', - ...params, - }), }; plugin = { /** @@ -3487,12 +3216,12 @@ export class Api< * * @tags Plugin * @name List - * @request GET:/plugins + * @request GET:/api/v1/db/meta/plugins * @response `200` `{ list?: (PluginType)[], pageInfo?: PaginatedType }` OK */ list: (params: RequestParams = {}) => this.request<{ list?: PluginType[]; pageInfo?: PaginatedType }, any>({ - path: `/plugins`, + path: `/api/v1/db/meta/plugins`, method: 'GET', format: 'json', ...params, @@ -3503,12 +3232,12 @@ export class Api< * * @tags Plugin * @name Status - * @request GET:/plugins/{pluginTitle}/status + * @request GET:/api/v1/db/meta/plugins/{pluginTitle}/status * @response `200` `boolean` OK */ status: (pluginTitle: string, params: RequestParams = {}) => this.request({ - path: `/plugins/${pluginTitle}/status`, + path: `/api/v1/db/meta/plugins/${pluginTitle}/status`, method: 'GET', format: 'json', ...params, @@ -3519,7 +3248,7 @@ export class Api< * * @tags Plugin * @name Test - * @request POST:/plugins/test + * @request POST:/api/v1/db/meta/plugins/test * @response `200` `any` OK * @response `400` `void` Bad Request * @response `401` `void` Unauthorized @@ -3529,7 +3258,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/plugins/test`, + path: `/api/v1/db/meta/plugins/test`, method: 'POST', body: data, type: ContentType.Json, @@ -3542,13 +3271,13 @@ export class Api< * * @tags Plugin * @name Update - * @request PUT:/plugins/{pluginId} + * @request PATCH:/api/v1/db/meta/plugins/{pluginId} * @response `200` `PluginType` OK */ update: (pluginId: string, data: PluginType, params: RequestParams = {}) => this.request({ - path: `/plugins/${pluginId}`, - method: 'PUT', + path: `/api/v1/db/meta/plugins/${pluginId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -3560,12 +3289,12 @@ export class Api< * * @tags Plugin * @name Read - * @request GET:/plugins/{pluginId} + * @request GET:/api/v1/db/meta/plugins/{pluginId} * @response `200` `PluginType` OK */ read: (pluginId: string, params: RequestParams = {}) => this.request({ - path: `/plugins/${pluginId}`, + path: `/api/v1/db/meta/plugins/${pluginId}`, method: 'GET', format: 'json', ...params, @@ -3578,12 +3307,12 @@ export class Api< * @tags Api token * @name List * @summary Your GET endpoint - * @request GET:/projects/{projectId}/apiTokens + * @request GET:/api/v1/db/meta/projects/{projectId}/api-tokens * @response `200` `(ApiTokenType)[]` OK */ list: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/apiTokens`, + path: `/api/v1/db/meta/projects/${projectId}/api-tokens`, method: 'GET', format: 'json', ...params, @@ -3594,7 +3323,7 @@ export class Api< * * @tags Api token * @name Create - * @request POST:/projects/{projectId}/apiTokens + * @request POST:/api/v1/db/meta/projects/{projectId}/api-tokens * @response `200` `void` OK * @response `201` `ApiTokenType` Created */ @@ -3604,7 +3333,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/apiTokens`, + path: `/api/v1/db/meta/projects/${projectId}/api-tokens`, method: 'POST', body: data, type: ContentType.Json, @@ -3616,14 +3345,37 @@ export class Api< * * @tags Api token * @name Delete - * @request DELETE:/projects/{projectId}/apiTokens/{token} + * @request DELETE:/api/v1/db/meta/projects/{projectId}/api-tokens/{token} * @response `200` `void` OK */ delete: (projectId: string, token: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/apiTokens/${token}`, + path: `/api/v1/db/meta/projects/${projectId}/api-tokens/${token}`, method: 'DELETE', ...params, }), }; + storage = { + /** + * No description + * + * @tags Storage + * @name Upload + * @summary Attachment + * @request POST:/api/v1/db/storage/upload + */ + upload: ( + query: { path: string }, + data: { files?: any; json?: string }, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/storage/upload`, + method: 'POST', + query: query, + body: data, + type: ContentType.FormData, + ...params, + }), + }; } diff --git a/packages/nocodb/package-lock.json b/packages/nocodb/package-lock.json index b20030b1da..80c1fde157 100644 --- a/packages/nocodb/package-lock.json +++ b/packages/nocodb/package-lock.json @@ -72,7 +72,7 @@ "nc-lib-gui": "0.84.15", "nc-plugin": "^0.1.1", "ncp": "^2.0.0", - "nocodb-sdk": "0.0.9", + "nocodb-sdk": "file:../nocodb-sdk", "nodemailer": "^6.4.10", "ora": "^4.0.4", "os-locale": "^5.0.0", @@ -91,7 +91,7 @@ "rmdir": "^1.2.0", "sha.js": "^2.4.11", "slash": "^3.0.0", - "socket.io": "^2.3.0", + "socket.io": "^4.4.1", "sqlite3": "5.0.0", "twilio": "^3.55.1", "unique-names-generator": "^4.3.1", @@ -227,6 +227,42 @@ "node": ">=8.9" } }, + "../nocodb-sdk": { + "version": "0.0.9", + "license": "MIT", + "dependencies": { + "axios": "^0.21.1", + "jsep": "^0.4.0" + }, + "devDependencies": { + "@ava/typescript": "^1.1.1", + "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@typescript-eslint/eslint-plugin": "^4.0.1", + "@typescript-eslint/parser": "^4.0.1", + "ava": "^3.12.1", + "codecov": "^3.5.0", + "cspell": "^4.1.0", + "cz-conventional-changelog": "^3.3.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", + "gh-pages": "^3.1.0", + "npm-run-all": "^4.1.5", + "nyc": "^15.1.0", + "open-cli": "^6.0.1", + "prettier": "^2.1.1", + "standard-version": "^9.0.0", + "ts-node": "^9.0.0", + "typedoc": "^0.19.0", + "typescript": "^4.0.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@assemblyscript/loader": { "version": "0.10.1", "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz", @@ -1681,6 +1717,14 @@ "node": ">=6" } }, + "node_modules/@socket.io/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/@stroncium/procfs": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz", @@ -1753,6 +1797,11 @@ "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", "dev": true }, + "node_modules/@types/component-emitter": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz", + "integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==" + }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -1762,12 +1811,22 @@ "@types/node": "*" } }, + "node_modules/@types/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" + }, "node_modules/@types/cookiejar": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz", "integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==", "dev": true }, + "node_modules/@types/cors": { + "version": "2.8.12", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz", + "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==" + }, "node_modules/@types/express": { "version": "4.17.13", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", @@ -15653,9 +15712,9 @@ } }, "node_modules/moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", + "version": "2.29.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.2.tgz", + "integrity": "sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg==", "engines": { "node": "*" } @@ -16193,16 +16252,8 @@ "dev": true }, "node_modules/nocodb-sdk": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.0.9.tgz", - "integrity": "sha512-MwvHh9WtplJtB2z41DbDUF09bYRLX4WBA+IytgPRWr5e3s8UEBzKZiKN7sLcVnmiY6a9ctT4Ad0CS4viwExoQw==", - "dependencies": { - "axios": "^0.21.1", - "jsep": "^0.4.0" - }, - "engines": { - "node": ">=10" - } + "resolved": "../nocodb-sdk", + "link": true }, "node_modules/node-addon-api": { "version": "2.0.0", @@ -20121,16 +20172,19 @@ } }, "node_modules/socket.io": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.4.1.tgz", - "integrity": "sha512-Si18v0mMXGAqLqCVpTxBa8MGqriHGQh8ccEOhmsmNS3thNCGBwO8WGrwMibANsWtQQ5NStdZwHqZR3naJVFc3w==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.1.tgz", + "integrity": "sha512-s04vrBswdQBUmuWJuuNTmXUVJhP0cVky8bBDhdkf8y0Ptsu7fKU2LuLbts9g+pdmAdyMMn8F/9Mf1/wbtUN0fg==", "dependencies": { - "debug": "~4.1.0", - "engine.io": "~3.5.0", - "has-binary2": "~1.0.2", - "socket.io-adapter": "~1.1.0", - "socket.io-client": "2.4.0", - "socket.io-parser": "~3.4.0" + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "debug": "~4.3.2", + "engine.io": "~6.1.0", + "socket.io-adapter": "~2.3.3", + "socket.io-parser": "~4.0.4" + }, + "engines": { + "node": ">=10.0.0" } }, "node_modules/socket.io-adapter": { @@ -20238,124 +20292,61 @@ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, - "node_modules/socket.io/node_modules/debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", - "dependencies": { - "ms": "^2.1.1" - } - }, "node_modules/socket.io/node_modules/engine.io": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.5.0.tgz", - "integrity": "sha512-21HlvPUKaitDGE4GXNtQ7PLP0Sz4aWLddMPw2VTyFz1FVZqu/kZsJUO8WNpKuE/OCL7nkfRaOui2ZCJloGznGA==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.3.tgz", + "integrity": "sha512-rqs60YwkvWTLLnfazqgZqLa/aKo+9cueVfEi/dZ8PyGyaf8TLOxj++4QMIgeG3Gn0AhrWiFXvghsoY9L9h25GA==", "dependencies": { + "@types/cookie": "^0.4.1", + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", "accepts": "~1.3.4", "base64id": "2.0.0", "cookie": "~0.4.1", - "debug": "~4.1.0", - "engine.io-parser": "~2.2.0", - "ws": "~7.4.2" + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.0.3", + "ws": "~8.2.3" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/socket.io/node_modules/engine.io-client": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.2.tgz", - "integrity": "sha512-QEqIp+gJ/kMHeUun7f5Vv3bteRHppHH/FMBQX/esFj/fuYfjyUKWGMo3VCvIP/V8bE9KcjHmRZrhIz2Z9oNsDA==", - "dependencies": { - "component-emitter": "~1.3.0", - "component-inherit": "0.0.3", - "debug": "~3.1.0", - "engine.io-parser": "~2.2.0", - "has-cors": "1.1.0", - "indexof": "0.0.1", - "parseqs": "0.0.6", - "parseuri": "0.0.6", - "ws": "~7.4.2", - "xmlhttprequest-ssl": "~1.6.2", - "yeast": "0.1.2" - } - }, - "node_modules/socket.io/node_modules/engine.io-client/node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/socket.io/node_modules/engine.io-client/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/socket.io/node_modules/isarray": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" - }, - "node_modules/socket.io/node_modules/parseqs": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", - "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" - }, - "node_modules/socket.io/node_modules/parseuri": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", - "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" - }, - "node_modules/socket.io/node_modules/socket.io-client": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.4.0.tgz", - "integrity": "sha512-M6xhnKQHuuZd4Ba9vltCLT9oa+YvTsP8j9NcEiLElfIg8KeYPyhWOes6x4t+LTAC8enQbE/995AdTem2uNyKKQ==", - "dependencies": { - "backo2": "1.0.2", - "component-bind": "1.0.0", - "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "engine.io-client": "~3.5.0", - "has-binary2": "~1.0.2", - "indexof": "0.0.1", - "parseqs": "0.0.6", - "parseuri": "0.0.6", - "socket.io-parser": "~3.3.0", - "to-array": "0.1.4" + "node": ">=10.0.0" } }, - "node_modules/socket.io/node_modules/socket.io-client/node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "node_modules/socket.io/node_modules/engine.io-parser": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz", + "integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==", "dependencies": { - "ms": "2.0.0" + "@socket.io/base64-arraybuffer": "~1.0.2" + }, + "engines": { + "node": ">=10.0.0" } }, - "node_modules/socket.io/node_modules/socket.io-client/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "node_modules/socket.io/node_modules/socket.io-adapter": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.3.3.tgz", + "integrity": "sha512-Qd/iwn3VskrpNO60BeRyCyr8ZWw9CPZyitW4AQwmRZ8zCiyDiL+znRnWX6tDHXnWn1sJrM1+b6Mn6wEDJJ4aYQ==" }, - "node_modules/socket.io/node_modules/socket.io-client/node_modules/socket.io-parser": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.2.tgz", - "integrity": "sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg==", + "node_modules/socket.io/node_modules/socket.io-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz", + "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==", "dependencies": { + "@types/component-emitter": "^1.2.10", "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "isarray": "2.0.1" + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" } }, "node_modules/socket.io/node_modules/ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", "engines": { - "node": ">=8.3.0" + "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", @@ -20370,14 +20361,6 @@ } } }, - "node_modules/socket.io/node_modules/xmlhttprequest-ssl": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz", - "integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", @@ -26177,6 +26160,11 @@ "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", "dev": true }, + "@socket.io/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ==" + }, "@stroncium/procfs": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz", @@ -26235,6 +26223,11 @@ "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", "dev": true }, + "@types/component-emitter": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz", + "integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==" + }, "@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -26244,12 +26237,22 @@ "@types/node": "*" } }, + "@types/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" + }, "@types/cookiejar": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz", "integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==", "dev": true }, + "@types/cors": { + "version": "2.8.12", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz", + "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==" + }, "@types/express": { "version": "4.17.13", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", @@ -37202,9 +37205,9 @@ "dev": true }, "moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" + "version": "2.29.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.2.tgz", + "integrity": "sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg==" }, "moment-timezone": { "version": "0.5.34", @@ -37652,12 +37655,33 @@ "dev": true }, "nocodb-sdk": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.0.9.tgz", - "integrity": "sha512-MwvHh9WtplJtB2z41DbDUF09bYRLX4WBA+IytgPRWr5e3s8UEBzKZiKN7sLcVnmiY6a9ctT4Ad0CS4viwExoQw==", + "version": "file:../nocodb-sdk", "requires": { + "@ava/typescript": "^1.1.1", + "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@typescript-eslint/eslint-plugin": "^4.0.1", + "@typescript-eslint/parser": "^4.0.1", + "ava": "^3.12.1", "axios": "^0.21.1", - "jsep": "^0.4.0" + "codecov": "^3.5.0", + "cspell": "^4.1.0", + "cz-conventional-changelog": "^3.3.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", + "gh-pages": "^3.1.0", + "jsep": "^0.4.0", + "npm-run-all": "^4.1.5", + "nyc": "^15.1.0", + "open-cli": "^6.0.1", + "prettier": "^2.1.1", + "standard-version": "^9.0.0", + "ts-node": "^9.0.0", + "typedoc": "^0.19.0", + "typescript": "^4.0.2" } }, "node-addon-api": { @@ -40706,16 +40730,16 @@ } }, "socket.io": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.4.1.tgz", - "integrity": "sha512-Si18v0mMXGAqLqCVpTxBa8MGqriHGQh8ccEOhmsmNS3thNCGBwO8WGrwMibANsWtQQ5NStdZwHqZR3naJVFc3w==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.1.tgz", + "integrity": "sha512-s04vrBswdQBUmuWJuuNTmXUVJhP0cVky8bBDhdkf8y0Ptsu7fKU2LuLbts9g+pdmAdyMMn8F/9Mf1/wbtUN0fg==", "requires": { - "debug": "~4.1.0", - "engine.io": "~3.5.0", - "has-binary2": "~1.0.2", - "socket.io-adapter": "~1.1.0", - "socket.io-client": "2.4.0", - "socket.io-parser": "~3.4.0" + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "debug": "~4.3.2", + "engine.io": "~6.1.0", + "socket.io-adapter": "~2.3.3", + "socket.io-parser": "~4.0.4" }, "dependencies": { "component-emitter": { @@ -40723,128 +40747,51 @@ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, "engine.io": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.5.0.tgz", - "integrity": "sha512-21HlvPUKaitDGE4GXNtQ7PLP0Sz4aWLddMPw2VTyFz1FVZqu/kZsJUO8WNpKuE/OCL7nkfRaOui2ZCJloGznGA==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.3.tgz", + "integrity": "sha512-rqs60YwkvWTLLnfazqgZqLa/aKo+9cueVfEi/dZ8PyGyaf8TLOxj++4QMIgeG3Gn0AhrWiFXvghsoY9L9h25GA==", "requires": { + "@types/cookie": "^0.4.1", + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", "accepts": "~1.3.4", "base64id": "2.0.0", "cookie": "~0.4.1", - "debug": "~4.1.0", - "engine.io-parser": "~2.2.0", - "ws": "~7.4.2" + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.0.3", + "ws": "~8.2.3" } }, - "engine.io-client": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.2.tgz", - "integrity": "sha512-QEqIp+gJ/kMHeUun7f5Vv3bteRHppHH/FMBQX/esFj/fuYfjyUKWGMo3VCvIP/V8bE9KcjHmRZrhIz2Z9oNsDA==", + "engine.io-parser": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz", + "integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==", "requires": { - "component-emitter": "~1.3.0", - "component-inherit": "0.0.3", - "debug": "~3.1.0", - "engine.io-parser": "~2.2.0", - "has-cors": "1.1.0", - "indexof": "0.0.1", - "parseqs": "0.0.6", - "parseuri": "0.0.6", - "ws": "~7.4.2", - "xmlhttprequest-ssl": "~1.6.2", - "yeast": "0.1.2" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } + "@socket.io/base64-arraybuffer": "~1.0.2" } }, - "isarray": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" - }, - "parseqs": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", - "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" - }, - "parseuri": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", - "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" + "socket.io-adapter": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.3.3.tgz", + "integrity": "sha512-Qd/iwn3VskrpNO60BeRyCyr8ZWw9CPZyitW4AQwmRZ8zCiyDiL+znRnWX6tDHXnWn1sJrM1+b6Mn6wEDJJ4aYQ==" }, - "socket.io-client": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.4.0.tgz", - "integrity": "sha512-M6xhnKQHuuZd4Ba9vltCLT9oa+YvTsP8j9NcEiLElfIg8KeYPyhWOes6x4t+LTAC8enQbE/995AdTem2uNyKKQ==", + "socket.io-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz", + "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==", "requires": { - "backo2": "1.0.2", - "component-bind": "1.0.0", + "@types/component-emitter": "^1.2.10", "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "engine.io-client": "~3.5.0", - "has-binary2": "~1.0.2", - "indexof": "0.0.1", - "parseqs": "0.0.6", - "parseuri": "0.0.6", - "socket.io-parser": "~3.3.0", - "to-array": "0.1.4" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "socket.io-parser": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.2.tgz", - "integrity": "sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg==", - "requires": { - "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "isarray": "2.0.1" - } - } + "debug": "~4.3.1" } }, "ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", "requires": {} - }, - "xmlhttprequest-ssl": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz", - "integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q==" } } }, diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json index 299bc5c1ea..97dda45b4a 100644 --- a/packages/nocodb/package.json +++ b/packages/nocodb/package.json @@ -154,7 +154,7 @@ "nc-lib-gui": "0.84.15", "nc-plugin": "^0.1.1", "ncp": "^2.0.0", - "nocodb-sdk": "0.0.9", + "nocodb-sdk": "file:../nocodb-sdk", "nodemailer": "^6.4.10", "ora": "^4.0.4", "os-locale": "^5.0.0", @@ -173,7 +173,7 @@ "rmdir": "^1.2.0", "sha.js": "^2.4.11", "slash": "^3.0.0", - "socket.io": "^2.3.0", + "socket.io": "^4.4.1", "sqlite3": "5.0.0", "twilio": "^3.55.1", "unique-names-generator": "^4.3.1", diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts index fd22cfbce1..3a2e9d43f3 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts @@ -179,8 +179,6 @@ class BaseModelSqlv2 { if (!ignoreFilterSort) applyPaginate(qb, rest); const proto = await this.getProto(); - console.log(qb.toQuery()); - return (await qb).map(d => { d.__proto__ = proto; return d; @@ -248,8 +246,6 @@ class BaseModelSqlv2 { as: 'count' }).first(); - console.log(qb.toQuery()); - return ((await qb) as any).count; } @@ -294,7 +290,7 @@ class BaseModelSqlv2 { allowedCols && (!includePkByDefault || !col.pk) ? allowedCols[col.id] && (!isSystemColumn(col) || view.show_system_fields) && - (!fields?.length || fields.include(col.title)) + (!fields?.length || fields.includes(col.title)) : 1 }), {} @@ -747,8 +743,6 @@ class BaseModelSqlv2 { ).orWhereNull(rcn); }); - console.log('----', qb.toQuery()); - const aliasColObjMap = await childTable.getAliasColObjMap(); const filterObj = extractFilterFromXwhere(args.where, aliasColObjMap); @@ -2059,9 +2053,8 @@ function extractFilterFromXwhere( function extractCondition(nestedArrayConditions, aliasColObjMap) { return nestedArrayConditions?.map(str => { // eslint-disable-next-line prefer-const - let [logicOp, alias, op, value] = str - .match(/(?:~(and|or|not))?\((.*?),(\w+),(.*)\)/) - .slice(1); + let [logicOp, alias, op, value] = + str.match(/(?:~(and|or|not))?\((.*?),(\w+),(.*)\)/)?.slice(1) || []; if (op === 'is') op = 'is' + value; else if (op === 'in') value = value.split(','); diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts index a605f82a7e..a2b3ea05be 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts @@ -457,7 +457,6 @@ const appendWhereCondition = function( } }); - console.log(knexRef.toQuery()); return knexRef; }; diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts index 55cac2ffee..632b32f33f 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts @@ -564,6 +564,41 @@ export default async function formulaQueryBuilderv2( } } break; + case 'DATEADD': + if (pt.arguments[1].value) { + pt.callee.name = 'DATE_ADD'; + return fn(pt, alias, prevBinaryOp); + } else if (pt.arguments[1].operator == '-') { + pt.callee.name = 'DATE_SUB'; + return fn(pt, alias, prevBinaryOp); + } + break; + case 'URL': + return fn( + { + type: 'CallExpression', + arguments: [ + { + type: 'Literal', + value: 'URI::(', + raw: '"URI::("' + }, + pt.arguments[0], + { + type: 'Literal', + value: ')', + raw: '")"' + } + ], + callee: { + type: 'Identifier', + name: 'CONCAT' + } + }, + alias, + prevBinaryOp + ); + break; default: { const res = mapFunctionName({ diff --git a/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts b/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts index 92d259003b..4a0f572b5c 100644 --- a/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts +++ b/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts @@ -767,8 +767,6 @@ export default class KnexMigratorv2 { ); } if (!sqlClient.knex.isTransaction) await trx.commit(); - - console.log('========== success '); } catch (error) { if (!sqlClient.knex.isTransaction) await trx.rollback(); vm.emitW( @@ -938,7 +936,6 @@ export default class KnexMigratorv2 { .del(); } if (!sqlClient.knex.isTransaction) await trx.commit(); - console.log('========== success '); } catch (error) { if (!sqlClient.knex.isTransaction) await trx.rollback(); vm.emitW( diff --git a/packages/nocodb/src/lib/noco-models/Audit.ts b/packages/nocodb/src/lib/noco-models/Audit.ts index 8be16ed720..6a1db21801 100644 --- a/packages/nocodb/src/lib/noco-models/Audit.ts +++ b/packages/nocodb/src/lib/noco-models/Audit.ts @@ -89,8 +89,6 @@ export default class Audit implements AuditType { if ((args.comments_only as any) == 'true') query.where('op_type', AuditOperationTypes.COMMENT); - console.log(query.toQuery()); - const audits = await query; return audits?.map(a => new Audit(a)); diff --git a/packages/nocodb/src/lib/noco-models/Column.ts b/packages/nocodb/src/lib/noco-models/Column.ts index d7f367877d..bd1b06f3c3 100644 --- a/packages/nocodb/src/lib/noco-models/Column.ts +++ b/packages/nocodb/src/lib/noco-models/Column.ts @@ -878,4 +878,30 @@ export default class Column implements ColumnType { exclude_id && { id: { neq: exclude_id } } )); } + + static async markAsSystemField( + colId: string, + system = true, + ncMeta = Noco.ncMeta + ) { + // get existing cache + const key = `${CacheScope.COLUMN}:${colId}`; + const o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT); + if (o) { + // update data + o.system = system; + // set cache + await NocoCache.set(key, o); + } + // update system field in meta db + await ncMeta.metaUpdate( + null, + null, + MetaTable.COLUMNS, + { + system + }, + colId + ); + } } diff --git a/packages/nocodb/src/lib/noco-models/Filter.ts b/packages/nocodb/src/lib/noco-models/Filter.ts index 8a220fce30..b9c2a95802 100644 --- a/packages/nocodb/src/lib/noco-models/Filter.ts +++ b/packages/nocodb/src/lib/noco-models/Filter.ts @@ -388,7 +388,7 @@ export default class Filter { await deleteRecursively(filter); } - private static async get(id: string, ncMeta = Noco.ncMeta) { + public static async get(id: string, ncMeta = Noco.ncMeta) { let filterObj = id && (await NocoCache.get( diff --git a/packages/nocodb/src/lib/noco-models/Model.ts b/packages/nocodb/src/lib/noco-models/Model.ts index 0aa29efa19..5203e4aaec 100644 --- a/packages/nocodb/src/lib/noco-models/Model.ts +++ b/packages/nocodb/src/lib/noco-models/Model.ts @@ -130,7 +130,7 @@ export default class Model implements TableType { await NocoCache.appendToList( CacheScope.MODEL, - [projectId, baseId], + [projectId], `${CacheScope.MODEL}:${id}` ); @@ -163,10 +163,7 @@ export default class Model implements TableType { }, ncMeta = Noco.ncMeta ): Promise { - let modelList = await NocoCache.getList(CacheScope.MODEL, [ - project_id, - base_id - ]); + let modelList = await NocoCache.getList(CacheScope.MODEL, [project_id]); if (!modelList.length) { modelList = await ncMeta.metaList2( project_id, @@ -179,11 +176,7 @@ export default class Model implements TableType { } ); - await NocoCache.setList( - CacheScope.MODEL, - [project_id, base_id], - modelList - ); + await NocoCache.setList(CacheScope.MODEL, [project_id], modelList); } modelList.sort( (a, b) => @@ -214,11 +207,7 @@ export default class Model implements TableType { MetaTable.MODELS ); - await NocoCache.setList( - CacheScope.MODEL, - [project_id, db_alias], - modelList - ); + await NocoCache.setList(CacheScope.MODEL, [project_id], modelList); } return modelList.map(m => new Model(m)); @@ -437,10 +426,10 @@ export default class Model implements TableType { await ncMeta.metaDelete(null, null, MetaTable.MODELS, this.id); await NocoCache.del( - `${CacheScope.MODEL}:${this.project_id}:${this.base_id}:${this.id}` + `${CacheScope.MODEL}:${this.project_id}:${this.id}` ); await NocoCache.del( - `${CacheScope.MODEL}:${this.project_id}:${this.base_id}:${this.title}` + `${CacheScope.MODEL}:${this.project_id}:${this.title}` ); return true; } @@ -632,10 +621,9 @@ export default class Model implements TableType { ) { const modelId = project_id && - base_id && aliasOrId && (await NocoCache.get( - `${CacheScope.MODEL}:${project_id}:${base_id}:${aliasOrId}`, + `${CacheScope.MODEL}:${project_id}:${aliasOrId}`, CacheGetType.TYPE_OBJECT )); if (!modelId) { @@ -661,7 +649,7 @@ export default class Model implements TableType { } ); await NocoCache.set( - `${CacheScope.MODEL}:${project_id}:${base_id}:${aliasOrId}`, + `${CacheScope.MODEL}:${project_id}:${aliasOrId}`, model.id ); await NocoCache.set(`${CacheScope.MODEL}:${model.id}`, model); diff --git a/packages/nocodb/src/lib/noco-models/ModelRoleVisibility.ts b/packages/nocodb/src/lib/noco-models/ModelRoleVisibility.ts index 3f0074a1d6..e3f2026112 100644 --- a/packages/nocodb/src/lib/noco-models/ModelRoleVisibility.ts +++ b/packages/nocodb/src/lib/noco-models/ModelRoleVisibility.ts @@ -6,8 +6,8 @@ import { CacheScope, MetaTable } from '../utils/globals'; -import Model from './Model'; import NocoCache from '../noco-cache/NocoCache'; +import View from './View'; export default class ModelRoleVisibility implements ModelRoleVisibilityType { id?: string; @@ -137,7 +137,6 @@ export default class ModelRoleVisibility implements ModelRoleVisibilityType { const insertObj = { role: body.role, disabled: body.disabled, - // fk_model_id: body.fk_model_id, fk_view_id: body.fk_view_id, project_id: body.project_id, base_id: body.base_id, @@ -146,9 +145,9 @@ export default class ModelRoleVisibility implements ModelRoleVisibilityType { }; if (!(body.project_id && body.base_id)) { - const model = await Model.getByIdOrName({ id: body.fk_model_id }, ncMeta); - insertObj.project_id = model.project_id; - insertObj.base_id = model.base_id; + const view = await View.get(body.fk_view_id, ncMeta); + insertObj.project_id = view.project_id; + insertObj.base_id = view.base_id; } await ncMeta.metaInsert2( diff --git a/packages/nocodb/src/lib/noco-models/ProjectUser.ts b/packages/nocodb/src/lib/noco-models/ProjectUser.ts index 41f7697ee6..99c5cc81cd 100644 --- a/packages/nocodb/src/lib/noco-models/ProjectUser.ts +++ b/packages/nocodb/src/lib/noco-models/ProjectUser.ts @@ -104,8 +104,6 @@ export default class ProjectUser { ); }); - console.log(queryBuilder.toQuery()); - return await queryBuilder; } diff --git a/packages/nocodb/src/lib/noco-models/User.ts b/packages/nocodb/src/lib/noco-models/User.ts index 3bb5ab76ae..7e7cdf3bdc 100644 --- a/packages/nocodb/src/lib/noco-models/User.ts +++ b/packages/nocodb/src/lib/noco-models/User.ts @@ -136,4 +136,11 @@ export default class User implements UserType { } return user; } + + static async getByRefreshToken(refresh_token, ncMeta = Noco.ncMeta) { + const user = await ncMeta.metaGet2(null, null, MetaTable.USERS, { + refresh_token + }); + return user; + } } diff --git a/packages/nocodb/src/lib/noco/Noco.ts b/packages/nocodb/src/lib/noco/Noco.ts index 7b4b3dc057..352ce09570 100644 --- a/packages/nocodb/src/lib/noco/Noco.ts +++ b/packages/nocodb/src/lib/noco/Noco.ts @@ -351,7 +351,6 @@ export default class Noco { projectBuilder.updateConfig(project.config); await projectBuilder.reInit(); - console.log(`Project updated: ${projectId}`); } break; @@ -370,7 +369,6 @@ export default class Noco { this.ncToolApi.destroy(); this.ncToolApi.reInitialize(this.config); // await this.init({progressCallback}); - console.log(`Loaded env : ${data.req.args.env}`); } catch (e) { console.log(e); } @@ -510,7 +508,6 @@ export default class Noco { this.socketClient = client; client.on('disconnect', () => { - console.log('Disconnected'); this.socketClient = null; }); }); diff --git a/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts b/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts index 360d0c2402..ede14d3686 100644 --- a/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts @@ -17,11 +17,17 @@ export async function apiTokenDelete(req: Request, res: Response) { const router = Router({ mergeParams: true }); -router.get('/projects/:projectId/apiTokens', ncMetaAclMw(apiTokenList)); -router.post('/projects/:projectId/apiTokens', ncMetaAclMw(apiTokenCreate)); +router.get( + '/api/v1/db/meta/projects/:projectId/api-tokens', + ncMetaAclMw(apiTokenList, 'apiTokenList') +); +router.post( + '/api/v1/db/meta/projects/:projectId/api-tokens', + ncMetaAclMw(apiTokenCreate, 'apiTokenCreate') +); router.delete( - '/projects/:projectId/apiTokens/:token', - ncMetaAclMw(apiTokenDelete) + '/api/v1/db/meta/projects/:projectId/api-tokens/:token', + ncMetaAclMw(apiTokenDelete, 'apiTokenDelete') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/attachmentApis.ts b/packages/nocodb/src/lib/noco/meta/api/attachmentApis.ts index 9debc6f4a6..6464f4f7a6 100644 --- a/packages/nocodb/src/lib/noco/meta/api/attachmentApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/attachmentApis.ts @@ -12,12 +12,10 @@ import NcPluginMgrv2 from '../helpers/NcPluginMgrv2'; // const storageAdapter = new Local(); export async function upload(req: Request, res: Response) { - const destPath = path.join( - 'nc', - 'uploads', - req.params.projectId, - req.params.viewId + const filePath = sanitizeUrlPath( + req.query?.path?.toString()?.split('/') || [''] ); + const destPath = path.join('nc', 'uploads', ...filePath); const storageAdapter = await NcPluginMgrv2.storageAdapter(); const attachments = await Promise.all( @@ -30,9 +28,9 @@ export async function upload(req: Request, res: Response) { ); if (!url) { - url = `${(req as any).ncSiteUrl}/download/${req.params.projectId}/${ - req.params.viewId - }/${fileName}`; + url = `${(req as any).ncSiteUrl}/download/${filePath.join( + '/' + )}/${fileName}`; } return { @@ -52,11 +50,11 @@ export async function upload(req: Request, res: Response) { export async function fileRead(req, res) { try { const storageAdapter = await NcPluginMgrv2.storageAdapter(); - // const type = mimetypes[path.extname(req.params.fileName).slice(1)] || 'text/plain'; + // const type = mimetypes[path.extname(req.s.fileName).slice(1)] || 'text/plain'; const type = mimetypes[ path - .extname(req.params.fileName) + .extname(req.params?.[0]) .split('/') .pop() .slice(1) @@ -67,9 +65,10 @@ export async function fileRead(req, res) { path.join( 'nc', 'uploads', - req.params.projectId, - req.params.viewId, - req.params.fileName + req.params?.[0] + ?.split('/') + .filter(p => p !== '..') + .join('/') ) ) ); @@ -82,15 +81,6 @@ export async function fileRead(req, res) { } const router = Router({ mergeParams: true }); -router.post( - '/projects/:projectId/views/:viewId/upload', - multer({ - storage: multer.diskStorage({}) - }).any(), - ncMetaAclMw(upload) -); -router.get('/download/:projectId/:viewId/:fileName', catchError(fileRead)); - router.get(/^\/dl\/([^/]+)\/([^/]+)\/(.+)$/, async (req, res) => { try { // const type = mimetypes[path.extname(req.params.fileName).slice(1)] || 'text/plain'; @@ -122,4 +112,18 @@ router.get(/^\/dl\/([^/]+)\/([^/]+)\/(.+)$/, async (req, res) => { res.status(404).send('Not found'); } }); + +export function sanitizeUrlPath(paths) { + return paths.map(url => url.replace(/[/.?#]+/g, '_')); +} + +router.post( + '/api/v1/db/storage/upload', + multer({ + storage: multer.diskStorage({}) + }).any(), + ncMetaAclMw(upload, 'upload') +); +router.get(/^\/download\/(.+)$/, catchError(fileRead)); + export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/auditApis.ts b/packages/nocodb/src/lib/noco/meta/api/auditApis.ts index 62a59fe246..c5b9944934 100644 --- a/packages/nocodb/src/lib/noco/meta/api/auditApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/auditApis.ts @@ -20,7 +20,7 @@ export async function auditRowUpdate(req: Request, res) { res.json( await Audit.insert({ fk_model_id: req.body.fk_model_id, - row_id: req.body.row_id, + row_id: req.params.rowId, op_type: AuditOperationTypes.DATA, op_sub_type: AuditOperationSubTypes.UPDATE, description: `Table ${model.table_name} : field ${req.body.column_name} got changed from ${req.body.prev_value} to ${req.body.value}`, @@ -58,9 +58,24 @@ export async function commentsCount(req: Request, res) { } const router = Router({ mergeParams: true }); -router.get('/audits/comments', ncMetaAclMw(commentList)); -router.post('/audits/rowUpdate', ncMetaAclMw(auditRowUpdate, 'auditRowUpdate')); -router.post('/audits/comments', ncMetaAclMw(commentRow)); -router.get('/audits/comments/count', ncMetaAclMw(commentsCount)); -router.get('/project/:projectId/audits', ncMetaAclMw(auditList)); +router.get( + '/api/v1/db/meta/audits/comments', + ncMetaAclMw(commentList, 'commentList') +); +router.post( + '/api/v1/db/meta/audits/comments', + ncMetaAclMw(commentRow, 'commentRow') +); +router.post( + '/api/v1/db/meta/audits/rows/:rowId/update', + ncMetaAclMw(auditRowUpdate, 'auditRowUpdate') +); +router.get( + '/api/v1/db/meta/audits/comments/count', + ncMetaAclMw(commentsCount, 'commentsCount') +); +router.get( + '/api/v1/db/meta/project/:projectId/audits', + ncMetaAclMw(auditList, 'auditList') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts b/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts index 8813822856..082aab1aa5 100644 --- a/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts @@ -16,6 +16,6 @@ export async function cacheDelete(_, res) { } const router = Router(); -router.get('/cache', catchError(cacheGet)); -router.delete('/cache', catchError(cacheDelete)); +router.get('/api/v1/db/meta/cache', catchError(cacheGet)); +router.delete('/api/v1/db/meta/cache', catchError(cacheDelete)); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/columnApis.ts b/packages/nocodb/src/lib/noco/meta/api/columnApis.ts index bee441428b..04137359c0 100644 --- a/packages/nocodb/src/lib/noco/meta/api/columnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/columnApis.ts @@ -498,14 +498,15 @@ export async function columnAdd(req: Request, res: Response) { } export async function columnSetAsPrimary(req: Request, res: Response) { - res.json( - await Model.updatePrimaryColumn(req.params.tableId, req.params.columnId) - ); + const column = await Column.get({ colId: req.params.columnId }); + res.json(await Model.updatePrimaryColumn(column.fk_model_id, column.id)); } export async function columnUpdate(req: Request, res: Response) { + const column = await Column.get({ colId: req.params.columnId }); + const table = await Model.getWithInfo({ - id: req.params.tableId + id: column.fk_model_id }); const base = await Base.get(table.base_id); @@ -513,7 +514,7 @@ export async function columnUpdate(req: Request, res: Response) { !isVirtualCol(req.body) && !(await Column.checkTitleAvailable({ column_name: req.body.column_name, - fk_model_id: req.params.tableId, + fk_model_id: column.fk_model_id, exclude_id: req.params.columnId })) ) { @@ -522,14 +523,13 @@ export async function columnUpdate(req: Request, res: Response) { if ( !(await Column.checkAliasAvailable({ title: req.body.title, - fk_model_id: req.params.tableId, + fk_model_id: column.fk_model_id, exclude_id: req.params.columnId })) ) { NcError.badRequest('Duplicate column alias'); } - const column = table.columns.find(c => c.id === req.params.columnId); let colBody = req.body; if ( [ @@ -622,8 +622,9 @@ export async function columnUpdate(req: Request, res: Response) { } export async function columnDelete(req: Request, res: Response) { + const column = await Column.get({ colId: req.params.columnId }); const table = await Model.getWithInfo({ - id: req.params.tableId + id: column.fk_model_id }); const base = await Base.get(table.base_id); @@ -636,9 +637,6 @@ export async function columnDelete(req: Request, res: Response) { const sqlMgr = await ProjectMgrv2.getSqlMgr({ id: base.project_id }); - // try { - const column: Column = table.columns.find(c => c.id === req.params.columnId); - switch (column.uidt) { case UITypes.Lookup: case UITypes.Rollup: @@ -900,11 +898,20 @@ const deleteHmOrBtRelation = async ( }; const router = Router({ mergeParams: true }); -router.post('/tables/:tableId/columns/', ncMetaAclMw(columnAdd)); -router.put('/tables/:tableId/columns/:columnId', ncMetaAclMw(columnUpdate)); -router.delete('/tables/:tableId/columns/:columnId', ncMetaAclMw(columnDelete)); router.post( - '/tables/:tableId/columns/:columnId/primary', - ncMetaAclMw(columnSetAsPrimary) + '/api/v1/db/meta/tables/:tableId/columns/', + ncMetaAclMw(columnAdd, 'columnAdd') +); +router.patch( + '/api/v1/db/meta/columns/:columnId', + ncMetaAclMw(columnUpdate, 'columnUpdate') +); +router.delete( + '/api/v1/db/meta/columns/:columnId', + ncMetaAclMw(columnDelete, 'columnDelete') +); +router.post( + '/api/v1/db/meta/columns/:columnId/primary', + ncMetaAclMw(columnSetAsPrimary, 'columnSetAsPrimary') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts index 5ac4f237e8..6bda7361d7 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts @@ -91,24 +91,24 @@ async function getViewAndModelFromRequest(req) { const router = Router({ mergeParams: true }); router.post( - '/bulkData/:orgs/:projectName/:tableAlias', - ncMetaAclMw(bulkDataInsert) + '/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias', + ncMetaAclMw(bulkDataInsert, 'bulkDataInsert') ); router.patch( - '/bulkData/:orgs/:projectName/:tableAlias', - ncMetaAclMw(bulkDataUpdate) + '/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias', + ncMetaAclMw(bulkDataUpdate, 'bulkDataUpdate') ); router.patch( - '/bulkData/:orgs/:projectName/:tableAlias/all', - ncMetaAclMw(bulkDataUpdateAll) + '/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias/all', + ncMetaAclMw(bulkDataUpdateAll, 'bulkDataUpdateAll') ); router.delete( - '/bulkData/:orgs/:projectName/:tableAlias', - ncMetaAclMw(bulkDataDelete) + '/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias', + ncMetaAclMw(bulkDataDelete, 'bulkDataDelete') ); router.delete( - '/bulkData/:orgs/:projectName/:tableAlias/all', - ncMetaAclMw(bulkDataDeleteAll) + '/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias/all', + ncMetaAclMw(bulkDataDeleteAll, 'bulkDataDeleteAll') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts index 23c5de015a..29f6f728bc 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts @@ -6,11 +6,10 @@ import NcConnectionMgrv2 from '../../../common/NcConnectionMgrv2'; import { PagedResponseImpl } from '../../helpers/PagedResponse'; import View from '../../../../noco-models/View'; import ncMetaAclMw from '../../helpers/ncMetaAclMw'; -import Project from '../../../../noco-models/Project'; -import { NcError } from '../../helpers/catchError'; +import { getViewAndModelFromRequestByAliasOrId } from './helpers'; -export async function dataList(req: Request, res: Response) { - const { model, view } = await getViewAndModelFromRequest(req); +async function dataList(req: Request, res: Response) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); res.json(await getDataList(model, view, req)); } @@ -36,7 +35,7 @@ async function dataCount(req: Request, res: Response) { } async function dataInsert(req: Request, res: Response) { - const { model, view } = await getViewAndModelFromRequest(req); + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); const base = await Base.get(model.base_id); @@ -50,12 +49,12 @@ async function dataInsert(req: Request, res: Response) { } async function dataUpdate(req: Request, res: Response) { - const { model, view } = await getViewAndModelFromRequest(req); + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); const base = await Base.get(model.base_id); const baseModel = await Model.getBaseModelSQL({ id: model.id, - viewId: view.id, + viewId: view?.id, dbDriver: NcConnectionMgrv2.get(base) }); @@ -63,11 +62,11 @@ async function dataUpdate(req: Request, res: Response) { } async function dataDelete(req: Request, res: Response) { - const { model, view } = await getViewAndModelFromRequest(req); + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); const base = await Base.get(model.base_id); const baseModel = await Model.getBaseModelSQL({ id: model.id, - viewId: view.id, + viewId: view?.id, dbDriver: NcConnectionMgrv2.get(base) }); @@ -106,25 +105,9 @@ async function getDataList(model, view: View, req) { count }); } -async function getViewAndModelFromRequest(req) { - const project = await Project.getWithInfoByTitle(req.params.projectName); - const model = await Model.getByAliasOrId({ - project_id: project.id, - base_id: project.bases?.[0]?.id, - aliasOrId: req.params.tableName - }); - const view = - req.params.viewName && - (await View.getByTitleOrId({ - titleOrId: req.params.viewName, - fk_model_id: model.id - })); - if (!model) NcError.notFound('Table not found'); - return { model, view }; -} async function dataRead(req: Request, res: Response) { - const { model, view } = await getViewAndModelFromRequest(req); + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); const base = await Base.get(model.base_id); @@ -146,10 +129,33 @@ async function dataRead(req: Request, res: Response) { const router = Router({ mergeParams: true }); -router.get('/data/:orgs/:projectName/:tableName', ncMetaAclMw(dataList)); +// table data crud apis router.get( - '/data/:orgs/:projectName/:tableName/views/:viewName', - ncMetaAclMw(dataList) + '/api/v1/db/data/:orgs/:projectName/:tableName', + ncMetaAclMw(dataList, 'dataList') +); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId', + ncMetaAclMw(dataRead, 'dataRead') +); +router.patch( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId', + ncMetaAclMw(dataUpdate, 'dataUpdate') +); +router.patch( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId', + ncMetaAclMw(dataUpdate, 'dataUpdate') +); + +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName', + ncMetaAclMw(dataList, 'dataList') +); + +// table view data crud apis +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName', + ncMetaAclMw(dataList, 'dataList') ); router.get( '/data/:orgs/:projectName/:tableName/views/:viewName/count', @@ -157,20 +163,24 @@ router.get( ); router.post( - '/data/:orgs/:projectName/:tableName/views/:viewName', - ncMetaAclMw(dataInsert) + '/api/v1/db/data/:orgs/:projectName/:tableName', + ncMetaAclMw(dataInsert, 'dataInsert') +); +router.post( + '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName', + ncMetaAclMw(dataInsert, 'dataInsert') ); -router.put( - '/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', - ncMetaAclMw(dataUpdate) +router.patch( + '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', + ncMetaAclMw(dataUpdate, 'dataUpdate') ); router.get( - '/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', - ncMetaAclMw(dataRead) + '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', + ncMetaAclMw(dataRead, 'dataRead') ); router.delete( - '/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', - ncMetaAclMw(dataDelete) + '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', + ncMetaAclMw(dataDelete, 'dataDelete') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasExportApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasExportApis.ts new file mode 100644 index 0000000000..ec62033258 --- /dev/null +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasExportApis.ts @@ -0,0 +1,33 @@ +import { Request, Response, Router } from 'express'; +import ncMetaAclMw from '../../helpers/ncMetaAclMw'; +import { + extractCsvData, + getViewAndModelFromRequestByAliasOrId +} from './helpers'; + +async function csvDataExport(req: Request, res: Response) { + const { view } = await getViewAndModelFromRequestByAliasOrId(req); + + const { offset, elapsed, data } = await extractCsvData(view, req); + + res.set({ + 'Access-Control-Expose-Headers': 'nc-export-offset', + 'nc-export-offset': offset, + 'nc-export-elapsed-time': elapsed, + 'Content-Disposition': `attachment; filename="${view.title}-export.csv"` + }); + res.send(data); +} + +const router = Router({ mergeParams: true }); + +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/export/csv', + ncMetaAclMw(csvDataExport, 'exportCsv') +); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName/export/csv', + ncMetaAclMw(csvDataExport, 'exportCsv') +); + +export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts new file mode 100644 index 0000000000..e8641fe556 --- /dev/null +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts @@ -0,0 +1,288 @@ +import { Request, Response, Router } from 'express'; +import Model from '../../../../noco-models/Model'; +import Base from '../../../../noco-models/Base'; +import NcConnectionMgrv2 from '../../../common/NcConnectionMgrv2'; +import { PagedResponseImpl } from '../../helpers/PagedResponse'; +import ncMetaAclMw from '../../helpers/ncMetaAclMw'; +import { getViewAndModelFromRequestByAliasOrId } from './helpers'; +import { NcError } from '../../helpers/catchError'; + +export async function mmList(req: Request, res: Response, next) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.mmList( + { + colId: column.id, + parentId: req.params.rowId + }, + req.query as any + ); + const count: any = await baseModel.mmListCount({ + colId: column.id, + parentId: req.params.rowId + }); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function mmExcludedList(req: Request, res: Response, next) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.getMmChildrenExcludedList( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + const count = await baseModel.getMmChildrenExcludedListCount( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function hmExcludedList(req: Request, res: Response, next) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.getHmChildrenExcludedList( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + const count = await baseModel.getHmChildrenExcludedListCount( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function btExcludedList(req: Request, res: Response, next) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.getBtChildrenExcludedList( + { + colId: column.id, + cid: req.params.rowId + }, + req.query + ); + + const count = await baseModel.getBtChildrenExcludedListCount( + { + colId: column.id, + cid: req.params.rowId + }, + req.query + ); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function hmList(req: Request, res: Response, next) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.hmList( + { + colId: column.id, + id: req.params.rowId + }, + req.query + ); + + const count = await baseModel.hmListCount({ + colId: column.id, + id: req.params.rowId + }); + + res.json( + new PagedResponseImpl(data, { + totalRows: count + } as any) + ); +} + +//@ts-ignore +async function relationDataDelete(req, res) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + + if (!model) NcError.notFound('Table not found'); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + await baseModel.removeChild({ + colId: column.id, + childId: req.params.refRowId, + rowId: req.params.rowId + }); + + res.json({ msg: 'success' }); +} + +//@ts-ignore +async function relationDataAdd(req, res) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + if (!model) NcError.notFound('Table not found'); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + await baseModel.addChild({ + colId: column.id, + childId: req.params.refRowId, + rowId: req.params.rowId + }); + + res.json({ msg: 'success' }); +} + +async function getColumnByIdOrName(columnNameOrId: string, model: Model) { + const column = (await model.getColumns()).find( + c => + c.title === columnNameOrId || + c.id === columnNameOrId || + c.column_name === columnNameOrId + ); + + if (!column) + NcError.notFound(`Column with id/name '${columnNameOrId}' is not found`); + + return column; +} + +const router = Router({ mergeParams: true }); + +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/mm/:columnName/exclude', + ncMetaAclMw(mmExcludedList, 'mmExcludedList') +); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/hm/:columnName/exclude', + ncMetaAclMw(hmExcludedList, 'hmExcludedList') +); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/bt/:columnName/exclude', + ncMetaAclMw(btExcludedList, 'btExcludedList') +); + +router.post( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/:relationType/:columnName/:refRowId', + ncMetaAclMw(relationDataAdd, 'relationDataAdd') +); +router.delete( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/:relationType/:columnName/:refRowId', + ncMetaAclMw(relationDataDelete, 'relationDataDelete') +); + +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/mm/:columnName', + ncMetaAclMw(mmList, 'mmList') +); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/hm/:columnName', + ncMetaAclMw(hmList, 'hmList') +); + +export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts index e298aded0c..6acf1f70d3 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts @@ -20,11 +20,6 @@ export async function dataList(req: Request, res: Response, next) { res.json(await getDataList(model, view, req)); } -// async function dataListNew(req: Request, res: Response) { -// const { model, view } = await getViewAndModelFromRequest(req); -// res.json(await getDataList(model, view, req)); -// } - export async function mmList(req: Request, res: Response, next) { const view = await View.get(req.params.viewId); @@ -554,7 +549,7 @@ const router = Router({ mergeParams: true }); // '/data/:orgs/:projectName/:tableName/views/:viewName', // ncMetaAclMw(dataInsertNew) // ); -// router.put( +// router.patch( // '/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', // ncMetaAclMw(dataUpdateNew) // ); @@ -563,34 +558,34 @@ const router = Router({ mergeParams: true }); // ncMetaAclMw(dataDeleteNew) // ); -router.get('/data/:viewId/', ncMetaAclMw(dataList)); -router.post('/data/:viewId/', ncMetaAclMw(dataInsert)); -router.get('/data/:viewId/:rowId', ncMetaAclMw(dataRead)); -router.put('/data/:viewId/:rowId', ncMetaAclMw(dataUpdate)); -router.delete('/data/:viewId/:rowId', ncMetaAclMw(dataDelete)); +router.get('/data/:viewId/', ncMetaAclMw(dataList, 'dataList')); +router.post('/data/:viewId/', ncMetaAclMw(dataInsert, 'dataInsert')); +router.get('/data/:viewId/:rowId', ncMetaAclMw(dataRead, 'dataRead')); +router.patch('/data/:viewId/:rowId', ncMetaAclMw(dataUpdate, 'dataUpdate')); +router.delete('/data/:viewId/:rowId', ncMetaAclMw(dataDelete, 'dataDelete')); -router.get('/data/:viewId/:rowId/mm/:colId', ncMetaAclMw(mmList)); -router.get('/data/:viewId/:rowId/hm/:colId', ncMetaAclMw(hmList)); +router.get('/data/:viewId/:rowId/mm/:colId', ncMetaAclMw(mmList, 'mmList')); +router.get('/data/:viewId/:rowId/hm/:colId', ncMetaAclMw(hmList, 'hmList')); router.get( '/data/:viewId/:rowId/mm/:colId/exclude', - ncMetaAclMw(mmExcludedList) + ncMetaAclMw(mmExcludedList, 'mmExcludedList') ); router.get( '/data/:viewId/:rowId/hm/:colId/exclude', - ncMetaAclMw(hmExcludedList) + ncMetaAclMw(hmExcludedList, 'hmExcludedList') ); router.get( '/data/:viewId/:rowId/bt/:colId/exclude', - ncMetaAclMw(btExcludedList) + ncMetaAclMw(btExcludedList, 'btExcludedList') ); router.post( '/data/:viewId/:rowId/:relationType/:colId/:childId', - ncMetaAclMw(relationDataAdd) + ncMetaAclMw(relationDataAdd, 'relationDataAdd') ); router.delete( '/data/:viewId/:rowId/:relationType/:colId/:childId', - ncMetaAclMw(relationDataDelete) + ncMetaAclMw(relationDataDelete, 'relationDataDelete') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/helpers.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/helpers.ts new file mode 100644 index 0000000000..75f689952e --- /dev/null +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/helpers.ts @@ -0,0 +1,179 @@ +import Project from '../../../../noco-models/Project'; +import Model from '../../../../noco-models/Model'; +import View from '../../../../noco-models/View'; +import { NcError } from '../../helpers/catchError'; +import { Request } from 'express'; +import Base from '../../../../noco-models/Base'; +import NcConnectionMgrv2 from '../../../common/NcConnectionMgrv2'; +import { isSystemColumn, UITypes } from 'nocodb-sdk'; + +import { nocoExecute } from 'nc-help'; +import Column from '../../../../noco-models/Column'; +import LookupColumn from '../../../../noco-models/LookupColumn'; +import LinkToAnotherRecordColumn from '../../../../noco-models/LinkToAnotherRecordColumn'; + +import papaparse from 'papaparse'; +export async function getViewAndModelFromRequestByAliasOrId( + req: + | Request<{ projectName: string; tableName: string; viewName?: string }> + | Request +) { + let project = await Project.getWithInfoByTitle(req.params.projectName); + + if (!project) { + project = await Project.getWithInfo(req.params.projectName); + } + + const model = await Model.getByAliasOrId({ + project_id: project.id, + base_id: project.bases?.[0]?.id, + aliasOrId: req.params.tableName + }); + const view = + req.params.viewName && + (await View.getByTitleOrId({ + titleOrId: req.params.viewName, + fk_model_id: model.id + })); + if (!model) NcError.notFound('Table not found'); + return { model, view }; +} + +export async function extractCsvData(view: View, req: Request) { + const base = await Base.get(view.base_id); + + await view.getModelWithInfo(); + await view.getColumns(); + + view.model.columns = view.columns + .filter(c => c.show) + .map( + c => + new Column({ ...c, ...view.model.columnsById[c.fk_column_id] } as any) + ) + .filter(column => !isSystemColumn(column) || view.show_system_fields); + + const baseModel = await Model.getBaseModelSQL({ + id: view.model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + let offset = +req.query.offset || 0; + const limit = 100; + // const size = +process.env.NC_EXPORT_MAX_SIZE || 1024; + const timeout = +process.env.NC_EXPORT_MAX_TIMEOUT || 5000; + const csvRows = []; + const startTime = process.hrtime(); + let elapsed, temp; + + for ( + elapsed = 0; + elapsed < timeout; + offset += limit, + temp = process.hrtime(startTime), + elapsed = temp[0] * 1000 + temp[1] / 1000000 + ) { + const rows = await nocoExecute( + await baseModel.defaultResolverReq(req.query, false, false), + await baseModel.list({ ...req.query, offset, limit }), + {}, + req.query + ); + + if (!rows?.length) { + offset = -1; + break; + } + + for (const row of rows) { + const csvRow = { ...row }; + + for (const column of view.model.columns) { + if (isSystemColumn(column) && !view.show_system_fields) continue; + csvRow[column.title] = await serializeCellValue({ + value: row[column.title], + column + }); + } + csvRows.push(csvRow); + } + } + + const data = papaparse.unparse( + { + fields: view.model.columns.map(c => c.title), + data: csvRows + }, + { + escapeFormulae: true + } + ); + + return { offset, csvRows, elapsed, data }; +} + +export async function serializeCellValue({ + value, + column +}: { + column?: Column; + value: any; +}) { + if (!column) { + return value; + } + + if (!value) return value; + + switch (column?.uidt) { + case UITypes.Attachment: { + let data = value; + try { + if (typeof value === 'string') { + data = JSON.parse(value); + } + } catch {} + + return (data || []).map( + attachment => + `${encodeURI(attachment.title)}(${encodeURI(attachment.url)})` + ); + } + case UITypes.Lookup: + { + const colOptions = await column.getColOptions(); + const lookupColumn = await colOptions.getLookupColumn(); + return ( + await Promise.all( + [...(Array.isArray(value) ? value : [value])].map(async v => + serializeCellValue({ + value: v, + column: lookupColumn + }) + ) + ) + ).join(', '); + } + break; + case UITypes.LinkToAnotherRecord: + { + const colOptions = await column.getColOptions< + LinkToAnotherRecordColumn + >(); + const relatedModel = await colOptions.getRelatedTable(); + await relatedModel.getColumns(); + return [...(Array.isArray(value) ? value : [value])] + .map(v => { + return v[relatedModel.primaryValue?.title]; + }) + .join(', '); + } + break; + default: + if (value && typeof value === 'object') { + return JSON.stringify(value); + } + return value; + } +} diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/index.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/index.ts index 4c9c61b6ba..4a337712db 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/index.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/index.ts @@ -2,5 +2,14 @@ import dataApis from './dataApis'; import oldDataApis from './oldDataApis'; import dataAliasApis from './dataAliasApis'; import bulkDataAliasApis from './bulkDataAliasApis'; +import dataAliasNestedApis from './dataAliasNestedApis'; +import dataAliasExportApis from './dataAliasExportApis'; -export { dataApis, oldDataApis, dataAliasApis, bulkDataAliasApis }; +export { + dataApis, + oldDataApis, + dataAliasApis, + bulkDataAliasApis, + dataAliasNestedApis, + dataAliasExportApis +}; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts index 564f867206..a0196854f6 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts @@ -125,14 +125,26 @@ async function dataRead(req: Request, res: Response) { const router = Router({ mergeParams: true }); -router.get('/nc/:projectId/api/v2/:tableName', ncMetaAclMw(dataList)); +router.get( + '/nc/:projectId/api/v2/:tableName', + ncMetaAclMw(dataList, 'dataList') +); -router.post('/nc/:projectId/api/v2/:tableName', ncMetaAclMw(dataInsert)); -router.get('/nc/:projectId/api/v2/:tableName/:rowId', ncMetaAclMw(dataRead)); -router.put('/nc/:projectId/api/v2/:tableName/:rowId', ncMetaAclMw(dataUpdate)); +router.post( + '/nc/:projectId/api/v2/:tableName', + ncMetaAclMw(dataInsert, 'dataInsert') +); +router.get( + '/nc/:projectId/api/v2/:tableName/:rowId', + ncMetaAclMw(dataRead, 'dataRead') +); +router.patch( + '/nc/:projectId/api/v2/:tableName/:rowId', + ncMetaAclMw(dataUpdate, 'dataUpdate') +); router.delete( '/nc/:projectId/api/v2/:tableName/:rowId', - ncMetaAclMw(dataDelete) + ncMetaAclMw(dataDelete, 'dataDelete') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/exportApis.ts b/packages/nocodb/src/lib/noco/meta/api/exportApis.ts index 33cca96cd9..9bbd8b2452 100644 --- a/packages/nocodb/src/lib/noco/meta/api/exportApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/exportApis.ts @@ -1,102 +1,11 @@ import { Request, Response, Router } from 'express'; import View from '../../../noco-models/View'; -import Model from '../../../noco-models/Model'; -import Base from '../../../noco-models/Base'; -import NcConnectionMgrv2 from '../../common/NcConnectionMgrv2'; -import { nocoExecute } from 'nc-help'; -import papaparse from 'papaparse'; -import { isSystemColumn, UITypes } from 'nocodb-sdk'; -import Column from '../../../noco-models/Column'; -import LinkToAnotherRecordColumn from '../../../noco-models/LinkToAnotherRecordColumn'; -import LookupColumn from '../../../noco-models/LookupColumn'; import ncMetaAclMw from '../helpers/ncMetaAclMw'; +import { extractCsvData } from './dataApis/helpers'; -async function exportCsv(req: Request, res: Response, next) { +async function exportCsv(req: Request, res: Response) { const view = await View.get(req.params.viewId); - - const model = await view.getModelWithInfo(); - await view.getColumns(); - - view.model.columns = view.columns - .filter(c => c.show) - .map( - c => - new Column({ ...c, ...view.model.columnsById[c.fk_column_id] } as any) - ) - .filter(column => !isSystemColumn(column) || view.show_system_fields); - - if (!model) return next(new Error('Table not found')); - - const base = await Base.get(model.base_id); - const baseModel = await Model.getBaseModelSQL({ - id: model.id, - viewId: view?.id, - dbDriver: NcConnectionMgrv2.get(base) - }); - - const key = `${model.title}List`; - const requestObj = { - [key]: await baseModel.defaultResolverReq(req.query, false, false) - }; - - let offset = +req.query.offset || 0; - const limit = 100; - // const size = +process.env.NC_EXPORT_MAX_SIZE || 1024; - const timeout = +process.env.NC_EXPORT_MAX_TIMEOUT || 5000; - const csvRows = []; - const startTime = process.hrtime(); - let elapsed, temp; - - for ( - elapsed = 0; - elapsed < timeout; - offset += limit, - temp = process.hrtime(startTime), - elapsed = temp[0] * 1000 + temp[1] / 1000000 - ) { - console.time('nocoExecute'); - const rows = ( - await nocoExecute( - requestObj, - { - [key]: async args => { - return await baseModel.list({ ...args, offset, limit }); - } - }, - {}, - { nested: { [key]: req.query } } - ) - )?.[key]; - - if (!rows?.length) { - offset = -1; - break; - } - - for (const row of rows) { - const csvRow = { ...row }; - - for (const column of view.model.columns) { - if (isSystemColumn(column) && !view.show_system_fields) continue; - csvRow[column.title] = await serializeCellValue({ - value: row[column.title], - column - }); - } - csvRows.push(csvRow); - } - console.timeEnd('nocoExecute'); - } - - const data = papaparse.unparse( - { - fields: model.columns.map(c => c.title), - data: csvRows - }, - { - escapeFormulae: true - } - ); + const { offset, elapsed, data } = await extractCsvData(view, req); res.set({ 'Access-Control-Expose-Headers': 'nc-export-offset', @@ -107,71 +16,6 @@ async function exportCsv(req: Request, res: Response, next) { res.send(data); } -async function serializeCellValue({ - value, - column -}: { - column?: Column; - value: any; -}) { - if (!column) { - return value; - } - - if (!value) return value; - - switch (column?.uidt) { - case UITypes.Attachment: { - let data = value; - try { - if (typeof value === 'string') { - data = JSON.parse(value); - } - } catch {} - - return (data || []).map( - attachment => - `${encodeURI(attachment.title)}(${encodeURI(attachment.url)})` - ); - } - case UITypes.Lookup: - { - const colOptions = await column.getColOptions(); - const lookupColumn = await colOptions.getLookupColumn(); - return ( - await Promise.all( - [...(Array.isArray(value) ? value : [value])].map(async v => - serializeCellValue({ - value: v, - column: lookupColumn - }) - ) - ) - ).join(', '); - } - break; - case UITypes.LinkToAnotherRecord: - { - const colOptions = await column.getColOptions< - LinkToAnotherRecordColumn - >(); - const relatedModel = await colOptions.getRelatedTable(); - await relatedModel.getColumns(); - return [...(Array.isArray(value) ? value : [value])] - .map(v => { - return v[relatedModel.primaryValue?.title]; - }) - .join(', '); - } - break; - default: - if (value && typeof value === 'object') { - return JSON.stringify(value); - } - return value; - } -} - const router = Router({ mergeParams: true }); -router.get('/data/:viewId/export/csv', ncMetaAclMw(exportCsv)); +router.get('/data/:viewId/export/csv', ncMetaAclMw(exportCsv, 'exportCsv')); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/filterApis.ts b/packages/nocodb/src/lib/noco/meta/api/filterApis.ts index 39890c9471..7dc9964bd7 100644 --- a/packages/nocodb/src/lib/noco/meta/api/filterApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/filterApis.ts @@ -85,7 +85,7 @@ export async function filterUpdate(req, res, next) { ...req.body, fk_view_id: req.params.viewId }); - Tele.emit('evt', { evt_type: 'table:updated' }); + Tele.emit('evt', { evt_type: 'filter:updated' }); res.json(filter); } catch (e) { console.log(e); @@ -97,7 +97,7 @@ export async function filterUpdate(req, res, next) { export async function filterDelete(req: Request, res: Response, next) { try { const filter = await Filter.delete(req.params.filterId); - Tele.emit('evt', { evt_type: 'table:deleted' }); + Tele.emit('evt', { evt_type: 'filter:deleted' }); res.json(filter); } catch (e) { console.log(e); @@ -105,14 +105,60 @@ export async function filterDelete(req: Request, res: Response, next) { } } +export async function hookFilterList( + req: Request, + res: Response +) { + const filter = await Filter.rootFilterListByHook({ + hookId: req.params.hookId + }); + + res.json(filter); +} + +export async function hookFilterCreate(req: Request, res) { + const filter = await Filter.insert({ + ...req.body, + fk_hook_id: req.params.hookId + }); + + Tele.emit('evt', { evt_type: 'hookFilter:created' }); + res.json(filter); +} + const router = Router({ mergeParams: true }); -router.get('/views/:viewId/filters/', ncMetaAclMw(filterList)); -router.post('/views/:viewId/filters/', ncMetaAclMw(filterCreate)); -router.get('/views/:viewId/filters/:filterId', ncMetaAclMw(filterGet)); -router.put('/views/:viewId/filters/:filterId', ncMetaAclMw(filterUpdate)); -router.delete('/views/:viewId/filters/:filterId', ncMetaAclMw(filterDelete)); router.get( - '/views/:viewId/filters/:filterParentId/children', - ncMetaAclMw(filterChildrenRead) + '/api/v1/db/meta/views/:viewId/filters', + ncMetaAclMw(filterList, 'filterList') +); +router.post( + '/api/v1/db/meta/views/:viewId/filters', + ncMetaAclMw(filterCreate, 'filterCreate') +); + +router.get( + '/api/v1/db/meta/hooks/:hookId/filters', + ncMetaAclMw(hookFilterList, 'filterList') +); +router.post( + '/api/v1/db/meta/hooks/:hookId/filters', + ncMetaAclMw(hookFilterCreate, 'filterCreate') +); + +router.get( + '/api/v1/db/meta/filters/:filterId', + ncMetaAclMw(filterGet, 'filterGet') +); +router.patch( + '/api/v1/db/meta/filters/:filterId', + ncMetaAclMw(filterUpdate, 'filterUpdate') +); +router.delete( + '/api/v1/db/meta/filters/:filterId', + ncMetaAclMw(filterDelete, 'filterDelete') +); +router.get( + '/api/v1/db/meta/filters/:filterParentId/children', + ncMetaAclMw(filterChildrenRead, 'filterChildrenRead') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts b/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts index 2aa7055155..ea99e1ee2b 100644 --- a/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts @@ -39,8 +39,20 @@ export async function formViewUpdate(req, res) { export async function formViewDelete(req: Request, res: Response, next) {} const router = Router({ mergeParams: true }); -router.post('/tables/:tableId/forms', ncMetaAclMw(formViewCreate)); -router.get('/forms/:formViewId', ncMetaAclMw(formViewGet)); -router.put('/forms/:formViewId', ncMetaAclMw(formViewUpdate)); -router.delete('/forms/:formViewId', ncMetaAclMw(formViewDelete)); +router.post( + '/api/v1/db/meta/tables/:tableId/forms', + ncMetaAclMw(formViewCreate, 'formViewCreate') +); +router.get( + '/api/v1/db/meta/forms/:formViewId', + ncMetaAclMw(formViewGet, 'formViewGet') +); +router.patch( + '/api/v1/db/meta/forms/:formViewId', + ncMetaAclMw(formViewUpdate, 'formViewUpdate') +); +router.delete( + '/api/v1/db/meta/forms/:formViewId', + ncMetaAclMw(formViewDelete, 'formViewDelete') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts b/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts index 06537da9b7..85fc44d8a3 100644 --- a/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts @@ -9,5 +9,8 @@ export async function columnUpdate(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.put('/formColumns/:formViewColumnId', ncMetaAclMw(columnUpdate)); +router.patch( + '/api/v1/db/meta/form-columns/:formViewColumnId', + ncMetaAclMw(columnUpdate, 'columnUpdate') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts b/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts index a7be5b7d75..de5912c315 100644 --- a/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts @@ -1,29 +1,13 @@ import { Request, Response, Router } from 'express'; -// @ts-ignore -import Model from '../../../noco-models/Model'; -// @ts-ignore -import { PagedResponseImpl } from '../helpers/PagedResponse'; -import { GalleryType, TableListType, ViewTypes } from 'nocodb-sdk'; -// @ts-ignore -import ProjectMgrv2 from '../../../sqlMgr/v2/ProjectMgrv2'; -// @ts-ignore -import Project from '../../../noco-models/Project'; +import { GalleryType, ViewTypes } from 'nocodb-sdk'; import View from '../../../noco-models/View'; import GalleryView from '../../../noco-models/GalleryView'; import ncMetaAclMw from '../helpers/ncMetaAclMw'; import { Tele } from 'nc-help'; -// @ts-ignore export async function galleryViewGet(req: Request, res: Response) { res.json(await GalleryView.get(req.params.galleryViewId)); } -// @ts-ignore -export async function galleyViewList( - _req: Request, - _res: Response -) {} - -// @ts-ignore export async function galleryViewCreate(req: Request, res) { Tele.emit('evt', { evt_type: 'vtable:created', show_as: 'gallery' }); const view = await View.insert({ @@ -35,20 +19,22 @@ export async function galleryViewCreate(req: Request, res) { res.json(view); } -// @ts-ignore export async function galleryViewUpdate(req, res) { Tele.emit('evt', { evt_type: 'view:updated', type: 'gallery' }); res.json(await GalleryView.update(req.params.galleryViewId, req.body)); } -// @ts-ignore -export async function galleyViewDelete(req: Request, res: Response, next) {} - const router = Router({ mergeParams: true }); -// router.get('/', galleyViewList); -router.post('/tables/:tableId/galleries', ncMetaAclMw(galleryViewCreate)); -// router.get('/:galleryViewId', galleyViewGet); -router.put('/galleries/:galleryViewId', ncMetaAclMw(galleryViewUpdate)); -router.get('/galleries/:galleryViewId', ncMetaAclMw(galleryViewGet)); -// router.delete('/:galleryViewId', galleyViewDelete); +router.post( + '/api/v1/db/meta/tables/:tableId/galleries', + ncMetaAclMw(galleryViewCreate, 'galleryViewCreate') +); +router.patch( + '/api/v1/db/meta/galleries/:galleryViewId', + ncMetaAclMw(galleryViewUpdate, 'galleryViewUpdate') +); +router.get( + '/api/v1/db/meta/galleries/:galleryViewId', + ncMetaAclMw(galleryViewGet, 'galleryViewGet') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts b/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts index 47cc17e2fb..23890a928f 100644 --- a/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts @@ -25,5 +25,8 @@ export async function gridViewCreate(req: Request, res) { } const router = Router({ mergeParams: true }); -router.post('/tables/:tableId/grids/', ncMetaAclMw(gridViewCreate)); +router.post( + '/api/v1/db/meta/tables/:tableId/grids/', + ncMetaAclMw(gridViewCreate, 'gridViewCreate') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts b/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts index 69bacd8d91..f845c09b57 100644 --- a/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts @@ -13,6 +13,12 @@ export async function gridColumnUpdate(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.get('/grid/:gridViewId/gridColumns', ncMetaAclMw(columnList)); -router.put('/gridColumns/:gridViewColumnId', ncMetaAclMw(gridColumnUpdate)); +router.get( + '/api/v1/db/meta/grids/:gridViewId/grid-columns', + ncMetaAclMw(columnList, 'columnList') +); +router.patch( + '/api/v1/db/meta/grid-columns/:gridViewColumnId', + ncMetaAclMw(gridColumnUpdate, 'gridColumnUpdate') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/hookApis.ts b/packages/nocodb/src/lib/noco/meta/api/hookApis.ts index b83111c553..e67dddcaef 100644 --- a/packages/nocodb/src/lib/noco/meta/api/hookApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/hookApis.ts @@ -75,13 +75,28 @@ export async function tableSampleData(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.get('/tables/:tableId/hooks', ncMetaAclMw(hookList)); -router.post('/tables/:tableId/hooks/test', ncMetaAclMw(hookTest)); -router.post('/tables/:tableId/hooks', ncMetaAclMw(hookCreate)); -router.delete('/hooks/:hookId', ncMetaAclMw(hookDelete)); -router.put('/hooks/:hookId', ncMetaAclMw(hookUpdate)); router.get( - '/tables/:tableId/hooks/samplePayload/:operation', + '/api/v1/db/meta/tables/:tableId/hooks', + ncMetaAclMw(hookList, 'hookList') +); +router.post( + '/api/v1/db/meta/tables/:tableId/hooks/test', + ncMetaAclMw(hookTest, 'hookTest') +); +router.post( + '/api/v1/db/meta/tables/:tableId/hooks', + ncMetaAclMw(hookCreate, 'hookCreate') +); +router.delete( + '/api/v1/db/meta/hooks/:hookId', + ncMetaAclMw(hookDelete, 'hookDelete') +); +router.patch( + '/api/v1/db/meta/hooks/:hookId', + ncMetaAclMw(hookUpdate, 'hookUpdate') +); +router.get( + '/api/v1/db/meta/tables/:tableId/hooks/samplePayload/:operation', catchError(tableSampleData) ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts b/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts index 4e62527739..c3bab363f0 100644 --- a/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts @@ -108,13 +108,25 @@ export async function filterDelete(req: Request, res: Response, next) { } const router = Router({ mergeParams: true }); -router.get('/hooks/:hookId/filters/', ncMetaAclMw(filterList)); -router.post('/hooks/:hookId/filters/', ncMetaAclMw(filterCreate)); -router.get('/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterGet)); -router.put('/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterUpdate)); -router.delete('/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterDelete)); +router.get('/hooks/:hookId/filters/', ncMetaAclMw(filterList, 'filterList')); +router.post( + '/hooks/:hookId/filters/', + ncMetaAclMw(filterCreate, 'filterCreate') +); +router.get( + '/hooks/:hookId/filters/:filterId', + ncMetaAclMw(filterGet, 'filterGet') +); +router.patch( + '/hooks/:hookId/filters/:filterId', + ncMetaAclMw(filterUpdate, 'filterUpdate') +); +router.delete( + '/hooks/:hookId/filters/:filterId', + ncMetaAclMw(filterDelete, 'filterDelete') +); router.get( '/hooks/:hookId/filters/:filterParentId/children', - ncMetaAclMw(filterChildrenRead) + ncMetaAclMw(filterChildrenRead, 'filterChildrenRead') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/index.ts b/packages/nocodb/src/lib/noco/meta/api/index.ts index c8b96c9b10..3f72fdaa41 100644 --- a/packages/nocodb/src/lib/noco/meta/api/index.ts +++ b/packages/nocodb/src/lib/noco/meta/api/index.ts @@ -30,6 +30,8 @@ import hookFilterApis from './hookFilterApis'; import { bulkDataAliasApis, dataAliasApis, + dataAliasExportApis, + dataAliasNestedApis, dataApis, oldDataApis } from './dataApis'; @@ -39,7 +41,8 @@ import { publicMetaApis } from './publicApis'; import { Tele } from 'nc-help'; -import Server from 'socket.io'; +import { Server } from 'socket.io'; +import passport from 'passport'; export default function(router: Router, server) { initStrategies(router); @@ -51,6 +54,8 @@ export default function(router: Router, server) { router.use(dataApis); router.use(bulkDataAliasApis); router.use(dataAliasApis); + router.use(dataAliasNestedApis); + router.use(dataAliasExportApis); router.use(oldDataApis); router.use(sortApis); router.use(filterApis); @@ -79,9 +84,33 @@ export default function(router: Router, server) { userApis(router); - const io = new Server(server); - io.on('connection', socket => { - socket.on('page', args => Tele.page(args)); - socket.on('event', args => Tele.event(args)); + const io = new Server(server, { + cors: { + origin: '*', + allowedHeaders: ['xc-auth'], + credentials: true + } + }); + + io.use(function(socket, next) { + passport.authenticate( + 'jwt', + { session: false }, + (_err, user, _info): any => { + if (!user) { + socket.disconnect(); + return next(new Error('Unauthorized')); + } + (socket.handshake as any).user = user; + next(); + } + )(socket.handshake, {}, next); + }).on('connection', socket => { + socket.on('page', args => { + Tele.page(args); + }); + socket.on('event', args => { + Tele.event(args); + }); }); } diff --git a/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts b/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts index c474075338..df0411c293 100644 --- a/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts @@ -17,6 +17,7 @@ import UITypes from '../../../sqlUi/UITypes'; import mapDefaultPrimaryValue from '../helpers/mapDefaultPrimaryValue'; import { Tele } from 'nc-help'; import getColumnUiType from '../helpers/getColumnUiType'; + export enum MetaDiffType { TABLE_NEW = 'TABLE_NEW', TABLE_REMOVE = 'TABLE_REMOVE', @@ -730,6 +731,7 @@ async function isMMRelationAvailable( if (col.uidt === UITypes.LinkToAnotherRecord) { const colOpt = await col.getColOptions(); if ( + colOpt && colOpt.type === RelationTypes.MANY_TO_MANY && colOpt.fk_mm_model_id === assocModel.id && colOpt.fk_child_column_id === colChildOpt.fk_parent_column_id && @@ -761,7 +763,7 @@ export async function extractAndGenerateManyToManyRelations( } } - // todo: impl proper way to identify m2m relation + // todo: impl better method to identify m2m relation if (belongsToCols?.length === 2 && normalColumns.length < 5) { const modelA = await belongsToCols[0].colOptions.getRelatedTable(); const modelB = await belongsToCols[1].colOptions.getRelatedTable(); @@ -819,6 +821,28 @@ export async function extractAndGenerateManyToManyRelations( } await Model.markAsMmTable(assocModel.id, true); + + // mark has many relation associated with mm as system field in both table + for (const btCol of [belongsToCols[0], belongsToCols[1]]) { + const colOpt = await btCol.colOptions; + const model = await colOpt.getRelatedTable(); + + for (const col of await model.getColumns()) { + if (col.uidt !== UITypes.LinkToAnotherRecord) continue; + + const colOpt1 = await col.getColOptions(); + if (!colOpt1 || colOpt1.type !== RelationTypes.HAS_MANY) continue; + + if ( + colOpt1.fk_child_column_id !== colOpt.fk_child_column_id || + colOpt1.fk_parent_column_id !== colOpt.fk_parent_column_id + ) + continue; + + await Column.markAsSystemField(col.id); + break; + } + } } else { if (assocModel.mm) await Model.markAsMmTable(assocModel.id, false); } @@ -826,6 +850,12 @@ export async function extractAndGenerateManyToManyRelations( } const router = Router(); -router.get('/projects/:projectId/metaDiff', ncMetaAclMw(metaDiff)); -router.post('/projects/:projectId/metaDiff', ncMetaAclMw(metaDiffSync)); +router.get( + '/api/v1/db/meta/projects/:projectId/meta-diff', + ncMetaAclMw(metaDiff, 'metaDiff') +); +router.post( + '/api/v1/db/meta/projects/:projectId/meta-diff', + ncMetaAclMw(metaDiffSync, 'metaDiffSync') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts b/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts index 785dbb832e..cb7093b3e4 100644 --- a/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts @@ -107,7 +107,7 @@ export async function xcVisibilityMetaGet( const router = Router({ mergeParams: true }); router.get( - '/projects/:projectId/modelVisibility', + '/api/v1/db/meta/projects/:projectId/visibility-rules', ncMetaAclMw(async (req, res) => { res.json( await xcVisibilityMetaGet( @@ -119,7 +119,7 @@ router.get( }, 'modelVisibilityList') ); router.post( - '/projects/:projectId/modelVisibility', + '/api/v1/db/meta/projects/:projectId/visibility-rules', ncMetaAclMw(xcVisibilityMetaSetAll, 'modelVisibilitySet') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts b/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts index 18455285aa..aff183d8b5 100644 --- a/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts @@ -34,9 +34,21 @@ export async function isPluginActive(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.get('/plugins', ncMetaAclMw(pluginList)); -router.post('/plugins/test', ncMetaAclMw(pluginTest)); -router.get('/plugins/:pluginId', ncMetaAclMw(pluginRead)); -router.put('/plugins/:pluginId', ncMetaAclMw(pluginUpdate)); -router.get('/plugins/:pluginTitle/status', ncMetaAclMw(isPluginActive)); +router.get('/api/v1/db/meta/plugins', ncMetaAclMw(pluginList, 'pluginList')); +router.post( + '/api/v1/db/meta/plugins/test', + ncMetaAclMw(pluginTest, 'pluginTest') +); +router.get( + '/api/v1/db/meta/plugins/:pluginId', + ncMetaAclMw(pluginRead, 'pluginRead') +); +router.patch( + '/api/v1/db/meta/plugins/:pluginId', + ncMetaAclMw(pluginUpdate, 'pluginUpdate') +); +router.get( + '/api/v1/db/meta/plugins/:pluginTitle/status', + ncMetaAclMw(isPluginActive, 'isPluginActive') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/projectApis.ts b/packages/nocodb/src/lib/noco/meta/api/projectApis.ts index 78ed0a9daa..a35bba442a 100644 --- a/packages/nocodb/src/lib/noco/meta/api/projectApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/projectApis.ts @@ -32,7 +32,6 @@ export async function projectGet( req: Request, res: Response ) { - console.log(req.query.page); const project = await Project.getWithInfo(req.params.projectId); // delete datasource connection details @@ -49,7 +48,6 @@ export async function projectList( next ) { try { - console.log(req.query.page); const projects = await Project.list(req.query); res // todo: pagination @@ -393,9 +391,24 @@ export async function projectInfoGet(req, res) { } export default router => { - router.get('/projects/:projectId/info', ncMetaAclMw(projectInfoGet)); - router.get('/projects/:projectId', ncMetaAclMw(projectGet)); - router.delete('/projects/:projectId', ncMetaAclMw(projectDelete)); - router.post('/projects', ncMetaAclMw(projectCreate)); - router.get('/projects', ncMetaAclMw(projectList)); + router.get( + '/api/v1/db/meta/projects/:projectId/info', + ncMetaAclMw(projectInfoGet, 'projectInfoGet') + ); + router.get( + '/api/v1/db/meta/projects/:projectId', + ncMetaAclMw(projectGet, 'projectGet') + ); + router.delete( + '/api/v1/db/meta/projects/:projectId', + ncMetaAclMw(projectDelete, 'projectDelete') + ); + router.post( + '/api/v1/db/meta/projects', + ncMetaAclMw(projectCreate, 'projectCreate') + ); + router.get( + '/api/v1/db/meta/projects', + ncMetaAclMw(projectList, 'projectList') + ); }; diff --git a/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts b/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts index ce132be1ca..ef49ce723e 100644 --- a/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts @@ -249,14 +249,20 @@ async function resendInvite(req, res, next): Promise { } const router = Router({ mergeParams: true }); -router.get('/projects/:projectId/users', ncMetaAclMw(userList)); -router.post('/projects/:projectId/users', ncMetaAclMw(userInvite)); -router.put( - '/projects/:projectId/users/:userId', - ncMetaAclMw(projectUserUpdate) +router.get( + '/api/v1/db/meta/projects/:projectId/users', + ncMetaAclMw(userList, 'userList') +); +router.post( + '/api/v1/db/meta/projects/:projectId/users', + ncMetaAclMw(userInvite, 'userInvite') +); +router.patch( + '/api/v1/db/meta/projects/:projectId/users/:userId', + ncMetaAclMw(projectUserUpdate, 'projectUserUpdate') ); router.delete( - '/projects/:projectId/users/:userId', - ncMetaAclMw(projectUserDelete) + '/api/v1/db/meta/projects/:projectId/users/:userId', + ncMetaAclMw(projectUserDelete, 'projectUserDelete') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts index b969de8934..6e00734fb5 100644 --- a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts @@ -15,15 +15,16 @@ import path from 'path'; import { nanoid } from 'nanoid'; import { mimeIcons } from '../../../../utils/mimeTypes'; import slash from 'slash'; +import { sanitizeUrlPath } from '../attachmentApis'; export async function dataList(req: Request, res: Response) { try { - const view = await View.getByUUID(req.params.publicDataUuid); + const view = await View.getByUUID(req.params.sharedViewUuid); if (!view) NcError.notFound('Not found'); if (view.type !== ViewTypes.GRID) NcError.notFound('Not found'); - if (view.password && view.password !== req.body?.password) { + if (view.password && view.password !== req.headers?.['xc-password']) { return NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); } @@ -39,37 +40,22 @@ export async function dataList(req: Request, res: Response) { dbDriver: NcConnectionMgrv2.get(base) }); - const key = `${model.title}List`; - const requestObj = { - [key]: await baseModel.defaultResolverReq(req.query) - }; - - const data = ( - await nocoExecute( - requestObj, - { - [key]: async args => { - return await baseModel.list(args); - } - }, - {}, - - { - nested: { - [key]: { - ...req.query, - sortArr: req.body?.sorts, - filterArr: req.body?.filters - } - } - } - ) - )?.[key]; + const listArgs: any = { ...req.query }; + try { + listArgs.filterArr = JSON.parse(listArgs.filterArrJson); + } catch (e) {} + try { + listArgs.sortArr = JSON.parse(listArgs.sortArrJson); + } catch (e) {} + + const data = await nocoExecute( + await baseModel.defaultResolverReq(req.query), + await baseModel.list(listArgs), + {}, + listArgs + ); - const count = await baseModel.count({ - ...req.query, - filterArr: req.body?.filters - }); + const count = await baseModel.count(listArgs); res.json({ data: new PagedResponseImpl(data, { ...req.query, count }) @@ -85,12 +71,12 @@ async function dataInsert( res: Response, next ) { - const view = await View.getByUUID(req.params.publicDataUuid); + const view = await View.getByUUID(req.params.sharedViewUuid); if (!view) return next(new Error('Not found')); if (view.type !== ViewTypes.FORM) return next(new Error('Not found')); - if (view.password && view.password !== req.body?.password) { + if (view.password && view.password !== req.headers?.['xc-password']) { return res.status(403).json(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); } @@ -98,6 +84,7 @@ async function dataInsert( id: view?.fk_model_id }); const base = await Base.get(model.base_id); + const project = await base.getProject(); const baseModel = await Model.getBaseModelSQL({ id: model.id, @@ -137,18 +124,26 @@ async function dataInsert( for (const file of req.files || []) { // remove `_` prefix and `[]` suffix const fieldName = file?.fieldname?.replace(/^_|\[\d*]$/g, ''); + + const filePath = sanitizeUrlPath([ + 'noco', + project.title, + model.title, + fieldName + ]); + if (fieldName in fields && fields[fieldName].uidt === UITypes.Attachment) { attachments[fieldName] = attachments[fieldName] || []; const fileName = `${nanoid(6)}_${file.originalname}`; let url = await storageAdapter.fileCreate( - slash(path.join('nc', 'uploads', base.project_id, view.id, fileName)), + slash(path.join('nc', 'uploads', ...filePath, fileName)), file ); if (!url) { - url = `${(req as any).ncSiteUrl}/download/${base.project_id}/${ - view.id - }/${fileName}`; + url = `${(req as any).ncSiteUrl}/download/${filePath.join( + '/' + )}/${fileName}`; } attachments[fieldName].push({ @@ -169,12 +164,12 @@ async function dataInsert( } async function relDataList(req, res) { - const view = await View.getByUUID(req.params.publicDataUuid); + const view = await View.getByUUID(req.params.sharedViewUuid); if (!view) NcError.notFound('Not found'); if (view.type !== ViewTypes.FORM) NcError.notFound('Not found'); - if (view.password && view.password !== req.body?.password) { + if (view.password && view.password !== req.headers?.['xc-password']) { NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); } @@ -215,12 +210,12 @@ async function relDataList(req, res) { } export async function publicMmList(req: Request, res: Response) { - const view = await View.getByUUID(req.params.publicDataUuid); + const view = await View.getByUUID(req.params.sharedViewUuid); if (!view) NcError.notFound('Not found'); if (view.type !== ViewTypes.GRID) NcError.notFound('Not found'); - if (view.password && view.password !== req.body?.password) { + if (view.password && view.password !== req.headers?.['xc-password']) { NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); } @@ -271,12 +266,12 @@ export async function publicMmList(req: Request, res: Response) { } export async function publicHmList(req: Request, res: Response) { - const view = await View.getByUUID(req.params.publicDataUuid); + const view = await View.getByUUID(req.params.sharedViewUuid); if (!view) NcError.notFound('Not found'); if (view.type !== ViewTypes.GRID) NcError.notFound('Not found'); - if (view.password && view.password !== req.body?.password) { + if (view.password && view.password !== req.headers?.['xc-password']) { NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); } @@ -330,13 +325,16 @@ export async function publicHmList(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.post('/public/data/:publicDataUuid/list', catchError(dataList)); -router.post( - '/public/data/:publicDataUuid/relationTable/:columnId', +router.get( + '/api/v1/db/public/shared-view/:sharedViewUuid/rows', + catchError(dataList) +); +router.get( + '/api/v1/db/public/shared-view/:sharedViewUuid/nested/:columnId', catchError(relDataList) ); router.post( - '/public/data/:publicDataUuid/create', + '/api/v1/db/public/shared-view/:sharedViewUuid/rows', multer({ storage: multer.diskStorage({}) }).any(), @@ -344,11 +342,11 @@ router.post( ); router.get( - '/public/data/:publicDataUuid/:rowId/mm/:colId', + '/api/v1/db/public/shared-view/:sharedViewUuid/rows/:rowId/mm/:colId', catchError(publicMmList) ); router.get( - '/public/data/:publicDataUuid/:rowId/hm/:colId', + '/api/v1/db/public/shared-view/:sharedViewUuid/rows/:rowId/hm/:colId', catchError(publicHmList) ); diff --git a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataExportApis.ts b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataExportApis.ts index 610ae41054..c39fb20343 100644 --- a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataExportApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataExportApis.ts @@ -17,7 +17,7 @@ async function exportCsv(req: Request, res: Response) { if (!view) NcError.notFound('Not found'); if (view.type !== ViewTypes.GRID) NcError.notFound('Not found'); - if (view.password && view.password !== req.body?.password) { + if (view.password && view.password !== req.headers?.['xc-password']) { NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); } @@ -34,6 +34,15 @@ async function exportCsv(req: Request, res: Response) { if (!model) NcError.notFound('Table not found'); + const fields = req.query.fields; + const listArgs: any = { ...req.query }; + try { + listArgs.filterArr = JSON.parse(listArgs.filterArrJson); + } catch (e) {} + try { + listArgs.sortArr = JSON.parse(listArgs.sortArrJson); + } catch (e) {} + const base = await Base.get(model.base_id); const baseModel = await Model.getBaseModelSQL({ id: model.id, @@ -61,7 +70,6 @@ async function exportCsv(req: Request, res: Response) { temp = process.hrtime(startTime), elapsed = temp[0] * 1000 + temp[1] / 1000000 ) { - console.time('nocoExecute'); const rows = ( await nocoExecute( requestObj, @@ -71,14 +79,9 @@ async function exportCsv(req: Request, res: Response) { } }, {}, - { nested: { - [key]: { - ...req.query, - sortArr: req.body?.sorts, - filterArr: req.body?.filters - } + [key]: listArgs } } ) @@ -100,12 +103,21 @@ async function exportCsv(req: Request, res: Response) { } csvRows.push(csvRow); } - console.timeEnd('nocoExecute'); } const data = papaparse.unparse( { - fields: model.columns.map(c => c.title), + fields: model.columns + .sort((c1, c2) => + Array.isArray(fields) + ? fields.indexOf(c1.title as any) - fields.indexOf(c2.title as any) + : 0 + ) + .filter( + c => + !fields || !Array.isArray(fields) || fields.includes(c.title as any) + ) + .map(c => c.title), data: csvRows }, { @@ -188,5 +200,8 @@ async function serializeCellValue({ } const router = Router({ mergeParams: true }); -router.post('/public/data/:publicDataUuid/export/csv', catchError(exportCsv)); +router.get( + '/api/v1/db/public/shared-view/:publicDataUuid/rows/export/csv', + catchError(exportCsv) +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts index 869deb951e..35a8f71c83 100644 --- a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts @@ -6,16 +6,17 @@ import UITypes from '../../../../sqlUi/UITypes'; import { ErrorMessages, LinkToAnotherRecordType } from 'nocodb-sdk'; import Column from '../../../../noco-models/Column'; import Base from '../../../../noco-models/Base'; +import Project from '../../../../noco-models/Project'; export async function viewMetaGet(req: Request, res: Response) { const view: View & { relatedMetas?: { [ket: string]: Model }; client?: string; - } = await View.getByUUID(req.params.publicDataUuid); + } = await View.getByUUID(req.params.sharedViewUuid); if (!view) NcError.notFound('Not found'); - if (view.password && view.password !== req.body?.password) { + if (view.password && view.password !== req.headers?.['xc-password']) { NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); } @@ -66,7 +67,24 @@ export async function viewMetaGet(req: Request, res: Response) { res.json(view); } +async function publicSharedBaseGet(req, res): Promise { + const project = await Project.getByUuid(req.params.sharedBaseUuid); + + if (!project) { + NcError.notFound(); + } + + res.json({ project_id: project.id }); +} const router = Router({ mergeParams: true }); -router.post('/public/meta/:publicDataUuid/', catchError(viewMetaGet)); +router.get( + '/api/v1/db/public/shared-view/:sharedViewUuid/meta', + catchError(viewMetaGet) +); + +router.get( + '/api/v1/db/public/shared-base/:sharedBaseUuid/meta', + catchError(publicSharedBaseGet) +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts b/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts index ee5aa59427..1fa4be4508 100644 --- a/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts @@ -3,7 +3,7 @@ import ncMetaAclMw from '../helpers/ncMetaAclMw'; import { v4 as uuidv4 } from 'uuid'; import { Tele } from 'nc-help'; import Project from '../../../noco-models/Project'; -import catchError, { NcError } from '../helpers/catchError'; +import { NcError } from '../helpers/catchError'; // todo: load from config const config = { dashboardPath: '/nc' @@ -88,29 +88,22 @@ async function getSharedBaseLink(req, res): Promise { res.json(data); } -async function publicSharedBaseGet(req, res): Promise { - const project = await Project.getByUuid(req.params.uuid); - - if (!project) { - NcError.notFound(); - } - - res.json({ project_id: project.id }); -} const router = Router({ mergeParams: true }); -router.get('/projects/:projectId/sharedBase', ncMetaAclMw(getSharedBaseLink)); +router.get( + '/api/v1/db/meta/projects/:projectId/shared', + ncMetaAclMw(getSharedBaseLink, 'getSharedBaseLink') +); router.post( - '/projects/:projectId/sharedBase', - ncMetaAclMw(createSharedBaseLink) + '/api/v1/db/meta/projects/:projectId/shared', + ncMetaAclMw(createSharedBaseLink, 'createSharedBaseLink') ); -router.put( - '/projects/:projectId/sharedBase', - ncMetaAclMw(updateSharedBaseLink) +router.patch( + '/api/v1/db/meta/projects/:projectId/shared', + ncMetaAclMw(updateSharedBaseLink, 'updateSharedBaseLink') ); router.delete( - '/projects/:projectId/sharedBase', - ncMetaAclMw(disableSharedBaseLink) + '/api/v1/db/meta/projects/:projectId/shared', + ncMetaAclMw(disableSharedBaseLink, 'disableSharedBaseLink') ); -router.get('/public/sharedBase/:uuid', catchError(publicSharedBaseGet)); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/sortApis.ts b/packages/nocodb/src/lib/noco/meta/api/sortApis.ts index 9022b42b83..26c2076c62 100644 --- a/packages/nocodb/src/lib/noco/meta/api/sortApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/sortApis.ts @@ -36,24 +36,34 @@ export async function sortCreate(req: Request, res) { res.json(sort); } -// @ts-ignore -export async function sortUpdate(req, res, next) { +export async function sortUpdate(req, res) { const sort = await Sort.update(req.params.sortId, req.body); Tele.emit('evt', { evt_type: 'sort:updated' }); res.json(sort); } -// @ts-ignore -export async function sortDelete(req: Request, res: Response, next) { +export async function sortDelete(req: Request, res: Response) { Tele.emit('evt', { evt_type: 'sort:deleted' }); const sort = await Sort.delete(req.params.sortId); res.json(sort); } const router = Router({ mergeParams: true }); -router.get('/views/:viewId/sorts/', ncMetaAclMw(sortList)); -router.post('/views/:viewId/sorts/', ncMetaAclMw(sortCreate)); -router.get('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortGet)); -router.put('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortUpdate)); -router.delete('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortDelete)); +router.get( + '/api/v1/db/meta/views/:viewId/sorts/', + ncMetaAclMw(sortList, 'sortList') +); +router.post( + '/api/v1/db/meta/views/:viewId/sorts/', + ncMetaAclMw(sortCreate, 'sortCreate') +); +router.get('/api/v1/db/meta/sorts/:sortId', ncMetaAclMw(sortGet, 'sortGet')); +router.patch( + '/api/v1/db/meta/sorts/:sortId', + ncMetaAclMw(sortUpdate, 'sortUpdate') +); +router.delete( + '/api/v1/db/meta/sorts/:sortId', + ncMetaAclMw(sortDelete, 'sortDelete') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/tableApis.ts b/packages/nocodb/src/lib/noco/meta/api/tableApis.ts index 39577ea28f..ee5ab4ea9b 100644 --- a/packages/nocodb/src/lib/noco/meta/api/tableApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/tableApis.ts @@ -183,7 +183,6 @@ export async function tableUpdate(req: Request, res) { export async function tableDelete(req: Request, res: Response, next) { try { - console.log(req.params); const table = await Model.getByIdOrName({ id: req.params.tableId }); await table.getColumns(); @@ -223,10 +222,28 @@ export async function tableDelete(req: Request, res: Response, next) { } const router = Router({ mergeParams: true }); -router.get('/projects/:projectId/:baseId/tables', ncMetaAclMw(tableList)); -router.post('/projects/:projectId/:baseId/tables', ncMetaAclMw(tableCreate)); -router.get('/tables/:tableId', ncMetaAclMw(tableGet)); -router.put('/tables/:tableId', ncMetaAclMw(tableUpdate)); -router.delete('/tables/:tableId', ncMetaAclMw(tableDelete)); -router.post('/tables/:tableId/reorder', ncMetaAclMw(tableReorder)); +router.get( + '/api/v1/db/meta/projects/:projectId/tables', + ncMetaAclMw(tableList, 'tableList') +); +router.post( + '/api/v1/db/meta/projects/:projectId/tables', + ncMetaAclMw(tableCreate, 'tableCreate') +); +router.get( + '/api/v1/db/meta/tables/:tableId', + ncMetaAclMw(tableGet, 'tableGet') +); +router.patch( + '/api/v1/db/meta/tables/:tableId', + ncMetaAclMw(tableUpdate, 'tableUpdate') +); +router.delete( + '/api/v1/db/meta/tables/:tableId', + ncMetaAclMw(tableDelete, 'tableDelete') +); +router.post( + '/api/v1/db/meta/tables/:tableId/reorder', + ncMetaAclMw(tableReorder, 'tableReorder') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts b/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts index 5eefd472a5..83051b481a 100644 --- a/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts +++ b/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts @@ -9,17 +9,18 @@ import { ExtractJwt } from 'passport-jwt'; import { Strategy as AuthTokenStrategy } from 'passport-auth-token'; const PassportLocalStrategy = require('passport-local').Strategy; -// todo: read from database + const jwtOptions = { - secretOrKey: 'dkjfkdjfkjdfjdfjdkfjdkfjkdfkjdkfjdkjfkdk', expiresIn: process.env.NC_JWT_EXPIRES_IN ?? '10h', jwtFromRequest: ExtractJwt.fromHeader('xc-auth') }; + import bcrypt from 'bcryptjs'; import Project from '../../../../noco-models/Project'; import NocoCache from '../../../../noco-cache/NocoCache'; import { CacheGetType, CacheScope } from '../../../../utils/globals'; import ApiToken from '../../../../noco-models/ApiToken'; +import Noco from '../../../Noco'; export function initStrategies(router): void { passport.use( @@ -80,8 +81,10 @@ export function initStrategies(router): void { passport.use( new Strategy( { + secretOrKey: Noco.getConfig().auth.jwt.secret, ...jwtOptions, - passReqToCallback: true + passReqToCallback: true, + ...Noco.getConfig().auth.jwt.options }, async (req, jwtPayload, done) => { const keyVals = [jwtPayload?.email]; diff --git a/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts b/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts index e8d966a39f..712862e018 100644 --- a/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts @@ -15,10 +15,6 @@ import Audit from '../../../../noco-models/Audit'; import crypto from 'crypto'; import NcPluginMgrv2 from '../../helpers/NcPluginMgrv2'; -// todo: read from database -const secret = 'dkjfkdjfkjdfjdfjdkfjdkfjkdfkjdkfjdkjfkdk'; -const jwtConfig = {}; - import passport from 'passport'; import extractProjectIdAndAuthenticate from '../../helpers/extractProjectIdAndAuthenticate'; import ncMetaAclMw from '../../helpers/ncMetaAclMw'; @@ -154,7 +150,8 @@ export async function signup(req: Request, res: Response) { id: user.id, roles: user.roles }, - secret + Noco.getConfig().auth.jwt.secret, + Noco.getConfig().auth.jwt.options ) } as any); } @@ -200,8 +197,9 @@ async function signin(req, res, next) { id: user.id, roles: user.roles }, - secret, - jwtConfig + + Noco.getConfig().auth.jwt.secret, + Noco.getConfig().auth.jwt.options ) } as any); } catch (e) { @@ -299,7 +297,6 @@ async function passwordForgot(req: Request, res): Promise { 'Warning : `mailSend` failed, Please configure emailClient configuration.' ); } - console.log(`Password reset token : ${token}`); Audit.insert({ op_type: 'AUTHENTICATION', @@ -393,6 +390,44 @@ async function emailVerification(req, res): Promise { res.json({ msg: 'Email verified successfully' }); } +async function refreshToken(req, res): Promise { + try { + if (!req?.cookies?.refresh_token) { + return res.status(400).json({ msg: 'Missing refresh token' }); + } + + const user = await User.getByRefreshToken(req.cookies.refresh_token); + + if (!user) { + return res.status(400).json({ msg: 'Invalid refresh token' }); + } + + const refreshToken = randomTokenString(); + + await User.update(user.id, { + refresh_token: refreshToken + }); + + setTokenCookie(res, refreshToken); + + res.json({ + token: jwt.sign( + { + email: user.email, + firstname: user.firstname, + lastname: user.lastname, + id: user.id, + roles: user.roles + }, + Noco.getConfig().auth.jwt.secret, + Noco.getConfig().auth.jwt.options + ) + } as any); + } catch (e) { + return res.status(400).json({ msg: e.message }); + } +} + const mapRoutes = router => { // todo: old api - /auth/signup?tool=1 router.post('/auth/user/signup', catchError(signup)); @@ -402,7 +437,39 @@ const mapRoutes = router => { router.post('/auth/token/validate/:tokenId', catchError(tokenValidate)); router.post('/auth/password/reset/:tokenId', catchError(passwordReset)); router.post('/auth/email/validate/:tokenId', catchError(emailVerification)); - - router.post('/user/password/change', ncMetaAclMw(passwordChange)); + router.post( + '/user/password/change', + ncMetaAclMw(passwordChange, 'passwordChange') + ); + router.post('/auth/token/refresh', ncMetaAclMw(refreshToken, 'refreshToken')); + + router.post('/api/v1/db/auth/user/signup', catchError(signup)); + router.post('/api/v1/db/auth/user/signin', catchError(signin)); + router.get( + '/api/v1/db/auth/user/me', + extractProjectIdAndAuthenticate, + catchError(me) + ); + router.post('/api/v1/db/auth/password/forgot', catchError(passwordForgot)); + router.post( + '/api/v1/db/auth/token/validate/:tokenId', + catchError(tokenValidate) + ); + router.post( + '/api/v1/db/auth/password/reset/:tokenId', + catchError(passwordReset) + ); + router.post( + '/api/v1/db/auth/email/validate/:tokenId', + catchError(emailVerification) + ); + router.post( + '/user/password/change', + ncMetaAclMw(passwordChange, 'passwordChange') + ); + router.post( + '/api/v1/db/auth/token/refresh', + ncMetaAclMw(refreshToken, 'refreshToken') + ); }; export { mapRoutes as userApis }; diff --git a/packages/nocodb/src/lib/noco/meta/api/utilApis.ts b/packages/nocodb/src/lib/noco/meta/api/utilApis.ts index f49621e733..a63a85d615 100644 --- a/packages/nocodb/src/lib/noco/meta/api/utilApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/utilApis.ts @@ -44,6 +44,9 @@ export async function appInfo(_req: Request, res: Response) { } export default router => { - router.post('/testConnection', ncMetaAclMw(testConnection)); - router.get('/appInfo', catchError(appInfo)); + router.post( + '/api/v1/db/meta/connection/test', + ncMetaAclMw(testConnection, 'testConnection') + ); + router.get('/api/v1/db/meta/nocodb/info', catchError(appInfo)); }; diff --git a/packages/nocodb/src/lib/noco/meta/api/viewApis.ts b/packages/nocodb/src/lib/noco/meta/api/viewApis.ts index 7504cd470b..42107db222 100644 --- a/packages/nocodb/src/lib/noco/meta/api/viewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/viewApis.ts @@ -101,15 +101,42 @@ async function shareViewList(req: Request, res) { } const router = Router({ mergeParams: true }); -router.get('/tables/:tableId/views', ncMetaAclMw(viewList)); -router.put('/views/:viewId', ncMetaAclMw(viewUpdate)); -router.delete('/views/:viewId', ncMetaAclMw(viewDelete)); -router.post('/views/:viewId/showAll', ncMetaAclMw(showAllColumns)); -router.post('/views/:viewId/hideAll', ncMetaAclMw(hideAllColumns)); - -router.get('/tables/:tableId/share', ncMetaAclMw(shareViewList)); -router.post('/views/:viewId/share', ncMetaAclMw(shareView)); -router.put('/views/:viewId/share', ncMetaAclMw(shareViewPasswordUpdate)); -router.delete('/views/:viewId/share', ncMetaAclMw(shareViewDelete)); +router.get( + '/api/v1/db/meta/tables/:tableId/views', + ncMetaAclMw(viewList, 'viewList') +); +router.patch( + '/api/v1/db/meta/views/:viewId', + ncMetaAclMw(viewUpdate, 'viewUpdate') +); +router.delete( + '/api/v1/db/meta/views/:viewId', + ncMetaAclMw(viewDelete, 'viewDelete') +); +router.post( + '/api/v1/db/meta/views/:viewId/show-all', + ncMetaAclMw(showAllColumns, 'showAllColumns') +); +router.post( + '/api/v1/db/meta/views/:viewId/hide-all', + ncMetaAclMw(hideAllColumns, 'hideAllColumns') +); + +router.get( + '/api/v1/db/meta/tables/:tableId/share', + ncMetaAclMw(shareViewList, 'shareViewList') +); +router.post( + '/api/v1/db/meta/views/:viewId/share', + ncMetaAclMw(shareView, 'shareView') +); +router.patch( + '/api/v1/db/meta/views/:viewId/share', + ncMetaAclMw(shareViewPasswordUpdate, 'shareViewPasswordUpdate') +); +router.delete( + '/api/v1/db/meta/views/:viewId/share', + ncMetaAclMw(shareViewDelete, 'shareViewDelete') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts b/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts index b8a6a3119e..2a3588308c 100644 --- a/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts @@ -31,10 +31,16 @@ export async function columnUpdate(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.get('/views/:viewId/columns/', ncMetaAclMw(columnList)); -router.post('/views/:viewId/columns/', ncMetaAclMw(columnAdd)); -router.put( - '/views/:viewId/columns/:columnId', +router.get( + '/api/v1/db/meta/views/:viewId/columns/', + ncMetaAclMw(columnList, 'columnList') +); +router.post( + '/api/v1/db/meta/views/:viewId/columns/', + ncMetaAclMw(columnAdd, 'columnAdd') +); +router.patch( + '/api/v1/db/meta/views/:viewId/columns/:columnId', ncMetaAclMw(columnUpdate, 'viewColumnUpdate') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/helpers/extractProjectIdAndAuthenticate.ts b/packages/nocodb/src/lib/noco/meta/helpers/extractProjectIdAndAuthenticate.ts index 686d0359ac..b30e33bb83 100644 --- a/packages/nocodb/src/lib/noco/meta/helpers/extractProjectIdAndAuthenticate.ts +++ b/packages/nocodb/src/lib/noco/meta/helpers/extractProjectIdAndAuthenticate.ts @@ -8,6 +8,9 @@ import GridViewColumn from '../../../noco-models/GridViewColumn'; import FormViewColumn from '../../../noco-models/FormViewColumn'; import GalleryViewColumn from '../../../noco-models/GalleryViewColumn'; import Project from '../../../noco-models/Project'; +import Column from '../../../noco-models/Column'; +import Filter from '../../../noco-models/Filter'; +import Sort from '../../../noco-models/Sort'; export default async (req, res, next) => { try { @@ -66,6 +69,15 @@ export default async (req, res, next) => { params.galleryViewColumnId ); req.ncProjectId = galleryViewColumn?.project_id; + } else if (params.columnId) { + const column = await Column.get({ colId: params.columnId }); + req.ncProjectId = column?.project_id; + } else if (params.filterId) { + const filter = await Filter.get(params.filterId); + req.ncProjectId = filter?.project_id; + } else if (params.sortId) { + const sort = await Sort.get(params.sortId); + req.ncProjectId = sort?.project_id; } const user = await new Promise((resolve, _reject) => { diff --git a/packages/nocodb/src/lib/noco/meta/helpers/ncMetaAclMw.ts b/packages/nocodb/src/lib/noco/meta/helpers/ncMetaAclMw.ts index 27f199c570..90e7687750 100644 --- a/packages/nocodb/src/lib/noco/meta/helpers/ncMetaAclMw.ts +++ b/packages/nocodb/src/lib/noco/meta/helpers/ncMetaAclMw.ts @@ -2,7 +2,7 @@ import projectAcl from '../../../utils/projectAcl'; import { NextFunction, Request, Response } from 'express'; import catchError, { NcError } from './catchError'; import extractProjectIdAndAuthenticate from './extractProjectIdAndAuthenticate'; -export default function(handlerFn, permissionName = handlerFn.name) { +export default function(handlerFn, permissionName) { return [ extractProjectIdAndAuthenticate, catchError(function authMiddleware(req, _res, next) { diff --git a/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts b/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts index 902a8c0dea..4eade93fa8 100644 --- a/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts @@ -185,7 +185,7 @@ export function axiosRequestMake(_apiMeta, apiReq, data) { export async function invokeWebhook( hook: Hook, - model: Model, + _model: Model, data, user, testFilters = null @@ -199,9 +199,6 @@ export async function invokeWebhook( ? JSON.parse(hook.notification) : hook.notification; - console.log('Hook handler ::::' + model.table_name + ':: Hook ::', hook); - console.log('Hook handler ::::' + model.table_name + ':: Data ::', data); - if (hook.condition) { if ( !(await validateCondition( diff --git a/packages/nocodb/src/lib/noco/migrations/nc_011.ts b/packages/nocodb/src/lib/noco/migrations/nc_011.ts index df924e38b0..56afd1c8cd 100644 --- a/packages/nocodb/src/lib/noco/migrations/nc_011.ts +++ b/packages/nocodb/src/lib/noco/migrations/nc_011.ts @@ -747,8 +747,16 @@ const up = async knex => { table.foreign('project_id').references(`${MetaTable.PROJECT}.id`); table.string('fk_user_id', 20); table.foreign('fk_user_id').references(`${MetaTable.USERS}.id`); - // todo table.text('roles'); + + table.boolean('starred'); + table.boolean('pinned'); + table.string('group'); + table.string('color'); + table.float('order'); + table.float('hidden'); + table.timestamp('opened_date'); + table.timestamps(true, true); }); diff --git a/packages/nocodb/src/lib/utils/projectAcl.ts b/packages/nocodb/src/lib/utils/projectAcl.ts index a86c8818d1..9fac3569e0 100644 --- a/packages/nocodb/src/lib/utils/projectAcl.ts +++ b/packages/nocodb/src/lib/utils/projectAcl.ts @@ -208,7 +208,9 @@ export default { passwordChange: true, projectList: true }, + super: '*', user: { + upload: true, passwordChange: true, pluginList: true, pluginRead: true, diff --git a/scripts/cypress/cypress.json b/scripts/cypress/cypress.json index f1e83f0797..006765dfbc 100644 --- a/scripts/cypress/cypress.json +++ b/scripts/cypress/cypress.json @@ -28,7 +28,7 @@ "viewportHeight": 1000, "video": false, "retries": 0, - "screenshotOnRunFailure": false, + "screenshotOnRunFailure": true, "numTestsKeptInMemory": 0, "env": { "testMode": [ @@ -43,7 +43,7 @@ "user": "root", "password": "password" }, - "screenshot": false + "screenshot": true }, "fixturesFolder": "scripts/cypress/fixtures", "integrationFolder": "scripts/cypress/integration", diff --git a/scripts/cypress/integration/common/6d_language_validation.js b/scripts/cypress/integration/common/6d_language_validation.js index 136fe2f7c6..bc0aef203c 100644 --- a/scripts/cypress/integration/common/6d_language_validation.js +++ b/scripts/cypress/integration/common/6d_language_validation.js @@ -7,8 +7,8 @@ export const genTest = (apiType, dbType) => { if (!isTestSuiteActive(apiType, dbType)) return; describe(`Language support`, () => { before(() => { - //loginPage.signIn(roles.owner.credentials) - mainPage.toolBarTopLeft(mainPage.HOME).click(); + loginPage.signIn(roles.owner.credentials) + // mainPage.toolBarTopLeft(mainPage.HOME).click(); cy.screenshot("Debug 6d-1", { overwrite: true }); }); diff --git a/scripts/markdown/readme/languages/chinese.md b/scripts/markdown/readme/languages/chinese.md index 796a3888db..e324e52081 100644 --- a/scripts/markdown/readme/languages/chinese.md +++ b/scripts/markdown/readme/languages/chinese.md @@ -10,7 +10,7 @@
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/dutch.md b/scripts/markdown/readme/languages/dutch.md index 19eece6b8e..d08f6fdf15 100644 --- a/scripts/markdown/readme/languages/dutch.md +++ b/scripts/markdown/readme/languages/dutch.md @@ -11,7 +11,7 @@ Draait elke MySQL, PostgreSQL, SQL Server, SQLITE & MARIADB in een Smart-Spreads
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/french.md b/scripts/markdown/readme/languages/french.md index dc8f4e972a..2f6b14d089 100644 --- a/scripts/markdown/readme/languages/french.md +++ b/scripts/markdown/readme/languages/french.md @@ -11,7 +11,7 @@ Tournez n'importe quel MySQL, PostgreSQL, SQL Server, SQLite & Mariadb dans une
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/german.md b/scripts/markdown/readme/languages/german.md index f7d6eefedf..c3decc7258 100644 --- a/scripts/markdown/readme/languages/german.md +++ b/scripts/markdown/readme/languages/german.md @@ -11,7 +11,7 @@ Verwandelt jeden MySQL, PostgreSQL, SQL Server, SQLite & MariaDB in eine Smart-T
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/NocoDB.svg?style=social&label=Follow%20%40NocoDB)](https://twitter.com/NocoDB)
diff --git a/scripts/markdown/readme/languages/indonesian.md b/scripts/markdown/readme/languages/indonesian.md index 7a53acdcdd..8f0dfedd91 100644 --- a/scripts/markdown/readme/languages/indonesian.md +++ b/scripts/markdown/readme/languages/indonesian.md @@ -11,7 +11,7 @@ Mengubah MySQL, PostgreSQL, SQL Server, SQLite & MariaDB apapun menjadi spreadsh
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/italian.md b/scripts/markdown/readme/languages/italian.md index 50b59880fd..f33566f054 100644 --- a/scripts/markdown/readme/languages/italian.md +++ b/scripts/markdown/readme/languages/italian.md @@ -11,7 +11,7 @@ Trasforma qualsiasi MySQL, PostgreSQL, SQL Server, SQLite & Mariadb in un foglio
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/japanese.md b/scripts/markdown/readme/languages/japanese.md index 6852ec8172..03f1e32819 100644 --- a/scripts/markdown/readme/languages/japanese.md +++ b/scripts/markdown/readme/languages/japanese.md @@ -11,7 +11,7 @@ MySQL、PostgreSQL、SQL Server、SQLite&Mariadbをスマートスプレッド
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/korean.md b/scripts/markdown/readme/languages/korean.md index 917ba3dc71..d424c22101 100644 --- a/scripts/markdown/readme/languages/korean.md +++ b/scripts/markdown/readme/languages/korean.md @@ -12,7 +12,7 @@ MySQL, PostgreSQL, SQL Server, SQLite, MariaDB를 똑똑한 스프레드시트
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/portuguese.md b/scripts/markdown/readme/languages/portuguese.md index c09cc75823..b0af3efc3c 100644 --- a/scripts/markdown/readme/languages/portuguese.md +++ b/scripts/markdown/readme/languages/portuguese.md @@ -11,7 +11,7 @@ Transforma qualquer MySQL, PostgreSQL, SQL Server, Sqlite e MariaDB em uma plani
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/russian.md b/scripts/markdown/readme/languages/russian.md index f8b4028d98..e1fe2cba40 100644 --- a/scripts/markdown/readme/languages/russian.md +++ b/scripts/markdown/readme/languages/russian.md @@ -11,7 +11,7 @@
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/markdown/readme/languages/spanish.md b/scripts/markdown/readme/languages/spanish.md index 479fbb3f1e..a2c1e63822 100644 --- a/scripts/markdown/readme/languages/spanish.md +++ b/scripts/markdown/readme/languages/spanish.md @@ -11,7 +11,7 @@ Convierte cualquier MySQL, PostgreSQL, SQL Server, SQLite y Mariadb en una hoja
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) -[![Node version](https://badgen.net/npm/node/next)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/node-%3E%3D%2014.18.0-brightgreen)](http://nodejs.org/download/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)
diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index eac855e9a4..c2c121aa66 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -10,7 +10,7 @@ } ], "paths": { - "/auth/user/signup": { + "/api/v1/db/auth/user/signup": { "post": { "summary": "Signup", "operationId": "auth-signup", @@ -49,7 +49,7 @@ "description": "Create a new user with provided email and password and first user is marked as super admin. " } }, - "/auth/user/signin": { + "/api/v1/db/auth/user/signin": { "post": { "summary": "Signin", "operationId": "auth-signin", @@ -98,7 +98,7 @@ }, "parameters": [] }, - "/auth/user/me": { + "/api/v1/db/auth/user/me": { "parameters": [], "get": { "summary": "User Info", @@ -121,7 +121,7 @@ "description": "Returns authenticated user info" } }, - "/auth/password/forgot": { + "/api/v1/db/auth/password/forgot": { "post": { "summary": "Password Forgot", "operationId": "auth-password-forgot", @@ -151,7 +151,7 @@ }, "parameters": [] }, - "/auth/password/change": { + "/api/v1/db/auth/password/change": { "post": { "summary": "Password Change", "operationId": "auth-password-change", @@ -187,7 +187,7 @@ }, "parameters": [] }, - "/auth/token/validate/{token}": { + "/api/v1/db/auth/token/validate/{token}": { "post": { "summary": "Reset Token Verify", "operationId": "auth-password-reset-token-validate", @@ -212,7 +212,7 @@ } ] }, - "/auth/email/validate/{token}": { + "/api/v1/db/auth/email/validate/{token}": { "post": { "summary": "Verify Email", "operationId": "auth-email-validate", @@ -237,7 +237,7 @@ } ] }, - "/auth/password/reset/{token}": { + "/api/v1/db/auth/password/reset/{token}": { "post": { "summary": "Password Reset", "operationId": "auth-password-reset", @@ -276,41 +276,7 @@ } ] }, - "/auth/token/verify": { - "post": { - "summary": "Password Verify", - "operationId": "auth-token-verify", - "responses": { - "200": { - "description": "OK" - } - }, - "description": "", - "tags": [ - "Auth" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "token": { - "type": "string" - }, - "email": { - "type": "string" - } - } - } - } - }, - "description": "" - } - }, - "parameters": [] - }, - "/auth/token/refresh": { + "/api/v1/db/auth/token/refresh": { "post": { "summary": "Refresh Token", "operationId": "auth-token-refresh", @@ -326,7 +292,8 @@ }, "parameters": [] }, - "/projects/{projectId}/users": { + + "/api/v1/db/meta/projects/{projectId}/users": { "get": { "summary": "Project Users", "operationId": "auth-project-user-list", @@ -404,7 +371,7 @@ ] } }, - "/projects/{projectId}/info": { + "/api/v1/db/meta/projects/{projectId}/info": { "parameters": [ { "schema": { @@ -461,7 +428,7 @@ ] } }, - "/projects/{projectId}/users/{userId}": { + "/api/v1/db/meta/projects/{projectId}/users/{userId}": { "parameters": [ { "schema": { @@ -480,7 +447,7 @@ "required": true } ], - "put": { + "patch": { "summary": "Project User Update", "operationId": "auth-project-user-update", "responses": { @@ -522,7 +489,7 @@ ] } }, - "/projects/{projectId}/modelVisibility": { + "/api/v1/db/meta/projects/{projectId}/visibility-rules": { "get": { "summary": "UI ACL", "operationId": "project-model-visibility-list", @@ -588,7 +555,7 @@ ] } }, - "/projects/": { + "/api/v1/db/meta/projects/": { "parameters": [], "get": { "summary": "", @@ -676,7 +643,7 @@ ] } }, - "/projects/{projectId}": { + "/api/v1/db/meta/projects/{projectId}": { "parameters": [ { "schema": { @@ -731,7 +698,7 @@ ] } }, - "/projects/{projectId}/sharedBase": { + "/api/v1/db/meta/projects/{projectId}/shared": { "parameters": [ { "schema": { @@ -836,7 +803,7 @@ } } }, - "put": { + "patch": { "summary": "", "operationId": "project-shared-base-update", "responses": { @@ -867,89 +834,7 @@ "description": "" } }, - "/public/sharedBase/{sharedBaseUuid}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "sharedBaseUuid", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "public-shared-base-get", - "description": "Read project details", - "parameters": [], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "project_id": { - "type": "string" - } - } - } - } - } - } - }, - "tags": [ - "Public" - ] - } - }, - "/projects/{projectId}/views/{viewId}/upload": { - "post": { - "summary": "Attachment", - "operationId": "db-view-upload", - "responses": {}, - "tags": [ - "DB View" - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "files": {}, - "json": { - "type": "string" - } - } - } - } - }, - "description": "" - } - }, - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "projectId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - } - ] - }, - "/projects/{projectId}/{baseId}/tables": { + "/api/v1/db/meta/projects/{projectId}/tables": { "parameters": [ { "schema": { @@ -958,14 +843,6 @@ "name": "projectId", "in": "path", "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "baseId", - "in": "path", - "required": true } ], "post": { @@ -1046,54 +923,7 @@ ] } }, - "/projects/{projectId}/metaDiff": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "projectId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "", - "operationId": "project-meta-diff-sync", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "tags": [ - "Project" - ] - }, - "get": { - "summary": "", - "operationId": "project-meta-diff-get", - "parameters": [], - "tags": [ - "Project" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - } - } - }, - "/tables/{tableId}": { + "/api/v1/db/meta/tables/{tableId}": { "parameters": [ { "schema": { @@ -1213,7 +1043,7 @@ "DB Table" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-table-update", "responses": { @@ -1258,7 +1088,7 @@ "description": "" } }, - "/tables/{tableId}/reorder": { + "/api/v1/db/meta/tables/{tableId}/reorder": { "parameters": [ { "schema": { @@ -1296,7 +1126,7 @@ ] } }, - "/tables/{tableId}/columns": { + "/api/v1/db/meta/tables/{tableId}/columns": { "parameters": [ { "schema": { @@ -1307,29 +1137,6 @@ "required": true } ], - "get": { - "summary": "Column List", - "operationId": "db-table-column-list", - "responses": { - "200": { - "$ref": "#/components/responses/ColumnList" - }, - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Column" - } - } - } - } - }, - "description": "Read project details", - "tags": [ - "DB Table column" - ] - }, "post": { "summary": "Column create", "operationId": "db-table-column-create", @@ -1352,16 +1159,8 @@ ] } }, - "/tables/{tableId}/columns/{columnId}": { + "/api/v1/db/meta/columns/{columnId}": { "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - }, { "schema": { "type": "string" @@ -1371,27 +1170,7 @@ "required": true } ], - "get": { - "summary": "Column Read", - "operationId": "db-table-column-read", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Column" - } - } - } - } - }, - "description": "Read project details", - "tags": [ - "DB Table column" - ] - }, - "put": { + "patch": { "summary": "Column Update", "operationId": "db-table-column-update", "responses": { @@ -1432,39 +1211,56 @@ ] } }, - "/tables/{tableId}/columns/{columnId}/primary": { + "/api/v1/db/meta/columns/{columnId}/primary": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "columnId", "in": "path", "required": true + } + ], + "post": { + "summary": "", + "operationId": "db-table-column-primary-column-set", + "responses": { + "200": { + "description": "OK" + } }, + "tags": [ + "DB Table column" + ] + } + }, + "/api/v1/db/meta/tables/{tableId}/views": { + "parameters": [ { "schema": { "type": "string" }, - "name": "columnId", + "name": "tableId", "in": "path", "required": true } ], - "post": { + "get": { "summary": "", - "operationId": "db-table-column-primary-column-set", + "operationId": "db-view-list", "responses": { "200": { - "description": "OK" + "$ref": "#/components/responses/ViewList" } }, "tags": [ - "DB Table column" - ] + "DB View" + ], + "description": "" } }, - "/views/{viewId}": { + "/api/v1/db/meta/views/{viewId}": { "parameters": [ { "schema": { @@ -1475,7 +1271,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-view-update", "responses": { @@ -1528,7 +1324,7 @@ ] } }, - "/views/{viewId}/columns": { + "/api/v1/db/meta/views/{viewId}/show-all": { "parameters": [ { "schema": { @@ -1539,56 +1335,16 @@ "required": true } ], - "get": { - "summary": "", - "operationId": "db-view-column-list", - "responses": { - }, - "tags": [ - "DB View Column" - ] - }, "post": { "summary": "", - "operationId": "db-view-column-create", + "operationId": "db-view-show-all-column", "responses": { "200": { "description": "OK" } }, "tags": [ - "DB View Column" - ], - "requestBody": { - "content": { - "application/json": { - "schema": {} - } - } - } - } - }, - "/views/{viewId}/showAll": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "", - "operationId": "db-view-show-all-column", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" + "DB View" ], "description": "", "parameters": [ @@ -1602,7 +1358,7 @@ ] } }, - "/views/{viewId}/hideAll": { + "/api/v1/db/meta/views/{viewId}/hide-all": { "parameters": [ { "schema": { @@ -1636,63 +1392,40 @@ "description": "" } }, - "/views/{viewId}/columns/{columnId}": { + "/api/v1/db/meta/tables/{tableId}/share": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "columnId", + "name": "tableId", "in": "path", "required": true } ], "get": { - "summary": "", - "operationId": "db-view-column-read", + "summary": "Shared view list", + "operationId": "db-view-share-list", "responses": { "200": { "description": "OK", "content": { "application/json": { - "schema": {} + "schema": { + "type": "array", + "items": {} + } } } } }, + "description": "", "tags": [ - "DB View Column" + "DB View Share" ] - }, - "put": { - "summary": "", - "operationId": "db-view-column-update", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View Column" - ], - "requestBody": { - "content": { - "application/json": { - "schema": {} - } - } - } } }, - "/views/{viewId}/share": { + "/api/v1/db/meta/views/{viewId}/share": { "parameters": [ { "schema": { @@ -1727,7 +1460,7 @@ "DB View Share" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-view-share-update", "responses": { @@ -1775,7 +1508,7 @@ ] } }, - "/tables/{viewId}/share": { + "/api/v1/db/meta/views/{viewId}/columns": { "parameters": [ { "schema": { @@ -1788,27 +1521,73 @@ ], "get": { "summary": "", - "operationId": "db-view-share-list", + "operationId": "db-view-column-list", + "responses": { + }, + "tags": [ + "DB View Column" + ] + }, + "post": { + "summary": "", + "operationId": "db-view-column-create", "responses": { "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": {} - } - } + "description": "OK" + } + }, + "tags": [ + "DB View Column" + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} } } + } + } + }, + "/api/v1/db/meta/views/{viewId}/columns/{columnId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "viewId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "columnId", + "in": "path", + "required": true + } + ], + "patch": { + "summary": "", + "operationId": "db-view-column-update", + "responses": { + "200": { + "description": "OK" + } }, - "description": "", "tags": [ - "DB View Share" - ] + "DB View Column" + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } + } } }, - "/views/{viewId}/sorts": { + "/api/v1/db/meta/views/{viewId}/sorts": { "parameters": [ { "schema": { @@ -1868,16 +1647,8 @@ } } }, - "/views/{viewId}/sorts/{sortId}": { + "/api/v1/db/meta/sorts/{sortId}": { "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - }, { "schema": { "type": "string" @@ -1906,7 +1677,7 @@ "DB Table Sort" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-table-sort-update", "responses": { @@ -1940,7 +1711,7 @@ ] } }, - "/views/{viewId}/filters": { + "/api/v1/db/meta/views/{viewId}/filters": { "parameters": [ { "schema": { @@ -1985,16 +1756,53 @@ } } }, - "/views/{viewId}/filters/{filterId}": { + "/api/v1/db/meta/hooks/{hookId}/filters": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", + "name": "hookId", "in": "path", "required": true + } + ], + "get": { + "summary": "", + "operationId": "db-table-webhook-filter-read", + "responses": { + "200": { + "$ref": "#/components/responses/FilterList" + } + }, + "tags": [ + "DB Table Webhook Filter" + ] + }, + "post": { + "summary": "", + "operationId": "db-table-webhook-filter-create", + "responses": { + "200": { + "description": "OK" + } }, + "tags": [ + "DB Table Webhook Filter" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Filter" + } + } + } + } + } + }, + "/api/v1/db/meta/filters/{filterId}": { + "parameters": [ { "schema": { "type": "string" @@ -2023,7 +1831,7 @@ "DB Table Filter" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-table-filter-update", "responses": { @@ -2057,21 +1865,13 @@ ] } }, - "/views/{viewId}/filters/{filterParentId}/children": { + "/api/v1/db/meta/filters/{filterGroupId}/children": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "filterParentId", + "name": "filterGroupId", "in": "path", "required": true } @@ -2096,300 +1896,88 @@ ] } }, - "/hooks/{hookId}/filters": { + "/api/v1/db/meta/tables/{tableId}/grids": { "parameters": [ { "schema": { "type": "string" }, - "name": "hookId", + "name": "tableId", "in": "path", "required": true } ], - "get": { - "summary": "", - "operationId": "db-table-webhook-filter-read", - "responses": { - "200": { - "$ref": "#/components/responses/FilterList" - } - }, - "tags": [ - "DB Table Webhook Filter" - ] - }, "post": { "summary": "", - "operationId": "db-table-webhook-filter-create", + "operationId": "db-view-grid-create", "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Grid" + } + } + } } }, "tags": [ - "DB Table Webhook Filter" + "DB View" ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/Grid" } } } } } }, - "/hooks/{viewId}/filters/{filterId}": { + "/api/v1/db/meta/tables/{tableId}/forms": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "filterId", + "name": "tableId", "in": "path", "required": true } ], - "get": { + "post": { "summary": "", - "operationId": "db-table-webhook-filter-get", + "operationId": "db-view-form-create", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/Form" } } } } }, + "description": "", "tags": [ - "DB Table Webhook Filter" - ] - }, - "put": { - "summary": "", - "operationId": "db-table-webhook-filter-update", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB Table Webhook Filter" + "DB View" ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" - } - } - } - } - }, - "delete": { - "summary": "", - "operationId": "db-table-webhook-filter-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB Table Webhook Filter" - ] - } - }, - "/hooks/{viewId}/filters/{filterParentId}/children": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "filterParentId", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "db-table-webhook-filter-children-read", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Filter" - } - } - } - } - }, - "tags": [ - "DB Table Webhook Filter" - ] - } - }, - "/tables/{tableId}/grids": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "", - "operationId": "db-view-grid-create", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Grid" - } - } - } - } - }, - "tags": [ - "DB View" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Grid" - } - } - } - } - } - }, - "/tables/{tableId}/grids/{gridId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "gridId", - "in": "path", - "required": true - } - ], - "put": { - "summary": "", - "operationId": "db-view-grid-update", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "delete": { - "summary": "", - "operationId": "db-view-grid-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "get": { - "summary": "", - "operationId": "db-view-grid-read", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - } - }, - "/tables/{tableId}/forms": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "", - "operationId": "db-view-form-create", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Form" - } - } - } - } - }, - "description": "", - "tags": [ - "DB View" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Form" + "$ref": "#/components/schemas/Form" } } } } } }, - "/forms/{formId}": { + "/api/v1/db/meta/forms/{formId}": { "parameters": [ { "schema": { @@ -2400,7 +1988,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-view-form-update", "responses": { @@ -2441,18 +2029,18 @@ ] } }, - "/formColumns/{columnId}": { + "/api/v1/db/meta/form-columns/{formViewColumnId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "columnId", + "name": "formViewColumnId", "in": "path", "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-view-form-column-update", "responses": { @@ -2481,13 +2069,13 @@ } } }, - "/grid/{gidId}/gridColumns": { + "/api/v1/db/meta/grids/{gridId}/grid-columns": { "parameters": [ { "schema": { "type": "string" }, - "name": "gidId", + "name": "gridId", "in": "path", "required": true } @@ -2515,7 +2103,7 @@ ] } }, - "/gridColumns/{columnId}": { + "/api/v1/db/meta/grid-columns/{columnId}": { "parameters": [ { "schema": { @@ -2526,7 +2114,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-view-grid-column-update", "responses": { @@ -2553,7 +2141,7 @@ } } }, - "/tables/{tableId}/galleries": { + "/api/v1/db/meta/tables/{tableId}/galleries": { "parameters": [ { "schema": { @@ -2594,7 +2182,7 @@ } } }, - "/galleries/{galleryId}": { + "/api/v1/db/meta/galleries/{galleryId}": { "parameters": [ { "schema": { @@ -2605,7 +2193,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-view-gallery-update", "responses": { @@ -2626,18 +2214,6 @@ } } }, - "delete": { - "summary": "", - "operationId": "db-view-gallery-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, "get": { "summary": "", "operationId": "db-view-gallery-read", @@ -2658,37 +2234,69 @@ ] } }, - "/tables/{tableId}/kanbans": { + "/api/v1/db/meta/projects/{projectId}/meta-diff": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "projectId", "in": "path", "required": true } ], "post": { "summary": "", - "operationId": "db-view-kanban-create", + "operationId": "project-meta-diff-sync", "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } } }, "tags": [ - "DB View" + "Project" ] + }, + "get": { + "summary": "", + "operationId": "project-meta-diff-get", + "parameters": [], + "tags": [ + "Project" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + } } }, - "/tables/{tableId}/kanbans/{kanbanId}": { + + "/api/v1/db/data/{orgs}/{projectName}/{tableName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", "in": "path", "required": true }, @@ -2696,150 +2304,7 @@ "schema": { "type": "string" }, - "name": "kanbanId", - "in": "path", - "required": true - } - ], - "put": { - "summary": "", - "operationId": "db-view-kanban-update", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "delete": { - "summary": "", - "operationId": "db-view-kanban-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "get": { - "summary": "", - "operationId": "db-view-kanban-read", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - } - }, - "/tables/{tableId}/views": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "db-view-list", - "responses": { - "200": { - "$ref": "#/components/responses/ViewList" - } - }, - "tags": [ - "DB View" - ], - "description": "" - } - }, - "/data/{tableId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "data-list", - "description": "", - "tags": [ - "Data" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - } - }, - "post": { - "summary": "", - "operationId": "data-create", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "tags": [ - "Data" - ], - "requestBody": { - "content": { - "application/json": { - "schema": {} - } - } - } - } - }, - "/data/{orgs}/{projectName}/{tableAlias}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "orgs", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "projectName", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "tableAlias", + "name": "tableName", "in": "path", "required": true } @@ -2910,7 +2375,7 @@ } } }, - "/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}": { "parameters": [ { "schema": { @@ -2932,7 +2397,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "tableName", "in": "path", "required": true }, @@ -3017,7 +2482,7 @@ } } }, - "/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/count": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId}": { "parameters": [ { "schema": { @@ -3039,7 +2504,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "tableName", "in": "path", "required": true }, @@ -3050,107 +2515,37 @@ "name": "viewName", "in": "path", "required": true - } - ], - "get": { - "summary": "", - "operationId": "db-view-row-count", - "description": "", - "tags": [ - "DB View Row" - ], - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "where" - }, - { - "schema": {}, - "in": "query", - "name": "nested", - "description": "Query params for nested data" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - } - } - }, - "/data/{tableId}/export/{type}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true }, { "schema": { - "type": "string", - "enum": [ - "csv", - "excel" - ] + "type": "string" }, - "name": "type", + "name": "rowId", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "data-csv-export", - "description": "CSV or Excel export", - "tags": [ - "Data" - ], - "wrapped": true, + "operationId": "db-view-row-read", "responses": { - "200": { - "description": "OK", + "201": { + "description": "Created", "content": { - "application/octet-stream": { + "application/json": { "schema": {} } - }, - "headers": { - "nc-export-offset": { - "schema": { - "type": "integer" - } - } } } }, - "parameters": [] - } - }, - "/public/data/{uuid}/list": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "uuid", - "in": "path", - "required": true - } - ], - "post": { + "description": "", + "tags": [ + "DB View Row" + ] + }, + "patch": { "summary": "", - "operationId": "public-data-list", + "operationId": "db-view-row-update", "responses": { "200": { "description": "OK", @@ -3162,60 +2557,37 @@ } }, "tags": [ - "Public" + "DB View Row" ], "requestBody": { "content": { "application/json": { - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "sorts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Sort" - } - }, - "filters": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Filter" - } - } - } - } + "schema": {} } - }, - "description": "" - }, - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "limit" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "offset" } - ] + } + }, + "delete": { + "summary": "", + "operationId": "db-view-row-delete", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [ + "DB View Row" + ], + "description": "" } }, - "/public/data/{uuid}/{rowId}/{relationType}/{columnId}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", "in": "path", "required": true }, @@ -3223,19 +2595,15 @@ "schema": { "type": "string" }, - "name": "rowId", + "name": "projectName", "in": "path", "required": true }, { "schema": { - "type": "string", - "enum": [ - "mm", - "hm" - ] + "type": "string" }, - "name": "relationType", + "name": "tableName", "in": "path", "required": true }, @@ -3243,14 +2611,32 @@ "schema": { "type": "string" }, - "name": "columnId", + "name": "rowId", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "public-data-nested-list", + "operationId": "db-table-row-read", + "responses": { + "201": { + "description": "Created", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "description": "", + "tags": [ + "DB Table Row" + ] + }, + "patch": { + "summary": "", + "operationId": "db-table-row-update", "responses": { "200": { "description": "OK", @@ -3262,33 +2648,37 @@ } }, "tags": [ - "Public" + "DB Table Row" ], - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "limit" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "offset" + "requestBody": { + "content": { + "application/json": { + "schema": {} + } } - ] + } + }, + "delete": { + "summary": "", + "operationId": "db-table-row-model-delete", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [ + "DB Table Row" + ], + "description": "" } }, - "/public/data/{uuid}/{rowId}/{relationType}/{columnId}/exclude": { + "/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", "in": "path", "required": true }, @@ -3296,19 +2686,7 @@ "schema": { "type": "string" }, - "name": "rowId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string", - "enum": [ - "mm", - "hm" - ] - }, - "name": "relationType", + "name": "projectName", "in": "path", "required": true }, @@ -3316,14 +2694,14 @@ "schema": { "type": "string" }, - "name": "columnId", + "name": "tableName", "in": "path", "required": true } ], - "get": { + "post": { "summary": "", - "operationId": "public-data-nested-excluded-list", + "operationId": "db-table-row-bulk-create", "responses": { "200": { "description": "OK", @@ -3335,40 +2713,19 @@ } }, "tags": [ - "Public" + "DB Table Row" ], - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "limit" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "offset" + "requestBody": { + "content": { + "application/json": { + "schema": {} + } } - ] - } - }, - "/public/data/{uuid}/create": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "uuid", - "in": "path", - "required": true } - ], - "post": { + }, + "patch": { "summary": "", - "operationId": "public-data-create", + "operationId": "db-table-row-bulk-create", "responses": { "200": { "description": "OK", @@ -3380,117 +2737,140 @@ } }, "tags": [ - "Public" + "DB Table Row" ], "requestBody": { "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "data": {}, - "password": { - "type": "string" - } - } + "application/json": { + "schema": {} + } + } + } + }, + "delete": { + "summary": "", + "operationId": "db-table-row-bulk-create", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} } } - }, - "description": "" + } }, - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "header" + "tags": [ + "DB Table Row" + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} + } } - ] + } } }, - "/public/data/{uuid}/export/{type}": { + "/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", "in": "path", "required": true }, { "schema": { - "type": "string", - "enum": [ - "csv", - "excel" - ] + "type": "string" }, - "name": "type", + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", "in": "path", "required": true } ], - "post": { + "patch": { "summary": "", - "operationId": "public-csv-export", - "description": "", - "wrapped": true, + "operationId": "db-table-row-create", "responses": { "200": { "description": "OK", "content": { - "application/octet-stream": { + "application/json": { "schema": {} } - }, - "headers": { - "nc-export-offset": { - "schema": { - "type": "integer" - } - } } } }, "tags": [ - "Public" + "DB Table Row" ], "requestBody": { "content": { "application/json": { - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "filters": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Filter" - } - }, - "sorts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Sort" - } - } - } + "schema": {} + } + } + } + }, + "delete": { + "summary": "", + "operationId": "db-table-row-create", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} } } } + }, + "tags": [ + "DB Table Row" + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } } } }, - "/public/data/{uuid}/relationTable/{relationColumnId}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/export/{type}": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", "in": "path", "required": true }, @@ -3498,118 +2878,133 @@ "schema": { "type": "string" }, - "name": "relationColumnId", + "name": "viewName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "csv", + "excel" + ] + }, + "name": "type", "in": "path", "required": true } ], - "post": { + "get": { "summary": "", - "operationId": "public-data-relation-list", + "operationId": "db-view-row-export", + "description": "CSV or Excel export", + "tags": [ + "DB view row" + ], + "wrapped": true, "responses": { "200": { "description": "OK", "content": { - "application/json": { + "application/octet-stream": { "schema": {} } - } - } - }, - "parameters": [ - { - "schema": { - "type": "string" }, - "in": "query", - "name": "limit" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "offset" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - } + "headers": { + "nc-export-offset": { + "schema": { + "type": "integer" } } } } }, - "tags": [ - "Public" - ], - "description": "" + "parameters": [] } }, - "/public/meta/{uuid}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/export/{type}": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "csv", + "excel" + ] + }, + "name": "type", "in": "path", "required": true } ], - "post": { + "get": { "summary": "", - "operationId": "public-shared-view-meta-get", + "operationId": "db-table-row-csv-export", + "description": "CSV or Excel export", + "tags": [ + "DB table row" + ], + "wrapped": true, "responses": { "200": { "description": "OK", "content": { - "application/json": { - "schema": { - "type": "object", - "properties": {} - } - }, - "application/xml": { + "application/octet-stream": { "schema": {} } - } - } - }, - "tags": [ - "Public" - ], - "description": "", - "parameters": [], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - } + }, + "headers": { + "nc-export-offset": { + "schema": { + "type": "integer" } } } } - } + }, + "parameters": [] } }, - "/data/{tableId}/{rowId}/{relationType}/{colId}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", "in": "path", "required": true }, @@ -3617,7 +3012,7 @@ "schema": { "type": "string" }, - "name": "rowId", + "name": "tableName", "in": "path", "required": true }, @@ -3625,25 +3020,36 @@ "schema": { "type": "string" }, - "name": "colId", + "name": "rowId", "in": "path", "required": true }, { "schema": { - "type": "string" + "type": "string", + "enum": [ + "mm", + "hm" + ] }, "name": "relationType", "in": "path", "required": true + },{ + "schema": { + "type": "string" + }, + "name": "columnName", + "in": "path", + "required": true } ], "get": { "summary": "", - "operationId": "data-nested-list", + "operationId": "db-table-row-nested-list", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3651,19 +3057,34 @@ } } }, - "description": "", "tags": [ - "Data" + "DB table row" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } ] } }, - "/data/{tableId}/{rowId}/{relationType}/{colId}/exclude": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "orgs", "in": "path", "required": true }, @@ -3671,7 +3092,7 @@ "schema": { "type": "string" }, - "name": "rowId", + "name": "projectName", "in": "path", "required": true }, @@ -3679,7 +3100,7 @@ "schema": { "type": "string" }, - "name": "colId", + "name": "tableName", "in": "path", "required": true }, @@ -3687,17 +3108,78 @@ "schema": { "type": "string" }, + "name": "rowId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "mm", + "hm" + ] + }, "name": "relationType", "in": "path", "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "columnName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "refRowId", + "in": "path", + "required": true } ], - "get": { + "post": { "summary": "", - "operationId": "data-nested-excluded-list", + "operationId": "db-table-row-nested-add", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "tags": [ + "DB table row" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } + ] + }, + "delete": { + "summary": "", + "operationId": "db-table-row-nested-delete", + "responses": { + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3705,19 +3187,18 @@ } } }, - "description": "", "tags": [ - "Data" + "DB table row" ] } }, - "/data/{tableId}/{rowId}/{relationType}/{colId}/{referenceTableRowId}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "orgs", "in": "path", "required": true }, @@ -3725,7 +3206,7 @@ "schema": { "type": "string" }, - "name": "rowId", + "name": "projectName", "in": "path", "required": true }, @@ -3733,7 +3214,7 @@ "schema": { "type": "string" }, - "name": "colId", + "name": "tableName", "in": "path", "required": true }, @@ -3741,6 +3222,18 @@ "schema": { "type": "string" }, + "name": "rowId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "mm", + "hm" + ] + }, "name": "relationType", "in": "path", "required": true @@ -3749,17 +3242,17 @@ "schema": { "type": "string" }, - "name": "referenceTableRowId", + "name": "columnName", "in": "path", "required": true } ], - "post": { + "get": { "summary": "", - "operationId": "data-nested-add", + "operationId": "db-table-row-nested-children-excluded-list", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3767,32 +3260,35 @@ } } }, - "description": "", "tags": [ - "Data" - ] - }, - "delete": { - "summary": "", - "operationId": "data-nested-delete", - "responses": { - "200": { - "description": "OK" + "DB table row" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" } - }, - "description": "", - "tags": [ - "Data" ] } }, - "/data/{tableId}/{rowId}": { + + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "sharedViewUuid", "in": "path", "required": true }, @@ -3800,17 +3296,17 @@ "schema": { "type": "string" }, - "name": "rowId", - "in": "path", - "required": true + "in": "header", + "name": "xc-password", + "description": "Shared view password" } ], "get": { "summary": "", - "operationId": "data-read", + "operationId": "public-data-list", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3818,14 +3314,29 @@ } } }, - "description": "", "tags": [ - "Data" + "Public" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } ] }, - "put": { + "post": { "summary": "", - "operationId": "data-update", + "operationId": "public-data-create", "responses": { "200": { "description": "OK", @@ -3836,38 +3347,36 @@ } } }, - "tags": [ - "Data" - ], "requestBody": { "content": { - "application/json": { - "schema": {} + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { } + } } } - } - }, - "delete": { - "summary": "", - "operationId": "data-delete", - "responses": { - "200": { - "description": "OK" - } }, "tags": [ - "Data" + "Public" ], - "description": "" + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "header" + } + ] } }, - "/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId}": { + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "orgs", + "name": "sharedViewUuid", "in": "path", "required": true }, @@ -3875,7 +3384,19 @@ "schema": { "type": "string" }, - "name": "projectName", + "name": "rowId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "mm", + "hm" + ] + }, + "name": "relationType", "in": "path", "required": true }, @@ -3883,98 +3404,102 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "columnName", "in": "path", "required": true + } + ], + "get": { + "summary": "", + "operationId": "public-data-nested-list", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } }, + "tags": [ + "Public" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } + ] + } + }, + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows/export/{type}": { + "parameters": [ { "schema": { "type": "string" }, - "name": "viewName", + "name": "sharedViewUuid", "in": "path", "required": true }, { "schema": { - "type": "string" + "type": "string", + "enum": [ + "csv", + "excel" + ] }, - "name": "rowId", + "name": "type", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "db-view-row-read", - "responses": { - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": {} - } - } - } - }, + "operationId": "public-csv-export", "description": "", - "tags": [ - "DB View Row" - ] - }, - "put": { - "summary": "", - "operationId": "db-view-row-update", + "wrapped": true, "responses": { "200": { "description": "OK", "content": { - "application/json": { + "application/octet-stream": { "schema": {} } + }, + "headers": { + "nc-export-offset": { + "schema": { + "type": "integer" + } + } } } }, "tags": [ - "DB View Row" - ], - "requestBody": { - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "delete": { - "summary": "", - "operationId": "db-view-row-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View Row" - ], - "description": "" + "Public" + ] } }, - "/data/{orgs}/{projectName}/{tableAlias}/{rowId}": { + "/api/v1/db/public/shared-view/{sharedViewUuid}/nested/{columnName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "orgs", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "projectName", + "name": "sharedViewUuid", "in": "path", "required": true }, @@ -3982,7 +3507,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "columnName", "in": "path", "required": true }, @@ -3990,17 +3515,17 @@ "schema": { "type": "string" }, - "name": "rowId", - "in": "path", - "required": true + "in": "header", + "name": "xc-password", + "description": "Shared view password" } ], "get": { "summary": "", - "operationId": "db-table-row-read", + "operationId": "public-data-relation-list", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -4008,50 +3533,113 @@ } } }, - "description": "", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } + ], "tags": [ - "DB Table Row" - ] - }, - "put": { + "Public" + ], + "description": "" + } + }, + "/api/v1/db/public/shared-view/{sharedViewUuid}/meta": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "sharedViewUuid", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "header", + "name": "xc-password", + "description": "Shared view password" + } + ], + "get": { "summary": "", - "operationId": "db-table-row-update", + "operationId": "public-shared-view-meta-get", "responses": { "200": { "description": "OK", "content": { "application/json": { + "schema": { + "type": "object", + "properties": {} + } + }, + "application/xml": { "schema": {} } } } }, "tags": [ - "DB Table Row" + "Public" ], - "requestBody": { - "content": { - "application/json": { - "schema": {} - } - } + "description": "", + "parameters": [] + } + }, + "/api/v1/db/public/shared-base/{sharedBaseUuid}/meta": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "sharedBaseUuid", + "in": "path", + "required": true } - }, - "delete": { + ], + "get": { "summary": "", - "operationId": "db-table-row-model-delete", + "operationId": "public-shared-base-get", + "description": "Read project details", + "parameters": [], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "project_id": { + "type": "string" + } + } + } + } + } } }, "tags": [ - "DB Table Row" - ], - "description": "" + "Public" + ] } }, - "/audits/comments": { + + "/api/v1/db/meta/audits/comments": { "parameters": [], "get": { "summary": "", @@ -4134,7 +3722,7 @@ ] } }, - "/audits/comments/count": { + "/api/v1/db/meta/audits/comments/count": { "parameters": [], "get": { "summary": "", @@ -4173,7 +3761,7 @@ ] } }, - "project/{projectId}/audits": { + "/api/v1/db/meta/project/{projectId}/audits": { "parameters": [ { "schema": { @@ -4238,8 +3826,17 @@ ] } }, - "/audits/rowUpdate": { - "parameters": [], + "/api/v1/db/meta/audits/rows/{rowId}/update": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "rowId", + "in": "path", + "required": true + } + ], "post": { "summary": "", "operationId": "utils-audit-row-update", @@ -4279,7 +3876,8 @@ } } }, - "/tables/{tableId}/hooks": { + + "/api/v1/db/meta/tables/{tableId}/hooks": { "parameters": [ { "schema": { @@ -4358,7 +3956,7 @@ ] } }, - "/tables/{tableId}/hooks/test": { + "/api/v1/db/meta/tables/{tableId}/hooks/test": { "parameters": [ { "schema": { @@ -4408,7 +4006,75 @@ } } }, - "/hooks/{hookId}": { + "/api/v1/db/meta/tables/{tableId}/hooks/samplePayload/{operation}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "tableId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "update", + "delete", + "insert" + ] + }, + "name": "operation", + "in": "path", + "required": true + } + ], + "get": { + "summary": "", + "operationId": "db-table-webhook-sample-payload-get", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "plugins": { + "type": "object", + "properties": { + "list": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "$ref": "#/components/schemas/Plugin" + } + }, + "pageInfo": { + "$ref": "#/components/schemas/Paginated" + } + }, + "required": [ + "list", + "pageInfo" + ] + } + } + } + } + } + } + }, + "description": "", + "parameters": [], + "tags": [ + "DB Table Webhook" + ] + } + }, + "/api/v1/db/meta/hooks/{hookId}": { "parameters": [ { "schema": { @@ -4419,7 +4085,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-table-webhook-update", "responses": { @@ -4460,7 +4126,8 @@ ] } }, - "/plugins": { + + "/api/v1/db/meta/plugins": { "parameters": [], "get": { "summary": "", @@ -4497,7 +4164,7 @@ ] } }, - "/plugins/{pluginTitle}/status": { + "/api/v1/db/meta/plugins/{pluginTitle}/status": { "parameters": [ { "schema": { @@ -4530,75 +4197,7 @@ ] } }, - "/tables/{tableId}/hooks/samplePayload/{operation}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string", - "enum": [ - "update", - "delete", - "insert" - ] - }, - "name": "operation", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "db-table-webhook-sample-payload-get", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "plugins": { - "type": "object", - "properties": { - "list": { - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { - "$ref": "#/components/schemas/Plugin" - } - }, - "pageInfo": { - "$ref": "#/components/schemas/Paginated" - } - }, - "required": [ - "list", - "pageInfo" - ] - } - } - } - } - } - } - }, - "description": "", - "parameters": [], - "tags": [ - "DB Table Webhook" - ] - } - }, - "/plugins/test": { + "/api/v1/db/meta/plugins/test": { "parameters": [], "post": { "summary": "", @@ -4647,7 +4246,7 @@ } } }, - "/plugins/{pluginId}": { + "/api/v1/db/meta/plugins/{pluginId}": { "parameters": [ { "schema": { @@ -4658,7 +4257,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "plugin-update", "responses": { @@ -4706,7 +4305,8 @@ ] } }, - "/testConnection": { + + "/api/v1/db/meta/connection/test": { "parameters": [], "post": { "summary": "", @@ -4744,7 +4344,7 @@ "description": "" } }, - "/appInfo": { + "/api/v1/db/meta/nocodb/info": { "parameters": [], "get": { "summary": "", @@ -4765,7 +4365,7 @@ "description": "" } }, - "/cache": { + "/api/v1/db/meta/cache": { "get": { "summary": "Your GET endpoint", "tags": [ @@ -4790,7 +4390,8 @@ }, "parameters": [] }, - "/projects/{projectId}/apiTokens": { + + "/api/v1/db/meta/projects/{projectId}/api-tokens": { "get": { "summary": "Your GET endpoint", "tags": [ @@ -4860,7 +4461,7 @@ } ] }, - "/projects/{projectId}/apiTokens/{token}": { + "/api/v1/db/meta/projects/{projectId}/api-tokens/{token}": { "delete": { "summary": "", "operationId": "api-token-delete", @@ -4892,197 +4493,40 @@ } ] }, - "/bulkData/{orgs}/{projectName}/{tableAlias}/": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "orgs", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "projectName", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "tableAlias", - "in": "path", - "required": true - } - ], - "delete": { - "summary": "", - "operationId": "db-table-row-bulk-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB Table Row" - ], - "description": "", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": {} - } - } - } - } - }, + + "/api/v1/db/storage/upload": { "post": { - "summary": "", - "operationId": "db-table-row-bulk-insert", - "responses": { - "200": { - "description": "OK" - } - }, + "summary": "Attachment", + "operationId": "storage-upload", + "responses": {}, "tags": [ - "DB Table Row" + "Storage" ], "requestBody": { "content": { - "application/json": { - "schema": { - "type": "array", - "items": {} - } - } - } - } - }, - "patch": { - "summary": "", - "operationId": "db-table-row-bulk-update", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {}, - "examples": {} - } - } - } - }, - "requestBody": { - "content": { - "application/json": { + "multipart/form-data": { "schema": { - "type": "array", - "items": { - "type": "object" + "type": "object", + "properties": { + "files": {}, + "json": { + "type": "string" + } } } } - } - }, - "tags": [ - "DB Table Row" - ] - } - }, - "/bulkData/{orgs}/{projectName}/{tableAlias}/all": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "orgs", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "projectName", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" }, - "name": "tableAlias", - "in": "path", - "required": true - } - ], - "patch": { - "summary": "", - "operationId": "db-table-row-bulk-update-all", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "description": "", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "where" - } - ], - "tags": [ - "DB Table Row" - ] - }, - "delete": { - "summary": "", - "operationId": "db-table-row-bulk-delete-all", - "responses": { - "200": { - "description": "OK", - "headers": {}, - "content": { - "application/json": { - "schema": {} - } - } - } + "description": "" }, "parameters": [ { "schema": { "type": "string" }, + "name": "path", "in": "query", - "name": "where" + "required": true } - ], - "tags": [ - "DB Table Row" ] } } @@ -5143,6 +4587,30 @@ "email_verified" ] }, + "PageReqQueryParams": { + "title": "PageReqQueryParams", + "type": "object", + "description": "", + "x-internal": false, + "properties": { + "offset": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "query": { + "type": "string" + } + }, + "required": [ + "id", + "firstname", + "lastname", + "email", + "email_verified" + ] + }, "UserList": { "description": "", "type": "object", diff --git a/scripts/upgradeNocodbSdk.js b/scripts/upgradeNocodbSdk.js index 5f41dd29c5..58daf921d9 100644 --- a/scripts/upgradeNocodbSdk.js +++ b/scripts/upgradeNocodbSdk.js @@ -37,7 +37,7 @@ const dfs = function(dir) { res = res.concat(dfs(file)); } else { const ext = path.extname(file).toLowerCase() - if (ext == '.vue' || ext == '.ts') { + if (ext == '.vue' || ext == '.ts' || ext == '.js') { res.push(file); } } @@ -58,9 +58,10 @@ const searchAndReplace = (target) => { fs.readFile(d, function(err, content) { if (err) reject(err) if (content.indexOf(target) > -1) { - replacePackageName(d) + resolve(replacePackageName(d)) + } else { + resolve() } - resolve() }) }) }))