ferrum-db-client
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -21,3 +21,4 @@ import { FerrumDBRemote } from './db_remote'; | ||
getDatabaseNames(): Promise<string[]>; | ||
getGrpcAPIVersion(): Promise<string>; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -66,3 +66,3 @@ "use strict"; | ||
async dropDatabase(dbName) { | ||
const msg = new database_server_pb_1.CreateDatabaseRequest(); | ||
const msg = new database_server_pb_1.DropDatabaseRequest(); | ||
msg.setName(dbName); | ||
@@ -90,4 +90,9 @@ const res = await (0, util_1.promisify)(this.client.dropDatabase.bind(this.client), msg); | ||
} | ||
async getGrpcAPIVersion() { | ||
const msg = new shared_pb_1.EmptyRequest(); | ||
const res = await (0, util_1.promisify)(this.client.grpcAPIVersion.bind(this.client), msg); | ||
return res.getVersion(); | ||
} | ||
} | ||
exports.FerrumServerClient = FerrumServerClient; | ||
//# sourceMappingURL=index.js.map |
@@ -63,2 +63,13 @@ // GENERATED CODE -- DO NOT EDIT! | ||
function serialize_GrpcAPIVersionResponse(arg) { | ||
if (!(arg instanceof database_server_pb.GrpcAPIVersionResponse)) { | ||
throw new Error('Expected argument of type GrpcAPIVersionResponse'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_GrpcAPIVersionResponse(buffer_arg) { | ||
return database_server_pb.GrpcAPIVersionResponse.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_HasDatabaseRequest(arg) { | ||
@@ -187,4 +198,15 @@ if (!(arg instanceof database_server_pb.HasDatabaseRequest)) { | ||
}, | ||
grpcAPIVersion: { | ||
path: '/DatabaseServer/GrpcAPIVersion', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: shared_pb.EmptyRequest, | ||
responseType: database_server_pb.GrpcAPIVersionResponse, | ||
requestSerialize: serialize_EmptyRequest, | ||
requestDeserialize: deserialize_EmptyRequest, | ||
responseSerialize: serialize_GrpcAPIVersionResponse, | ||
responseDeserialize: deserialize_GrpcAPIVersionResponse, | ||
}, | ||
}; | ||
exports.DatabaseServerClient = grpc.makeGenericClientConstructor(DatabaseServerService); |
@@ -24,2 +24,3 @@ // source: database_server.proto | ||
goog.exportSymbol('proto.DropDatabaseRequest', null, global); | ||
goog.exportSymbol('proto.GrpcAPIVersionResponse', null, global); | ||
goog.exportSymbol('proto.HasDatabaseRequest', null, global); | ||
@@ -175,2 +176,23 @@ goog.exportSymbol('proto.HasDatabaseResponse', null, global); | ||
} | ||
/** | ||
* Generated by JsPbCodeGenerator. | ||
* @param {Array=} opt_data Optional initial data array, typically from a | ||
* server response, or constructed directly in Javascript. The array is used | ||
* in place and becomes part of the constructed object. It is not cloned. | ||
* If no data is provided, the constructed object will be empty, but still | ||
* valid. | ||
* @extends {jspb.Message} | ||
* @constructor | ||
*/ | ||
proto.GrpcAPIVersionResponse = function(opt_data) { | ||
jspb.Message.initialize(this, opt_data, 0, -1, null, null); | ||
}; | ||
goog.inherits(proto.GrpcAPIVersionResponse, jspb.Message); | ||
if (goog.DEBUG && !COMPILED) { | ||
/** | ||
* @public | ||
* @override | ||
*/ | ||
proto.GrpcAPIVersionResponse.displayName = 'proto.GrpcAPIVersionResponse'; | ||
} | ||
@@ -1208,2 +1230,132 @@ | ||
if (jspb.Message.GENERATE_TO_OBJECT) { | ||
/** | ||
* Creates an object representation of this proto. | ||
* Field names that are reserved in JavaScript and will be renamed to pb_name. | ||
* Optional fields that are not set will be set to undefined. | ||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. | ||
* For the list of reserved names please see: | ||
* net/proto2/compiler/js/internal/generator.cc#kKeyword. | ||
* @param {boolean=} opt_includeInstance Deprecated. whether to include the | ||
* JSPB instance for transitional soy proto support: | ||
* http://goto/soy-param-migration | ||
* @return {!Object} | ||
*/ | ||
proto.GrpcAPIVersionResponse.prototype.toObject = function(opt_includeInstance) { | ||
return proto.GrpcAPIVersionResponse.toObject(opt_includeInstance, this); | ||
}; | ||
/** | ||
* Static version of the {@see toObject} method. | ||
* @param {boolean|undefined} includeInstance Deprecated. Whether to include | ||
* the JSPB instance for transitional soy proto support: | ||
* http://goto/soy-param-migration | ||
* @param {!proto.GrpcAPIVersionResponse} msg The msg instance to transform. | ||
* @return {!Object} | ||
* @suppress {unusedLocalVariables} f is only used for nested messages | ||
*/ | ||
proto.GrpcAPIVersionResponse.toObject = function(includeInstance, msg) { | ||
var f, obj = { | ||
version: jspb.Message.getFieldWithDefault(msg, 1, "") | ||
}; | ||
if (includeInstance) { | ||
obj.$jspbMessageInstance = msg; | ||
} | ||
return obj; | ||
}; | ||
} | ||
/** | ||
* Deserializes binary data (in protobuf wire format). | ||
* @param {jspb.ByteSource} bytes The bytes to deserialize. | ||
* @return {!proto.GrpcAPIVersionResponse} | ||
*/ | ||
proto.GrpcAPIVersionResponse.deserializeBinary = function(bytes) { | ||
var reader = new jspb.BinaryReader(bytes); | ||
var msg = new proto.GrpcAPIVersionResponse; | ||
return proto.GrpcAPIVersionResponse.deserializeBinaryFromReader(msg, reader); | ||
}; | ||
/** | ||
* Deserializes binary data (in protobuf wire format) from the | ||
* given reader into the given message object. | ||
* @param {!proto.GrpcAPIVersionResponse} msg The message object to deserialize into. | ||
* @param {!jspb.BinaryReader} reader The BinaryReader to use. | ||
* @return {!proto.GrpcAPIVersionResponse} | ||
*/ | ||
proto.GrpcAPIVersionResponse.deserializeBinaryFromReader = function(msg, reader) { | ||
while (reader.nextField()) { | ||
if (reader.isEndGroup()) { | ||
break; | ||
} | ||
var field = reader.getFieldNumber(); | ||
switch (field) { | ||
case 1: | ||
var value = /** @type {string} */ (reader.readString()); | ||
msg.setVersion(value); | ||
break; | ||
default: | ||
reader.skipField(); | ||
break; | ||
} | ||
} | ||
return msg; | ||
}; | ||
/** | ||
* Serializes the message to binary data (in protobuf wire format). | ||
* @return {!Uint8Array} | ||
*/ | ||
proto.GrpcAPIVersionResponse.prototype.serializeBinary = function() { | ||
var writer = new jspb.BinaryWriter(); | ||
proto.GrpcAPIVersionResponse.serializeBinaryToWriter(this, writer); | ||
return writer.getResultBuffer(); | ||
}; | ||
/** | ||
* Serializes the given message to binary data (in protobuf wire | ||
* format), writing to the given BinaryWriter. | ||
* @param {!proto.GrpcAPIVersionResponse} message | ||
* @param {!jspb.BinaryWriter} writer | ||
* @suppress {unusedLocalVariables} f is only used for nested messages | ||
*/ | ||
proto.GrpcAPIVersionResponse.serializeBinaryToWriter = function(message, writer) { | ||
var f = undefined; | ||
f = message.getVersion(); | ||
if (f.length > 0) { | ||
writer.writeString( | ||
1, | ||
f | ||
); | ||
} | ||
}; | ||
/** | ||
* optional string version = 1; | ||
* @return {string} | ||
*/ | ||
proto.GrpcAPIVersionResponse.prototype.getVersion = function() { | ||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); | ||
}; | ||
/** | ||
* @param {string} value | ||
* @return {!proto.GrpcAPIVersionResponse} returns this | ||
*/ | ||
proto.GrpcAPIVersionResponse.prototype.setVersion = function(value) { | ||
return jspb.Message.setProto3StringField(this, 1, value); | ||
}; | ||
goog.object.extend(exports, proto); |
{ | ||
"name": "ferrum-db-client", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
import { ChannelCredentials } from '@grpc/grpc-js'; | ||
import { FerrumDBRemote } from './db_remote'; | ||
import { DatabaseServerClient } from './proto/database_server_grpc_pb'; | ||
import { CreateDatabaseRequest, HasDatabaseRequest } from './proto/database_server_pb'; | ||
import { CreateDatabaseRequest, DropDatabaseRequest, HasDatabaseRequest } from './proto/database_server_pb'; | ||
import { EmptyRequest } from './proto/shared_pb'; | ||
@@ -87,3 +87,3 @@ import { CallbackReturnType, promisify } from './util'; | ||
public async dropDatabase(dbName: string): Promise<void> { | ||
const msg = new CreateDatabaseRequest(); | ||
const msg = new DropDatabaseRequest(); | ||
msg.setName(dbName); | ||
@@ -125,2 +125,9 @@ | ||
} | ||
public async getGrpcAPIVersion(): Promise<string> { | ||
const msg = new EmptyRequest(); | ||
const res = await promisify<CallbackReturnType<typeof this.client.grpcAPIVersion>, EmptyRequest>(this.client.grpcAPIVersion.bind(this.client), msg); | ||
return res.getVersion(); | ||
} | ||
} |
@@ -19,2 +19,3 @@ // package: | ||
compactDatabase: IDatabaseServerService_ICompactDatabase; | ||
grpcAPIVersion: IDatabaseServerService_IGrpcAPIVersion; | ||
} | ||
@@ -85,2 +86,11 @@ | ||
} | ||
interface IDatabaseServerService_IGrpcAPIVersion extends grpc.MethodDefinition<shared_pb.EmptyRequest, database_server_pb.GrpcAPIVersionResponse> { | ||
path: "/DatabaseServer/GrpcAPIVersion"; | ||
requestStream: false; | ||
responseStream: false; | ||
requestSerialize: grpc.serialize<shared_pb.EmptyRequest>; | ||
requestDeserialize: grpc.deserialize<shared_pb.EmptyRequest>; | ||
responseSerialize: grpc.serialize<database_server_pb.GrpcAPIVersionResponse>; | ||
responseDeserialize: grpc.deserialize<database_server_pb.GrpcAPIVersionResponse>; | ||
} | ||
@@ -97,2 +107,3 @@ export const DatabaseServerService: IDatabaseServerService; | ||
compactDatabase: grpc.handleUnaryCall<database_server_pb.CompactDatabaseRequest, shared_pb.SuccessResponse>; | ||
grpcAPIVersion: grpc.handleUnaryCall<shared_pb.EmptyRequest, database_server_pb.GrpcAPIVersionResponse>; | ||
} | ||
@@ -122,2 +133,5 @@ | ||
compactDatabase(request: database_server_pb.CompactDatabaseRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: shared_pb.SuccessResponse) => void): grpc.ClientUnaryCall; | ||
grpcAPIVersion(request: shared_pb.EmptyRequest, callback: (error: grpc.ServiceError | null, response: database_server_pb.GrpcAPIVersionResponse) => void): grpc.ClientUnaryCall; | ||
grpcAPIVersion(request: shared_pb.EmptyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: database_server_pb.GrpcAPIVersionResponse) => void): grpc.ClientUnaryCall; | ||
grpcAPIVersion(request: shared_pb.EmptyRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: database_server_pb.GrpcAPIVersionResponse) => void): grpc.ClientUnaryCall; | ||
} | ||
@@ -148,2 +162,5 @@ | ||
public compactDatabase(request: database_server_pb.CompactDatabaseRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: shared_pb.SuccessResponse) => void): grpc.ClientUnaryCall; | ||
public grpcAPIVersion(request: shared_pb.EmptyRequest, callback: (error: grpc.ServiceError | null, response: database_server_pb.GrpcAPIVersionResponse) => void): grpc.ClientUnaryCall; | ||
public grpcAPIVersion(request: shared_pb.EmptyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: database_server_pb.GrpcAPIVersionResponse) => void): grpc.ClientUnaryCall; | ||
public grpcAPIVersion(request: shared_pb.EmptyRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: database_server_pb.GrpcAPIVersionResponse) => void): grpc.ClientUnaryCall; | ||
} |
@@ -163,1 +163,21 @@ // package: | ||
} | ||
export class GrpcAPIVersionResponse extends jspb.Message { | ||
getVersion(): string; | ||
setVersion(value: string): GrpcAPIVersionResponse; | ||
serializeBinary(): Uint8Array; | ||
toObject(includeInstance?: boolean): GrpcAPIVersionResponse.AsObject; | ||
static toObject(includeInstance: boolean, msg: GrpcAPIVersionResponse): GrpcAPIVersionResponse.AsObject; | ||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; | ||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; | ||
static serializeBinaryToWriter(message: GrpcAPIVersionResponse, writer: jspb.BinaryWriter): void; | ||
static deserializeBinary(bytes: Uint8Array): GrpcAPIVersionResponse; | ||
static deserializeBinaryFromReader(message: GrpcAPIVersionResponse, reader: jspb.BinaryReader): GrpcAPIVersionResponse; | ||
} | ||
export namespace GrpcAPIVersionResponse { | ||
export type AsObject = { | ||
version: string, | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1186086
27706