Browse Source

Merge branch 'develop' into mvp-mobile-layout-and-code-scanner

pull/5114/head
Daniel Spaude 2 years ago
parent
commit
3b74033720
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 86
      README.md
  2. 130
      packages/nc-cli/package-lock.json
  3. 2
      packages/nc-cli/package.json
  4. 2
      packages/nc-gui/components/smartsheet/Grid.vue
  5. 18
      packages/nc-gui/components/webhook/Editor.vue
  6. 16
      packages/nc-gui/composables/useAttachment.ts
  7. 36
      packages/nc-gui/package-lock.json
  8. 11
      packages/nc-gui/pages/[projectType]/[projectId]/index.vue
  9. 25
      packages/nc-gui/store/tab.ts
  10. 1
      packages/noco-docs/content/en/getting-started/environment-variables.md
  11. 5
      packages/nocodb/src/lib/controllers/sync/import.ctl.ts
  12. 4
      packages/nocodb/src/lib/services/column.svc.ts
  13. 479
      packages/nocodb/src/lib/services/sync/helpers/job.ts
  14. 65
      packages/nocodb/src/lib/services/sync/helpers/readAndProcessData.ts

86
README.md

@ -10,10 +10,9 @@
</h1> </h1>
<p align="center"> <p align="center">
Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart-spreadsheet. Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart spreadsheet.
</p> </p>
<div align="center"> <div align="center">
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB) [![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.com/github/NocoDB/NocoDB)
@ -29,7 +28,7 @@ Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart-spreadshe
<a href="https://twitter.com/nocodb"><b>Twitter</b></a> <a href="https://twitter.com/nocodb"><b>Twitter</b></a>
<a href="https://www.reddit.com/r/NocoDB/"><b>Reddit</b></a> <a href="https://www.reddit.com/r/NocoDB/"><b>Reddit</b></a>
<a href="https://docs.nocodb.com/"><b>Documentation</b></a> <a href="https://docs.nocodb.com/"><b>Documentation</b></a>
</p> </p>
![All Views](https://user-images.githubusercontent.com/35857179/194825053-3aa3373d-3e0f-4b42-b3f1-42928332054a.gif) ![All Views](https://user-images.githubusercontent.com/35857179/194825053-3aa3373d-3e0f-4b42-b3f1-42928332054a.gif)
@ -47,12 +46,12 @@ Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart-spreadshe
</div> </div>
<p align="center"><a href="markdown/readme/languages/README.md"><b>See other languages »</b></a></p> <p align="center"><a href="markdown/readme/languages/README.md"><b>See other languages »</b></a></p>
<img src="https://static.scarf.sh/a.png?x-pxid=c12a77cc-855e-4602-8a0f-614b2d0da56a" /> <img src="https://static.scarf.sh/a.png?x-pxid=c12a77cc-855e-4602-8a0f-614b2d0da56a" />
# Join Our Team # Join Our Team
<p align=""><a href="http://careers.nocodb.com" target="_blank"><img src="https://user-images.githubusercontent.com/61551451/169663818-45643495-e95b-48e2-be13-01d6a77dc2fd.png" width="250"/></a></p> <p align=""><a href="http://careers.nocodb.com" target="_blank"><img src="https://user-images.githubusercontent.com/61551451/169663818-45643495-e95b-48e2-be13-01d6a77dc2fd.png" width="250"/></a></p>
# Join Our Community # Join Our Community
@ -65,14 +64,14 @@ Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart-spreadshe
<img src="https://i2.wp.com/www.feverbee.com/wp-content/uploads/2018/07/logo-discourse.png" alt=""> <img src="https://i2.wp.com/www.feverbee.com/wp-content/uploads/2018/07/logo-discourse.png" alt="">
</a> </a>
--> -->
[![Stargazers repo roster for @nocodb/nocodb](https://reporoster.com/stars/nocodb/nocodb)](https://github.com/nocodb/nocodb/stargazers)
[![Stargazers repo roster for @nocodb/nocodb](https://reporoster.com/stars/nocodb/nocodb)](https://github.com/nocodb/nocodb/stargazers)
# Quick try # Quick try
## NPX ## NPX
You can run below command if you need an interactive configuration. You can run the below command if you need an interactive configuration.
``` ```
npx create-nocodb-app npx create-nocodb-app
@ -91,7 +90,7 @@ npm install
npm start npm start
``` ```
## Docker ## Docker
```bash ```bash
# for SQLite # for SQLite
@ -130,32 +129,40 @@ nocodb/nocodb:latest
> If you plan to input some special characters, you may need to change the character set and collation yourself when creating the database. Please check out the examples for [MySQL Docker](https://github.com/nocodb/nocodb/issues/1340#issuecomment-1049481043). > If you plan to input some special characters, you may need to change the character set and collation yourself when creating the database. Please check out the examples for [MySQL Docker](https://github.com/nocodb/nocodb/issues/1340#issuecomment-1049481043).
## Binaries ## Binaries
##### MacOS (x64) ##### MacOS (x64)
```bash ```bash
curl http://get.nocodb.com/macos-x64 -o nocodb -L && chmod +x nocodb && ./nocodb curl http://get.nocodb.com/macos-x64 -o nocodb -L && chmod +x nocodb && ./nocodb
``` ```
##### MacOS (arm64) ##### MacOS (arm64)
```bash ```bash
curl http://get.nocodb.com/macos-arm64 -o nocodb -L && chmod +x nocodb && ./nocodb curl http://get.nocodb.com/macos-arm64 -o nocodb -L && chmod +x nocodb && ./nocodb
``` ```
##### Linux (x64) ##### Linux (x64)
```bash ```bash
curl http://get.nocodb.com/linux-x64 -o nocodb -L && chmod +x nocodb && ./nocodb curl http://get.nocodb.com/linux-x64 -o nocodb -L && chmod +x nocodb && ./nocodb
``` ```
##### Linux (arm64) ##### Linux (arm64)
```bash ```bash
curl http://get.nocodb.com/linux-arm64 -o nocodb -L && chmod +x nocodb && ./nocodb curl http://get.nocodb.com/linux-arm64 -o nocodb -L && chmod +x nocodb && ./nocodb
``` ```
##### Windows (x64) ##### Windows (x64)
```bash ```bash
iwr http://get.nocodb.com/win-x64.exe iwr http://get.nocodb.com/win-x64.exe
.\Noco-win-x64.exe .\Noco-win-x64.exe
``` ```
##### Windows (arm64) ##### Windows (arm64)
```bash ```bash
iwr http://get.nocodb.com/win-arm64.exe iwr http://get.nocodb.com/win-arm64.exe
.\Noco-win-arm64.exe .\Noco-win-arm64.exe
@ -182,7 +189,7 @@ docker-compose up -d
# GUI # GUI
Access Dashboard using : [http://localhost:8080/dashboard](http://localhost:8080/dashboard) Access Dashboard using: [http://localhost:8080/dashboard](http://localhost:8080/dashboard)
# Screenshots # Screenshots
@ -202,22 +209,22 @@ Access Dashboard using : [http://localhost:8080/dashboard](http://localhost:8080
# Table of Contents # Table of Contents
- [Quick try](#quick-try) - [Quick try](#quick-try)
* [NPX](#npx) - [NPX](#npx)
* [Node Application](#node-application) - [Node Application](#node-application)
* [Docker](#docker) - [Docker](#docker)
* [Docker Compose](#docker-compose) - [Docker Compose](#docker-compose)
- [GUI](#gui) - [GUI](#gui)
- [Join Our Community](#join-our-community) - [Join Our Community](#join-our-community)
- [Screenshots](#screenshots) - [Screenshots](#screenshots)
- [Table of Contents](#table-of-contents) - [Table of Contents](#table-of-contents)
- [Features](#features) - [Features](#features)
+ [Rich Spreadsheet Interface](#rich-spreadsheet-interface) - [Rich Spreadsheet Interface](#rich-spreadsheet-interface)
+ [App Store for Workflow Automations](#app-store-for-workflow-automations) - [App Store for Workflow Automations](#app-store-for-workflow-automations)
+ [Programmatic Access](#programmatic-access) - [Programmatic Access](#programmatic-access)
+ [Sync Schema](#sync-schema) - [Sync Schema](#sync-schema)
+ [Audit](#audit) - [Audit](#audit)
- [Production Setup](#production-setup) - [Production Setup](#production-setup)
* [Environment variables](#environment-variables) - [Environment variables](#environment-variables)
- [Development Setup](#development-setup) - [Development Setup](#development-setup)
- [Contributing](#contributing) - [Contributing](#contributing)
- [Why are we building this?](#why-are-we-building-this) - [Why are we building this?](#why-are-we-building-this)
@ -229,47 +236,47 @@ Access Dashboard using : [http://localhost:8080/dashboard](http://localhost:8080
### Rich Spreadsheet Interface ### Rich Spreadsheet Interface
- ⚡ &nbsp;Basic Operations: Create, Read, Update and Delete on Tables, Columns, and Rows - ⚡ &nbsp;Basic Operations: Create, Read, Update and Delete Tables, Columns, and Rows
- ⚡ &nbsp;Fields Operations: Sort, Filter, Hide / Unhide Columns - ⚡ &nbsp;Fields Operations: Sort, Filter, Hide / Unhide Columns
- ⚡ &nbsp;Multiple Views Types: Grid (By default), Gallery, Form View and Kanban View - ⚡ &nbsp;Multiple Views Types: Grid (By default), Gallery, Form View and Kanban View
- ⚡ &nbsp;View Permissions Types: Collaborative Views, & Locked Views - ⚡ &nbsp;View Permissions Types: Collaborative Views, & Locked Views
- ⚡ &nbsp;Share Bases / Views: either Public or Private (with Password Protected) - ⚡ &nbsp;Share Bases / Views: either Public or Private (with Password Protected)
- ⚡ &nbsp;Variant Cell Types: ID, LinkToAnotherRecord, Lookup, Rollup, SingleLineText, Attachement, Currency, Formula and etc - ⚡ &nbsp;Variant Cell Types: ID, LinkToAnotherRecord, Lookup, Rollup, SingleLineText, Attachment, Currency, Formula, etc
- ⚡ &nbsp;Access Control with Roles : Fine-grained Access Control at different levels - ⚡ &nbsp;Access Control with Roles: Fine-grained Access Control at different levels
- ⚡ &nbsp;and more ... - ⚡ &nbsp;and more ...
### App Store for Workflow Automations ### App Store for Workflow Automations
We provide different integrations in three main categories. See <a href="https://docs.nocodb.com/setup-and-usages/app-store" target="_blank">App Store</a> for details. We provide different integrations in three main categories. See <a href="https://docs.nocodb.com/setup-and-usages/app-store" target="_blank">App Store</a> for details.
- ⚡ &nbsp;Chat : Slack, Discord, Mattermost, and etc - ⚡ &nbsp;Chat: Slack, Discord, Mattermost, and etc
- ⚡ &nbsp;Email : AWS SES, SMTP, MailerSend, and etc - ⚡ &nbsp;Email: AWS SES, SMTP, MailerSend, and etc
- ⚡ &nbsp;Storage : AWS S3, Google Cloud Storage, Minio, and etc - ⚡ &nbsp;Storage: AWS S3, Google Cloud Storage, Minio, and etc
### Programmatic Access ### Programmatic Access
We provide the following ways to let users to invoke actions in a programmatic way. You can use a token (either JWT or Social Auth) to sign your requests for authorization to NocoDB. We provide the following ways to let users programmatically invoke actions. You can use a token (either JWT or Social Auth) to sign your requests for authorization to NocoDB.
- ⚡ &nbsp;REST APIs - ⚡ &nbsp;REST APIs
- ⚡ &nbsp;NocoDB SDK - ⚡ &nbsp;NocoDB SDK
### Sync Schema ### Sync Schema
We allow you to sync schema changes if you have made changes outside NocoDB GUI. However, it has to be noted then you will have to bring your own schema migrations for moving from environment to others. See <a href="https://docs.nocodb.com/setup-and-usages/sync-schema/" target="_blank">Sync Schema</a> for details. We allow you to sync schema changes if you have made changes outside NocoDB GUI. However, it has to be noted then you will have to bring your own schema migrations for moving from one environment to another. See <a href="https://docs.nocodb.com/setup-and-usages/sync-schema/" target="_blank">Sync Schema</a> for details.
### Audit ### Audit
We are keeping all the user operation logs under one place. See <a href="https://docs.nocodb.com/setup-and-usages/audit" target="_blank">Audit</a> for details. We are keeping all the user operation logs in one place. See <a href="https://docs.nocodb.com/setup-and-usages/audit" target="_blank">Audit</a> for details.
# Production Setup # Production Setup
By default, SQLite is used for storing meta data. However, you can specify your own database. The connection params for this database can be specified in `NC_DB` environment variable. Moreover, we also provide the below environment variables for configuration. By default, SQLite is used for storing metadata. However, you can specify your database. The connection parameters for this database can be specified in `NC_DB` environment variable. Moreover, we also provide the below environment variables for configuration.
## Environment variables ## Environment variables
Please refer to [Environment variables](https://docs.nocodb.com/getting-started/environment-variables) Please refer to the [Environment variables](https://docs.nocodb.com/getting-started/environment-variables)
# Development Setup # Development Setup
Please refer to [Development Setup](https://docs.nocodb.com/engineering/development-setup) Please refer to [Development Setup](https://docs.nocodb.com/engineering/development-setup)
@ -278,12 +285,15 @@ Please refer to [Development Setup](https://docs.nocodb.com/engineering/developm
Please refer to [Contribution Guide](https://github.com/nocodb/nocodb/blob/master/.github/CONTRIBUTING.md). Please refer to [Contribution Guide](https://github.com/nocodb/nocodb/blob/master/.github/CONTRIBUTING.md).
# Why are we building this? # Why are we building this?
Most internet businesses equip themselves with either spreadsheet or a database to solve their business needs. Spreadsheets are used by a Billion+ humans collaboratively every single day. However, we are way off working at similar speeds on databases which are way more powerful tools when it comes to computing. Attempts to solve this with SaaS offerings has meant horrible access controls, vendor lockin, data lockin, abrupt price changes & most importantly a glass ceiling on what's possible in future.
Most internet businesses equip themselves with either spreadsheet or a database to solve their business needs. Spreadsheets are used by Billion+ humans collaboratively every single day. However, we are way off working at similar speeds on databases which are way more powerful tools when it comes to computing. Attempts to solve this with SaaS offerings have meant horrible access controls, vendor lock-in, data lock-in, abrupt price changes & most importantly a glass ceiling on what's possible in the future.
# Our Mission # Our Mission
Our mission is to provide the most powerful no-code interface for databases which is open source to every single internet business in the world. This would not only democratise access to a powerful computing tool but also bring forth a billion+ people who will have radical tinkering-and-building abilities on internet.
# License Our mission is to provide the most powerful no-code interface for databases that is open source to every single internet business in the world. This would not only democratise access to a powerful computing tool but also bring forth a billion+ people who will have radical tinkering-and-building abilities on the internet.
# License
<p> <p>
This project is licensed under <a href="./LICENSE">AGPLv3</a>. This project is licensed under <a href="./LICENSE">AGPLv3</a>.
</p> </p>
@ -294,4 +304,4 @@ Thank you for your contributions! We appreciate all the contributions from the c
<a href="https://github.com/nocodb/nocodb/graphs/contributors"> <a href="https://github.com/nocodb/nocodb/graphs/contributors">
<img src="https://contrib.rocks/image?repo=nocodb/nocodb" /> <img src="https://contrib.rocks/image?repo=nocodb/nocodb" />
</a> </a>

130
packages/nc-cli/package-lock.json generated

@ -61,7 +61,7 @@
"tslint-config-prettier": "^1.18.0", "tslint-config-prettier": "^1.18.0",
"tslint-immutable": "^6.0.1", "tslint-immutable": "^6.0.1",
"typescript": "^3.5.3", "typescript": "^3.5.3",
"webpack": "^5.1.0", "webpack": "^5.76.0",
"webpack-cli": "^4.10.0", "webpack-cli": "^4.10.0",
"webpack-node-externals": "^2.5.2" "webpack-node-externals": "^2.5.2"
}, },
@ -921,9 +921,9 @@
} }
}, },
"node_modules/@types/eslint": { "node_modules/@types/eslint": {
"version": "8.2.2", "version": "8.21.2",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.2.2.tgz", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.21.2.tgz",
"integrity": "sha512-nQxgB8/Sg+QKhnV8e0WzPpxjIGT3tuJDDzybkDi8ItE/IgTlHo07U0shaIjzhcvQxlq9SDRE42lsJ23uvEgJ2A==", "integrity": "sha512-EMpxUyystd3uZVByZap1DACsMXvb82ypQnGn89e1Y0a+LYu3JJscUd/gqhRsVFDkaD2MIiWo0MT8EfXr3DGRKw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/estree": "*", "@types/estree": "*",
@ -931,9 +931,9 @@
} }
}, },
"node_modules/@types/eslint-scope": { "node_modules/@types/eslint-scope": {
"version": "3.7.2", "version": "3.7.4",
"resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.2.tgz", "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz",
"integrity": "sha512-TzgYCWoPiTeRg6RQYgtuW7iODtVoKu3RVL72k3WohqhjfaOLK5Mg2T4Tg1o2bSfu0vPkoI48wdQFv5b/Xe04wQ==", "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/eslint": "*", "@types/eslint": "*",
@ -941,9 +941,9 @@
} }
}, },
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "0.0.50", "version": "0.0.51",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz",
"integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==",
"dev": true "dev": true
}, },
"node_modules/@types/glob": { "node_modules/@types/glob": {
@ -1220,9 +1220,9 @@
} }
}, },
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.5.0", "version": "8.8.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
"integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
"dev": true, "dev": true,
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
@ -14972,9 +14972,9 @@
} }
}, },
"node_modules/watchpack": { "node_modules/watchpack": {
"version": "2.3.1", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
"integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==", "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"glob-to-regexp": "^0.4.1", "glob-to-regexp": "^0.4.1",
@ -14998,35 +14998,35 @@
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
}, },
"node_modules/webpack": { "node_modules/webpack": {
"version": "5.65.0", "version": "5.76.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.0.tgz",
"integrity": "sha512-Q5or2o6EKs7+oKmJo7LaqZaMOlDWQse9Tm5l1WAfU/ujLGN5Pb0SqGeVkN/4bpPmEqEP5RnVhiqsOtWtUVwGRw==", "integrity": "sha512-l5sOdYBDunyf72HW8dF23rFtWq/7Zgvt/9ftMof71E/yUb1YLOBmTgA2K4vQthB3kotMrSj609txVE0dnr2fjA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/eslint-scope": "^3.7.0", "@types/eslint-scope": "^3.7.3",
"@types/estree": "^0.0.50", "@types/estree": "^0.0.51",
"@webassemblyjs/ast": "1.11.1", "@webassemblyjs/ast": "1.11.1",
"@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1",
"@webassemblyjs/wasm-parser": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1",
"acorn": "^8.4.1", "acorn": "^8.7.1",
"acorn-import-assertions": "^1.7.6", "acorn-import-assertions": "^1.7.6",
"browserslist": "^4.14.5", "browserslist": "^4.14.5",
"chrome-trace-event": "^1.0.2", "chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.8.3", "enhanced-resolve": "^5.10.0",
"es-module-lexer": "^0.9.0", "es-module-lexer": "^0.9.0",
"eslint-scope": "5.1.1", "eslint-scope": "5.1.1",
"events": "^3.2.0", "events": "^3.2.0",
"glob-to-regexp": "^0.4.1", "glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.9",
"json-parse-better-errors": "^1.0.2", "json-parse-even-better-errors": "^2.3.1",
"loader-runner": "^4.2.0", "loader-runner": "^4.2.0",
"mime-types": "^2.1.27", "mime-types": "^2.1.27",
"neo-async": "^2.6.2", "neo-async": "^2.6.2",
"schema-utils": "^3.1.0", "schema-utils": "^3.1.0",
"tapable": "^2.1.1", "tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3", "terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.3.1", "watchpack": "^2.4.0",
"webpack-sources": "^3.2.2" "webpack-sources": "^3.2.3"
}, },
"bin": { "bin": {
"webpack": "bin/webpack.js" "webpack": "bin/webpack.js"
@ -15197,18 +15197,18 @@
"dev": true "dev": true
}, },
"node_modules/webpack-sources": { "node_modules/webpack-sources": {
"version": "3.2.2", "version": "3.2.3",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.2.tgz", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
"integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==", "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=10.13.0" "node": ">=10.13.0"
} }
}, },
"node_modules/webpack/node_modules/enhanced-resolve": { "node_modules/webpack/node_modules/enhanced-resolve": {
"version": "5.8.3", "version": "5.12.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
"integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==", "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.4",
@ -16170,9 +16170,9 @@
"dev": true "dev": true
}, },
"@types/eslint": { "@types/eslint": {
"version": "8.2.2", "version": "8.21.2",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.2.2.tgz", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.21.2.tgz",
"integrity": "sha512-nQxgB8/Sg+QKhnV8e0WzPpxjIGT3tuJDDzybkDi8ItE/IgTlHo07U0shaIjzhcvQxlq9SDRE42lsJ23uvEgJ2A==", "integrity": "sha512-EMpxUyystd3uZVByZap1DACsMXvb82ypQnGn89e1Y0a+LYu3JJscUd/gqhRsVFDkaD2MIiWo0MT8EfXr3DGRKw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/estree": "*", "@types/estree": "*",
@ -16180,9 +16180,9 @@
} }
}, },
"@types/eslint-scope": { "@types/eslint-scope": {
"version": "3.7.2", "version": "3.7.4",
"resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.2.tgz", "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz",
"integrity": "sha512-TzgYCWoPiTeRg6RQYgtuW7iODtVoKu3RVL72k3WohqhjfaOLK5Mg2T4Tg1o2bSfu0vPkoI48wdQFv5b/Xe04wQ==", "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/eslint": "*", "@types/eslint": "*",
@ -16190,9 +16190,9 @@
} }
}, },
"@types/estree": { "@types/estree": {
"version": "0.0.50", "version": "0.0.51",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz",
"integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==",
"dev": true "dev": true
}, },
"@types/glob": { "@types/glob": {
@ -16447,9 +16447,9 @@
} }
}, },
"acorn": { "acorn": {
"version": "8.5.0", "version": "8.8.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
"integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
"dev": true "dev": true
}, },
"acorn-import-assertions": { "acorn-import-assertions": {
@ -26952,9 +26952,9 @@
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
}, },
"watchpack": { "watchpack": {
"version": "2.3.1", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
"integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==", "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==",
"dev": true, "dev": true,
"requires": { "requires": {
"glob-to-regexp": "^0.4.1", "glob-to-regexp": "^0.4.1",
@ -26975,41 +26975,41 @@
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
}, },
"webpack": { "webpack": {
"version": "5.65.0", "version": "5.76.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.0.tgz",
"integrity": "sha512-Q5or2o6EKs7+oKmJo7LaqZaMOlDWQse9Tm5l1WAfU/ujLGN5Pb0SqGeVkN/4bpPmEqEP5RnVhiqsOtWtUVwGRw==", "integrity": "sha512-l5sOdYBDunyf72HW8dF23rFtWq/7Zgvt/9ftMof71E/yUb1YLOBmTgA2K4vQthB3kotMrSj609txVE0dnr2fjA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/eslint-scope": "^3.7.0", "@types/eslint-scope": "^3.7.3",
"@types/estree": "^0.0.50", "@types/estree": "^0.0.51",
"@webassemblyjs/ast": "1.11.1", "@webassemblyjs/ast": "1.11.1",
"@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1",
"@webassemblyjs/wasm-parser": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1",
"acorn": "^8.4.1", "acorn": "^8.7.1",
"acorn-import-assertions": "^1.7.6", "acorn-import-assertions": "^1.7.6",
"browserslist": "^4.14.5", "browserslist": "^4.14.5",
"chrome-trace-event": "^1.0.2", "chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.8.3", "enhanced-resolve": "^5.10.0",
"es-module-lexer": "^0.9.0", "es-module-lexer": "^0.9.0",
"eslint-scope": "5.1.1", "eslint-scope": "5.1.1",
"events": "^3.2.0", "events": "^3.2.0",
"glob-to-regexp": "^0.4.1", "glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.9",
"json-parse-better-errors": "^1.0.2", "json-parse-even-better-errors": "^2.3.1",
"loader-runner": "^4.2.0", "loader-runner": "^4.2.0",
"mime-types": "^2.1.27", "mime-types": "^2.1.27",
"neo-async": "^2.6.2", "neo-async": "^2.6.2",
"schema-utils": "^3.1.0", "schema-utils": "^3.1.0",
"tapable": "^2.1.1", "tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3", "terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.3.1", "watchpack": "^2.4.0",
"webpack-sources": "^3.2.2" "webpack-sources": "^3.2.3"
}, },
"dependencies": { "dependencies": {
"enhanced-resolve": { "enhanced-resolve": {
"version": "5.8.3", "version": "5.12.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
"integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==", "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.4",
@ -27135,9 +27135,9 @@
"dev": true "dev": true
}, },
"webpack-sources": { "webpack-sources": {
"version": "3.2.2", "version": "3.2.3",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.2.tgz", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
"integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==", "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==",
"dev": true "dev": true
}, },
"well-known-symbols": { "well-known-symbols": {

2
packages/nc-cli/package.json

@ -113,7 +113,7 @@
"tslint-config-prettier": "^1.18.0", "tslint-config-prettier": "^1.18.0",
"tslint-immutable": "^6.0.1", "tslint-immutable": "^6.0.1",
"typescript": "^3.5.3", "typescript": "^3.5.3",
"webpack": "^5.1.0", "webpack": "^5.76.0",
"webpack-cli": "^4.10.0", "webpack-cli": "^4.10.0",
"webpack-node-externals": "^2.5.2" "webpack-node-externals": "^2.5.2"
}, },

2
packages/nc-gui/components/smartsheet/Grid.vue

@ -794,7 +794,7 @@ const closeAddColumnDropdown = () => {
class="nc-row-no text-xs text-gray-500" class="nc-row-no text-xs text-gray-500"
:class="{ toggle: !readOnly, hidden: row.rowMeta.selected }" :class="{ toggle: !readOnly, hidden: row.rowMeta.selected }"
> >
{{ ((paginationData.page ?? 1) - 1) * 25 + rowIndex + 1 }} {{ ((paginationData.page ?? 1) - 1) * (paginationData.pageSize ?? 25) + rowIndex + 1 }}
</div> </div>
<div <div
v-if="!readOnly" v-if="!readOnly"

18
packages/nc-gui/components/webhook/Editor.vue

@ -325,17 +325,11 @@ async function loadPluginList() {
...(p as any), ...(p as any),
} }
plugin.tags = p.tags ? p.tags.split(',') : [] plugin.tags = p.tags ? p.tags.split(',') : []
plugin.parsedInput = p.input && JSON.parse(p.input) plugin.parsedInput = typeof p.input === 'string' ? JSON.parse(p.input) : p.input
o[plugin.title] = plugin o[plugin.title] = plugin
return o return o
}, {} as Record<string, any>) }, {} as Record<string, any>)
if (hook.event && hook.operation) {
hook.eventOperation = `${hook.event} ${hook.operation}`
}
onNotTypeChange()
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
@ -422,7 +416,15 @@ watch(
{ immediate: true }, { immediate: true },
) )
onMounted(loadPluginList) onMounted(async () => {
await loadPluginList()
if (hook.event && hook.operation) {
hook.eventOperation = `${hook.event} ${hook.operation}`
}
onNotTypeChange()
})
</script> </script>
<template> <template>

16
packages/nc-gui/composables/useAttachment.ts

@ -16,13 +16,17 @@ const useAttachment = () => {
} }
const sources = getPossibleAttachmentSrc(item) const sources = getPossibleAttachmentSrc(item)
for (const source of sources) { for (const source of sources) {
// test if the source is accessible or not try {
const res = await fetch(source, { method: 'HEAD' }) // test if the source is accessible or not
if (res.ok) { const res = await fetch(source, { method: 'HEAD' })
return source if (res.ok) {
} return source
}
} catch {}
} }
return null // if no source can be fetched, it could be probably blocked by CORS
// return original url or built url anyway
return item.url || `${appInfo.value.ncSiteUrl}/${item.path}`
} }
const openAttachment = async (item: Record<string, any>) => { const openAttachment = async (item: Record<string, any>) => {

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

@ -6990,9 +6990,9 @@
} }
}, },
"node_modules/enhanced-resolve": { "node_modules/enhanced-resolve": {
"version": "5.9.3", "version": "5.12.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.3.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
"integrity": "sha512-Bq9VSor+kjvW3f9/MiiR4eE3XYgOl7/rS8lnSxbRbF3kS0B2r+Y9w5krBWxZgDxASVZbdYrn5wT4j/Wb0J9qow==", "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.4",
@ -17742,9 +17742,9 @@
"dev": true "dev": true
}, },
"node_modules/webpack": { "node_modules/webpack": {
"version": "5.73.0", "version": "5.76.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.73.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
"integrity": "sha512-svjudQRPPa0YiOYa2lM/Gacw0r6PvxptHj4FuEKQ2kX05ZLkjbVc5MnPs6its5j7IZljnIqSVo/OsY2X0IpHGA==", "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"peer": true, "peer": true,
@ -17754,11 +17754,11 @@
"@webassemblyjs/ast": "1.11.1", "@webassemblyjs/ast": "1.11.1",
"@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1",
"@webassemblyjs/wasm-parser": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1",
"acorn": "^8.4.1", "acorn": "^8.7.1",
"acorn-import-assertions": "^1.7.6", "acorn-import-assertions": "^1.7.6",
"browserslist": "^4.14.5", "browserslist": "^4.14.5",
"chrome-trace-event": "^1.0.2", "chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.9.3", "enhanced-resolve": "^5.10.0",
"es-module-lexer": "^0.9.0", "es-module-lexer": "^0.9.0",
"eslint-scope": "5.1.1", "eslint-scope": "5.1.1",
"events": "^3.2.0", "events": "^3.2.0",
@ -17771,7 +17771,7 @@
"schema-utils": "^3.1.0", "schema-utils": "^3.1.0",
"tapable": "^2.1.1", "tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3", "terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.3.1", "watchpack": "^2.4.0",
"webpack-sources": "^3.2.3" "webpack-sources": "^3.2.3"
}, },
"bin": { "bin": {
@ -23537,9 +23537,9 @@
"integrity": "sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg==" "integrity": "sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg=="
}, },
"enhanced-resolve": { "enhanced-resolve": {
"version": "5.9.3", "version": "5.12.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.3.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
"integrity": "sha512-Bq9VSor+kjvW3f9/MiiR4eE3XYgOl7/rS8lnSxbRbF3kS0B2r+Y9w5krBWxZgDxASVZbdYrn5wT4j/Wb0J9qow==", "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.4",
@ -31244,9 +31244,9 @@
"dev": true "dev": true
}, },
"webpack": { "webpack": {
"version": "5.73.0", "version": "5.76.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.73.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
"integrity": "sha512-svjudQRPPa0YiOYa2lM/Gacw0r6PvxptHj4FuEKQ2kX05ZLkjbVc5MnPs6its5j7IZljnIqSVo/OsY2X0IpHGA==", "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"peer": true, "peer": true,
@ -31256,11 +31256,11 @@
"@webassemblyjs/ast": "1.11.1", "@webassemblyjs/ast": "1.11.1",
"@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1",
"@webassemblyjs/wasm-parser": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1",
"acorn": "^8.4.1", "acorn": "^8.7.1",
"acorn-import-assertions": "^1.7.6", "acorn-import-assertions": "^1.7.6",
"browserslist": "^4.14.5", "browserslist": "^4.14.5",
"chrome-trace-event": "^1.0.2", "chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.9.3", "enhanced-resolve": "^5.10.0",
"es-module-lexer": "^0.9.0", "es-module-lexer": "^0.9.0",
"eslint-scope": "5.1.1", "eslint-scope": "5.1.1",
"events": "^3.2.0", "events": "^3.2.0",
@ -31273,7 +31273,7 @@
"schema-utils": "^3.1.0", "schema-utils": "^3.1.0",
"tapable": "^2.1.1", "tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3", "terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.3.1", "watchpack": "^2.4.0",
"webpack-sources": "^3.2.3" "webpack-sources": "^3.2.3"
} }
}, },

