From f48fcfd0c862135178aa82e3e70d9ec554e8a9e8 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 11 Aug 2022 12:24:36 +0100 Subject: [PATCH] Fixes based on re-trying everything with the new type structures (some empty structures being filled out affected things). --- packages/server/src/definitions/common.ts | 1 + .../server/src/migrations/functions/backfill/app/queries.ts | 5 +++-- packages/types/src/documents/app/datasource.ts | 6 +++--- packages/types/src/sdk/datasources.ts | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/server/src/definitions/common.ts b/packages/server/src/definitions/common.ts index cdbe82344f..dd7286213b 100644 --- a/packages/server/src/definitions/common.ts +++ b/packages/server/src/definitions/common.ts @@ -2,6 +2,7 @@ export { Query, Datasource } from "./datasource" export { FieldSchema, TableSchema, Table, Document, Row } from "@budibase/types" export interface Application extends Document { + _id: string appId?: string } diff --git a/packages/server/src/migrations/functions/backfill/app/queries.ts b/packages/server/src/migrations/functions/backfill/app/queries.ts index b2ea31c19c..c47a4061c7 100644 --- a/packages/server/src/migrations/functions/backfill/app/queries.ts +++ b/packages/server/src/migrations/functions/backfill/app/queries.ts @@ -1,6 +1,6 @@ import { events } from "@budibase/backend-core" import { getQueryParams } from "../../../../db/utils" -import { Query, Datasource } from "@budibase/types" +import { Query, Datasource, SourceNames } from "@budibase/types" const getQueries = async (appDb: any): Promise => { const response = await appDb.allDocs( @@ -31,8 +31,9 @@ export const backfill = async (appDb: any, timestamp: string | number) => { // and the query has not if (e.status === 404) { datasource = { + type: "unknown", _id: query.datasourceId, - source: "unknown", + source: SourceNames.UNKNOWN, } } else { throw e diff --git a/packages/types/src/documents/app/datasource.ts b/packages/types/src/documents/app/datasource.ts index 68f84e4b98..10bdd24afa 100644 --- a/packages/types/src/documents/app/datasource.ts +++ b/packages/types/src/documents/app/datasource.ts @@ -4,13 +4,13 @@ import { Table } from "./table" export interface Datasource extends Document { type: string - name: string + name?: string source: SourceNames // the config is defined by the schema - config: { + config?: { [key: string]: string | number | boolean } - plus: boolean + plus?: boolean entities?: { [key: string]: Table } diff --git a/packages/types/src/sdk/datasources.ts b/packages/types/src/sdk/datasources.ts index 6e2f158c09..e6b5582a6f 100644 --- a/packages/types/src/sdk/datasources.ts +++ b/packages/types/src/sdk/datasources.ts @@ -51,6 +51,7 @@ export enum SourceNames { FIRESTORE = "FIRESTORE", REDIS = "REDIS", SNOWFLAKE = "SNOWFLAKE", + UNKNOWN = "unknown", } export enum IncludeRelationships {