Merge branch 'develop' into feat/pnpm

This commit is contained in:
Wing-Kam Wong
2023-09-06 20:52:59 +08:00
189 changed files with 2748 additions and 3913 deletions

View File

@@ -1,5 +1,6 @@
import { Api, WorkspaceListType } from 'nocodb-sdk';
import { Api } from 'nocodb-sdk';
import { NcContext } from './index';
import { isEE } from './db';
let api: Api<any>;
async function createXcdb(context: NcContext) {
@@ -10,7 +11,14 @@ async function createXcdb(context: NcContext) {
},
});
const projectList = await api.project.list();
let projectList;
if (isEE() && context.workspace?.id) {
projectList = await api['workspaceProject'].list(context.workspace.id);
} else {
projectList = await api.project.list();
}
for (const project of projectList.list) {
// delete project with title 'xcdb' if it exists
if (project.title === 'xcdb') {
@@ -20,21 +28,32 @@ async function createXcdb(context: NcContext) {
const project = await api.project.create({
title: 'xcdb',
fk_workspace_id: context?.workspace?.id,
type: 'database',
...(isEE()
? {
fk_workspace_id: context?.workspace?.id,
}
: {}),
});
return project;
}
async function deleteXcdb(token?: string) {
async function deleteXcdb(context: NcContext) {
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': token,
'xc-auth': context.token,
},
});
const projectList = await api.project.list();
let projectList;
if (isEE() && context.workspace?.id) {
projectList = await api['workspaceProject'].list(context.workspace.id);
} else {
projectList = await api.project.list();
}
for (const project of projectList.list) {
// delete project with title 'xcdb' if it exists
if (project.title === 'xcdb') {