Skip to content

Commit

Permalink
Refactor: shadow name
Browse files Browse the repository at this point in the history
  • Loading branch information
sjwiesman committed Mar 23, 2023
1 parent c7e0d11 commit 7a84a7a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/kafka/kafkaConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export default async function kafkaConfig() {
connectionTimeout: 10_000,
authenticationTimeout: 10_000
};
const kafka = new Kafka(conf);
return kafka;
return new Kafka(conf);
}

if (sslCaLocation && sslCertLocation && sslKeyLocation) {
Expand Down
8 changes: 4 additions & 4 deletions src/schemas/parseAvroSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export async function parseAvroSchema(schemaFile: any) {
});

if (global.debug) {
const parsed = avro.parse(schemaFile);
console.log(parsed);
const avroSchema = avro.parse(schemaFile);
console.log(avroSchema);
}

let schema = [];
Expand All @@ -23,9 +23,9 @@ export async function parseAvroSchema(schemaFile: any) {
}


async function convertAvroSchemaToJson(schema: any): Promise<any> {
async function convertAvroSchemaToJson(schemas: any): Promise<any> {
const jsonSchema = [];
schema.forEach(table => {
schemas.forEach(table => {
const schema = {
_meta: {
topic: table.name
Expand Down
6 changes: 3 additions & 3 deletions src/schemas/parseSqlSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export async function parseSqlSchema(schemaFile: any) {
let tables = [];
// @ts-ignore
parsedSchema.ast.forEach((table: { table: ({ [s: string]: unknown; } | ArrayLike<unknown>)[]; create_definitions: any[]; }) => {
const schema = {
const recordSchema = {
tableName: Object.values(table.table[0])
.filter(x => x)
.join('.'),
columns: []
};
table.create_definitions.forEach(column => {
schema.columns.push(column);
recordSchema.columns.push(column);
});
// @ts-ignore
tables.push(schema);
tables.push(recordSchema);
});

// Convert the schema to JSON
Expand Down

0 comments on commit 7a84a7a

Please sign in to comment.