@kurrent/kurrentdb-client 1.0.4 → 1.2.0-alpha.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/Client/ServerFeatures.d.ts +2 -2
- package/dist/Client/ServerFeatures.js +2 -2
- package/dist/Client/ServerFeatures.js.map +1 -1
- package/dist/Client/discovery.js +2 -2
- package/dist/Client/discovery.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/persistentSubscription/createPersistentSubscriptionToAll.js +22 -12
- package/dist/persistentSubscription/createPersistentSubscriptionToAll.js.map +1 -1
- package/dist/persistentSubscription/createPersistentSubscriptionToStream.js +16 -6
- package/dist/persistentSubscription/createPersistentSubscriptionToStream.js.map +1 -1
- package/dist/persistentSubscription/deletePersistentSubscriptionToAll.js +7 -7
- package/dist/persistentSubscription/deletePersistentSubscriptionToAll.js.map +1 -1
- package/dist/persistentSubscription/deletePersistentSubscriptionToStream.js +5 -5
- package/dist/persistentSubscription/deletePersistentSubscriptionToStream.js.map +1 -1
- package/dist/persistentSubscription/getPersistentSubscriptionToAllInfo.js +7 -7
- package/dist/persistentSubscription/getPersistentSubscriptionToAllInfo.js.map +1 -1
- package/dist/persistentSubscription/getPersistentSubscriptionToStreamInfo.js +6 -6
- package/dist/persistentSubscription/getPersistentSubscriptionToStreamInfo.js.map +1 -1
- package/dist/persistentSubscription/listAllPersistentSubscriptions.js +7 -7
- package/dist/persistentSubscription/listAllPersistentSubscriptions.js.map +1 -1
- package/dist/persistentSubscription/listPersistentSubscriptionsToAll.js +8 -8
- package/dist/persistentSubscription/listPersistentSubscriptionsToAll.js.map +1 -1
- package/dist/persistentSubscription/listPersistentSubscriptionsToStream.js +7 -7
- package/dist/persistentSubscription/listPersistentSubscriptionsToStream.js.map +1 -1
- package/dist/persistentSubscription/replayParkedMessagesToAll.js +7 -7
- package/dist/persistentSubscription/replayParkedMessagesToAll.js.map +1 -1
- package/dist/persistentSubscription/replayParkedMessagesToStream.js +7 -7
- package/dist/persistentSubscription/replayParkedMessagesToStream.js.map +1 -1
- package/dist/persistentSubscription/restartPersistentSubscriptionSubsystem.js +4 -4
- package/dist/persistentSubscription/restartPersistentSubscriptionSubsystem.js.map +1 -1
- package/dist/persistentSubscription/subscribeToPersistentSubscriptionToAll.js +8 -8
- package/dist/persistentSubscription/subscribeToPersistentSubscriptionToAll.js.map +1 -1
- package/dist/persistentSubscription/subscribeToPersistentSubscriptionToStream.js +7 -7
- package/dist/persistentSubscription/subscribeToPersistentSubscriptionToStream.js.map +1 -1
- package/dist/persistentSubscription/updatePersistentSubscriptionToAll.js +10 -10
- package/dist/persistentSubscription/updatePersistentSubscriptionToAll.js.map +1 -1
- package/dist/persistentSubscription/updatePersistentSubscriptionToStream.js +6 -6
- package/dist/persistentSubscription/updatePersistentSubscriptionToStream.js.map +1 -1
- package/dist/persistentSubscription/utils/PersistentSubscriptionImpl.d.ts +1 -1
- package/dist/persistentSubscription/utils/PersistentSubscriptionImpl.js +9 -9
- package/dist/persistentSubscription/utils/PersistentSubscriptionImpl.js.map +1 -1
- package/dist/persistentSubscription/utils/mapPersistentSubscriptionInfo.d.ts +1 -1
- package/dist/persistentSubscription/utils/settingsToGRPC.d.ts +1 -1
- package/dist/persistentSubscription/utils/settingsToGRPC.js +13 -4
- package/dist/persistentSubscription/utils/settingsToGRPC.js.map +1 -1
- package/dist/projections/createProjection.js +7 -7
- package/dist/projections/createProjection.js.map +1 -1
- package/dist/projections/deleteProjection.js +5 -5
- package/dist/projections/deleteProjection.js.map +1 -1
- package/dist/projections/disableProjection.js +5 -5
- package/dist/projections/disableProjection.js.map +1 -1
- package/dist/projections/enableProjection.js +5 -5
- package/dist/projections/enableProjection.js.map +1 -1
- package/dist/projections/getProjectionResult.js +5 -5
- package/dist/projections/getProjectionResult.js.map +1 -1
- package/dist/projections/getProjectionState.js +5 -5
- package/dist/projections/getProjectionState.js.map +1 -1
- package/dist/projections/getProjectionStatus.js +5 -5
- package/dist/projections/getProjectionStatus.js.map +1 -1
- package/dist/projections/listProjections.js +6 -6
- package/dist/projections/listProjections.js.map +1 -1
- package/dist/projections/resetProjection.js +5 -5
- package/dist/projections/resetProjection.js.map +1 -1
- package/dist/projections/restartSubsystem.js +3 -3
- package/dist/projections/restartSubsystem.js.map +1 -1
- package/dist/projections/updateProjection.js +6 -6
- package/dist/projections/updateProjection.js.map +1 -1
- package/dist/projections/utils/mapGrpcProjectionDetails.d.ts +1 -1
- package/dist/schemaRegistry/checkSchemaCompatibility.d.ts +12 -0
- package/dist/schemaRegistry/checkSchemaCompatibility.js +60 -0
- package/dist/schemaRegistry/checkSchemaCompatibility.js.map +1 -0
- package/dist/schemaRegistry/createSchema.d.ts +13 -0
- package/dist/schemaRegistry/createSchema.js +36 -0
- package/dist/schemaRegistry/createSchema.js.map +1 -0
- package/dist/schemaRegistry/deleteSchema.d.ts +11 -0
- package/dist/schemaRegistry/deleteSchema.js +23 -0
- package/dist/schemaRegistry/deleteSchema.js.map +1 -0
- package/dist/schemaRegistry/deleteSchemaVersions.d.ts +13 -0
- package/dist/schemaRegistry/deleteSchemaVersions.js +29 -0
- package/dist/schemaRegistry/deleteSchemaVersions.js.map +1 -0
- package/dist/schemaRegistry/getSchema.d.ts +12 -0
- package/dist/schemaRegistry/getSchema.js +28 -0
- package/dist/schemaRegistry/getSchema.js.map +1 -0
- package/dist/schemaRegistry/getSchemaVersion.d.ts +12 -0
- package/dist/schemaRegistry/getSchemaVersion.js +33 -0
- package/dist/schemaRegistry/getSchemaVersion.js.map +1 -0
- package/dist/schemaRegistry/getSchemaVersionById.d.ts +12 -0
- package/dist/schemaRegistry/getSchemaVersionById.js +28 -0
- package/dist/schemaRegistry/getSchemaVersionById.js.map +1 -0
- package/dist/schemaRegistry/index.d.ts +14 -0
- package/dist/schemaRegistry/index.js +35 -0
- package/dist/schemaRegistry/index.js.map +1 -0
- package/dist/schemaRegistry/listRegisteredSchemas.d.ts +11 -0
- package/dist/schemaRegistry/listRegisteredSchemas.js +41 -0
- package/dist/schemaRegistry/listRegisteredSchemas.js.map +1 -0
- package/dist/schemaRegistry/listSchemaVersions.d.ts +12 -0
- package/dist/schemaRegistry/listSchemaVersions.js +28 -0
- package/dist/schemaRegistry/listSchemaVersions.js.map +1 -0
- package/dist/schemaRegistry/listSchemas.d.ts +11 -0
- package/dist/schemaRegistry/listSchemas.js +35 -0
- package/dist/schemaRegistry/listSchemas.js.map +1 -0
- package/dist/schemaRegistry/lookupSchemaName.d.ts +12 -0
- package/dist/schemaRegistry/lookupSchemaName.js +23 -0
- package/dist/schemaRegistry/lookupSchemaName.js.map +1 -0
- package/dist/schemaRegistry/registerSchemaVersion.d.ts +13 -0
- package/dist/schemaRegistry/registerSchemaVersion.js +31 -0
- package/dist/schemaRegistry/registerSchemaVersion.js.map +1 -0
- package/dist/schemaRegistry/types.d.ts +347 -0
- package/dist/schemaRegistry/types.js +3 -0
- package/dist/schemaRegistry/types.js.map +1 -0
- package/dist/schemaRegistry/updateSchema.d.ts +11 -0
- package/dist/schemaRegistry/updateSchema.js +51 -0
- package/dist/schemaRegistry/updateSchema.js.map +1 -0
- package/dist/schemaRegistry/utils/index.d.ts +1 -0
- package/dist/schemaRegistry/utils/index.js +18 -0
- package/dist/schemaRegistry/utils/index.js.map +1 -0
- package/dist/schemaRegistry/utils/mappers.d.ts +24 -0
- package/dist/schemaRegistry/utils/mappers.js +198 -0
- package/dist/schemaRegistry/utils/mappers.js.map +1 -0
- package/dist/streams/appendToStream/append.js +3 -3
- package/dist/streams/appendToStream/append.js.map +1 -1
- package/dist/streams/appendToStream/batchAppend.js +3 -3
- package/dist/streams/appendToStream/batchAppend.js.map +1 -1
- package/dist/streams/appendToStream/index.d.ts +2 -1
- package/dist/streams/appendToStream/index.js +10 -1
- package/dist/streams/appendToStream/index.js.map +1 -1
- package/dist/streams/appendToStream/multiStreamAppend.d.ts +3 -0
- package/dist/streams/appendToStream/multiStreamAppend.js +130 -0
- package/dist/streams/appendToStream/multiStreamAppend.js.map +1 -0
- package/dist/streams/appendToStream/unpackError.d.ts +2 -2
- package/dist/streams/appendToStream/unpackError.js +1 -1
- package/dist/streams/appendToStream/unpackError.js.map +1 -1
- package/dist/streams/deleteStream.js +3 -3
- package/dist/streams/deleteStream.js.map +1 -1
- package/dist/streams/subscribeToAll.js +3 -3
- package/dist/streams/subscribeToAll.js.map +1 -1
- package/dist/streams/subscribeToStream.js +3 -3
- package/dist/streams/subscribeToStream.js.map +1 -1
- package/dist/streams/tombstoneStream.js +3 -3
- package/dist/streams/tombstoneStream.js.map +1 -1
- package/dist/streams/utils/ReadStream.d.ts +1 -1
- package/dist/streams/utils/Subscription.d.ts +1 -1
- package/dist/types/index.d.ts +35 -4
- package/dist/types/index.js +5 -2
- package/dist/types/index.js.map +1 -1
- package/dist/utils/CommandError.d.ts +26 -2
- package/dist/utils/CommandError.js +100 -3
- package/dist/utils/CommandError.js.map +1 -1
- package/dist/utils/convertGrpcEvent.d.ts +2 -2
- package/dist/utils/getGrpcStatusDetails.d.ts +5 -0
- package/dist/utils/getGrpcStatusDetails.js +17 -0
- package/dist/utils/getGrpcStatusDetails.js.map +1 -0
- package/dist/utils/grpcStreamIdentifier.d.ts +1 -1
- package/dist/utils/grpcStreamIdentifier.js +1 -1
- package/dist/utils/grpcStreamIdentifier.js.map +1 -1
- package/dist/utils/grpcUUID.d.ts +1 -1
- package/dist/utils/grpcUUID.js +1 -1
- package/dist/utils/grpcUUID.js.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mapToValue.d.ts +3 -0
- package/dist/utils/mapToValue.js +19 -0
- package/dist/utils/mapToValue.js.map +1 -0
- package/dist/utils/schema.d.ts +7 -0
- package/dist/utils/schema.js +21 -0
- package/dist/utils/schema.js.map +1 -0
- package/generated/{code_pb.d.ts → kurrentdb/protocols/v1/code_pb.d.ts} +1 -1
- package/generated/{code_pb.js → kurrentdb/protocols/v1/code_pb.js} +1 -1
- package/generated/kurrentdb/protocols/v1/gossip_grpc_pb.d.ts +42 -0
- package/generated/{gossip_grpc_pb.js → kurrentdb/protocols/v1/gossip_grpc_pb.js} +8 -8
- package/generated/{gossip_pb.d.ts → kurrentdb/protocols/v1/gossip_pb.d.ts} +5 -5
- package/generated/{gossip_pb.js → kurrentdb/protocols/v1/gossip_pb.js} +8 -8
- package/generated/kurrentdb/protocols/v1/operations_grpc_pb.d.ts +144 -0
- package/generated/{operations_grpc_pb.js → kurrentdb/protocols/v1/operations_grpc_pb.js} +26 -26
- package/generated/{operations_pb.d.ts → kurrentdb/protocols/v1/operations_pb.d.ts} +2 -2
- package/generated/{operations_pb.js → kurrentdb/protocols/v1/operations_pb.js} +3 -3
- package/generated/kurrentdb/protocols/v1/persistentsubscriptions_grpc_pb.d.ts +160 -0
- package/generated/{persistent_grpc_pb.js → kurrentdb/protocols/v1/persistentsubscriptions_grpc_pb.js} +48 -48
- package/generated/{persistent_pb.d.ts → kurrentdb/protocols/v1/persistentsubscriptions_pb.d.ts} +106 -106
- package/generated/{persistent_pb.js → kurrentdb/protocols/v1/persistentsubscriptions_pb.js} +173 -173
- package/generated/kurrentdb/protocols/v1/projectionmanagement_grpc_pb.d.ts +194 -0
- package/generated/{projections_grpc_pb.js → kurrentdb/protocols/v1/projectionmanagement_grpc_pb.js} +60 -60
- package/generated/{projections_pb.d.ts → kurrentdb/protocols/v1/projectionmanagement_pb.d.ts} +20 -20
- package/generated/{projections_pb.js → kurrentdb/protocols/v1/projectionmanagement_pb.js} +33 -33
- package/generated/kurrentdb/protocols/v1/serverfeatures_grpc_pb.d.ts +42 -0
- package/generated/{serverfeatures_grpc_pb.js → kurrentdb/protocols/v1/serverfeatures_grpc_pb.js} +8 -8
- package/generated/{serverfeatures_pb.d.ts → kurrentdb/protocols/v1/serverfeatures_pb.d.ts} +2 -2
- package/generated/{serverfeatures_pb.js → kurrentdb/protocols/v1/serverfeatures_pb.js} +3 -3
- package/generated/{shared_pb.d.ts → kurrentdb/protocols/v1/shared_pb.d.ts} +1 -1
- package/generated/{shared_pb.js → kurrentdb/protocols/v1/shared_pb.js} +1 -1
- package/generated/{status_pb.d.ts → kurrentdb/protocols/v1/status_pb.d.ts} +5 -5
- package/generated/{status_pb.js → kurrentdb/protocols/v1/status_pb.js} +3 -3
- package/generated/kurrentdb/protocols/v1/streams_grpc_pb.d.ts +113 -0
- package/generated/{streams_grpc_pb.js → kurrentdb/protocols/v1/streams_grpc_pb.js} +33 -33
- package/generated/{streams_pb.d.ts → kurrentdb/protocols/v1/streams_pb.d.ts} +138 -138
- package/generated/{streams_pb.js → kurrentdb/protocols/v1/streams_pb.js} +230 -230
- package/generated/kurrentdb/protocols/v1/usermanagement_grpc_pb.d.ts +158 -0
- package/generated/{users_grpc_pb.js → kurrentdb/protocols/v1/usermanagement_grpc_pb.js} +49 -49
- package/generated/{users_pb.d.ts → kurrentdb/protocols/v1/usermanagement_pb.d.ts} +1 -1
- package/generated/{users_pb.js → kurrentdb/protocols/v1/usermanagement_pb.js} +1 -1
- package/generated/kurrentdb/protocols/v2/core_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/core_pb.d.ts +188 -0
- package/generated/kurrentdb/protocols/v2/core_pb.js +1301 -0
- package/generated/kurrentdb/protocols/v2/errors_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/errors_pb.d.ts +105 -0
- package/generated/kurrentdb/protocols/v2/errors_pb.js +692 -0
- package/generated/kurrentdb/protocols/v2/features/service_grpc_pb.d.ts +43 -0
- package/generated/kurrentdb/protocols/v2/features/service_grpc_pb.js +50 -0
- package/generated/kurrentdb/protocols/v2/features/service_pb.d.ts +227 -0
- package/generated/kurrentdb/protocols/v2/features/service_pb.js +1753 -0
- package/generated/kurrentdb/protocols/v2/registry/errors_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/registry/errors_pb.d.ts +75 -0
- package/generated/kurrentdb/protocols/v2/registry/errors_pb.js +493 -0
- package/generated/kurrentdb/protocols/v2/registry/events_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/registry/events_pb.d.ts +255 -0
- package/generated/kurrentdb/protocols/v2/registry/events_pb.js +2057 -0
- package/generated/kurrentdb/protocols/v2/registry/groups_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/registry/groups_pb.d.ts +474 -0
- package/generated/kurrentdb/protocols/v2/registry/groups_pb.js +3593 -0
- package/generated/kurrentdb/protocols/v2/registry/schemas_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/registry/schemas_pb.d.ts +825 -0
- package/generated/kurrentdb/protocols/v2/registry/schemas_pb.js +6500 -0
- package/generated/kurrentdb/protocols/v2/registry/service_grpc_pb.d.ts +350 -0
- package/generated/kurrentdb/protocols/v2/registry/service_grpc_pb.js +654 -0
- package/generated/kurrentdb/protocols/v2/registry/service_pb.d.ts +10 -0
- package/generated/kurrentdb/protocols/v2/registry/service_pb.js +29 -0
- package/generated/kurrentdb/protocols/v2/registry/shared_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/registry/shared_pb.d.ts +26 -0
- package/generated/kurrentdb/protocols/v2/registry/shared_pb.js +51 -0
- package/generated/kurrentdb/protocols/v2/registry/validation_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/registry/validation_pb.d.ts +247 -0
- package/generated/kurrentdb/protocols/v2/registry/validation_pb.js +1789 -0
- package/generated/kurrentdb/protocols/v2/rpc_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/rpc_pb.d.ts +34 -0
- package/generated/kurrentdb/protocols/v2/rpc_pb.js +236 -0
- package/generated/kurrentdb/protocols/v2/streams/errors_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/streams/errors_pb.d.ts +199 -0
- package/generated/kurrentdb/protocols/v2/streams/errors_pb.js +1439 -0
- package/generated/kurrentdb/protocols/v2/streams/shared_grpc_pb.js +1 -0
- package/generated/kurrentdb/protocols/v2/streams/shared_pb.d.ts +218 -0
- package/generated/kurrentdb/protocols/v2/streams/shared_pb.js +1561 -0
- package/generated/kurrentdb/protocols/v2/streams/streams_grpc_pb.d.ts +44 -0
- package/generated/kurrentdb/protocols/v2/streams/streams_grpc_pb.js +69 -0
- package/generated/kurrentdb/protocols/v2/streams/streams_pb.d.ts +176 -0
- package/generated/kurrentdb/protocols/v2/streams/streams_pb.js +1289 -0
- package/package.json +66 -64
- package/generated/cluster_grpc_pb.d.ts +0 -211
- package/generated/cluster_grpc_pb.js +0 -247
- package/generated/cluster_pb.d.ts +0 -546
- package/generated/cluster_pb.js +0 -4357
- package/generated/gossip_grpc_pb.d.ts +0 -42
- package/generated/monitoring_grpc_pb.d.ts +0 -39
- package/generated/monitoring_grpc_pb.js +0 -44
- package/generated/monitoring_pb.d.ts +0 -52
- package/generated/monitoring_pb.js +0 -361
- package/generated/operations_grpc_pb.d.ts +0 -144
- package/generated/persistent_grpc_pb.d.ts +0 -160
- package/generated/projections_grpc_pb.d.ts +0 -194
- package/generated/serverfeatures_grpc_pb.d.ts +0 -42
- package/generated/streams_grpc_pb.d.ts +0 -113
- package/generated/users_grpc_pb.d.ts +0 -158
- /package/generated/{code_grpc_pb.js → kurrentdb/protocols/v1/code_grpc_pb.js} +0 -0
- /package/generated/{shared_grpc_pb.js → kurrentdb/protocols/v1/shared_grpc_pb.js} +0 -0
- /package/generated/{status_grpc_pb.js → kurrentdb/protocols/v1/status_grpc_pb.js} +0 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import type { BaseOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Schema data format types supported by the schema registry.
|
|
4
|
+
*/
|
|
5
|
+
export type SchemaDataFormat = "json" | "protobuf" | "avro" | "bytes";
|
|
6
|
+
/**
|
|
7
|
+
* Schema compatibility modes for version validation.
|
|
8
|
+
*/
|
|
9
|
+
export type CompatibilityMode = "backward" | "forward" | "full" | "backward-all" | "forward-all" | "full-all" | "none";
|
|
10
|
+
/**
|
|
11
|
+
* Schema details for creating or updating a schema.
|
|
12
|
+
*/
|
|
13
|
+
export interface SchemaDetails {
|
|
14
|
+
/**
|
|
15
|
+
* The data format of the schema.
|
|
16
|
+
*/
|
|
17
|
+
dataFormat: SchemaDataFormat;
|
|
18
|
+
/**
|
|
19
|
+
* The compatibility mode for schema versions.
|
|
20
|
+
*/
|
|
21
|
+
compatibility: CompatibilityMode;
|
|
22
|
+
/**
|
|
23
|
+
* Optional description of the schema.
|
|
24
|
+
*/
|
|
25
|
+
description?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional tags for the schema.
|
|
28
|
+
*/
|
|
29
|
+
tags?: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Represents a schema in the registry.
|
|
33
|
+
*/
|
|
34
|
+
export interface Schema {
|
|
35
|
+
/**
|
|
36
|
+
* The name of the schema.
|
|
37
|
+
*/
|
|
38
|
+
schemaName: string;
|
|
39
|
+
/**
|
|
40
|
+
* The schema details.
|
|
41
|
+
*/
|
|
42
|
+
details: SchemaDetails;
|
|
43
|
+
/**
|
|
44
|
+
* The latest version number of the schema.
|
|
45
|
+
*/
|
|
46
|
+
latestSchemaVersion: number;
|
|
47
|
+
/**
|
|
48
|
+
* When the schema was created.
|
|
49
|
+
*/
|
|
50
|
+
createdAt?: Date;
|
|
51
|
+
/**
|
|
52
|
+
* When the schema was last updated.
|
|
53
|
+
*/
|
|
54
|
+
updatedAt?: Date;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Represents a version of a schema.
|
|
58
|
+
*/
|
|
59
|
+
export interface SchemaVersion {
|
|
60
|
+
/**
|
|
61
|
+
* The unique identifier for this schema version.
|
|
62
|
+
*/
|
|
63
|
+
schemaVersionId: string;
|
|
64
|
+
/**
|
|
65
|
+
* The version number.
|
|
66
|
+
*/
|
|
67
|
+
versionNumber: number;
|
|
68
|
+
/**
|
|
69
|
+
* The schema definition bytes.
|
|
70
|
+
*/
|
|
71
|
+
schemaDefinition: Uint8Array;
|
|
72
|
+
/**
|
|
73
|
+
* The data format of the schema.
|
|
74
|
+
*/
|
|
75
|
+
dataFormat: SchemaDataFormat;
|
|
76
|
+
/**
|
|
77
|
+
* When the version was registered.
|
|
78
|
+
*/
|
|
79
|
+
registeredAt?: Date;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Represents a registered schema with its latest version information.
|
|
83
|
+
*/
|
|
84
|
+
export interface RegisteredSchema {
|
|
85
|
+
/**
|
|
86
|
+
* The name of the schema.
|
|
87
|
+
*/
|
|
88
|
+
schemaName: string;
|
|
89
|
+
/**
|
|
90
|
+
* The unique identifier for the schema version.
|
|
91
|
+
*/
|
|
92
|
+
schemaVersionId: string;
|
|
93
|
+
/**
|
|
94
|
+
* The version number.
|
|
95
|
+
*/
|
|
96
|
+
versionNumber: number;
|
|
97
|
+
/**
|
|
98
|
+
* The schema definition bytes.
|
|
99
|
+
*/
|
|
100
|
+
schemaDefinition?: Uint8Array;
|
|
101
|
+
/**
|
|
102
|
+
* The data format of the schema.
|
|
103
|
+
*/
|
|
104
|
+
dataFormat: SchemaDataFormat;
|
|
105
|
+
/**
|
|
106
|
+
* The compatibility mode for schema versions.
|
|
107
|
+
*/
|
|
108
|
+
compatibility: CompatibilityMode;
|
|
109
|
+
/**
|
|
110
|
+
* Tags associated with the schema.
|
|
111
|
+
*/
|
|
112
|
+
tags: Record<string, string>;
|
|
113
|
+
/**
|
|
114
|
+
* When the version was registered.
|
|
115
|
+
*/
|
|
116
|
+
registeredAt?: Date;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Error details for a schema version operation.
|
|
120
|
+
*/
|
|
121
|
+
export interface SchemaVersionError {
|
|
122
|
+
/**
|
|
123
|
+
* The version number that had an error.
|
|
124
|
+
*/
|
|
125
|
+
versionNumber: number;
|
|
126
|
+
/**
|
|
127
|
+
* The error details.
|
|
128
|
+
*/
|
|
129
|
+
error?: {
|
|
130
|
+
code: string;
|
|
131
|
+
message: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Schema compatibility error information.
|
|
136
|
+
*/
|
|
137
|
+
export interface SchemaCompatibilityError {
|
|
138
|
+
/**
|
|
139
|
+
* The kind of compatibility error.
|
|
140
|
+
*/
|
|
141
|
+
kind: SchemaCompatibilityErrorKind;
|
|
142
|
+
/**
|
|
143
|
+
* Detailed description of the error.
|
|
144
|
+
*/
|
|
145
|
+
details: string;
|
|
146
|
+
/**
|
|
147
|
+
* The property path where the error occurred.
|
|
148
|
+
*/
|
|
149
|
+
propertyPath?: string;
|
|
150
|
+
/**
|
|
151
|
+
* The original type before the change.
|
|
152
|
+
*/
|
|
153
|
+
originalType?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The new type after the change.
|
|
156
|
+
*/
|
|
157
|
+
newType?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Types of schema compatibility errors.
|
|
161
|
+
*/
|
|
162
|
+
export type SchemaCompatibilityErrorKind = "unspecified" | "missing-required-property" | "incompatible-type-change" | "optional-to-required" | "new-required-property" | "removed-property" | "array-type-incompatibility" | "data-format-mismatch";
|
|
163
|
+
/**
|
|
164
|
+
* Options for creating a schema.
|
|
165
|
+
*/
|
|
166
|
+
export interface CreateSchemaOptions extends BaseOptions {
|
|
167
|
+
/**
|
|
168
|
+
* Optional initial schema definition. If provided, the schema will be created
|
|
169
|
+
* with version 1 containing this definition.
|
|
170
|
+
*/
|
|
171
|
+
schemaDefinition?: string | Uint8Array;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Result of creating a schema.
|
|
175
|
+
*/
|
|
176
|
+
export interface CreateSchemaResult {
|
|
177
|
+
/**
|
|
178
|
+
* The schema version ID (only present if schemaDefinition was provided).
|
|
179
|
+
*/
|
|
180
|
+
schemaVersionId?: string;
|
|
181
|
+
/**
|
|
182
|
+
* The version number (only present if schemaDefinition was provided).
|
|
183
|
+
*/
|
|
184
|
+
versionNumber?: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Options for updating a schema.
|
|
188
|
+
*/
|
|
189
|
+
export interface UpdateSchemaOptions extends BaseOptions {
|
|
190
|
+
/**
|
|
191
|
+
* The data format of the schema (must match existing schema).
|
|
192
|
+
*/
|
|
193
|
+
dataFormat: SchemaDataFormat;
|
|
194
|
+
/**
|
|
195
|
+
* The compatibility mode (must match existing schema).
|
|
196
|
+
*/
|
|
197
|
+
compatibility: CompatibilityMode;
|
|
198
|
+
/**
|
|
199
|
+
* Updated description for the schema.
|
|
200
|
+
*/
|
|
201
|
+
description?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Updated tags for the schema.
|
|
204
|
+
*/
|
|
205
|
+
tags?: Record<string, string>;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Options for deleting a schema.
|
|
209
|
+
*/
|
|
210
|
+
export type DeleteSchemaOptions = BaseOptions;
|
|
211
|
+
/**
|
|
212
|
+
* Options for getting a schema.
|
|
213
|
+
*/
|
|
214
|
+
export type GetSchemaOptions = BaseOptions;
|
|
215
|
+
/**
|
|
216
|
+
* Options for listing schemas.
|
|
217
|
+
*/
|
|
218
|
+
export interface ListSchemasOptions extends BaseOptions {
|
|
219
|
+
/**
|
|
220
|
+
* Filter schemas by name prefix.
|
|
221
|
+
*/
|
|
222
|
+
schemaNamePrefix?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Filter schemas by tags.
|
|
225
|
+
*/
|
|
226
|
+
schemaTags?: Record<string, string>;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Options for looking up a schema name.
|
|
230
|
+
*/
|
|
231
|
+
export type LookupSchemaNameOptions = BaseOptions;
|
|
232
|
+
/**
|
|
233
|
+
* Options for registering a schema version.
|
|
234
|
+
*/
|
|
235
|
+
export type RegisterSchemaVersionOptions = BaseOptions;
|
|
236
|
+
/**
|
|
237
|
+
* Result of registering a schema version.
|
|
238
|
+
*/
|
|
239
|
+
export interface RegisterSchemaVersionResult {
|
|
240
|
+
/**
|
|
241
|
+
* The unique identifier for the registered schema version.
|
|
242
|
+
*/
|
|
243
|
+
schemaVersionId: string;
|
|
244
|
+
/**
|
|
245
|
+
* The version number assigned to the registration.
|
|
246
|
+
*/
|
|
247
|
+
versionNumber: number;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Options for deleting schema versions.
|
|
251
|
+
*/
|
|
252
|
+
export type DeleteSchemaVersionsOptions = BaseOptions;
|
|
253
|
+
/**
|
|
254
|
+
* Result of deleting schema versions.
|
|
255
|
+
*/
|
|
256
|
+
export interface DeleteSchemaVersionsResult {
|
|
257
|
+
/**
|
|
258
|
+
* Errors that occurred during deletion, if any.
|
|
259
|
+
*/
|
|
260
|
+
errors: SchemaVersionError[];
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Options for getting a schema version.
|
|
264
|
+
*/
|
|
265
|
+
export interface GetSchemaVersionOptions extends BaseOptions {
|
|
266
|
+
/**
|
|
267
|
+
* The specific version number to retrieve. If not provided, returns the latest version.
|
|
268
|
+
*/
|
|
269
|
+
versionNumber?: number;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Options for getting a schema version by ID.
|
|
273
|
+
*/
|
|
274
|
+
export type GetSchemaVersionByIdOptions = BaseOptions;
|
|
275
|
+
/**
|
|
276
|
+
* Options for listing schema versions.
|
|
277
|
+
*/
|
|
278
|
+
export interface ListSchemaVersionsOptions extends BaseOptions {
|
|
279
|
+
/**
|
|
280
|
+
* Whether to include the schema definition in the response.
|
|
281
|
+
* @defaultValue false
|
|
282
|
+
*/
|
|
283
|
+
includeDefinition?: boolean;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Options for listing registered schemas.
|
|
287
|
+
*/
|
|
288
|
+
export interface ListRegisteredSchemasOptions extends BaseOptions {
|
|
289
|
+
/**
|
|
290
|
+
* Filter by a specific schema version ID.
|
|
291
|
+
*/
|
|
292
|
+
schemaVersionId?: string;
|
|
293
|
+
/**
|
|
294
|
+
* Filter schemas by name prefix.
|
|
295
|
+
*/
|
|
296
|
+
schemaNamePrefix?: string;
|
|
297
|
+
/**
|
|
298
|
+
* Filter schemas by tags.
|
|
299
|
+
*/
|
|
300
|
+
schemaTags?: Record<string, string>;
|
|
301
|
+
/**
|
|
302
|
+
* Whether to include the schema definition in the response.
|
|
303
|
+
* @defaultValue false
|
|
304
|
+
*/
|
|
305
|
+
includeDefinition?: boolean;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Options for checking schema compatibility.
|
|
309
|
+
*/
|
|
310
|
+
export interface CheckSchemaCompatibilityOptions extends BaseOptions {
|
|
311
|
+
/**
|
|
312
|
+
* The schema name to check compatibility against.
|
|
313
|
+
* Either schemaName or schemaVersionId must be provided.
|
|
314
|
+
*/
|
|
315
|
+
schemaName?: string;
|
|
316
|
+
/**
|
|
317
|
+
* The specific schema version ID to check compatibility against.
|
|
318
|
+
* Either schemaName or schemaVersionId must be provided.
|
|
319
|
+
*/
|
|
320
|
+
schemaVersionId?: string;
|
|
321
|
+
/**
|
|
322
|
+
* The data format of the schema definition being checked.
|
|
323
|
+
*/
|
|
324
|
+
dataFormat: SchemaDataFormat;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Result of checking schema compatibility.
|
|
328
|
+
*/
|
|
329
|
+
export type CheckSchemaCompatibilityResult = {
|
|
330
|
+
/**
|
|
331
|
+
* Whether the schema is compatible.
|
|
332
|
+
*/
|
|
333
|
+
isCompatible: true;
|
|
334
|
+
/**
|
|
335
|
+
* The schema version ID that was checked against.
|
|
336
|
+
*/
|
|
337
|
+
schemaVersionId: string;
|
|
338
|
+
} | {
|
|
339
|
+
/**
|
|
340
|
+
* Whether the schema is compatible.
|
|
341
|
+
*/
|
|
342
|
+
isCompatible: false;
|
|
343
|
+
/**
|
|
344
|
+
* The compatibility errors found.
|
|
345
|
+
*/
|
|
346
|
+
errors: SchemaCompatibilityError[];
|
|
347
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/schemaRegistry/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UpdateSchemaOptions } from "./types";
|
|
2
|
+
declare module "../Client" {
|
|
3
|
+
interface Client {
|
|
4
|
+
/**
|
|
5
|
+
* Updates schema metadata (description and/or tags).
|
|
6
|
+
* @param schemaName - The name of the schema to update.
|
|
7
|
+
* @param options - The update options including description and tags to update.
|
|
8
|
+
*/
|
|
9
|
+
updateSchema(schemaName: string, options?: UpdateSchemaOptions): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const field_mask_pb_1 = require("google-protobuf/google/protobuf/field_mask_pb");
|
|
4
|
+
const service_grpc_pb_1 = require("../../generated/kurrentdb/protocols/v2/registry/service_grpc_pb");
|
|
5
|
+
const schemas_pb_1 = require("../../generated/kurrentdb/protocols/v2/registry/schemas_pb");
|
|
6
|
+
const Client_1 = require("../Client");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const utils_2 = require("./utils");
|
|
9
|
+
Client_1.Client.prototype.updateSchema = async function (schemaName, options) {
|
|
10
|
+
const { description, tags, dataFormat, compatibility, ...baseOptions } = options;
|
|
11
|
+
const req = new schemas_pb_1.UpdateSchemaRequest();
|
|
12
|
+
req.setSchemaName(schemaName);
|
|
13
|
+
const details = new schemas_pb_1.SchemaDetails();
|
|
14
|
+
const updatePaths = [];
|
|
15
|
+
// dataFormat and compatibility are required fields but not updated via field mask
|
|
16
|
+
details.setDataFormat((0, utils_2.mapSchemaDataFormatToGrpc)(dataFormat));
|
|
17
|
+
details.setCompatibility((0, utils_2.mapCompatibilityModeToGrpc)(compatibility));
|
|
18
|
+
if (description !== undefined) {
|
|
19
|
+
details.setDescription(description);
|
|
20
|
+
updatePaths.push("details.description");
|
|
21
|
+
}
|
|
22
|
+
if (tags !== undefined) {
|
|
23
|
+
const tagsMap = details.getTagsMap();
|
|
24
|
+
for (const [key, value] of Object.entries(tags)) {
|
|
25
|
+
tagsMap.set(key, value);
|
|
26
|
+
}
|
|
27
|
+
updatePaths.push("details.tags");
|
|
28
|
+
}
|
|
29
|
+
req.setDetails(details);
|
|
30
|
+
if (updatePaths.length > 0) {
|
|
31
|
+
const fieldMask = new field_mask_pb_1.FieldMask();
|
|
32
|
+
fieldMask.setPathsList(updatePaths);
|
|
33
|
+
req.setUpdateMask(fieldMask);
|
|
34
|
+
}
|
|
35
|
+
utils_1.debug.command("updateSchema: %O", {
|
|
36
|
+
schemaName,
|
|
37
|
+
description,
|
|
38
|
+
tags,
|
|
39
|
+
updatePaths,
|
|
40
|
+
options: baseOptions,
|
|
41
|
+
});
|
|
42
|
+
utils_1.debug.command_grpc("updateSchema: %g", req);
|
|
43
|
+
return this.execute(service_grpc_pb_1.SchemaRegistryServiceClient, "updateSchema", (client) => new Promise((resolve, reject) => {
|
|
44
|
+
client.updateSchema(req, ...this.callArguments(baseOptions), (error) => {
|
|
45
|
+
if (error)
|
|
46
|
+
return reject((0, utils_1.convertToCommandError)(error));
|
|
47
|
+
return resolve();
|
|
48
|
+
});
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=updateSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateSchema.js","sourceRoot":"","sources":["../../src/schemaRegistry/updateSchema.ts"],"names":[],"mappings":";;AAAA,iFAA0E;AAE1E,qGAA8G;AAC9G,2FAGoE;AAEpE,sCAAmC;AACnC,oCAAwD;AAGxD,mCAAgF;AAgBhF,eAAM,CAAC,SAAS,CAAC,YAAY,GAAG,KAAK,WAEnC,UAAkB,EAClB,OAA4B;IAE5B,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,WAAW,EAAE,GACpE,OAAO,CAAC;IAEV,MAAM,GAAG,GAAG,IAAI,gCAAmB,EAAE,CAAC;IACtC,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAE9B,MAAM,OAAO,GAAG,IAAI,0BAAiB,EAAE,CAAC;IACxC,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,kFAAkF;IAClF,OAAO,CAAC,aAAa,CAAC,IAAA,iCAAyB,EAAC,UAAU,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,gBAAgB,CAAC,IAAA,kCAA0B,EAAC,aAAa,CAAC,CAAC,CAAC;IAEpE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACpC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACrC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAExB,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,IAAI,yBAAS,EAAE,CAAC;QAClC,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACpC,GAAG,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,aAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE;QAChC,UAAU;QACV,WAAW;QACX,IAAI;QACJ,WAAW;QACX,OAAO,EAAE,WAAW;KACrB,CAAC,CAAC;IACH,aAAK,CAAC,YAAY,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;IAE5C,OAAO,IAAI,CAAC,OAAO,CACjB,6CAA2B,EAC3B,cAAc,EACd,CAAC,MAAM,EAAE,EAAE,CACT,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,MAAM,CAAC,YAAY,CACjB,GAAG,EACH,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAClC,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,KAAK;gBAAE,OAAO,MAAM,CAAC,IAAA,6BAAqB,EAAC,KAAK,CAAC,CAAC,CAAC;YACvD,OAAO,OAAO,EAAE,CAAC;QACnB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CACL,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./mappers";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mappers"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemaRegistry/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb";
|
|
2
|
+
import { SchemaDataFormat as GrpcSchemaDataFormat, CompatibilityMode as GrpcCompatibilityMode } from "../../../generated/kurrentdb/protocols/v2/registry/shared_pb";
|
|
3
|
+
import { Schema as GrpcSchema, SchemaDetails as GrpcSchemaDetails, SchemaVersion as GrpcSchemaVersion, RegisteredSchema as GrpcRegisteredSchema, DeleteSchemaVersionsResponse } from "../../../generated/kurrentdb/protocols/v2/registry/schemas_pb";
|
|
4
|
+
import { SchemaCompatibilityError as GrpcSchemaCompatibilityError } from "../../../generated/kurrentdb/protocols/v2/registry/validation_pb";
|
|
5
|
+
import type { SchemaDataFormat, CompatibilityMode, Schema, SchemaDetails, SchemaVersion, RegisteredSchema, SchemaVersionError, SchemaCompatibilityError } from "../types";
|
|
6
|
+
export declare function mapSchemaDataFormatToGrpc(format: SchemaDataFormat): GrpcSchemaDataFormat;
|
|
7
|
+
export declare function mapGrpcSchemaDataFormat(format: GrpcSchemaDataFormat): SchemaDataFormat;
|
|
8
|
+
export declare function mapCompatibilityModeToGrpc(mode: CompatibilityMode): GrpcCompatibilityMode;
|
|
9
|
+
export declare function mapGrpcCompatibilityMode(mode: GrpcCompatibilityMode): CompatibilityMode;
|
|
10
|
+
export declare function mapGrpcTimestamp(timestamp: Timestamp | undefined): Date | undefined;
|
|
11
|
+
export declare function mapGrpcSchemaDetails(details: GrpcSchemaDetails | undefined): SchemaDetails;
|
|
12
|
+
export declare function mapGrpcSchema(grpcSchema: GrpcSchema): Schema;
|
|
13
|
+
export declare function mapGrpcSchemaVersion(grpcVersion: GrpcSchemaVersion): SchemaVersion;
|
|
14
|
+
export declare function mapGrpcRegisteredSchema(grpcSchema: GrpcRegisteredSchema): RegisteredSchema;
|
|
15
|
+
export declare function mapGrpcSchemaVersionError(error: DeleteSchemaVersionsResponse.SchemaVersionError): SchemaVersionError;
|
|
16
|
+
export declare function mapGrpcSchemaCompatibilityError(error: GrpcSchemaCompatibilityError): SchemaCompatibilityError;
|
|
17
|
+
/**
|
|
18
|
+
* Converts a string or Uint8Array schema definition to Uint8Array.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toSchemaDefinitionBytes(definition: string | Uint8Array): Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a GrpcSchemaDetails from the input parameters.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createGrpcSchemaDetails(details: SchemaDetails): GrpcSchemaDetails;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapSchemaDataFormatToGrpc = mapSchemaDataFormatToGrpc;
|
|
4
|
+
exports.mapGrpcSchemaDataFormat = mapGrpcSchemaDataFormat;
|
|
5
|
+
exports.mapCompatibilityModeToGrpc = mapCompatibilityModeToGrpc;
|
|
6
|
+
exports.mapGrpcCompatibilityMode = mapGrpcCompatibilityMode;
|
|
7
|
+
exports.mapGrpcTimestamp = mapGrpcTimestamp;
|
|
8
|
+
exports.mapGrpcSchemaDetails = mapGrpcSchemaDetails;
|
|
9
|
+
exports.mapGrpcSchema = mapGrpcSchema;
|
|
10
|
+
exports.mapGrpcSchemaVersion = mapGrpcSchemaVersion;
|
|
11
|
+
exports.mapGrpcRegisteredSchema = mapGrpcRegisteredSchema;
|
|
12
|
+
exports.mapGrpcSchemaVersionError = mapGrpcSchemaVersionError;
|
|
13
|
+
exports.mapGrpcSchemaCompatibilityError = mapGrpcSchemaCompatibilityError;
|
|
14
|
+
exports.toSchemaDefinitionBytes = toSchemaDefinitionBytes;
|
|
15
|
+
exports.createGrpcSchemaDetails = createGrpcSchemaDetails;
|
|
16
|
+
const shared_pb_1 = require("../../../generated/kurrentdb/protocols/v2/registry/shared_pb");
|
|
17
|
+
const schemas_pb_1 = require("../../../generated/kurrentdb/protocols/v2/registry/schemas_pb");
|
|
18
|
+
const validation_pb_1 = require("../../../generated/kurrentdb/protocols/v2/registry/validation_pb");
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Enum Mappers
|
|
21
|
+
// ============================================================================
|
|
22
|
+
const schemaDataFormatToGrpc = {
|
|
23
|
+
json: shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_JSON,
|
|
24
|
+
protobuf: shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_PROTOBUF,
|
|
25
|
+
avro: shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_AVRO,
|
|
26
|
+
bytes: shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_BYTES,
|
|
27
|
+
};
|
|
28
|
+
const grpcSchemaDataFormatMap = {
|
|
29
|
+
[shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_UNSPECIFIED]: "bytes",
|
|
30
|
+
[shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_JSON]: "json",
|
|
31
|
+
[shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_PROTOBUF]: "protobuf",
|
|
32
|
+
[shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_AVRO]: "avro",
|
|
33
|
+
[shared_pb_1.SchemaDataFormat.SCHEMA_DATA_FORMAT_BYTES]: "bytes",
|
|
34
|
+
};
|
|
35
|
+
const compatibilityModeToGrpc = {
|
|
36
|
+
backward: shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_BACKWARD,
|
|
37
|
+
forward: shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FORWARD,
|
|
38
|
+
full: shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FULL,
|
|
39
|
+
"backward-all": shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_BACKWARD_ALL,
|
|
40
|
+
"forward-all": shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FORWARD_ALL,
|
|
41
|
+
"full-all": shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FULL_ALL,
|
|
42
|
+
none: shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_NONE,
|
|
43
|
+
};
|
|
44
|
+
const grpcCompatibilityModeMap = {
|
|
45
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_UNSPECIFIED]: "none",
|
|
46
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_BACKWARD]: "backward",
|
|
47
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FORWARD]: "forward",
|
|
48
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FULL]: "full",
|
|
49
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_BACKWARD_ALL]: "backward-all",
|
|
50
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FORWARD_ALL]: "forward-all",
|
|
51
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_FULL_ALL]: "full-all",
|
|
52
|
+
[shared_pb_1.CompatibilityMode.COMPATIBILITY_MODE_NONE]: "none",
|
|
53
|
+
};
|
|
54
|
+
const grpcSchemaCompatibilityErrorKindMap = {
|
|
55
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_UNSPECIFIED]: "unspecified",
|
|
56
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_MISSING_REQUIRED_PROPERTY]: "missing-required-property",
|
|
57
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_INCOMPATIBLE_TYPE_CHANGE]: "incompatible-type-change",
|
|
58
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_OPTIONAL_TO_REQUIRED]: "optional-to-required",
|
|
59
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_NEW_REQUIRED_PROPERTY]: "new-required-property",
|
|
60
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_REMOVED_PROPERTY]: "removed-property",
|
|
61
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_ARRAY_TYPE_INCOMPATIBILITY]: "array-type-incompatibility",
|
|
62
|
+
[validation_pb_1.SchemaCompatibilityErrorKind.SCHEMA_COMPATIBILITY_ERROR_KIND_DATA_FORMAT_MISMATCH]: "data-format-mismatch",
|
|
63
|
+
};
|
|
64
|
+
// ============================================================================
|
|
65
|
+
// Export Enum Conversion Functions
|
|
66
|
+
// ============================================================================
|
|
67
|
+
function mapSchemaDataFormatToGrpc(format) {
|
|
68
|
+
return schemaDataFormatToGrpc[format];
|
|
69
|
+
}
|
|
70
|
+
function mapGrpcSchemaDataFormat(format) {
|
|
71
|
+
return grpcSchemaDataFormatMap[format];
|
|
72
|
+
}
|
|
73
|
+
function mapCompatibilityModeToGrpc(mode) {
|
|
74
|
+
return compatibilityModeToGrpc[mode];
|
|
75
|
+
}
|
|
76
|
+
function mapGrpcCompatibilityMode(mode) {
|
|
77
|
+
return grpcCompatibilityModeMap[mode];
|
|
78
|
+
}
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// Timestamp Mapper
|
|
81
|
+
// ============================================================================
|
|
82
|
+
function mapGrpcTimestamp(timestamp) {
|
|
83
|
+
if (!timestamp)
|
|
84
|
+
return undefined;
|
|
85
|
+
const seconds = timestamp.getSeconds();
|
|
86
|
+
const nanos = timestamp.getNanos();
|
|
87
|
+
return new Date(seconds * 1000 + Math.floor(nanos / 1_000_000));
|
|
88
|
+
}
|
|
89
|
+
// ============================================================================
|
|
90
|
+
// Map Utilities
|
|
91
|
+
// ============================================================================
|
|
92
|
+
function mapToRecord(map) {
|
|
93
|
+
const result = {};
|
|
94
|
+
if (Array.isArray(map)) {
|
|
95
|
+
for (const [key, value] of map) {
|
|
96
|
+
result[key] = value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
map.forEach((value, key) => {
|
|
101
|
+
result[key] = value;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
// ============================================================================
|
|
107
|
+
// Message Mappers
|
|
108
|
+
// ============================================================================
|
|
109
|
+
function mapGrpcSchemaDetails(details) {
|
|
110
|
+
if (!details) {
|
|
111
|
+
return {
|
|
112
|
+
dataFormat: "bytes",
|
|
113
|
+
compatibility: "none",
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
dataFormat: mapGrpcSchemaDataFormat(details.getDataFormat()),
|
|
118
|
+
compatibility: mapGrpcCompatibilityMode(details.getCompatibility()),
|
|
119
|
+
description: details.getDescription(),
|
|
120
|
+
tags: mapToRecord(details.getTagsMap().toArray()),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function mapGrpcSchema(grpcSchema) {
|
|
124
|
+
return {
|
|
125
|
+
schemaName: grpcSchema.getSchemaName(),
|
|
126
|
+
details: mapGrpcSchemaDetails(grpcSchema.getDetails()),
|
|
127
|
+
latestSchemaVersion: grpcSchema.getLatestSchemaVersion(),
|
|
128
|
+
createdAt: mapGrpcTimestamp(grpcSchema.getCreatedAt()),
|
|
129
|
+
updatedAt: mapGrpcTimestamp(grpcSchema.getUpdatedAt()),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function mapGrpcSchemaVersion(grpcVersion) {
|
|
133
|
+
return {
|
|
134
|
+
schemaVersionId: grpcVersion.getSchemaVersionId(),
|
|
135
|
+
versionNumber: grpcVersion.getVersionNumber(),
|
|
136
|
+
schemaDefinition: grpcVersion.getSchemaDefinition_asU8(),
|
|
137
|
+
dataFormat: mapGrpcSchemaDataFormat(grpcVersion.getDataFormat()),
|
|
138
|
+
registeredAt: mapGrpcTimestamp(grpcVersion.getRegisteredAt()),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function mapGrpcRegisteredSchema(grpcSchema) {
|
|
142
|
+
const definition = grpcSchema.getSchemaDefinition_asU8();
|
|
143
|
+
return {
|
|
144
|
+
schemaName: grpcSchema.getSchemaName(),
|
|
145
|
+
schemaVersionId: grpcSchema.getSchemaVersionId(),
|
|
146
|
+
versionNumber: grpcSchema.getVersionNumber(),
|
|
147
|
+
schemaDefinition: definition.length > 0 ? definition : undefined,
|
|
148
|
+
dataFormat: mapGrpcSchemaDataFormat(grpcSchema.getDataFormat()),
|
|
149
|
+
compatibility: mapGrpcCompatibilityMode(grpcSchema.getCompatibility()),
|
|
150
|
+
tags: mapToRecord(grpcSchema.getTagsMap().toArray()),
|
|
151
|
+
registeredAt: mapGrpcTimestamp(grpcSchema.getRegisteredAt()),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function mapGrpcSchemaVersionError(error) {
|
|
155
|
+
return {
|
|
156
|
+
versionNumber: error.getVersionNumber(),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function mapGrpcSchemaCompatibilityError(error) {
|
|
160
|
+
return {
|
|
161
|
+
kind: grpcSchemaCompatibilityErrorKindMap[error.getKind()],
|
|
162
|
+
details: error.getDetails(),
|
|
163
|
+
propertyPath: error.getPropertyPath() || undefined,
|
|
164
|
+
originalType: error.getOriginalType() || undefined,
|
|
165
|
+
newType: error.getNewType() || undefined,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// ============================================================================
|
|
169
|
+
// Input Conversion Utilities
|
|
170
|
+
// ============================================================================
|
|
171
|
+
/**
|
|
172
|
+
* Converts a string or Uint8Array schema definition to Uint8Array.
|
|
173
|
+
*/
|
|
174
|
+
function toSchemaDefinitionBytes(definition) {
|
|
175
|
+
if (typeof definition === "string") {
|
|
176
|
+
return new TextEncoder().encode(definition);
|
|
177
|
+
}
|
|
178
|
+
return definition;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Creates a GrpcSchemaDetails from the input parameters.
|
|
182
|
+
*/
|
|
183
|
+
function createGrpcSchemaDetails(details) {
|
|
184
|
+
const grpcDetails = new schemas_pb_1.SchemaDetails();
|
|
185
|
+
grpcDetails.setDataFormat(mapSchemaDataFormatToGrpc(details.dataFormat));
|
|
186
|
+
grpcDetails.setCompatibility(mapCompatibilityModeToGrpc(details.compatibility));
|
|
187
|
+
if (details.description !== undefined) {
|
|
188
|
+
grpcDetails.setDescription(details.description);
|
|
189
|
+
}
|
|
190
|
+
if (details.tags) {
|
|
191
|
+
const tagsMap = grpcDetails.getTagsMap();
|
|
192
|
+
for (const [key, value] of Object.entries(details.tags)) {
|
|
193
|
+
tagsMap.set(key, value);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return grpcDetails;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=mappers.js.map
|