Fixing a typescript issue in server.

This commit is contained in:
Michael Drury 2022-02-01 20:29:12 +00:00
parent 7852960a03
commit 4b23a78bc9
6 changed files with 17 additions and 796 deletions

View File

@ -222,6 +222,7 @@ exports.getAllDbs = async () => {
/** /**
* Lots of different points in the system need to find the full list of apps, this will * Lots of different points in the system need to find the full list of apps, this will
* enumerate the entire CouchDB cluster and get the list of databases (every app). * enumerate the entire CouchDB cluster and get the list of databases (every app).
*
* @return {Promise<object[]>} returns the app information document stored in each app database. * @return {Promise<object[]>} returns the app information document stored in each app database.
*/ */
exports.getAllApps = async ({ dev, all, idsOnly } = {}) => { exports.getAllApps = async ({ dev, all, idsOnly } = {}) => {

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
// @ts-ignore
import { getGlobalDB, getTenantId } from "@budibase/backend-core/tenancy" import { getGlobalDB, getTenantId } from "@budibase/backend-core/tenancy"
// @ts-ignore
import { getAllApps } from "@budibase/backend-core/db" import { getAllApps } from "@budibase/backend-core/db"
import { getUsageQuotaDoc } from "../../../utilities/usageQuota" import { getUsageQuotaDoc } from "../../../utilities/usageQuota"
export const run = async () => { export const run = async () => {
const db = getGlobalDB() const db = getGlobalDB()
// get app count // get app count
// @ts-ignore
const devApps = await getAllApps({ dev: true }) const devApps = await getAllApps({ dev: true })
const appCount = devApps ? devApps.length : 0 const appCount = devApps ? devApps.length : 0

View File

@ -1,6 +1,4 @@
// @ts-ignore
import { getGlobalDB, getTenantId } from "@budibase/backend-core/tenancy" import { getGlobalDB, getTenantId } from "@budibase/backend-core/tenancy"
// @ts-ignore
import { getAllApps } from "@budibase/backend-core/db" import { getAllApps } from "@budibase/backend-core/db"
import { getUsageQuotaDoc } from "../../../utilities/usageQuota" import { getUsageQuotaDoc } from "../../../utilities/usageQuota"
import { getUniqueRows } from "../../../utilities/usageQuota/rows" import { getUniqueRows } from "../../../utilities/usageQuota/rows"
@ -8,7 +6,9 @@ import { getUniqueRows } from "../../../utilities/usageQuota/rows"
export const run = async () => { export const run = async () => {
const db = getGlobalDB() const db = getGlobalDB()
// get all rows in all apps // get all rows in all apps
// @ts-ignore
const allApps = await getAllApps({ all: true }) const allApps = await getAllApps({ all: true })
// @ts-ignore
const appIds = allApps ? allApps.map((app: { appId: any }) => app.appId) : [] const appIds = allApps ? allApps.map((app: { appId: any }) => app.appId) : []
const rows = await getUniqueRows(appIds) const rows = await getUniqueRows(appIds)
const rowCount = rows ? rows.length : 0 const rowCount = rows ? rows.length : 0

3
packages/server/src/module.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare module "@budibase/backend-core"
declare module "@budibase/backend-core/tenancy"
declare module "@budibase/backend-core/db"

View File

@ -12,7 +12,8 @@
"incremental": true "incremental": true
}, },
"include": [ "include": [
"./src/**/*" "./src/**/*",
"./src/module.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",