@biorate/schema-registry 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.js → cjs/index.js} +0 -1
- package/dist/cjs/package.json +3 -0
- package/dist/{src → cjs/src}/api.js +8 -5
- package/dist/{src → cjs/src}/errors.js +0 -1
- package/dist/{src → cjs/src}/index.js +0 -1
- package/dist/{src → cjs/src}/interfaces.js +0 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/src/api.js +201 -0
- package/dist/esm/src/errors.js +13 -0
- package/dist/esm/src/index.js +33 -0
- package/dist/esm/src/interfaces.js +1 -0
- package/dist/types/src/api.d.ts +61 -0
- package/dist/types/src/errors.d.ts +7 -0
- package/dist/types/src/index.d.ts +11 -0
- package/dist/types/src/interfaces.d.ts +9 -0
- package/package.json +35 -10
- package/.nyc_output/2ab817d0-505c-454e-bed2-1750a6e607a4.json +0 -1
- package/.nyc_output/97ca74bd-bff5-4f5e-b84c-68ea3601b0d6.json +0 -1
- package/.nyc_output/c03eee38-4fa7-4d46-973b-4d91dcc18bca.json +0 -1
- package/.nyc_output/processinfo/2ab817d0-505c-454e-bed2-1750a6e607a4.json +0 -1
- package/.nyc_output/processinfo/97ca74bd-bff5-4f5e-b84c-68ea3601b0d6.json +0 -1
- package/.nyc_output/processinfo/c03eee38-4fa7-4d46-973b-4d91dcc18bca.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/CHANGELOG.md +0 -1026
- package/allure-results/090d63d4-5302-44e6-a431-1f0bb56b01a4-result.json +0 -1
- package/allure-results/13f0ae5c-3043-4bdb-b6b1-327953028f5b-result.json +0 -1
- package/allure-results/1ac1fd37-8bf9-42f0-a808-976f1b58a5e1-container.json +0 -1
- package/allure-results/41a93db0-4085-4b31-8c34-5016fe756a73-result.json +0 -1
- package/allure-results/5059215a-e888-471e-b61d-2231e86df801-result.json +0 -1
- package/allure-results/5afc98f7-ce6c-4d4a-b23c-94fa74a96e14-result.json +0 -1
- package/allure-results/5f57981e-3ffa-4b13-8aab-c93c93d494a1-result.json +0 -1
- package/allure-results/8298dd4f-c79c-44eb-b6a9-ee86fe498e22-result.json +0 -1
- package/allure-results/aee745b7-2ca7-4d13-b780-f39c3c647e31-result.json +0 -1
- package/allure-results/b3c2840e-8a5c-492c-9704-e2c82e0311b5-result.json +0 -1
- package/allure-results/c591d6cd-6548-4899-827d-cb9575581d95-result.json +0 -1
- package/allure-results/d3a22bb1-3c24-4c25-b226-3c4b3c5e4bc1-result.json +0 -1
- package/allure-results/e015e709-764f-42c2-96a3-26b31fe144d3-container.json +0 -1
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -120
- package/coverage/coverage-final.json +0 -7
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -146
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/src/api.ts.html +0 -802
- package/coverage/src/errors.ts.html +0 -130
- package/coverage/src/index.html +0 -161
- package/coverage/src/index.ts.html +0 -379
- package/coverage/src/interfaces.ts.html +0 -154
- package/coverage/tests/__mocks__/index.html +0 -116
- package/coverage/tests/__mocks__/index.ts.html +0 -145
- package/coverage/tests/index.html +0 -116
- package/coverage/tests/test.avsc.json.html +0 -142
- package/dist/index.js.map +0 -1
- package/dist/src/api.js.map +0 -1
- package/dist/src/errors.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/interfaces.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/index.d.ts +0 -12
- package/src/api.ts +0 -239
- package/src/errors.ts +0 -15
- package/src/index.ts +0 -98
- package/src/interfaces.ts +0 -23
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -9
- /package/{index.ts → dist/types/index.d.ts} +0 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.create = void 0;
|
|
4
7
|
const axios_prometheus_1 = require("@biorate/axios-prometheus");
|
|
5
|
-
const avsc_1 = require("avsc");
|
|
8
|
+
const avsc_1 = __importDefault(require("avsc"));
|
|
6
9
|
const errors_1 = require("./errors");
|
|
10
|
+
const AvroType = avsc_1.default.Type;
|
|
7
11
|
const create = (config) => {
|
|
8
12
|
const cache = new Map();
|
|
9
13
|
class SchemaRegistryApi extends axios_prometheus_1.AxiosPrometheus {
|
|
@@ -159,7 +163,7 @@ const create = (config) => {
|
|
|
159
163
|
const errors = [];
|
|
160
164
|
const response = await GetSubjectsByVersion.fetch({ subject, version });
|
|
161
165
|
const header = Buffer.alloc(5);
|
|
162
|
-
const schema =
|
|
166
|
+
const schema = AvroType.forSchema(JSON.parse(response.data.schema));
|
|
163
167
|
schema.isValid(data, {
|
|
164
168
|
errorHook: (path, value) => {
|
|
165
169
|
errors.push(`${path.join('.')}: ${value} (${typeof value})`);
|
|
@@ -175,10 +179,10 @@ const create = (config) => {
|
|
|
175
179
|
let data = cache.get(id);
|
|
176
180
|
if (!data) {
|
|
177
181
|
const response = await GetSchemasById.fetch(id);
|
|
178
|
-
data =
|
|
182
|
+
data = AvroType.forSchema(JSON.parse(response.data.schema));
|
|
179
183
|
cache.set(id, data);
|
|
180
184
|
}
|
|
181
|
-
const schema =
|
|
185
|
+
const schema = AvroType.forSchema(data);
|
|
182
186
|
return schema.fromBuffer(buffer.slice(5));
|
|
183
187
|
}
|
|
184
188
|
function toStringData(data) {
|
|
@@ -202,4 +206,3 @@ const create = (config) => {
|
|
|
202
206
|
};
|
|
203
207
|
};
|
|
204
208
|
exports.create = create;
|
|
205
|
-
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/index.js';
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { AxiosPrometheus } from '@biorate/axios-prometheus';
|
|
2
|
+
import avsc from 'avsc';
|
|
3
|
+
import { SchemaRegistryAvroSchemaParseError } from './errors.js';
|
|
4
|
+
const AvroType = avsc.Type;
|
|
5
|
+
export const create = (config) => {
|
|
6
|
+
const cache = new Map();
|
|
7
|
+
class SchemaRegistryApi extends AxiosPrometheus {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.baseURL = config.baseURL;
|
|
11
|
+
this.headers = config.headers;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class Ping extends SchemaRegistryApi {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.url = '/';
|
|
18
|
+
this.method = 'get';
|
|
19
|
+
}
|
|
20
|
+
static fetch() {
|
|
21
|
+
return this._fetch({});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class GetSchemasById extends SchemaRegistryApi {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.url = '/schemas/ids/:id';
|
|
28
|
+
this.method = 'get';
|
|
29
|
+
}
|
|
30
|
+
static fetch(id) {
|
|
31
|
+
return this._fetch({ path: { id } });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
class GetSchemasTypes extends SchemaRegistryApi {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.url = '/schemas/types';
|
|
38
|
+
this.method = 'get';
|
|
39
|
+
}
|
|
40
|
+
static fetch() {
|
|
41
|
+
return this._fetch({});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
class GetSchemasVersionsById extends SchemaRegistryApi {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.url = '/schemas/ids/:id/versions';
|
|
48
|
+
this.method = 'get';
|
|
49
|
+
}
|
|
50
|
+
static fetch(id) {
|
|
51
|
+
return this._fetch({ path: { id } });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class GetSubjects extends SchemaRegistryApi {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
|
+
this.url = '/subjects';
|
|
58
|
+
this.method = 'get';
|
|
59
|
+
}
|
|
60
|
+
static fetch() {
|
|
61
|
+
return this._fetch({});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
class GetSubjectsVersions extends SchemaRegistryApi {
|
|
65
|
+
constructor() {
|
|
66
|
+
super(...arguments);
|
|
67
|
+
this.url = '/subjects/:subject/versions';
|
|
68
|
+
this.method = 'get';
|
|
69
|
+
}
|
|
70
|
+
static fetch(subject) {
|
|
71
|
+
return this._fetch({ path: { subject } });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class DeleteSubjects extends SchemaRegistryApi {
|
|
75
|
+
constructor() {
|
|
76
|
+
super(...arguments);
|
|
77
|
+
this.url = '/subjects/:subject';
|
|
78
|
+
this.method = 'delete';
|
|
79
|
+
}
|
|
80
|
+
static fetch(data) {
|
|
81
|
+
return this._fetch({
|
|
82
|
+
path: { subject: data.subject },
|
|
83
|
+
params: { permanent: !!data.permanent },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
class GetSubjectsByVersion extends SchemaRegistryApi {
|
|
88
|
+
constructor() {
|
|
89
|
+
super(...arguments);
|
|
90
|
+
this.url = '/subjects/:subject/versions/:version';
|
|
91
|
+
this.method = 'get';
|
|
92
|
+
}
|
|
93
|
+
static fetch(data) {
|
|
94
|
+
return this._fetch({ path: data });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
class GetSchemaBySubjectsAndVersion extends SchemaRegistryApi {
|
|
98
|
+
constructor() {
|
|
99
|
+
super(...arguments);
|
|
100
|
+
this.url = '/subjects/:subject/versions/:version/schema';
|
|
101
|
+
this.method = 'get';
|
|
102
|
+
}
|
|
103
|
+
static fetch(data) {
|
|
104
|
+
return this._fetch({ path: data });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class PostSubjectsVersions extends SchemaRegistryApi {
|
|
108
|
+
constructor() {
|
|
109
|
+
super(...arguments);
|
|
110
|
+
this.url = '/subjects/:subject/versions';
|
|
111
|
+
this.method = 'post';
|
|
112
|
+
}
|
|
113
|
+
static fetch(data) {
|
|
114
|
+
return this._fetch({
|
|
115
|
+
path: { subject: data.subject },
|
|
116
|
+
params: { normalize: !!data.normalize },
|
|
117
|
+
data: {
|
|
118
|
+
schema: toStringData(data.schema),
|
|
119
|
+
schemaType: data.schemaType,
|
|
120
|
+
reference: data.reference,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
class PostSubjects extends SchemaRegistryApi {
|
|
126
|
+
constructor() {
|
|
127
|
+
super(...arguments);
|
|
128
|
+
this.url = '/subjects/:subject';
|
|
129
|
+
this.method = 'post';
|
|
130
|
+
}
|
|
131
|
+
static fetch(data) {
|
|
132
|
+
return this._fetch({
|
|
133
|
+
path: { subject: data.subject },
|
|
134
|
+
params: { normalize: !!data.normalize },
|
|
135
|
+
data: {
|
|
136
|
+
schema: toStringData(data.schema),
|
|
137
|
+
schemaType: data.schemaType,
|
|
138
|
+
reference: data.reference,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
class PutConfig extends SchemaRegistryApi {
|
|
144
|
+
constructor() {
|
|
145
|
+
super(...arguments);
|
|
146
|
+
this.url = '/config/:subject';
|
|
147
|
+
this.method = 'put';
|
|
148
|
+
}
|
|
149
|
+
static fetch(data) {
|
|
150
|
+
return this._fetch({
|
|
151
|
+
path: { subject: data.subject },
|
|
152
|
+
data: { compatibility: data.compatibility },
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function encode(subject, data, version = 'latest') {
|
|
157
|
+
const errors = [];
|
|
158
|
+
const response = await GetSubjectsByVersion.fetch({ subject, version });
|
|
159
|
+
const header = Buffer.alloc(5);
|
|
160
|
+
const schema = AvroType.forSchema(JSON.parse(response.data.schema));
|
|
161
|
+
schema.isValid(data, {
|
|
162
|
+
errorHook: (path, value) => {
|
|
163
|
+
errors.push(`${path.join('.')}: ${value} (${typeof value})`);
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
if (errors.length)
|
|
167
|
+
throw new SchemaRegistryAvroSchemaParseError(errors);
|
|
168
|
+
header.writeInt32BE(response.data.id, 1);
|
|
169
|
+
return Buffer.concat([header, schema.toBuffer(data)]);
|
|
170
|
+
}
|
|
171
|
+
async function decode(buffer) {
|
|
172
|
+
const id = buffer.readInt32BE(1);
|
|
173
|
+
let data = cache.get(id);
|
|
174
|
+
if (!data) {
|
|
175
|
+
const response = await GetSchemasById.fetch(id);
|
|
176
|
+
data = AvroType.forSchema(JSON.parse(response.data.schema));
|
|
177
|
+
cache.set(id, data);
|
|
178
|
+
}
|
|
179
|
+
const schema = AvroType.forSchema(data);
|
|
180
|
+
return schema.fromBuffer(buffer.slice(5));
|
|
181
|
+
}
|
|
182
|
+
function toStringData(data) {
|
|
183
|
+
return typeof data === 'string' ? data : JSON.stringify(data);
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
ping: Ping.fetch.bind(Ping),
|
|
187
|
+
getSchemasById: (GetSchemasById.fetch.bind(GetSchemasById)),
|
|
188
|
+
getSchemasTypes: (GetSchemasTypes.fetch.bind(GetSchemasTypes)),
|
|
189
|
+
getSchemasVersionsById: (GetSchemasVersionsById.fetch.bind(GetSchemasVersionsById)),
|
|
190
|
+
getSubjects: GetSubjects.fetch.bind(GetSubjects),
|
|
191
|
+
getSubjectsVersions: (GetSubjectsVersions.fetch.bind(GetSubjectsVersions)),
|
|
192
|
+
deleteSubjects: (DeleteSubjects.fetch.bind(DeleteSubjects)),
|
|
193
|
+
getSubjectsByVersion: (GetSubjectsByVersion.fetch.bind(GetSubjectsByVersion)),
|
|
194
|
+
getSchemaBySubjectsAndVersion: (GetSchemaBySubjectsAndVersion.fetch.bind(GetSchemaBySubjectsAndVersion)),
|
|
195
|
+
postSubjects: PostSubjects.fetch.bind(PostSubjects),
|
|
196
|
+
postSubjectsVersions: (PostSubjectsVersions.fetch.bind(PostSubjectsVersions)),
|
|
197
|
+
putConfig: PutConfig.fetch.bind(PutConfig),
|
|
198
|
+
encode,
|
|
199
|
+
decode,
|
|
200
|
+
};
|
|
201
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseError } from '@biorate/errors';
|
|
2
|
+
export class SchemaRegistryCantConnectError extends BaseError {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
super(`Can't connect to schema registry: [%s]`, [e.message]);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class SchemaRegistryAvroSchemaParseError extends BaseError {
|
|
8
|
+
constructor(errors) {
|
|
9
|
+
super('%s', [errors.join('; ')], {
|
|
10
|
+
status: 400,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { injectable } from '@biorate/inversion';
|
|
8
|
+
import { Connector } from '@biorate/connector';
|
|
9
|
+
import { SchemaRegistryCantConnectError } from './errors.js';
|
|
10
|
+
import { create } from './api.js';
|
|
11
|
+
export * from './api.js';
|
|
12
|
+
export * from './errors.js';
|
|
13
|
+
export * from './interfaces.js';
|
|
14
|
+
let SchemaRegistryConnector = class SchemaRegistryConnector extends Connector {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.namespace = 'SchemaRegistry';
|
|
18
|
+
}
|
|
19
|
+
async connect(config) {
|
|
20
|
+
const connection = create(config);
|
|
21
|
+
try {
|
|
22
|
+
await connection.ping();
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
throw new SchemaRegistryCantConnectError(e);
|
|
26
|
+
}
|
|
27
|
+
return connection;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
SchemaRegistryConnector = __decorate([
|
|
31
|
+
injectable()
|
|
32
|
+
], SchemaRegistryConnector);
|
|
33
|
+
export { SchemaRegistryConnector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ICompatibilities, ISchemaRegistryConfig } from './interfaces';
|
|
2
|
+
export declare const create: (config: ISchemaRegistryConfig) => {
|
|
3
|
+
ping: () => Promise<import("@biorate/axios-prometheus").AxiosResponse<Record<string, unknown>, any, {}>>;
|
|
4
|
+
getSchemasById: (id: number) => Promise<import("@biorate/axios-prometheus").AxiosResponse<{
|
|
5
|
+
schema: string;
|
|
6
|
+
}, any, {}>>;
|
|
7
|
+
getSchemasTypes: () => Promise<import("@biorate/axios-prometheus").AxiosResponse<string[], any, {}>>;
|
|
8
|
+
getSchemasVersionsById: (id: number) => Promise<import("@biorate/axios-prometheus").AxiosResponse<{
|
|
9
|
+
subject: string;
|
|
10
|
+
version: number;
|
|
11
|
+
}[], any, {}>>;
|
|
12
|
+
getSubjects: () => Promise<import("@biorate/axios-prometheus").AxiosResponse<string[], any, {}>>;
|
|
13
|
+
getSubjectsVersions: (subject: string) => Promise<import("@biorate/axios-prometheus").AxiosResponse<number[], any, {}>>;
|
|
14
|
+
deleteSubjects: (data: {
|
|
15
|
+
subject: string;
|
|
16
|
+
permanent?: boolean;
|
|
17
|
+
}) => Promise<import("@biorate/axios-prometheus").AxiosResponse<number[], any, {}>>;
|
|
18
|
+
getSubjectsByVersion: (data: {
|
|
19
|
+
subject: string;
|
|
20
|
+
version: number | string;
|
|
21
|
+
}) => Promise<import("@biorate/axios-prometheus").AxiosResponse<{
|
|
22
|
+
subject: string;
|
|
23
|
+
id: number;
|
|
24
|
+
version: number;
|
|
25
|
+
schemaType: string;
|
|
26
|
+
schema: string;
|
|
27
|
+
}, any, {}>>;
|
|
28
|
+
getSchemaBySubjectsAndVersion: (data: {
|
|
29
|
+
subject: string;
|
|
30
|
+
version: number | string;
|
|
31
|
+
}) => Promise<import("@biorate/axios-prometheus").AxiosResponse<unknown, any, {}>>;
|
|
32
|
+
postSubjects: (data: {
|
|
33
|
+
subject: string;
|
|
34
|
+
schema: string | Record<string, any>;
|
|
35
|
+
schemaType?: string;
|
|
36
|
+
reference?: string;
|
|
37
|
+
normalize?: boolean;
|
|
38
|
+
}) => Promise<import("@biorate/axios-prometheus").AxiosResponse<{
|
|
39
|
+
subject: string;
|
|
40
|
+
id: number;
|
|
41
|
+
version: number;
|
|
42
|
+
schema: string;
|
|
43
|
+
}, any, {}>>;
|
|
44
|
+
postSubjectsVersions: (data: {
|
|
45
|
+
subject: string;
|
|
46
|
+
schema: string | Record<string, any>;
|
|
47
|
+
schemaType?: string;
|
|
48
|
+
reference?: string;
|
|
49
|
+
normalize?: boolean;
|
|
50
|
+
}) => Promise<import("@biorate/axios-prometheus").AxiosResponse<{
|
|
51
|
+
id: number;
|
|
52
|
+
}, any, {}>>;
|
|
53
|
+
putConfig: (data: {
|
|
54
|
+
subject: string;
|
|
55
|
+
compatibility: ICompatibilities;
|
|
56
|
+
}) => Promise<import("@biorate/axios-prometheus").AxiosResponse<{
|
|
57
|
+
compatibility: ICompatibilities;
|
|
58
|
+
}, any, {}>>;
|
|
59
|
+
encode: (subject: string, data: Record<string, any>, version?: string | number) => Promise<Buffer>;
|
|
60
|
+
decode: (buffer: Buffer) => Promise<any>;
|
|
61
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ISchemaRegistryConfig, ISchemaRegistryConnection } from './interfaces';
|
|
2
|
+
import { Connector } from '@biorate/connector';
|
|
3
|
+
export * from './api';
|
|
4
|
+
export * from './errors';
|
|
5
|
+
export * from './interfaces';
|
|
6
|
+
export declare class SchemaRegistryConnector extends Connector<ISchemaRegistryConfig, ISchemaRegistryConnection> {
|
|
7
|
+
private '#connections';
|
|
8
|
+
private '#current';
|
|
9
|
+
protected readonly namespace = "SchemaRegistry";
|
|
10
|
+
protected connect(config: ISchemaRegistryConfig): Promise<ISchemaRegistryConnection>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IConnectorConfig, IConnector } from '@biorate/connector';
|
|
2
|
+
import { create } from './api';
|
|
3
|
+
export type ISchemaRegistryConnection = ReturnType<typeof create>;
|
|
4
|
+
export interface ISchemaRegistryConfig extends IConnectorConfig {
|
|
5
|
+
baseURL: string;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export type ISchemaRegistryConnector = IConnector<ISchemaRegistryConfig, ISchemaRegistryConnection>;
|
|
9
|
+
export type ICompatibilities = 'BACKWARD' | 'BACKWARD_TRANSITIVE' | 'FORWARD' | 'FORWARD_TRANSITIVE' | 'FULL' | 'FULL_TRANSITIVE' | 'NONE';
|
package/package.json
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biorate/schema-registry",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Schema registry connector",
|
|
5
|
-
"main": "dist/index.js",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.js",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"require": "./dist/cjs/index.js",
|
|
13
|
+
"default": "./dist/cjs/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/**",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
6
21
|
"scripts": {
|
|
7
|
-
"
|
|
22
|
+
"clean": "cleanup dist",
|
|
23
|
+
"build:cjs": "npx tsc -p ./tsconfig.build.cjs.json",
|
|
24
|
+
"build:esm": "npx tsc -p ./tsconfig.build.esm.json",
|
|
25
|
+
"build:types": "npx tsc -p ./tsconfig.build.types.json",
|
|
26
|
+
"build": "pnpm run clean && pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
|
|
27
|
+
"postbuild:cjs": "node ../../../.scripts/write-package-type.js dist/cjs commonjs",
|
|
28
|
+
"postbuild:esm": "tsc-esm-fix --tsconfig=./tsconfig.build.esm.json --target=./dist/esm && node ../../../.scripts/write-package-type.js dist/esm module",
|
|
29
|
+
"format": "prettier --check src",
|
|
30
|
+
"lint": "eslint src --ext .ts",
|
|
31
|
+
"format:fix": "prettier --write src",
|
|
32
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
8
33
|
"test": "npx vitest run --coverage",
|
|
9
34
|
"prepublishOnly": "pnpm run build"
|
|
10
35
|
},
|
|
@@ -25,13 +50,13 @@
|
|
|
25
50
|
],
|
|
26
51
|
"author": "llevkin",
|
|
27
52
|
"license": "MIT",
|
|
53
|
+
"gitHead": "b2400d06c44d0cac2dd01440a6075a100702c278",
|
|
28
54
|
"dependencies": {
|
|
29
|
-
"@biorate/axios-prometheus": "
|
|
30
|
-
"@biorate/config": "
|
|
31
|
-
"@biorate/connector": "
|
|
32
|
-
"@biorate/errors": "
|
|
33
|
-
"@biorate/inversion": "
|
|
55
|
+
"@biorate/axios-prometheus": "2.0.0",
|
|
56
|
+
"@biorate/config": "3.0.0",
|
|
57
|
+
"@biorate/connector": "3.0.0",
|
|
58
|
+
"@biorate/errors": "3.0.0",
|
|
59
|
+
"@biorate/inversion": "3.0.0",
|
|
34
60
|
"avsc": "^5.7.4"
|
|
35
|
-
}
|
|
36
|
-
"gitHead": "00168f8350ace8f561f08800f8ef1e5ed61a364c"
|
|
61
|
+
}
|
|
37
62
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|