11
packages/nc-gui/pages/[projectType]/[projectId]/index.vue

@ -171,8 +171,6 @@ onKeyStroke(
{ eventName: 'keydown' }, { eventName: 'keydown' },
) )
clearTabs()
onBeforeMount(async () => { onBeforeMount(async () => {
try { try {
await loadProject() await loadProject()
@ -186,8 +184,8 @@ onBeforeMount(async () => {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
if (!route.params.type && isUIAllowed('teamAndAuth')) { if (route.name === 'projectType-projectId-index-index' && isUIAllowed('teamAndAuth')) {
addTab({ type: TabType.AUTH, title: t('title.teamAndAuth') }) addTab({ id: TabType.AUTH, type: TabType.AUTH, title: t('title.teamAndAuth') })
} }
/** If v1 url found navigate to corresponding new url */ /** If v1 url found navigate to corresponding new url */
@ -202,7 +200,10 @@ onMounted(() => {
toggleHasSidebar(true) toggleHasSidebar(true)
}) })
onBeforeUnmount(reset) onBeforeUnmount(() => {
clearTabs()
reset()
})
function openKeyboardShortcutDialog() { function openKeyboardShortcutDialog() {
$e('a:actions:keyboard-shortcut') $e('a:actions:keyboard-shortcut')

25
packages/nc-gui/store/tab.ts

@ -18,6 +18,10 @@ export const useTabs = defineStore('tabStore', () => {
const route = $(router.currentRoute) const route = $(router.currentRoute)
const { t } = useI18n()
const { isUIAllowed } = useUIPermission()
const projectStore = useProject() const projectStore = useProject()
const projectType = $computed(() => route.params.projectType as string) const projectType = $computed(() => route.params.projectType as string)
@ -56,8 +60,8 @@ export const useTabs = defineStore('tabStore', () => {
} }
return index return index
} else if (routeName.startsWith('nc-projectId-index-index-auth')) { } else if (routeName.startsWith('projectType-projectId-index-index-auth')) {
return tabs.value.findIndex((t) => t.type === 'auth') return tabs.value.findIndex((t) => t.type === TabType.AUTH)
} }
// by default, it's showing Team & Auth // by default, it's showing Team & Auth
@ -156,5 +160,22 @@ export const useTabs = defineStore('tabStore', () => {
} }
} }
watch(
() => route.name,
(n, o) => {
if (n === o) return
if (!n || !/^projectType-projectId-index-index/.test(n.toString())) return
const activeTabRoute = n.toString().replace('projectType-projectId-index-index-', '')
switch (activeTabRoute) {
case TabType.AUTH:
if (isUIAllowed('teamAndAuth')) addTab({ id: TabType.AUTH, type: TabType.AUTH, title: t('title.teamAndAuth') })
break
default:
break
}
},
{ immediate: true },
)
return { tabs, addTab, activeTabIndex, activeTab, clearTabs, closeTab, updateTab } return { tabs, addTab, activeTabIndex, activeTab, clearTabs, closeTab, updateTab }
}) })

1
packages/noco-docs/content/en/getting-started/environment-variables.md

@ -43,7 +43,6 @@ For production usecases, it is **recommended** to configure
| NC_REDIS_URL | Custom Redis URL. Example: `redis://:authpassword@127.0.0.1:6380/4` | Meta data will be stored in memory | | | NC_REDIS_URL | Custom Redis URL. Example: `redis://:authpassword@127.0.0.1:6380/4` | Meta data will be stored in memory | |
| NC_DISABLE_ERR_REPORT | Disable error reporting | | | | NC_DISABLE_ERR_REPORT | Disable error reporting | | |
| NC_DISABLE_CACHE | To be used only while debugging. On setting this to `true` - meta data be fetched from db instead of redis/cache. | `false` | | | NC_DISABLE_CACHE | To be used only while debugging. On setting this to `true` - meta data be fetched from db instead of redis/cache. | `false` | |
| NC_BASEURL_INTERNAL | Used as base url for internal(server) API calls | Default value in docker will be `http://localhost:$PORT` and in all other case it's populated from request object | |
| AWS_ACCESS_KEY_ID | For Litestream - S3 access key id | If Litestream is configured and `NC_DB` is not present. SQLite gets backed up to S3 | | | AWS_ACCESS_KEY_ID | For Litestream - S3 access key id | If Litestream is configured and `NC_DB` is not present. SQLite gets backed up to S3 | |
| AWS_SECRET_ACCESS_KEY | For Litestream - S3 secret access key | If Litestream is configured and `NC_DB` is not present. SQLite gets backed up to S3 | | | AWS_SECRET_ACCESS_KEY | For Litestream - S3 secret access key | If Litestream is configured and `NC_DB` is not present. SQLite gets backed up to S3 | |
| AWS_BUCKET | For Litestream - S3 bucket | If Litestream is configured and `NC_DB` is not present. SQLite gets backed up to S3 | | | AWS_BUCKET | For Litestream - S3 bucket | If Litestream is configured and `NC_DB` is not present. SQLite gets backed up to S3 | |

5
packages/nocodb/src/lib/controllers/sync/import.ctl.ts

@ -105,9 +105,7 @@ export default (
// if environment value avail use it // if environment value avail use it
// or if it's docker construct using `PORT` // or if it's docker construct using `PORT`
if (process.env.NC_BASEURL_INTERNAL) { if (process.env.NC_DOCKER) {
baseURL = process.env.NC_BASEURL_INTERNAL;
} else if (process.env.NC_DOCKER) {
baseURL = `http://localhost:${process.env.PORT || 8080}`; baseURL = `http://localhost:${process.env.PORT || 8080}`;
} }
@ -119,6 +117,7 @@ export default (
baseId: syncSource.base_id, baseId: syncSource.base_id,
authToken: token, authToken: token,
baseURL, baseURL,
user: user,
}); });
}, 1000); }, 1000);

