From 6a1fdc576a9c96bc73ca9f9b589c80d7b6a9cb4c Mon Sep 17 00:00:00 2001 From: Edmundo Ruiz Ghanem Date: Wed, 22 Jun 2022 11:10:54 -0400 Subject: [PATCH] Generate api for changes in #13370 and make code compatible --- .../src/components/EntityTable/types.ts | 2 +- airbyte-webapp/src/config/utils.ts | 2 +- .../src/core/request/AirbyteClient.ts | 34 ++++++++++--------- .../src/hooks/services/useConnectionHook.tsx | 2 +- .../Connection/CatalogTree/CatalogSection.tsx | 2 +- .../ConnectionForm/ConnectionForm.test.tsx | 2 +- .../calculateInitialCatalog.test.ts | 2 +- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/airbyte-webapp/src/components/EntityTable/types.ts b/airbyte-webapp/src/components/EntityTable/types.ts index 6ebbf3053c19..00ad714dd31c 100644 --- a/airbyte-webapp/src/components/EntityTable/types.ts +++ b/airbyte-webapp/src/components/EntityTable/types.ts @@ -24,7 +24,7 @@ interface ITableDataItem { isSyncing?: boolean; status?: string; lastSync?: number | null; - schedule: ConnectionSchedule | undefined; + schedule?: ConnectionSchedule; lastSyncStatus: string | null; connectorIcon?: string; entityIcon?: string; diff --git a/airbyte-webapp/src/config/utils.ts b/airbyte-webapp/src/config/utils.ts index d15f084bb1be..6699f864bd23 100644 --- a/airbyte-webapp/src/config/utils.ts +++ b/airbyte-webapp/src/config/utils.ts @@ -3,4 +3,4 @@ import { ConnectionSchedule } from "core/request/AirbyteClient"; import { equal } from "utils/objects"; export const getFrequencyConfig = (schedule?: ConnectionSchedule) => - FrequencyConfig.find((item) => (!schedule && !item) || equal(item.config, schedule)); + FrequencyConfig.find((item) => (!schedule && !item.config) || equal(item.config, schedule)); diff --git a/airbyte-webapp/src/core/request/AirbyteClient.ts b/airbyte-webapp/src/core/request/AirbyteClient.ts index 46717adf6721..043ae0f2fbe8 100644 --- a/airbyte-webapp/src/core/request/AirbyteClient.ts +++ b/airbyte-webapp/src/core/request/AirbyteClient.ts @@ -374,12 +374,12 @@ export interface DbMigrationReadList { /** * optional resource requirements to run workers (blank for unbounded allocations) */ -export type ResourceRequirements = { +export interface ResourceRequirements { cpu_request?: string; cpu_limit?: string; memory_request?: string; memory_limit?: string; -} | null; +} /** * enum that describes the different types of jobs that the platform runs. @@ -527,18 +527,18 @@ export interface AttemptFailureReason { timestamp: number; } -export type AttemptFailureSummary = { +export interface AttemptFailureSummary { failures: AttemptFailureReason[]; /** True if the number of committed records for this attempt was greater than 0. False if 0 records were committed. If not set, the number of committed records is unknown. */ partialSuccess?: boolean; -} | null; +} -export type AttemptStats = { +export interface AttemptStats { recordsEmitted?: number; bytesEmitted?: number; stateMessagesEmitted?: number; recordsCommitted?: number; -} | null; +} export interface AttemptStreamStats { streamName: string; @@ -658,13 +658,13 @@ export interface AirbyteStream { jsonSchema?: StreamJsonSchema; supportedSyncModes?: SyncMode[]; /** If the source defines the cursor field, then any other cursor field inputs will be ignored. If it does not, either the user_provided one is used, or the default one is used as a backup. */ - sourceDefinedCursor?: boolean | null; + sourceDefinedCursor?: boolean; /** Path to the field that will be used to determine if a record is new or modified since the last sync. If not provided by the source, the end user will have to specify the comparable themselves. */ defaultCursorField?: string[]; /** If the source defines the primary key, paths to the fields that will be used as a primary key. If not provided by the source, the end user will have to specify the primary key themselves. */ sourceDefinedPrimaryKey?: string[][]; /** Optional Source-defined namespace. Airbyte streams from the same sources should have the same namespace. Currently only used by JDBC destinations to determine what schema to write to. */ - namespace?: string | null; + namespace?: string; } /** @@ -710,12 +710,12 @@ export interface CheckOperationRead { message?: string; } -export type OperatorDbt = { +export interface OperatorDbt { gitRepoUrl: string; gitRepoBranch?: string; dockerImage?: string; dbtArguments?: string; -} | null; +} export type OperatorNormalizationOption = typeof OperatorNormalizationOption[keyof typeof OperatorNormalizationOption]; @@ -797,10 +797,10 @@ export const ConnectionScheduleTimeUnit = { /** * if null, then no schedule is set. */ -export type ConnectionSchedule = { +export interface ConnectionSchedule { units: number; timeUnit: ConnectionScheduleTimeUnit; -} | null; +} /** * Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. @@ -871,7 +871,7 @@ export interface ConnectionCreate { schedule?: ConnectionSchedule; status: ConnectionStatus; resourceRequirements?: ResourceRequirements; - sourceCatalogId?: string | null; + sourceCatalogId?: string; } export interface DbMigrationRequestBody { @@ -910,7 +910,7 @@ export interface ConnectionUpdate { schedule?: ConnectionSchedule; status: ConnectionStatus; resourceRequirements?: ResourceRequirements; - sourceCatalogId?: string | null; + sourceCatalogId?: string; } export interface WebBackendConnectionRequestBody { @@ -1010,7 +1010,7 @@ export interface ConnectionRead { schedule?: ConnectionSchedule; status: ConnectionStatus; resourceRequirements?: ResourceRequirements; - sourceCatalogId?: string | null; + sourceCatalogId?: string; } export interface DestinationIdRequestBody { @@ -1342,7 +1342,9 @@ export const NotificationType = { customerio: "customerio", } as const; -export type CustomerioNotificationConfiguration = { [key: string]: any }; +export interface CustomerioNotificationConfiguration { + [key: string]: any; +} export interface SlackNotificationConfiguration { webhook: string; diff --git a/airbyte-webapp/src/hooks/services/useConnectionHook.tsx b/airbyte-webapp/src/hooks/services/useConnectionHook.tsx index 8dc72cfe07ac..d26f656bd49e 100644 --- a/airbyte-webapp/src/hooks/services/useConnectionHook.tsx +++ b/airbyte-webapp/src/hooks/services/useConnectionHook.tsx @@ -33,7 +33,7 @@ export const connectionsKeys = { export interface ValuesProps { name?: string; - schedule: ConnectionSchedule | null; + schedule?: ConnectionSchedule; prefix: string; syncCatalog: SyncSchema; namespaceDefinition: NamespaceDefinitionType; diff --git a/airbyte-webapp/src/views/Connection/CatalogTree/CatalogSection.tsx b/airbyte-webapp/src/views/Connection/CatalogTree/CatalogSection.tsx index 0c0e95724b20..80f87e85eec1 100644 --- a/airbyte-webapp/src/views/Connection/CatalogTree/CatalogSection.tsx +++ b/airbyte-webapp/src/views/Connection/CatalogTree/CatalogSection.tsx @@ -109,7 +109,7 @@ const CatalogSectionInner: React.FC = ({ const destNamespace = getDestinationNamespace({ namespaceDefinition, namespaceFormat, - sourceNamespace: stream?.namespace ?? undefined, + sourceNamespace: stream?.namespace, }); const fields = useMemo(() => { diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.test.tsx b/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.test.tsx index bf2961bcbac2..2b6ac079a233 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.test.tsx +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.test.tsx @@ -38,7 +38,7 @@ const mockConnection: WebBackendConnectionRead = { sourceId: "test-source", destinationId: "test-destination", status: ConnectionStatus.active, - schedule: null, + schedule: undefined, syncCatalog: { streams: [], }, diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/calculateInitialCatalog.test.ts b/airbyte-webapp/src/views/Connection/ConnectionForm/calculateInitialCatalog.test.ts index 8a8bdd578332..604749ec5c6e 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/calculateInitialCatalog.test.ts +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/calculateInitialCatalog.test.ts @@ -6,7 +6,7 @@ import calculateInitialCatalog from "./calculateInitialCatalog"; const mockSyncSchemaStream: SyncSchemaStream = { id: "1", stream: { - sourceDefinedCursor: null, + sourceDefinedCursor: undefined, defaultCursorField: [], sourceDefinedPrimaryKey: [], jsonSchema: {},