-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into leeti/add-clear-cta-to-trial-expired-message
* master: (24 commits) Discover worker starts to use API to write schema result (#21875) 🪟 🎉 Connector Builder Landing Page (#22122) Fix pnpm cache path (#22418) Add additional shorter setup guides (#22318) Source Amazon Ads: fix reports stream records primary keys (#21677) Connector acceptance test: Fix discovered catalog caching for different configs (#22301) 🪟🐛 Make modal scrollable (#21973) only compute diff if the schema discovery actually succeeded (#22377) Source Klaviyo: fix schema (#22071) 🪟 🔧 Switch to `pnpm` for package managing (#22053) Source Sentry: turn on default availability strategy (#22303) Source freshdesk: deduplicate table names (#22164) Update connector-acceptance-tests-reference.md (#22370) Update the default security groups for the EC2 runner (#22347) Trace refresh schema operations (#22326) Remove manual docker upgrades from workflows (#22344) Update CODEOWNERS for connector acceptance tests to connector ops (#22341) 🐛 source: airtable - handle singleSelect types (#22311) Source tiktok: chunk advertiser IDs (#22309) 🪟 🧪 E2E Tests for auto-detect schema changes (#20682) ...
- Loading branch information
Showing
2,002 changed files
with
21,423 additions
and
61,314 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
airbyte-commons-worker/src/main/java/io/airbyte/workers/helper/CatalogClientConverters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.workers.helper; | ||
|
||
import io.airbyte.commons.enums.Enums; | ||
import io.airbyte.commons.text.Names; | ||
import io.airbyte.protocol.models.AirbyteStream; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Utilities to convert Catalog protocol to Catalog API client. This class was similar to existing | ||
* logic in CatalogConverter.java; But code can't be shared because the protocol model is | ||
* essentially converted to two different api models. Thus, if we need to change logic on either | ||
* place we have to take care of the other one too. | ||
*/ | ||
public class CatalogClientConverters { | ||
|
||
/** | ||
* Converts a protocol AirbyteCatalog to an OpenAPI client versioned AirbyteCatalog. | ||
*/ | ||
public static io.airbyte.api.client.model.generated.AirbyteCatalog toAirbyteCatalogClientApi( | ||
final io.airbyte.protocol.models.AirbyteCatalog catalog) { | ||
return new io.airbyte.api.client.model.generated.AirbyteCatalog() | ||
.streams(catalog.getStreams() | ||
.stream() | ||
.map(stream -> toAirbyteStreamClientApi(stream)) | ||
.map(s -> new io.airbyte.api.client.model.generated.AirbyteStreamAndConfiguration() | ||
.stream(s) | ||
.config(generateDefaultConfiguration(s))) | ||
.collect(Collectors.toList())); | ||
} | ||
|
||
private static io.airbyte.api.client.model.generated.AirbyteStreamConfiguration generateDefaultConfiguration( | ||
final io.airbyte.api.client.model.generated.AirbyteStream stream) { | ||
final io.airbyte.api.client.model.generated.AirbyteStreamConfiguration result = | ||
new io.airbyte.api.client.model.generated.AirbyteStreamConfiguration() | ||
.aliasName(Names.toAlphanumericAndUnderscore(stream.getName())) | ||
.cursorField(stream.getDefaultCursorField()) | ||
.destinationSyncMode(io.airbyte.api.client.model.generated.DestinationSyncMode.APPEND) | ||
.primaryKey(stream.getSourceDefinedPrimaryKey()) | ||
.selected(true); | ||
if (stream.getSupportedSyncModes().size() > 0) { | ||
result.setSyncMode(Enums.convertTo(stream.getSupportedSyncModes().get(0), | ||
io.airbyte.api.client.model.generated.SyncMode.class)); | ||
} else { | ||
result.setSyncMode(io.airbyte.api.client.model.generated.SyncMode.INCREMENTAL); | ||
} | ||
return result; | ||
} | ||
|
||
private static io.airbyte.api.client.model.generated.AirbyteStream toAirbyteStreamClientApi( | ||
final AirbyteStream stream) { | ||
return new io.airbyte.api.client.model.generated.AirbyteStream() | ||
.name(stream.getName()) | ||
.jsonSchema(stream.getJsonSchema()) | ||
.supportedSyncModes(Enums.convertListTo(stream.getSupportedSyncModes(), | ||
io.airbyte.api.client.model.generated.SyncMode.class)) | ||
.sourceDefinedCursor(stream.getSourceDefinedCursor()) | ||
.defaultCursorField(stream.getDefaultCursorField()) | ||
.sourceDefinedPrimaryKey(stream.getSourceDefinedPrimaryKey()) | ||
.namespace(stream.getNamespace()); | ||
} | ||
|
||
} |
Oops, something went wrong.