4
packages/nocodb/src/lib/services/column.svc.ts

@ -835,7 +835,7 @@ export async function columnSetAsPrimary(param: { columnId: string }) {
} }
export async function columnAdd(param: { export async function columnAdd(param: {
req?: any; req: any;
tableId: string; tableId: string;
column: ColumnReqType; column: ColumnReqType;
}) { }) {
@ -1110,7 +1110,7 @@ export async function columnAdd(param: {
project_id: base.project_id, project_id: base.project_id,
op_type: AuditOperationTypes.TABLE_COLUMN, op_type: AuditOperationTypes.TABLE_COLUMN,
op_sub_type: AuditOperationSubTypes.CREATED, op_sub_type: AuditOperationSubTypes.CREATED,
user: param?.req?.user?.email, user: param?.req.user?.email,
description: `created column ${colBody.column_name} with alias ${colBody.title} from table ${table.table_name}`, description: `created column ${colBody.column_name} with alias ${colBody.title} from table ${table.table_name}`,
ip: param?.req.clientIp, ip: param?.req.clientIp,
}).then(() => {}); }).then(() => {});

479
packages/nocodb/src/lib/services/sync/helpers/job.ts

@ -1,6 +1,5 @@
import { promisify } from 'util'; import { promisify } from 'util';
import { UITypes } from 'nocodb-sdk'; import { UITypes } from 'nocodb-sdk';
import { Api } from 'nocodb-sdk';
import Airtable from 'airtable'; import Airtable from 'airtable';
import jsonfile from 'jsonfile'; import jsonfile from 'jsonfile';
import hash from 'object-hash'; import hash from 'object-hash';
@ -8,9 +7,25 @@ import { T } from 'nc-help';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc'; import utc from 'dayjs/plugin/utc';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import {
attachmentService,
columnService,
filterService,
formViewColumnService,
formViewService,
galleryViewService,
gridViewService,
projectService,
projectUserService,
sortService,
tableService,
viewColumnService,
viewService,
} from '../..';
import FetchAT from './fetchAT'; import FetchAT from './fetchAT';
import { importData, importLTARData } from './readAndProcessData'; import { importData, importLTARData } from './readAndProcessData';
import EntityMap from './EntityMap'; import EntityMap from './EntityMap';
import type { UserType } from 'nocodb-sdk';
const writeJsonFileAsync = promisify(jsonfile.writeFile); const writeJsonFileAsync = promisify(jsonfile.writeFile);
@ -69,6 +84,9 @@ export default async (
) => { ) => {
const sMapEM = new EntityMap('aTblId', 'ncId', 'ncName', 'ncParent'); const sMapEM = new EntityMap('aTblId', 'ncId', 'ncName', 'ncParent');
await sMapEM.init(); await sMapEM.init();
const userRole = syncDB.user.roles
.split(',')
.reduce((rolesObj, role) => ({ [role]: true, ...rolesObj }), {});
const sMap = { const sMap = {
// static mapping records between aTblId && ncId // static mapping records between aTblId && ncId
@ -116,7 +134,6 @@ export default async (
const enableErrorLogs = false; const enableErrorLogs = false;
const generate_migrationStats = true; const generate_migrationStats = true;
const debugMode = false; const debugMode = false;
let api: Api<any>;
let g_aTblSchema = []; let g_aTblSchema = [];
let ncCreatedProjectSchema: any = {}; let ncCreatedProjectSchema: any = {};
const ncLinkMappingTable: any[] = []; const ncLinkMappingTable: any[] = [];
@ -286,16 +303,6 @@ export default async (
}; };
} }
// aTbl: retrieve table name from table ID
//
// @ts-ignore
function aTbl_getTableName(tblId) {
const sheetObj = g_aTblSchema.find((tbl) => tbl.id === tblId);
return {
tn: sheetObj.name,
};
}
const ncSchema = { const ncSchema = {
tables: [], tables: [],
tablesById: {}, tablesById: {},
@ -320,12 +327,24 @@ export default async (
// @ts-ignore // @ts-ignore
async function nc_DumpTableSchema() { async function nc_DumpTableSchema() {
console.log('['); console.log('[');
const ncTblList = await api.base.tableList( // const ncTblList = await api.base.tableList(
ncCreatedProjectSchema.id, // ncCreatedProjectSchema.id,
syncDB.baseId // syncDB.baseId
); // );
const ncTblList = { list: [] };
ncTblList['list'] = await tableService.getAccessibleTables({
projectId: ncCreatedProjectSchema.id,
baseId: syncDB.baseId,
roles: userRole,
});
for (let i = 0; i < ncTblList.list.length; i++) { for (let i = 0; i < ncTblList.list.length; i++) {
const ncTbl = await api.dbTable.read(ncTblList.list[i].id); // const ncTbl = await api.dbTable.read(ncTblList.list[i].id);
const ncTbl = await tableService.getTableWithAccessibleViews({
tableId: ncTblList.list[i].id,
user: syncDB.user,
});
console.log(JSON.stringify(ncTbl, null, 2)); console.log(JSON.stringify(ncTbl, null, 2));
console.log(','); console.log(',');
} }
@ -335,13 +354,6 @@ export default async (
// retrieve nc column schema from using aTbl field ID as reference // retrieve nc column schema from using aTbl field ID as reference
// //
async function nc_getColumnSchema(aTblFieldId) { async function nc_getColumnSchema(aTblFieldId) {
// let ncTblList = await api.dbTable.list(ncCreatedProjectSchema.id);
// let aTblField = aTbl_getColumnName(aTblFieldId);
// let ncTblId = ncTblList.list.filter(x => x.title === aTblField.tn)[0].id;
// let ncTbl = await api.dbTable.read(ncTblId);
// let ncCol = ncTbl.columns.find(x => x.title === aTblField.cn);
// return ncCol;
const ncTblId = await sMap.getNcParentFromAtId(aTblFieldId); const ncTblId = await sMap.getNcParentFromAtId(aTblFieldId);
const ncColId = await sMap.getNcIdFromAtId(aTblFieldId); const ncColId = await sMap.getNcIdFromAtId(aTblFieldId);
@ -355,11 +367,6 @@ export default async (
// optimize: create a look-up table & re-use information // optimize: create a look-up table & re-use information
// //
async function nc_getTableSchema(tableName) { async function nc_getTableSchema(tableName) {
// let ncTblList = await api.dbTable.list(ncCreatedProjectSchema.id);
// let ncTblId = ncTblList.list.filter(x => x.title === tableName)[0].id;
// let ncTbl = await api.dbTable.read(ncTblId);
// return ncTbl;
return ncSchema.tables.find((x) => x.title === tableName); return ncSchema.tables.find((x) => x.title === tableName);
} }
@ -371,11 +378,16 @@ export default async (
projectId?: string; projectId?: string;
}) { }) {
// delete 'sample' project if already exists // delete 'sample' project if already exists
const x = await api.project.list(); const x = { list: [] };
x['list'] = await projectService.projectList({
user: { id: syncDB.user.id, roles: syncDB.user.roles },
});
const sampleProj = x.list.find((a) => a.title === projectName); const sampleProj = x.list.find((a) => a.title === projectName);
if (sampleProj) { if (sampleProj) {
await api.project.delete(sampleProj.id); await projectService.projectSoftDelete({
projectId: sampleProj.id,
});
} }
logDetailed('Init'); logDetailed('Init');
} }
@ -421,11 +433,6 @@ export default async (
case 'date': case 'date':
if (col.typeOptions?.isDateTime) ncType = UITypes.DateTime; if (col.typeOptions?.isDateTime) ncType = UITypes.DateTime;
break; break;
// case 'barcode':
// case 'button':
// ncType = UITypes.SingleLineText;
// break;
} }
return ncType; return ncType;
@ -452,7 +459,9 @@ export default async (
(value as any).name = 'nc_empty'; (value as any).name = 'nc_empty';
} }
// enumerate duplicates (we don't allow them) // enumerate duplicates (we don't allow them)
// TODO fix record mapping (this causes every record to map first option, we can't handle them using data api as they don't provide option id within data we might instead get the correct mapping from schema file ) // TODO fix record mapping (this causes every record to map first option,
// we can't handle them using data api as they don't provide option id
// within data we might instead get the correct mapping from schema file )
let dupNo = 1; let dupNo = 1;
const defaultName = (value as any).name; const defaultName = (value as any).name;
while ( while (
@ -562,13 +571,6 @@ export default async (
continue; continue;
} }
// populate cdf (column default value) if configured
// if (col?.default) {
// if (typeof col.default === 'string')
// ncCol.cdf = `'${col.default.replace?.(/'/g, "\\'")}'`;
// else ncCol.cdf = col.default;
// }
// change from default 'tinytext' as airtable allows more than 255 characters // change from default 'tinytext' as airtable allows more than 255 characters
// for single line text column type // for single line text column type
if (col.type === 'text') ncCol.dt = 'text'; if (col.type === 'text') ncCol.dt = 'text';
@ -625,11 +627,12 @@ export default async (
logDetailed(`NC API: base.tableCreate ${tables[idx].title}`); logDetailed(`NC API: base.tableCreate ${tables[idx].title}`);
let _perfStart = recordPerfStart(); let _perfStart = recordPerfStart();
const table: any = await api.base.tableCreate( const table = await tableService.tableCreate({
ncCreatedProjectSchema.id, baseId: syncDB.baseId,
syncDB.baseId, projectId: ncCreatedProjectSchema.id,
tables[idx] table: tables[idx],
); user: syncDB.user,
});
recordPerfStats(_perfStart, 'dbTable.create'); recordPerfStats(_perfStart, 'dbTable.create');
updateNcTblSchema(table); updateNcTblSchema(table);
@ -653,14 +656,19 @@ export default async (
// update default view name- to match it to airtable view name // update default view name- to match it to airtable view name
logDetailed(`NC API: dbView.list ${table.id}`); logDetailed(`NC API: dbView.list ${table.id}`);
_perfStart = recordPerfStart(); _perfStart = recordPerfStart();
const view = await api.dbView.list(table.id); const view = { list: [] };
view['list'] = await viewService.viewList({
tableId: table.id,
user: { roles: userRole },
});
recordPerfStats(_perfStart, 'dbView.list'); recordPerfStats(_perfStart, 'dbView.list');
const aTbl_grid = aTblSchema[idx].views.find((x) => x.type === 'grid'); const aTbl_grid = aTblSchema[idx].views.find((x) => x.type === 'grid');
logDetailed(`NC API: dbView.update ${view.list[0].id} ${aTbl_grid.name}`); logDetailed(`NC API: dbView.update ${view.list[0].id} ${aTbl_grid.name}`);
_perfStart = recordPerfStart(); _perfStart = recordPerfStart();
await api.dbView.update(view.list[0].id, { await viewService.viewUpdate({
title: aTbl_grid.name, viewId: view.list[0].id,
view: { title: aTbl_grid.name },
}); });
recordPerfStats(_perfStart, 'dbView.update'); recordPerfStats(_perfStart, 'dbView.update');
@ -708,7 +716,6 @@ export default async (
// check if link already established? // check if link already established?
if (!nc_isLinkExists(aTblLinkColumns[i].id)) { if (!nc_isLinkExists(aTblLinkColumns[i].id)) {
// parent table ID // parent table ID
// let srcTableId = (await nc_getTableSchema(aTblSchema[idx].name)).id;
const srcTableId = await sMap.getNcIdFromAtId(aTblSchema[idx].id); const srcTableId = await sMap.getNcIdFromAtId(aTblSchema[idx].id);
// find child table name from symmetric column ID specified // find child table name from symmetric column ID specified
@ -725,7 +732,10 @@ export default async (
// check if already a column exists with this name? // check if already a column exists with this name?
let _perfStart = recordPerfStart(); let _perfStart = recordPerfStart();
const srcTbl: any = await api.dbTable.read(srcTableId); const srcTbl: any = await tableService.getTableWithAccessibleViews({
tableId: srcTableId,
user: syncDB.user,
});
recordPerfStats(_perfStart, 'dbTable.read'); recordPerfStats(_perfStart, 'dbTable.read');
// create link // create link
@ -742,16 +752,20 @@ export default async (
`NC API: dbTableColumn.create LinkToAnotherRecord ${ncName.title}` `NC API: dbTableColumn.create LinkToAnotherRecord ${ncName.title}`
); );
_perfStart = recordPerfStart(); _perfStart = recordPerfStart();
const ncTbl: any = await api.dbTableColumn.create(srcTableId, { const ncTbl: any = await columnService.columnAdd({
uidt: UITypes.LinkToAnotherRecord, tableId: srcTableId,
title: ncName.title, column: {
column_name: ncName.column_name, uidt: UITypes.LinkToAnotherRecord,
parentId: srcTableId, title: ncName.title,
childId: childTableId, column_name: ncName.column_name,
type: 'mm', parentId: srcTableId,
// aTblLinkColumns[i].typeOptions.relationship === 'many' childId: childTableId,
// ? 'mm' type: 'mm',
// : 'hm' },
req: {
user: syncDB.user.email,
clientIp: '',
},
}); });
recordPerfStats(_perfStart, 'dbTableColumn.create'); recordPerfStats(_perfStart, 'dbTableColumn.create');
@ -799,21 +813,21 @@ export default async (
); );
let _perfStart = recordPerfStart(); let _perfStart = recordPerfStart();
const childTblSchema: any = await api.dbTable.read( const childTblSchema: any =
ncLinkMappingTable[x].nc.childId await tableService.getTableWithAccessibleViews({
); tableId: ncLinkMappingTable[x].nc.childId,
user: syncDB.user,
});
recordPerfStats(_perfStart, 'dbTable.read'); recordPerfStats(_perfStart, 'dbTable.read');
_perfStart = recordPerfStart(); _perfStart = recordPerfStart();
const parentTblSchema: any = await api.dbTable.read( const parentTblSchema: any =
ncLinkMappingTable[x].nc.parentId await tableService.getTableWithAccessibleViews({
); tableId: ncLinkMappingTable[x].nc.parentId,
user: syncDB.user,
});
recordPerfStats(_perfStart, 'dbTable.read'); recordPerfStats(_perfStart, 'dbTable.read');
// fix me
// let childTblSchema = ncSchema.tablesById[ncLinkMappingTable[x].nc.childId]
// let parentTblSchema = ncSchema.tablesById[ncLinkMappingTable[x].nc.parentId]
let parentLinkColumn = parentTblSchema.columns.find( let parentLinkColumn = parentTblSchema.columns.find(
(col) => col.title === ncLinkMappingTable[x].nc.title (col) => col.title === ncLinkMappingTable[x].nc.title
); );
@ -886,14 +900,14 @@ export default async (
`NC API: dbTableColumn.update rename symmetric column ${ncName.title}` `NC API: dbTableColumn.update rename symmetric column ${ncName.title}`
); );
_perfStart = recordPerfStart(); _perfStart = recordPerfStart();
const ncTbl: any = await api.dbTableColumn.update( const ncTbl: any = await columnService.columnUpdate({
childLinkColumn.id, columnId: childLinkColumn.id,
{ column: {
...childLinkColumn, ...childLinkColumn,
title: ncName.title, title: ncName.title,
column_name: ncName.column_name, column_name: ncName.column_name,
} },
); });
recordPerfStats(_perfStart, 'dbTableColumn.update'); recordPerfStats(_perfStart, 'dbTableColumn.update');
updateNcTblSchema(ncTbl); updateNcTblSchema(ncTbl);
@ -907,8 +921,6 @@ export default async (
aTblLinkColumns[i].name + suffix, aTblLinkColumns[i].name + suffix,
ncTbl.id ncTbl.id
); );
// console.log(res.columns.find(x => x.title === aTblLinkColumns[i].name))
} }
} }
} }
@ -923,7 +935,6 @@ export default async (
); );
// parent table ID // parent table ID
// let srcTableId = (await nc_getTableSchema(aTblSchema[idx].name)).id;
const srcTableId = await sMap.getNcIdFromAtId(aTblSchema[idx].id); const srcTableId = await sMap.getNcIdFromAtId(aTblSchema[idx].id);
const srcTableSchema = ncSchema.tablesById[srcTableId]; const srcTableSchema = ncSchema.tablesById[srcTableId];
@ -975,12 +986,19 @@ export default async (
logDetailed(`NC API: dbTableColumn.create LOOKUP ${ncName.title}`); logDetailed(`NC API: dbTableColumn.create LOOKUP ${ncName.title}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const ncTbl: any = await api.dbTableColumn.create(srcTableId, { const ncTbl: any = await columnService.columnAdd({
uidt: UITypes.Lookup, tableId: srcTableId,
title: ncName.title, column: {
column_name: ncName.column_name, uidt: UITypes.Lookup,
fk_relation_column_id: ncRelationColumnId, title: ncName.title,
fk_lookup_column_id: ncLookupColumnId, column_name: ncName.column_name,
fk_relation_column_id: ncRelationColumnId,
fk_lookup_column_id: ncLookupColumnId,
},
req: {
user: syncDB.user.email,
clientIp: '',
},
}); });
recordPerfStats(_perfStart, 'dbTableColumn.create'); recordPerfStats(_perfStart, 'dbTableColumn.create');
@ -1055,12 +1073,19 @@ export default async (
logDetailed(`NC API: dbTableColumn.create LOOKUP ${ncName.title}`); logDetailed(`NC API: dbTableColumn.create LOOKUP ${ncName.title}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const ncTbl: any = await api.dbTableColumn.create(srcTableId, { const ncTbl: any = await columnService.columnAdd({
uidt: UITypes.Lookup, tableId: srcTableId,
title: ncName.title, column: {
column_name: ncName.column_name, uidt: UITypes.Lookup,
fk_relation_column_id: ncRelationColumnId, title: ncName.title,
fk_lookup_column_id: ncLookupColumnId, column_name: ncName.column_name,
fk_relation_column_id: ncRelationColumnId,
fk_lookup_column_id: ncLookupColumnId,
},
req: {
user: syncDB.user.email,
clientIp: '',
},
}); });
recordPerfStats(_perfStart, 'dbTableColumn.create'); recordPerfStats(_perfStart, 'dbTableColumn.create');
@ -1113,7 +1138,6 @@ export default async (
); );
// parent table ID // parent table ID
// let srcTableId = (await nc_getTableSchema(aTblSchema[idx].name)).id;
const srcTableId = await sMap.getNcIdFromAtId(aTblSchema[idx].id); const srcTableId = await sMap.getNcIdFromAtId(aTblSchema[idx].id);
const srcTableSchema = ncSchema.tablesById[srcTableId]; const srcTableSchema = ncSchema.tablesById[srcTableId];
@ -1131,7 +1155,6 @@ export default async (
const ncRollupFn = getRollupNcFunction( const ncRollupFn = getRollupNcFunction(
aTblColumns[i].typeOptions.formulaTextParsed aTblColumns[i].typeOptions.formulaTextParsed
); );
// const ncRollupFn = '';
if (ncRollupFn === '' || ncRollupFn === undefined) { if (ncRollupFn === '' || ncRollupFn === undefined) {
updateMigrationSkipLog( updateMigrationSkipLog(
@ -1198,13 +1221,20 @@ export default async (
logDetailed(`NC API: dbTableColumn.create ROLLUP ${ncName.title}`); logDetailed(`NC API: dbTableColumn.create ROLLUP ${ncName.title}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const ncTbl: any = await api.dbTableColumn.create(srcTableId, { const ncTbl: any = await columnService.columnAdd({
uidt: UITypes.Rollup, tableId: srcTableId,
title: ncName.title, column: {
column_name: ncName.column_name, uidt: UITypes.Rollup,
fk_relation_column_id: ncRelationColumnId, title: ncName.title,
fk_rollup_column_id: ncRollupColumnId, column_name: ncName.column_name,
rollup_function: ncRollupFn, fk_relation_column_id: ncRelationColumnId,
fk_rollup_column_id: ncRollupColumnId,
rollup_function: ncRollupFn,
},
req: {
user: syncDB.user.email,
clientIp: '',
},
}); });
recordPerfStats(_perfStart, 'dbTableColumn.create'); recordPerfStats(_perfStart, 'dbTableColumn.create');
@ -1256,12 +1286,19 @@ export default async (
logDetailed(`NC API: dbTableColumn.create LOOKUP ${ncName.title}`); logDetailed(`NC API: dbTableColumn.create LOOKUP ${ncName.title}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const ncTbl: any = await api.dbTableColumn.create(srcTableId, { const ncTbl: any = await columnService.columnAdd({
uidt: UITypes.Lookup, tableId: srcTableId,
title: ncName.title, column: {
column_name: ncName.column_name, uidt: UITypes.Lookup,
fk_relation_column_id: ncRelationColumnId, title: ncName.title,
fk_lookup_column_id: ncLookupColumnId, column_name: ncName.column_name,
fk_relation_column_id: ncRelationColumnId,
fk_lookup_column_id: ncLookupColumnId,
},
req: {
user: syncDB.user.email,
clientIp: '',
},
}); });
recordPerfStats(_perfStart, 'dbTableColumn.create'); recordPerfStats(_perfStart, 'dbTableColumn.create');
@ -1297,7 +1334,7 @@ export default async (
if (ncColId) { if (ncColId) {
logDetailed(`NC API: dbTableColumn.primaryColumnSet`); logDetailed(`NC API: dbTableColumn.primaryColumnSet`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
await api.dbTableColumn.primaryColumnSet(ncColId); await columnService.columnSetAsPrimary({ columnId: ncColId });
recordPerfStats(_perfStart, 'dbTableColumn.primaryColumnSet'); recordPerfStats(_perfStart, 'dbTableColumn.primaryColumnSet');
// update schema // update schema
@ -1314,13 +1351,16 @@ export default async (
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
if (viewType === 'form') { if (viewType === 'form') {
viewDetails = (await api.dbView.formRead(viewId)).columns; viewDetails = (await formViewService.formViewGet({ formViewId: viewId }))
.columns;
recordPerfStats(_perfStart, 'dbView.formRead'); recordPerfStats(_perfStart, 'dbView.formRead');
} else if (viewType === 'gallery') { } else if (viewType === 'gallery') {
viewDetails = (await api.dbView.galleryRead(viewId)).columns; viewDetails = (
await galleryViewService.galleryViewGet({ galleryViewId: viewId })
).columns;
recordPerfStats(_perfStart, 'dbView.galleryRead'); recordPerfStats(_perfStart, 'dbView.galleryRead');
} else { } else {
viewDetails = await api.dbView.gridColumnsList(viewId); viewDetails = await viewColumnService.columnList({ viewId: viewId });
recordPerfStats(_perfStart, 'dbView.gridColumnsList'); recordPerfStats(_perfStart, 'dbView.gridColumnsList');
} }
@ -1448,17 +1488,15 @@ export default async (
?.map((a) => a.filename?.split('?')?.[0]) ?.map((a) => a.filename?.split('?')?.[0])
.join(', ')}` .join(', ')}`
); );
tempArr = await api.storage.uploadByUrl( tempArr = await attachmentService.uploadViaURL({
{ path: `noco/${sDB.projectName}/${table.title}/${key}`,
path: `noco/${sDB.projectName}/${table.title}/${key}`, urls: value?.map((attachment) => ({
},
value?.map((attachment) => ({
fileName: attachment.filename?.split('?')?.[0], fileName: attachment.filename?.split('?')?.[0],
url: attachment.url, url: attachment.url,
size: attachment.size, size: attachment.size,
mimetype: attachment.type, mimetype: attachment.type,
})) })),
); });
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
@ -1497,8 +1535,6 @@ export default async (
}) })
.eachPage( .eachPage(
async function page(records, fetchNextPage) { async function page(records, fetchNextPage) {
// console.log(JSON.stringify(records, null, 2));
// This function (`page`) will get called for each page of records. // This function (`page`) will get called for each page of records.
// records.forEach(record => callback(table, record)); // records.forEach(record => callback(table, record));
logBasic( logBasic(
@ -1538,9 +1574,12 @@ export default async (
// create empty project (XC-DB) // create empty project (XC-DB)
logDetailed(`Create Project: ${projName}`); logDetailed(`Create Project: ${projName}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
ncCreatedProjectSchema = await api.project.create({
title: projName, ncCreatedProjectSchema = await projectService.projectCreate({
project: { title: projName },
user: { id: syncDB.user.id },
}); });
recordPerfStats(_perfStart, 'project.create'); recordPerfStats(_perfStart, 'project.create');
} }
@ -1548,7 +1587,9 @@ export default async (
// create empty project (XC-DB) // create empty project (XC-DB)
logDetailed(`Getting project meta: ${projId}`); logDetailed(`Getting project meta: ${projId}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
ncCreatedProjectSchema = await api.project.read(projId); ncCreatedProjectSchema = await projectService.getProjectWithInfo({
projectId: projId,
});
recordPerfStats(_perfStart, 'project.read'); recordPerfStats(_perfStart, 'project.read');
} }
@ -1580,13 +1621,15 @@ export default async (
logDetailed(`NC API dbView.galleryCreate :: ${viewName}`); logDetailed(`NC API dbView.galleryCreate :: ${viewName}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
await api.dbView.galleryCreate(tblId, { title: viewName }); await galleryViewService.galleryViewCreate({
tableId: tblId,
gallery: {
title: viewName,
},
});
recordPerfStats(_perfStart, 'dbView.galleryCreate'); recordPerfStats(_perfStart, 'dbView.galleryCreate');
await updateNcTblSchemaById(tblId); await updateNcTblSchemaById(tblId);
// syncLog(`[${idx+1}/${aTblSchema.length}][Gallery View][${i+1}/${galleryViews.length}] Create ${viewName}`)
// await nc_configureFields(g.id, vData, aTblSchema[idx].name, viewName, 'gallery');
} }
} }
} }
@ -1641,7 +1684,11 @@ export default async (
logDetailed(`NC API dbView.formCreate :: ${viewName}`); logDetailed(`NC API dbView.formCreate :: ${viewName}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const f = await api.dbView.formCreate(tblId, formData); // const f = await api.dbView.formCreate(tblId, formData);
const f = await formViewService.formViewCreate({
tableId: tblId,
body: formData,
});
recordPerfStats(_perfStart, 'dbView.formCreate'); recordPerfStats(_perfStart, 'dbView.formCreate');
logDetailed( logDetailed(
@ -1684,7 +1731,12 @@ export default async (
(x) => x.id === gridViews[i].id (x) => x.id === gridViews[i].id
)?.name; )?.name;
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const viewList: any = await api.dbView.list(tblId); // const viewList: any = await api.dbView.list(tblId);
const viewList = { list: [] };
viewList['list'] = await viewService.viewList({
tableId: tblId,
user: { roles: userRole },
});
recordPerfStats(_perfStart, 'dbView.list'); recordPerfStats(_perfStart, 'dbView.list');
let ncViewId = viewList?.list?.find((x) => x.tn === viewName)?.id; let ncViewId = viewList?.list?.find((x) => x.tn === viewName)?.id;
@ -1699,8 +1751,11 @@ export default async (
if (i > 0) { if (i > 0) {
logDetailed(`NC API dbView.gridCreate :: ${viewName}`); logDetailed(`NC API dbView.gridCreate :: ${viewName}`);
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const viewCreated = await api.dbView.gridCreate(tblId, { const viewCreated = await gridViewService.gridViewCreate({
title: viewName, tableId: tblId,
grid: {
title: viewName,
},
}); });
recordPerfStats(_perfStart, 'dbView.gridCreate'); recordPerfStats(_perfStart, 'dbView.gridCreate');
@ -1711,11 +1766,9 @@ export default async (
viewName, viewName,
tblId tblId
); );
// syncLog(`[${idx+1}/${aTblSchema.length}][Grid View][${i+1}/${gridViews.length}] Create ${viewName}`)
ncViewId = viewCreated.id; ncViewId = viewCreated.id;
} }
// syncLog(`[${idx+1}/${aTblSchema.length}][Grid View][${i+1}/${gridViews.length}] Hide columns ${viewName}`)
logDetailed(` Configure show/hide columns`); logDetailed(` Configure show/hide columns`);
await nc_configureFields( await nc_configureFields(
ncViewId, ncViewId,
@ -1727,7 +1780,6 @@ export default async (
// configure filters // configure filters
if (vData?.filters) { if (vData?.filters) {
// syncLog(`[${idx+1}/${aTblSchema.length}][Grid View][${i+1}/${gridViews.length}] Configure filters ${viewName}`)
logDetailed(` Configure filter set`); logDetailed(` Configure filter set`);
// skip filters if nested // skip filters if nested
@ -1738,7 +1790,6 @@ export default async (
// configure sort // configure sort
if (vData?.lastSortsApplied?.sortSet.length) { if (vData?.lastSortsApplied?.sortSet.length) {
// syncLog(`[${idx+1}/${aTblSchema.length}][Grid View][${i+1}/${gridViews.length}] Configure sort ${viewName}`)
logDetailed(` Configure sort set`); logDetailed(` Configure sort set`);
await nc_configureSort(ncViewId, vData.lastSortsApplied); await nc_configureSort(ncViewId, vData.lastSortsApplied);
} }
@ -1768,10 +1819,14 @@ export default async (
); );
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
insertJobs.push( insertJobs.push(
api.auth projectUserService
.projectUserAdd(ncCreatedProjectSchema.id, { .userInvite({
email: value.email, projectId: ncCreatedProjectSchema.id,
roles: userRoles[value.permissionLevel], projectUser: {
email: value.email,
roles: userRoles[value.permissionLevel],
},
req: { user: syncDB.user, clientIp: '' },
}) })
.catch((e) => .catch((e) =>
e.response?.data?.msg e.response?.data?.msg
@ -1798,7 +1853,10 @@ export default async (
async function updateNcTblSchemaById(tblId) { async function updateNcTblSchemaById(tblId) {
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const ncTbl = await api.dbTable.read(tblId); const ncTbl: any = await tableService.getTableWithAccessibleViews({
tableId: tblId,
user: syncDB.user,
});
recordPerfStats(_perfStart, 'dbTable.read'); recordPerfStats(_perfStart, 'dbTable.read');
updateNcTblSchema(ncTbl); updateNcTblSchema(ncTbl);
@ -2055,8 +2113,9 @@ export default async (
// insert filters // insert filters
for (let i = 0; i < ncFilters.length; i++) { for (let i = 0; i < ncFilters.length; i++) {
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
await api.dbTableFilter.create(viewId, { await filterService.filterCreate({
...ncFilters[i], viewId: viewId,
filter: ncFilters[i],
}); });
recordPerfStats(_perfStart, 'dbTableFilter.create'); recordPerfStats(_perfStart, 'dbTableFilter.create');
@ -2071,9 +2130,12 @@ export default async (
if (columnId) { if (columnId) {
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
await api.dbTableSort.create(viewId, { await sortService.sortCreate({
fk_column_id: columnId, viewId: viewId,
direction: s.sortSet[i].ascending ? 'asc' : 'desc', sort: {
fk_column_id: columnId,
direction: s.sortSet[i].ascending ? 'asc' : 'desc',
},
}); });
recordPerfStats(_perfStart, 'dbTableSort.create'); recordPerfStats(_perfStart, 'dbTableSort.create');
} }
@ -2095,13 +2157,18 @@ export default async (
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
if (viewType === 'form') { if (viewType === 'form') {
viewDetails = (await api.dbView.formRead(viewId)).columns; viewDetails = (await formViewService.formViewGet({ formViewId: viewId }))
.columns;
recordPerfStats(_perfStart, 'dbView.formRead'); recordPerfStats(_perfStart, 'dbView.formRead');
} else if (viewType === 'gallery') { } else if (viewType === 'gallery') {
viewDetails = (await api.dbView.galleryRead(viewId)).columns; viewDetails = (
await galleryViewService.galleryViewGet({
galleryViewId: viewId,
})
).columns;
recordPerfStats(_perfStart, 'dbView.galleryRead'); recordPerfStats(_perfStart, 'dbView.galleryRead');
} else { } else {
viewDetails = await api.dbView.gridColumnsList(viewId); viewDetails = await viewColumnService.columnList({ viewId: viewId });
recordPerfStats(_perfStart, 'dbView.gridColumnsList'); recordPerfStats(_perfStart, 'dbView.gridColumnsList');
} }
@ -2113,18 +2180,17 @@ export default async (
const ncViewColumnId = viewDetails.find( const ncViewColumnId = viewDetails.find(
(x) => x.fk_column_id === ncColumnId (x) => x.fk_column_id === ncColumnId
)?.id; )?.id;
// const ncViewColumnId = await nc_getViewColumnId(
// viewId,
// viewType,
// ncColumnId
// );
if (ncViewColumnId === undefined) continue; if (ncViewColumnId === undefined) continue;
// first two positions held by record id & record hash // first two positions held by record id & record hash
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
await api.dbViewColumn.update(viewId, ncViewColumnId, { await viewColumnService.columnUpdate({
show: false, viewId: viewId,
order: j + 1 + c.length, columnId: ncViewColumnId,
column: {
show: false,
order: j + 1 + c.length,
},
}); });
recordPerfStats(_perfStart, 'dbViewColumn.update'); recordPerfStats(_perfStart, 'dbViewColumn.update');
} }
@ -2149,12 +2215,19 @@ export default async (
if (x?.required) formData[`required`] = x.required; if (x?.required) formData[`required`] = x.required;
if (x?.description) formData[`description`] = x.description; if (x?.description) formData[`description`] = x.description;
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
await api.dbView.formColumnUpdate(ncViewColumnId, formData); await formViewColumnService.columnUpdate({
formViewColumnId: ncViewColumnId,
formViewColumn: formData,
});
recordPerfStats(_perfStart, 'dbView.formColumnUpdate'); recordPerfStats(_perfStart, 'dbView.formColumnUpdate');
} }
} }
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
await api.dbViewColumn.update(viewId, ncViewColumnId, configData); await viewColumnService.columnUpdate({
viewId: viewId,
columnId: ncViewColumnId,
column: configData,
});
recordPerfStats(_perfStart, 'dbViewColumn.update'); recordPerfStats(_perfStart, 'dbViewColumn.update');
} }
} }
@ -2163,13 +2236,6 @@ export default async (
let recordCnt = 0; let recordCnt = 0;
try { try {
logBasic('SDK initialized'); logBasic('SDK initialized');
api = new Api({
baseURL: syncDB.baseURL,
headers: {
'xc-auth': syncDB.authToken,
},
});
logDetailed('Project initialization started'); logDetailed('Project initialization started');
// delete project if already exists // delete project if already exists
if (debugMode) await init(syncDB); if (debugMode) await init(syncDB);
@ -2249,10 +2315,12 @@ export default async (
try { try {
// await nc_DumpTableSchema(); // await nc_DumpTableSchema();
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const ncTblList = await api.base.tableList( const ncTblList = { list: [] };
ncCreatedProjectSchema.id, ncTblList['list'] = await tableService.getAccessibleTables({
syncDB.baseId projectId: ncCreatedProjectSchema.id,
); baseId: syncDB.baseId,
roles: userRole,
});
recordPerfStats(_perfStart, 'base.tableList'); recordPerfStats(_perfStart, 'base.tableList');
logBasic('Reading Records...'); logBasic('Reading Records...');
@ -2268,17 +2336,18 @@ export default async (
continue; continue;
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
const ncTbl = await api.dbTable.read(ncTblList.list[i].id); const ncTbl: any = await tableService.getTableWithAccessibleViews({
tableId: ncTblList.list[i].id,
user: syncDB.user,
});
recordPerfStats(_perfStart, 'dbTable.read'); recordPerfStats(_perfStart, 'dbTable.read');
recordCnt = 0; recordCnt = 0;
// await nocoReadData(syncDB, ncTbl);
recordsMap[ncTbl.id] = await importData({ recordsMap[ncTbl.id] = await importData({
projectName: syncDB.projectName, projectName: syncDB.projectName,
table: ncTbl, table: ncTbl,
base, base,
api,
logBasic, logBasic,
nocoBaseDataProcessing_v2, nocoBaseDataProcessing_v2,
sDB: syncDB, sDB: syncDB,
@ -2298,12 +2367,15 @@ export default async (
) )
continue; continue;
const ncTbl = await api.dbTable.read(ncTblList.list[i].id); // const ncTbl = await api.dbTable.read(ncTblList.list[i].id);
const ncTbl: any = await tableService.getTableWithAccessibleViews({
tableId: ncTblList.list[i].id,
user: syncDB.user,
});
rtc.data.nestedLinks += await importLTARData({ rtc.data.nestedLinks += await importLTARData({
table: ncTbl, table: ncTbl,
projectName: syncDB.projectName, projectName: syncDB.projectName,
api,
base, base,
fields: null, //Object.values(tblLinkGroup).flat(), fields: null, //Object.values(tblLinkGroup).flat(),
logBasic, logBasic,
@ -2312,61 +2384,9 @@ export default async (
records: recordsMap[ncTbl.id], records: recordsMap[ncTbl.id],
atNcAliasRef, atNcAliasRef,
ncLinkMappingTable, ncLinkMappingTable,
syncDB,
}); });
} }
if (storeLinks) {
// const insertJobs: Promise<any>[] = [];
// for (const [pTitle, v] of Object.entries(ncLinkDataStore)) {
// logBasic(`:: ${pTitle}`);
// for (const [, record] of Object.entries(v)) {
// const tbl = ncTblList.list.find(a => a.title === pTitle);
// await nocoLinkProcessing(syncDB.projectName, tbl, record, 0);
// // insertJobs.push(
// // nocoLinkProcessing(syncDB.projectName, tbl, record, 0)
// // );
// }
// }
// await Promise.all(insertJobs);
// await nocoLinkProcessing(syncDB.projectName, 0, 0, 0);
} else {
// // create link groups (table: link fields)
// // const tblLinkGroup = {};
// // for (let idx = 0; idx < ncLinkMappingTable.length; idx++) {
// // const x = ncLinkMappingTable[idx];
// // if (tblLinkGroup[x.aTbl.tblId] === undefined)
// // tblLinkGroup[x.aTbl.tblId] = [x.aTbl.name];
// // else tblLinkGroup[x.aTbl.tblId].push(x.aTbl.name);
// // }
// //
// // const ncTbl = await nc_getTableSchema(aTbl_getTableName(k).tn);
// //
// // await importLTARData({
// // table: ncTbl,
// // projectName: syncDB.projectName,
// // api,
// // base,
// // fields: Object.values(tblLinkGroup).flat(),
// // logBasic
// // });
// for (const [k, v] of Object.entries(tblLinkGroup)) {
// const ncTbl = await nc_getTableSchema(aTbl_getTableName(k).tn);
//
// // not a migrated table, skip
// if (undefined === aTblSchema.find(x => x.name === ncTbl.title))
// continue;
//
// recordCnt = 0;
// await nocoReadDataSelected(
// syncDB.projectName,
// ncTbl,
// async (projName, table, record, _field) => {
// await nocoLinkProcessing(projName, table, record, _field);
// },
// v
// );
// }
}
} catch (error) { } catch (error) {
logDetailed( logDetailed(
`There was an error while migrating data! Please make sure your API key (${syncDB.apiKey}) is correct.` `There was an error while migrating data! Please make sure your API key (${syncDB.apiKey}) is correct.`
@ -2412,6 +2432,7 @@ export interface AirtableSyncConfig {
baseId?: string; baseId?: string;
apiKey: string; apiKey: string;
shareId: string; shareId: string;
user: UserType;
options: { options: {
syncViews: boolean; syncViews: boolean;
syncData: boolean; syncData: boolean;

65
packages/nocodb/src/lib/services/sync/helpers/readAndProcessData.ts

@ -1,7 +1,8 @@
import { RelationTypes, UITypes } from 'nocodb-sdk'; import { RelationTypes, UITypes } from 'nocodb-sdk';
import { bulkDataService, tableService } from '../..';
import EntityMap from './EntityMap'; import EntityMap from './EntityMap';
import type { AirtableBase } from 'airtable/lib/airtable_base'; import type { AirtableBase } from 'airtable/lib/airtable_base';
import type { Api, TableType } from 'nocodb-sdk'; import type { TableType } from 'nocodb-sdk';
const BULK_DATA_BATCH_SIZE = 500; const BULK_DATA_BATCH_SIZE = 500;
const ASSOC_BULK_DATA_BATCH_SIZE = 1000; const ASSOC_BULK_DATA_BATCH_SIZE = 1000;
@ -70,7 +71,6 @@ export async function importData({
projectName, projectName,
table, table,
base, base,
api,
nocoBaseDataProcessing_v2, nocoBaseDataProcessing_v2,
sDB, sDB,
logDetailed = (_str) => {}, logDetailed = (_str) => {},
@ -82,7 +82,6 @@ export async function importData({
base: AirtableBase; base: AirtableBase;
logBasic: (string) => void; logBasic: (string) => void;
logDetailed: (string) => void; logDetailed: (string) => void;
api: Api<any>;
nocoBaseDataProcessing_v2; nocoBaseDataProcessing_v2;
sDB; sDB;
}): Promise<EntityMap> { }): Promise<EntityMap> {
@ -116,12 +115,14 @@ export async function importData({
if (tempData.length >= BULK_DATA_BATCH_SIZE) { if (tempData.length >= BULK_DATA_BATCH_SIZE) {
let insertArray = tempData.splice(0, tempData.length); let insertArray = tempData.splice(0, tempData.length);
await api.dbTableRow.bulkCreate(
'nc', await bulkDataService.bulkDataInsert({
projectName, projectName,
table.id, tableName: table.title,
insertArray body: insertArray,
); cookie: {},
});
logBasic( logBasic(
`:: Importing '${ `:: Importing '${
table.title table.title
@ -142,12 +143,13 @@ export async function importData({
readable.on('end', async () => { readable.on('end', async () => {
await Promise.all(promises); await Promise.all(promises);
if (tempData.length > 0) { if (tempData.length > 0) {
await api.dbTableRow.bulkCreate( await bulkDataService.bulkDataInsert({
'nc',
projectName, projectName,
table.id, tableName: table.title,
tempData body: tempData,
); cookie: {},
});
logBasic( logBasic(
`:: Importing '${ `:: Importing '${
table.title table.title
@ -174,7 +176,6 @@ export async function importLTARData({
table, table,
fields, fields,
base, base,
api,
projectName, projectName,
insertedAssocRef = {}, insertedAssocRef = {},
logDetailed = (_str) => {}, logDetailed = (_str) => {},
@ -182,6 +183,7 @@ export async function importLTARData({
records, records,
atNcAliasRef, atNcAliasRef,
ncLinkMappingTable, ncLinkMappingTable,
syncDB,
}: { }: {
projectName: string; projectName: string;
table: { title?: string; id?: string }; table: { title?: string; id?: string };
@ -189,7 +191,6 @@ export async function importLTARData({
base: AirtableBase; base: AirtableBase;
logDetailed: (string) => void; logDetailed: (string) => void;
logBasic: (string) => void; logBasic: (string) => void;
api: Api<any>;
insertedAssocRef: { [assocTableId: string]: boolean }; insertedAssocRef: { [assocTableId: string]: boolean };
records?: EntityMap; records?: EntityMap;
atNcAliasRef: { atNcAliasRef: {
@ -198,6 +199,7 @@ export async function importLTARData({
}; };
}; };
ncLinkMappingTable: Record<string, Record<string, any>>[]; ncLinkMappingTable: Record<string, Record<string, any>>[];
syncDB;
}) { }) {
const assocTableMetas: Array<{ const assocTableMetas: Array<{
modelMeta: { id?: string; title?: string }; modelMeta: { id?: string; title?: string };
@ -215,7 +217,10 @@ export async function importLTARData({
logBasic, logBasic,
})); }));
const modelMeta: any = await api.dbTable.read(table.id); const modelMeta: any = await tableService.getTableWithAccessibleViews({
tableId: table.id,
user: syncDB.user,
});
for (const colMeta of modelMeta.columns) { for (const colMeta of modelMeta.columns) {
// skip columns which are not LTAR and Many to many // skip columns which are not LTAR and Many to many
@ -235,9 +240,11 @@ export async function importLTARData({
// mark as inserted // mark as inserted
insertedAssocRef[colMeta.colOptions.fk_mm_model_id] = true; insertedAssocRef[colMeta.colOptions.fk_mm_model_id] = true;
const assocModelMeta: TableType = (await api.dbTable.read( const assocModelMeta: TableType =
colMeta.colOptions.fk_mm_model_id (await tableService.getTableWithAccessibleViews({
)) as any; tableId: colMeta.colOptions.fk_mm_model_id,
user: syncDB.user,
})) as any;
// extract associative table and columns meta // extract associative table and columns meta
assocTableMetas.push({ assocTableMetas.push({
@ -291,12 +298,12 @@ export async function importLTARData({
)}` )}`
); );
await api.dbTableRow.bulkCreate( await bulkDataService.bulkDataInsert({
'nc',
projectName, projectName,
assocMeta.modelMeta.id, tableName: assocMeta.modelMeta.title,
insertArray body: insertArray,
); cookie: {},
});
importedCount += insertArray.length; importedCount += insertArray.length;
insertArray = []; insertArray = [];
@ -319,12 +326,12 @@ export async function importLTARData({
)}` )}`
); );
await api.dbTableRow.bulkCreate( await bulkDataService.bulkDataInsert({
'nc',
projectName, projectName,
assocMeta.modelMeta.id, tableName: assocMeta.modelMeta.title,
assocTableData body: assocTableData,
); cookie: {},
});
importedCount += assocTableData.length; importedCount += assocTableData.length;
assocTableData = []; assocTableData = [];

Loading…
Cancel
Save