Skip to content

Commit

Permalink
Update Schema registry
Browse files Browse the repository at this point in the history
Should fix #74
  • Loading branch information
ivank committed Apr 6, 2021
1 parent e601f48 commit 536892c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/avro-kafkajs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ovotech/avro-kafkajs",
"version": "0.6.2",
"version": "0.6.3",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"description": "A wrapper around Kafkajs to transparently use Schema Registry for producing and consuming messages with avro schemas.",
Expand Down Expand Up @@ -44,7 +44,7 @@
"kafkajs": "^1.15.0"
},
"dependencies": {
"@ovotech/schema-registry-api": "^1.0.7",
"@ovotech/schema-registry-api": "^1.1.1",
"avsc": "^5.5.6",
"long": "^4.0.0"
}
Expand Down
12 changes: 12 additions & 0 deletions packages/avro-kafkajs/src/SchemaRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
idToSchema,
schemaToId,
getSubjects,
getSubjectVersion,
getSubjectVersionSchema,
getSubjectVersions,
} from '@ovotech/schema-registry-api';
Expand All @@ -13,6 +14,13 @@ export interface AvroBuffer {
buffer: Buffer;
}

export interface SchemaVersion {
subject: string;
id: number;
version: number;
schema: string;
}

export const deconstructMessage = (buffer: Buffer): AvroBuffer => {
return { id: buffer.readInt32BE(1), buffer: buffer.slice(5) };
};
Expand Down Expand Up @@ -93,6 +101,10 @@ export class SchemaRegistry {
return await getSubjectVersions(this.uri, subject);
}

public async getSubjectVersion(subject: string, version: number): Promise<SchemaVersion> {
return await getSubjectVersion(this.uri, subject, version);
}

public async getSubjectVersionSchema(subject: string, version: number): Promise<Schema> {
return await getSubjectVersionSchema(this.uri, subject, version);
}
Expand Down
1 change: 1 addition & 0 deletions packages/avro-kafkajs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export {
EncodeCache,
DecodeCache,
SchemaRegistryConfig,
SchemaVersion,
} from './SchemaRegistry';
export { AvroKafka } from './AvroKafka';
export { AvroProducer } from './AvroProducer';
Expand Down
2 changes: 1 addition & 1 deletion packages/castle-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"preset": "../../jest.json"
},
"dependencies": {
"@ovotech/avro-kafkajs": "^0.6.2",
"@ovotech/avro-kafkajs": "^0.6.3",
"ansi-regex": "^5.0.0",
"chalk": "^4.1.0",
"commander": "^7.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/castle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ovotech/castle",
"version": "0.6.4",
"version": "0.6.5",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"description": "A kafka and avro based event listener",
Expand Down Expand Up @@ -41,7 +41,7 @@
"preset": "../../jest.json"
},
"dependencies": {
"@ovotech/avro-kafkajs": "^0.6.2",
"@ovotech/avro-kafkajs": "^0.6.3",
"kafkajs": "^1.15.0",
"lodash.chunk": "^4.2.0"
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1516,10 +1516,10 @@
mersenne-twister "^1.1.0"
uuid "^7.0.2"

"@ovotech/schema-registry-api@^1.0.7":
version "1.0.7"
resolved "https://registry.yarnpkg.com/@ovotech/schema-registry-api/-/schema-registry-api-1.0.7.tgz#b6f6e0d0b7aa103e407390a82ec8f5ebc46da156"
integrity sha512-BEXvIZ6d7lujJrLDyJ7E94F2vgnLZzTLbQbzJlu6HPwWvA163HX2nzFd/TMPgxYQKKgPvENqO+yemsrbaIe5ZA==
"@ovotech/schema-registry-api@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@ovotech/schema-registry-api/-/schema-registry-api-1.1.1.tgz#8d54391167aed32ff6f777a6a4232e2e288148ef"
integrity sha512-NeLYpy7qRSvrtuZpySnMjbJJW4I55Z06rJWKeDDdqsK4CjG5Rb6XcOQjKnkA7oFTC91LCv1C+jcbt/y846oyGw==
dependencies:
node-fetch "^2.6.0"

Expand Down

0 comments on commit 536892c

Please sign in to comment.