diff --git a/schemaregistry/README.md b/schemaregistry/README.md index 33e8945e..7b840662 100644 --- a/schemaregistry/README.md +++ b/schemaregistry/README.md @@ -12,7 +12,7 @@ and [Java](https://github.com/confluentinc/schema-registry) clients. npm install @confluentinc/schemaregistry ``` -# Getting Started +## Getting Started Below is a simple example of using Avro serialization with the Schema Registry client and the KafkaJS client. ```javascript const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS; @@ -109,7 +109,7 @@ run().catch (async e => { ## Features and Limitations - Full Avro and JSON Schema support -- Protobuf support requires (upcoming) release: CP 7.4.8, 7.5.7, 7.6.4, 7.7.2, 7.8.0 +- Protobuf support requires Schema Registry in (upcoming) release: CP 7.4.8, 7.5.7, 7.6.4, 7.7.2, 7.8.0 - Support for CSFLE (Client-Side Field Level Encryption) - Support for schema migration rules for Avro and JSON Schema - Data quality rules are not yet supported diff --git a/schemaregistry/index.ts b/schemaregistry/index.ts index 9762ac24..a3bf6961 100644 --- a/schemaregistry/index.ts +++ b/schemaregistry/index.ts @@ -2,6 +2,7 @@ export * from './confluent/types/decimal_pb' export * from './confluent/meta_pb' export * from './rules/encryption/awskms/aws-driver' export * from './rules/encryption/azurekms/azure-driver' +export * from './rules/encryption/dekregistry/dekregistry-client' export * from './rules/encryption/gcpkms/gcp-driver' export * from './rules/encryption/hcvault/hcvault-driver' export * from './rules/encryption/localkms/local-driver' diff --git a/schemaregistry/rules/encryption/dekregistry/dekregistry-client.ts b/schemaregistry/rules/encryption/dekregistry/dekregistry-client.ts index dff910fe..16fea683 100644 --- a/schemaregistry/rules/encryption/dekregistry/dekregistry-client.ts +++ b/schemaregistry/rules/encryption/dekregistry/dekregistry-client.ts @@ -46,7 +46,7 @@ interface Dek { deleted?: boolean; } -interface Client { +interface DekClient { registerKek(name: string, kmsType: string, kmsKeyId: string, shared: boolean, kmsProps?: { [key: string]: string }, doc?: string): Promise; getKek(name: string, deleted: boolean): Promise; @@ -56,7 +56,7 @@ interface Client { close(): Promise; } -class DekRegistryClient implements Client { +class DekRegistryClient implements DekClient { private restService: RestService; private kekCache: LRUCache; private dekCache: LRUCache; @@ -78,7 +78,7 @@ class DekRegistryClient implements Client { this.dekMutex = new Mutex(); } - static newClient(config: ClientConfig): Client { + static newClient(config: ClientConfig): DekClient { const url = config.baseURLs[0]; if (url.startsWith("mock://")) { return new MockDekRegistryClient() @@ -242,5 +242,5 @@ class DekRegistryClient implements Client { } } -export { DekRegistryClient, Client, Kek, Dek }; +export { DekRegistryClient, DekClient, Kek, Dek }; diff --git a/schemaregistry/rules/encryption/dekregistry/mock-dekregistry-client.ts b/schemaregistry/rules/encryption/dekregistry/mock-dekregistry-client.ts index 46f20219..beef28e0 100644 --- a/schemaregistry/rules/encryption/dekregistry/mock-dekregistry-client.ts +++ b/schemaregistry/rules/encryption/dekregistry/mock-dekregistry-client.ts @@ -1,9 +1,9 @@ -import { Client, Dek, Kek } from "./dekregistry-client"; +import { DekClient, Dek, Kek } from "./dekregistry-client"; import { MOCK_TS } from "./constants"; import stringify from "json-stringify-deterministic"; import {RestError} from "../../../rest-error"; -class MockDekRegistryClient implements Client { +class MockDekRegistryClient implements DekClient { private kekCache: Map; private dekCache: Map; diff --git a/schemaregistry/rules/encryption/encrypt-executor.ts b/schemaregistry/rules/encryption/encrypt-executor.ts index ffbd018c..ff70df41 100644 --- a/schemaregistry/rules/encryption/encrypt-executor.ts +++ b/schemaregistry/rules/encryption/encrypt-executor.ts @@ -8,7 +8,7 @@ import { RuleError, } from "../../serde/serde"; import {RuleMode,} from "../../schemaregistry-client"; -import {Client, Dek, DekRegistryClient, Kek} from "./dekregistry/dekregistry-client"; +import {DekClient, Dek, DekRegistryClient, Kek} from "./dekregistry/dekregistry-client"; import {RuleRegistry} from "../../serde/rule-registry"; import {ClientConfig} from "../../rest-service"; import {RestError} from "../../rest-error"; @@ -61,7 +61,7 @@ export class Clock { } export class FieldEncryptionExecutor extends FieldRuleExecutor { - client: Client | null = null + client: DekClient | null = null clock: Clock /** diff --git a/schemaregistry/serde/rule-registry.ts b/schemaregistry/serde/rule-registry.ts index 464962cd..2c6e9278 100644 --- a/schemaregistry/serde/rule-registry.ts +++ b/schemaregistry/serde/rule-registry.ts @@ -1,7 +1,7 @@ import {RuleAction, RuleExecutor} from "./serde"; /** - * + * RuleRegistry is used to register and fetch rule executors and actions. */ export class RuleRegistry { private ruleExecutors: Map = new Map()