From ff0877b92b7cf4e5003f8b9c9f6a67b0c0b49859 Mon Sep 17 00:00:00 2001 From: jjdiaz <jjdiaz@cttc.es> Date: Mon, 9 Sep 2024 16:27:04 +0200 Subject: [PATCH] Code cleanup --- src/dlt/gateway/Dockerfile | 3 +- src/dlt/gateway/dltApp/proto/context.proto | 48 - .../gateway/dltApp/proto/dlt_service.proto | 97 - .../dltApp/proto/dlt_service_grpc_pb.js | 181 -- .../gateway/dltApp/proto/dlt_service_pb.js | 1633 ----------------- src/dlt/gateway/dltApp/src/dltGateway.js | 2 +- src/dlt/gateway/dltApp/tests/testEvents.js | 2 +- src/dlt/gateway/dltApp/tests/testGateway.js | 2 +- 8 files changed, 5 insertions(+), 1963 deletions(-) delete mode 100644 src/dlt/gateway/dltApp/proto/context.proto delete mode 100644 src/dlt/gateway/dltApp/proto/dlt_service.proto delete mode 100644 src/dlt/gateway/dltApp/proto/dlt_service_grpc_pb.js delete mode 100644 src/dlt/gateway/dltApp/proto/dlt_service_pb.js diff --git a/src/dlt/gateway/Dockerfile b/src/dlt/gateway/Dockerfile index 694cc521f..66b7e0b30 100644 --- a/src/dlt/gateway/Dockerfile +++ b/src/dlt/gateway/Dockerfile @@ -10,7 +10,8 @@ COPY src/dlt/gateway/dltApp/package*.json ./ # Copy tsconfig.json COPY src/dlt/gateway/dltApp/tsconfig*.json ./ # Copy the proto folder -COPY src/dlt/gateway/dltApp/proto/ ./proto +COPY proto/context.proto ./proto +COPY proto/dlt_gateway.proto ./proto # Copy the src folder COPY src/dlt/gateway/dltApp/src/ ./src diff --git a/src/dlt/gateway/dltApp/proto/context.proto b/src/dlt/gateway/dltApp/proto/context.proto deleted file mode 100644 index dccb72dfa..000000000 --- a/src/dlt/gateway/dltApp/proto/context.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -package context; - -message Empty {} - -message Uuid { - string uuid = 1; -} - -enum EventTypeEnum { - EVENTTYPE_UNDEFINED = 0; - EVENTTYPE_CREATE = 1; - EVENTTYPE_UPDATE = 2; - EVENTTYPE_REMOVE = 3; -} - -message Timestamp { - double timestamp = 1; -} - -message Event { - Timestamp timestamp = 1; - EventTypeEnum event_type = 2; -} - -message TeraFlowController { - ContextId context_id = 1; - string ip_address = 2; - uint32 port = 3; -} - -message ContextId { - Uuid context_uuid = 1; -} diff --git a/src/dlt/gateway/dltApp/proto/dlt_service.proto b/src/dlt/gateway/dltApp/proto/dlt_service.proto deleted file mode 100644 index 9f6da08f5..000000000 --- a/src/dlt/gateway/dltApp/proto/dlt_service.proto +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -package dlt; - -import "context.proto"; - -service DltGatewayService { - rpc RecordToDlt (DltRecord ) returns ( DltRecordStatus ) {} - rpc GetFromDlt (DltRecordId ) returns ( DltRecord ) {} - rpc SubscribeToDlt(DltRecordSubscription ) returns (stream DltRecordEvent ) {} - rpc GetDltStatus (context.TeraFlowController) returns ( DltPeerStatus ) {} // NEC is checking if it is possible - rpc GetDltPeers (context.Empty ) returns ( DltPeerStatusList) {} // NEC is checking if it is possible -} - -enum DltRecordTypeEnum { - DLTRECORDTYPE_UNDEFINED = 0; - DLTRECORDTYPE_CONTEXT = 1; - DLTRECORDTYPE_TOPOLOGY = 2; - DLTRECORDTYPE_DEVICE = 3; - DLTRECORDTYPE_LINK = 4; - DLTRECORDTYPE_SERVICE = 5; - DLTRECORDTYPE_SLICE = 6; -} - -enum DltRecordOperationEnum { - DLTRECORDOPERATION_UNDEFINED = 0; - DLTRECORDOPERATION_ADD = 1; - DLTRECORDOPERATION_UPDATE = 2; - DLTRECORDOPERATION_DELETE = 3; -} - -enum DltRecordStatusEnum { - DLTRECORDSTATUS_UNDEFINED = 0; - DLTRECORDSTATUS_SUCCEEDED = 1; - DLTRECORDSTATUS_FAILED = 2; -} - -enum DltStatusEnum { - DLTSTATUS_UNDEFINED = 0; - DLTSTATUS_NOTAVAILABLE = 1; - DLTSTATUS_INITIALIZED = 2; - DLTSTATUS_AVAILABLE = 3; - DLTSTATUS_DEINIT = 4; -} - -message DltRecordId { - context.Uuid domain_uuid = 1; // unique identifier of domain owning the record - DltRecordTypeEnum type = 2; // type of record - context.Uuid record_uuid = 3; // unique identifier of the record within the domain context_uuid/topology_uuid -} - -message DltRecord { - DltRecordId record_id = 1; // record identifier - DltRecordOperationEnum operation = 2; // operation to be performed over the record - string data_json = 3; // record content: JSON-encoded record content -} - -message DltRecordSubscription { - // retrieved events have to match ALL conditions. - // i.e., type in types requested, AND operation in operations requested - // TODO: consider adding a more sophisticated filtering - repeated DltRecordTypeEnum type = 1; // selected event types, empty=all - repeated DltRecordOperationEnum operation = 2; // selected event operations, empty=all -} - -message DltRecordEvent { - context.Event event = 1; // common event data (timestamp & event_type) - DltRecordId record_id = 2; // record identifier associated with this event -} - -message DltRecordStatus { - DltRecordId record_id = 1; // identifier of the associated record - DltRecordStatusEnum status = 2; // status of the record - string error_message = 3; // error message in case of failure, empty otherwise -} - -message DltPeerStatus { - context.TeraFlowController controller = 1; // Identifier of the TeraFlow controller instance - DltStatusEnum status = 2; // Status of the TeraFlow controller instance -} - -message DltPeerStatusList { - repeated DltPeerStatus peers = 1; // List of peers and their status -} diff --git a/src/dlt/gateway/dltApp/proto/dlt_service_grpc_pb.js b/src/dlt/gateway/dltApp/proto/dlt_service_grpc_pb.js deleted file mode 100644 index 85af635c7..000000000 --- a/src/dlt/gateway/dltApp/proto/dlt_service_grpc_pb.js +++ /dev/null @@ -1,181 +0,0 @@ -// GENERATED CODE -- DO NOT EDIT! - -// Original file comments: -// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -'use strict'; -var grpc = require('grpc'); -var dlt_service_pb = require('./dlt_service_pb.js'); -var context_pb = require('./context_pb.js'); - -function serialize_context_Empty(arg) { - if (!(arg instanceof context_pb.Empty)) { - throw new Error('Expected argument of type context.Empty'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_context_Empty(buffer_arg) { - return context_pb.Empty.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_context_TeraFlowController(arg) { - if (!(arg instanceof context_pb.TeraFlowController)) { - throw new Error('Expected argument of type context.TeraFlowController'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_context_TeraFlowController(buffer_arg) { - return context_pb.TeraFlowController.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_dlt_DltPeerStatus(arg) { - if (!(arg instanceof dlt_service_pb.DltPeerStatus)) { - throw new Error('Expected argument of type dlt.DltPeerStatus'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_dlt_DltPeerStatus(buffer_arg) { - return dlt_service_pb.DltPeerStatus.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_dlt_DltPeerStatusList(arg) { - if (!(arg instanceof dlt_service_pb.DltPeerStatusList)) { - throw new Error('Expected argument of type dlt.DltPeerStatusList'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_dlt_DltPeerStatusList(buffer_arg) { - return dlt_service_pb.DltPeerStatusList.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_dlt_DltRecord(arg) { - if (!(arg instanceof dlt_service_pb.DltRecord)) { - throw new Error('Expected argument of type dlt.DltRecord'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_dlt_DltRecord(buffer_arg) { - return dlt_service_pb.DltRecord.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_dlt_DltRecordEvent(arg) { - if (!(arg instanceof dlt_service_pb.DltRecordEvent)) { - throw new Error('Expected argument of type dlt.DltRecordEvent'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_dlt_DltRecordEvent(buffer_arg) { - return dlt_service_pb.DltRecordEvent.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_dlt_DltRecordId(arg) { - if (!(arg instanceof dlt_service_pb.DltRecordId)) { - throw new Error('Expected argument of type dlt.DltRecordId'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_dlt_DltRecordId(buffer_arg) { - return dlt_service_pb.DltRecordId.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_dlt_DltRecordStatus(arg) { - if (!(arg instanceof dlt_service_pb.DltRecordStatus)) { - throw new Error('Expected argument of type dlt.DltRecordStatus'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_dlt_DltRecordStatus(buffer_arg) { - return dlt_service_pb.DltRecordStatus.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_dlt_DltRecordSubscription(arg) { - if (!(arg instanceof dlt_service_pb.DltRecordSubscription)) { - throw new Error('Expected argument of type dlt.DltRecordSubscription'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_dlt_DltRecordSubscription(buffer_arg) { - return dlt_service_pb.DltRecordSubscription.deserializeBinary(new Uint8Array(buffer_arg)); -} - - -var DltGatewayServiceService = exports.DltGatewayServiceService = { - recordToDlt: { - path: '/dlt.DltGatewayService/RecordToDlt', - requestStream: false, - responseStream: false, - requestType: dlt_service_pb.DltRecord, - responseType: dlt_service_pb.DltRecordStatus, - requestSerialize: serialize_dlt_DltRecord, - requestDeserialize: deserialize_dlt_DltRecord, - responseSerialize: serialize_dlt_DltRecordStatus, - responseDeserialize: deserialize_dlt_DltRecordStatus, - }, - getFromDlt: { - path: '/dlt.DltGatewayService/GetFromDlt', - requestStream: false, - responseStream: false, - requestType: dlt_service_pb.DltRecordId, - responseType: dlt_service_pb.DltRecord, - requestSerialize: serialize_dlt_DltRecordId, - requestDeserialize: deserialize_dlt_DltRecordId, - responseSerialize: serialize_dlt_DltRecord, - responseDeserialize: deserialize_dlt_DltRecord, - }, - subscribeToDlt: { - path: '/dlt.DltGatewayService/SubscribeToDlt', - requestStream: false, - responseStream: true, - requestType: dlt_service_pb.DltRecordSubscription, - responseType: dlt_service_pb.DltRecordEvent, - requestSerialize: serialize_dlt_DltRecordSubscription, - requestDeserialize: deserialize_dlt_DltRecordSubscription, - responseSerialize: serialize_dlt_DltRecordEvent, - responseDeserialize: deserialize_dlt_DltRecordEvent, - }, - getDltStatus: { - path: '/dlt.DltGatewayService/GetDltStatus', - requestStream: false, - responseStream: false, - requestType: context_pb.TeraFlowController, - responseType: dlt_service_pb.DltPeerStatus, - requestSerialize: serialize_context_TeraFlowController, - requestDeserialize: deserialize_context_TeraFlowController, - responseSerialize: serialize_dlt_DltPeerStatus, - responseDeserialize: deserialize_dlt_DltPeerStatus, - }, - getDltPeers: { - path: '/dlt.DltGatewayService/GetDltPeers', - requestStream: false, - responseStream: false, - requestType: context_pb.Empty, - responseType: dlt_service_pb.DltPeerStatusList, - requestSerialize: serialize_context_Empty, - requestDeserialize: deserialize_context_Empty, - responseSerialize: serialize_dlt_DltPeerStatusList, - responseDeserialize: deserialize_dlt_DltPeerStatusList, - }, -}; - -exports.DltGatewayServiceClient = grpc.makeGenericClientConstructor(DltGatewayServiceService); diff --git a/src/dlt/gateway/dltApp/proto/dlt_service_pb.js b/src/dlt/gateway/dltApp/proto/dlt_service_pb.js deleted file mode 100644 index 59782ff7a..000000000 --- a/src/dlt/gateway/dltApp/proto/dlt_service_pb.js +++ /dev/null @@ -1,1633 +0,0 @@ -// source: dlt_service.proto -/** - * @fileoverview - * @enhanceable - * @suppress {missingRequire} reports error on implicit type usages. - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! -/* eslint-disable */ -// @ts-nocheck - -var jspb = require('google-protobuf'); -var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } - return Function('return this')(); -}.call(null)); - -var context_pb = require('./context_pb.js'); -goog.object.extend(proto, context_pb); -goog.exportSymbol('proto.dlt.DltPeerStatus', null, global); -goog.exportSymbol('proto.dlt.DltPeerStatusList', null, global); -goog.exportSymbol('proto.dlt.DltRecord', null, global); -goog.exportSymbol('proto.dlt.DltRecordEvent', null, global); -goog.exportSymbol('proto.dlt.DltRecordId', null, global); -goog.exportSymbol('proto.dlt.DltRecordOperationEnum', null, global); -goog.exportSymbol('proto.dlt.DltRecordStatus', null, global); -goog.exportSymbol('proto.dlt.DltRecordStatusEnum', null, global); -goog.exportSymbol('proto.dlt.DltRecordSubscription', null, global); -goog.exportSymbol('proto.dlt.DltRecordTypeEnum', null, global); -goog.exportSymbol('proto.dlt.DltStatusEnum', 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.dlt.DltRecordId = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.dlt.DltRecordId, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.dlt.DltRecordId.displayName = 'proto.dlt.DltRecordId'; -} -/** - * 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.dlt.DltRecord = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.dlt.DltRecord, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.dlt.DltRecord.displayName = 'proto.dlt.DltRecord'; -} -/** - * 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.dlt.DltRecordSubscription = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.dlt.DltRecordSubscription.repeatedFields_, null); -}; -goog.inherits(proto.dlt.DltRecordSubscription, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.dlt.DltRecordSubscription.displayName = 'proto.dlt.DltRecordSubscription'; -} -/** - * 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.dlt.DltRecordEvent = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.dlt.DltRecordEvent, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.dlt.DltRecordEvent.displayName = 'proto.dlt.DltRecordEvent'; -} -/** - * 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.dlt.DltRecordStatus = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.dlt.DltRecordStatus, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.dlt.DltRecordStatus.displayName = 'proto.dlt.DltRecordStatus'; -} -/** - * 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.dlt.DltPeerStatus = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.dlt.DltPeerStatus, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.dlt.DltPeerStatus.displayName = 'proto.dlt.DltPeerStatus'; -} -/** - * 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.dlt.DltPeerStatusList = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.dlt.DltPeerStatusList.repeatedFields_, null); -}; -goog.inherits(proto.dlt.DltPeerStatusList, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.dlt.DltPeerStatusList.displayName = 'proto.dlt.DltPeerStatusList'; -} - - - -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.dlt.DltRecordId.prototype.toObject = function(opt_includeInstance) { - return proto.dlt.DltRecordId.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.dlt.DltRecordId} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordId.toObject = function(includeInstance, msg) { - var f, obj = { - domainUuid: (f = msg.getDomainUuid()) && context_pb.Uuid.toObject(includeInstance, f), - type: jspb.Message.getFieldWithDefault(msg, 2, 0), - recordUuid: (f = msg.getRecordUuid()) && context_pb.Uuid.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.dlt.DltRecordId} - */ -proto.dlt.DltRecordId.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.dlt.DltRecordId; - return proto.dlt.DltRecordId.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.dlt.DltRecordId} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.dlt.DltRecordId} - */ -proto.dlt.DltRecordId.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new context_pb.Uuid; - reader.readMessage(value,context_pb.Uuid.deserializeBinaryFromReader); - msg.setDomainUuid(value); - break; - case 2: - var value = /** @type {!proto.dlt.DltRecordTypeEnum} */ (reader.readEnum()); - msg.setType(value); - break; - case 3: - var value = new context_pb.Uuid; - reader.readMessage(value,context_pb.Uuid.deserializeBinaryFromReader); - msg.setRecordUuid(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.dlt.DltRecordId.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.dlt.DltRecordId.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.dlt.DltRecordId} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordId.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getDomainUuid(); - if (f != null) { - writer.writeMessage( - 1, - f, - context_pb.Uuid.serializeBinaryToWriter - ); - } - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } - f = message.getRecordUuid(); - if (f != null) { - writer.writeMessage( - 3, - f, - context_pb.Uuid.serializeBinaryToWriter - ); - } -}; - - -/** - * optional context.Uuid domain_uuid = 1; - * @return {?proto.context.Uuid} - */ -proto.dlt.DltRecordId.prototype.getDomainUuid = function() { - return /** @type{?proto.context.Uuid} */ ( - jspb.Message.getWrapperField(this, context_pb.Uuid, 1)); -}; - - -/** - * @param {?proto.context.Uuid|undefined} value - * @return {!proto.dlt.DltRecordId} returns this -*/ -proto.dlt.DltRecordId.prototype.setDomainUuid = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.dlt.DltRecordId} returns this - */ -proto.dlt.DltRecordId.prototype.clearDomainUuid = function() { - return this.setDomainUuid(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.dlt.DltRecordId.prototype.hasDomainUuid = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional DltRecordTypeEnum type = 2; - * @return {!proto.dlt.DltRecordTypeEnum} - */ -proto.dlt.DltRecordId.prototype.getType = function() { - return /** @type {!proto.dlt.DltRecordTypeEnum} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {!proto.dlt.DltRecordTypeEnum} value - * @return {!proto.dlt.DltRecordId} returns this - */ -proto.dlt.DltRecordId.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); -}; - - -/** - * optional context.Uuid record_uuid = 3; - * @return {?proto.context.Uuid} - */ -proto.dlt.DltRecordId.prototype.getRecordUuid = function() { - return /** @type{?proto.context.Uuid} */ ( - jspb.Message.getWrapperField(this, context_pb.Uuid, 3)); -}; - - -/** - * @param {?proto.context.Uuid|undefined} value - * @return {!proto.dlt.DltRecordId} returns this -*/ -proto.dlt.DltRecordId.prototype.setRecordUuid = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.dlt.DltRecordId} returns this - */ -proto.dlt.DltRecordId.prototype.clearRecordUuid = function() { - return this.setRecordUuid(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.dlt.DltRecordId.prototype.hasRecordUuid = function() { - return jspb.Message.getField(this, 3) != null; -}; - - - - - -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.dlt.DltRecord.prototype.toObject = function(opt_includeInstance) { - return proto.dlt.DltRecord.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.dlt.DltRecord} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecord.toObject = function(includeInstance, msg) { - var f, obj = { - recordId: (f = msg.getRecordId()) && proto.dlt.DltRecordId.toObject(includeInstance, f), - operation: jspb.Message.getFieldWithDefault(msg, 2, 0), - dataJson: jspb.Message.getFieldWithDefault(msg, 3, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.dlt.DltRecord} - */ -proto.dlt.DltRecord.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.dlt.DltRecord; - return proto.dlt.DltRecord.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.dlt.DltRecord} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.dlt.DltRecord} - */ -proto.dlt.DltRecord.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.dlt.DltRecordId; - reader.readMessage(value,proto.dlt.DltRecordId.deserializeBinaryFromReader); - msg.setRecordId(value); - break; - case 2: - var value = /** @type {!proto.dlt.DltRecordOperationEnum} */ (reader.readEnum()); - msg.setOperation(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setDataJson(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.dlt.DltRecord.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.dlt.DltRecord.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.dlt.DltRecord} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecord.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getRecordId(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.dlt.DltRecordId.serializeBinaryToWriter - ); - } - f = message.getOperation(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } - f = message.getDataJson(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } -}; - - -/** - * optional DltRecordId record_id = 1; - * @return {?proto.dlt.DltRecordId} - */ -proto.dlt.DltRecord.prototype.getRecordId = function() { - return /** @type{?proto.dlt.DltRecordId} */ ( - jspb.Message.getWrapperField(this, proto.dlt.DltRecordId, 1)); -}; - - -/** - * @param {?proto.dlt.DltRecordId|undefined} value - * @return {!proto.dlt.DltRecord} returns this -*/ -proto.dlt.DltRecord.prototype.setRecordId = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.dlt.DltRecord} returns this - */ -proto.dlt.DltRecord.prototype.clearRecordId = function() { - return this.setRecordId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.dlt.DltRecord.prototype.hasRecordId = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional DltRecordOperationEnum operation = 2; - * @return {!proto.dlt.DltRecordOperationEnum} - */ -proto.dlt.DltRecord.prototype.getOperation = function() { - return /** @type {!proto.dlt.DltRecordOperationEnum} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {!proto.dlt.DltRecordOperationEnum} value - * @return {!proto.dlt.DltRecord} returns this - */ -proto.dlt.DltRecord.prototype.setOperation = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); -}; - - -/** - * optional string data_json = 3; - * @return {string} - */ -proto.dlt.DltRecord.prototype.getDataJson = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.dlt.DltRecord} returns this - */ -proto.dlt.DltRecord.prototype.setDataJson = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array<number>} - * @const - */ -proto.dlt.DltRecordSubscription.repeatedFields_ = [1,2]; - - - -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.dlt.DltRecordSubscription.prototype.toObject = function(opt_includeInstance) { - return proto.dlt.DltRecordSubscription.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.dlt.DltRecordSubscription} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordSubscription.toObject = function(includeInstance, msg) { - var f, obj = { - typeList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f, - operationList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.dlt.DltRecordSubscription} - */ -proto.dlt.DltRecordSubscription.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.dlt.DltRecordSubscription; - return proto.dlt.DltRecordSubscription.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.dlt.DltRecordSubscription} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.dlt.DltRecordSubscription} - */ -proto.dlt.DltRecordSubscription.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var values = /** @type {!Array<!proto.dlt.DltRecordTypeEnum>} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); - for (var i = 0; i < values.length; i++) { - msg.addType(values[i]); - } - break; - case 2: - var values = /** @type {!Array<!proto.dlt.DltRecordOperationEnum>} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); - for (var i = 0; i < values.length; i++) { - msg.addOperation(values[i]); - } - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.dlt.DltRecordSubscription.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.dlt.DltRecordSubscription.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.dlt.DltRecordSubscription} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordSubscription.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getTypeList(); - if (f.length > 0) { - writer.writePackedEnum( - 1, - f - ); - } - f = message.getOperationList(); - if (f.length > 0) { - writer.writePackedEnum( - 2, - f - ); - } -}; - - -/** - * repeated DltRecordTypeEnum type = 1; - * @return {!Array<!proto.dlt.DltRecordTypeEnum>} - */ -proto.dlt.DltRecordSubscription.prototype.getTypeList = function() { - return /** @type {!Array<!proto.dlt.DltRecordTypeEnum>} */ (jspb.Message.getRepeatedField(this, 1)); -}; - - -/** - * @param {!Array<!proto.dlt.DltRecordTypeEnum>} value - * @return {!proto.dlt.DltRecordSubscription} returns this - */ -proto.dlt.DltRecordSubscription.prototype.setTypeList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {!proto.dlt.DltRecordTypeEnum} value - * @param {number=} opt_index - * @return {!proto.dlt.DltRecordSubscription} returns this - */ -proto.dlt.DltRecordSubscription.prototype.addType = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.dlt.DltRecordSubscription} returns this - */ -proto.dlt.DltRecordSubscription.prototype.clearTypeList = function() { - return this.setTypeList([]); -}; - - -/** - * repeated DltRecordOperationEnum operation = 2; - * @return {!Array<!proto.dlt.DltRecordOperationEnum>} - */ -proto.dlt.DltRecordSubscription.prototype.getOperationList = function() { - return /** @type {!Array<!proto.dlt.DltRecordOperationEnum>} */ (jspb.Message.getRepeatedField(this, 2)); -}; - - -/** - * @param {!Array<!proto.dlt.DltRecordOperationEnum>} value - * @return {!proto.dlt.DltRecordSubscription} returns this - */ -proto.dlt.DltRecordSubscription.prototype.setOperationList = function(value) { - return jspb.Message.setField(this, 2, value || []); -}; - - -/** - * @param {!proto.dlt.DltRecordOperationEnum} value - * @param {number=} opt_index - * @return {!proto.dlt.DltRecordSubscription} returns this - */ -proto.dlt.DltRecordSubscription.prototype.addOperation = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 2, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.dlt.DltRecordSubscription} returns this - */ -proto.dlt.DltRecordSubscription.prototype.clearOperationList = function() { - return this.setOperationList([]); -}; - - - - - -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.dlt.DltRecordEvent.prototype.toObject = function(opt_includeInstance) { - return proto.dlt.DltRecordEvent.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.dlt.DltRecordEvent} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordEvent.toObject = function(includeInstance, msg) { - var f, obj = { - event: (f = msg.getEvent()) && context_pb.Event.toObject(includeInstance, f), - recordId: (f = msg.getRecordId()) && proto.dlt.DltRecordId.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.dlt.DltRecordEvent} - */ -proto.dlt.DltRecordEvent.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.dlt.DltRecordEvent; - return proto.dlt.DltRecordEvent.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.dlt.DltRecordEvent} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.dlt.DltRecordEvent} - */ -proto.dlt.DltRecordEvent.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new context_pb.Event; - reader.readMessage(value,context_pb.Event.deserializeBinaryFromReader); - msg.setEvent(value); - break; - case 2: - var value = new proto.dlt.DltRecordId; - reader.readMessage(value,proto.dlt.DltRecordId.deserializeBinaryFromReader); - msg.setRecordId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.dlt.DltRecordEvent.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.dlt.DltRecordEvent.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.dlt.DltRecordEvent} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordEvent.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getEvent(); - if (f != null) { - writer.writeMessage( - 1, - f, - context_pb.Event.serializeBinaryToWriter - ); - } - f = message.getRecordId(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.dlt.DltRecordId.serializeBinaryToWriter - ); - } -}; - - -/** - * optional context.Event event = 1; - * @return {?proto.context.Event} - */ -proto.dlt.DltRecordEvent.prototype.getEvent = function() { - return /** @type{?proto.context.Event} */ ( - jspb.Message.getWrapperField(this, context_pb.Event, 1)); -}; - - -/** - * @param {?proto.context.Event|undefined} value - * @return {!proto.dlt.DltRecordEvent} returns this -*/ -proto.dlt.DltRecordEvent.prototype.setEvent = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.dlt.DltRecordEvent} returns this - */ -proto.dlt.DltRecordEvent.prototype.clearEvent = function() { - return this.setEvent(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.dlt.DltRecordEvent.prototype.hasEvent = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional DltRecordId record_id = 2; - * @return {?proto.dlt.DltRecordId} - */ -proto.dlt.DltRecordEvent.prototype.getRecordId = function() { - return /** @type{?proto.dlt.DltRecordId} */ ( - jspb.Message.getWrapperField(this, proto.dlt.DltRecordId, 2)); -}; - - -/** - * @param {?proto.dlt.DltRecordId|undefined} value - * @return {!proto.dlt.DltRecordEvent} returns this -*/ -proto.dlt.DltRecordEvent.prototype.setRecordId = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.dlt.DltRecordEvent} returns this - */ -proto.dlt.DltRecordEvent.prototype.clearRecordId = function() { - return this.setRecordId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.dlt.DltRecordEvent.prototype.hasRecordId = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -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.dlt.DltRecordStatus.prototype.toObject = function(opt_includeInstance) { - return proto.dlt.DltRecordStatus.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.dlt.DltRecordStatus} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordStatus.toObject = function(includeInstance, msg) { - var f, obj = { - recordId: (f = msg.getRecordId()) && proto.dlt.DltRecordId.toObject(includeInstance, f), - status: jspb.Message.getFieldWithDefault(msg, 2, 0), - errorMessage: jspb.Message.getFieldWithDefault(msg, 3, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.dlt.DltRecordStatus} - */ -proto.dlt.DltRecordStatus.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.dlt.DltRecordStatus; - return proto.dlt.DltRecordStatus.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.dlt.DltRecordStatus} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.dlt.DltRecordStatus} - */ -proto.dlt.DltRecordStatus.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.dlt.DltRecordId; - reader.readMessage(value,proto.dlt.DltRecordId.deserializeBinaryFromReader); - msg.setRecordId(value); - break; - case 2: - var value = /** @type {!proto.dlt.DltRecordStatusEnum} */ (reader.readEnum()); - msg.setStatus(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setErrorMessage(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.dlt.DltRecordStatus.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.dlt.DltRecordStatus.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.dlt.DltRecordStatus} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltRecordStatus.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getRecordId(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.dlt.DltRecordId.serializeBinaryToWriter - ); - } - f = message.getStatus(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } - f = message.getErrorMessage(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } -}; - - -/** - * optional DltRecordId record_id = 1; - * @return {?proto.dlt.DltRecordId} - */ -proto.dlt.DltRecordStatus.prototype.getRecordId = function() { - return /** @type{?proto.dlt.DltRecordId} */ ( - jspb.Message.getWrapperField(this, proto.dlt.DltRecordId, 1)); -}; - - -/** - * @param {?proto.dlt.DltRecordId|undefined} value - * @return {!proto.dlt.DltRecordStatus} returns this -*/ -proto.dlt.DltRecordStatus.prototype.setRecordId = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.dlt.DltRecordStatus} returns this - */ -proto.dlt.DltRecordStatus.prototype.clearRecordId = function() { - return this.setRecordId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.dlt.DltRecordStatus.prototype.hasRecordId = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional DltRecordStatusEnum status = 2; - * @return {!proto.dlt.DltRecordStatusEnum} - */ -proto.dlt.DltRecordStatus.prototype.getStatus = function() { - return /** @type {!proto.dlt.DltRecordStatusEnum} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {!proto.dlt.DltRecordStatusEnum} value - * @return {!proto.dlt.DltRecordStatus} returns this - */ -proto.dlt.DltRecordStatus.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); -}; - - -/** - * optional string error_message = 3; - * @return {string} - */ -proto.dlt.DltRecordStatus.prototype.getErrorMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.dlt.DltRecordStatus} returns this - */ -proto.dlt.DltRecordStatus.prototype.setErrorMessage = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - - - - -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.dlt.DltPeerStatus.prototype.toObject = function(opt_includeInstance) { - return proto.dlt.DltPeerStatus.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.dlt.DltPeerStatus} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltPeerStatus.toObject = function(includeInstance, msg) { - var f, obj = { - controller: (f = msg.getController()) && context_pb.TeraFlowController.toObject(includeInstance, f), - status: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.dlt.DltPeerStatus} - */ -proto.dlt.DltPeerStatus.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.dlt.DltPeerStatus; - return proto.dlt.DltPeerStatus.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.dlt.DltPeerStatus} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.dlt.DltPeerStatus} - */ -proto.dlt.DltPeerStatus.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new context_pb.TeraFlowController; - reader.readMessage(value,context_pb.TeraFlowController.deserializeBinaryFromReader); - msg.setController(value); - break; - case 2: - var value = /** @type {!proto.dlt.DltStatusEnum} */ (reader.readEnum()); - msg.setStatus(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.dlt.DltPeerStatus.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.dlt.DltPeerStatus.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.dlt.DltPeerStatus} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltPeerStatus.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getController(); - if (f != null) { - writer.writeMessage( - 1, - f, - context_pb.TeraFlowController.serializeBinaryToWriter - ); - } - f = message.getStatus(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } -}; - - -/** - * optional context.TeraFlowController controller = 1; - * @return {?proto.context.TeraFlowController} - */ -proto.dlt.DltPeerStatus.prototype.getController = function() { - return /** @type{?proto.context.TeraFlowController} */ ( - jspb.Message.getWrapperField(this, context_pb.TeraFlowController, 1)); -}; - - -/** - * @param {?proto.context.TeraFlowController|undefined} value - * @return {!proto.dlt.DltPeerStatus} returns this -*/ -proto.dlt.DltPeerStatus.prototype.setController = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.dlt.DltPeerStatus} returns this - */ -proto.dlt.DltPeerStatus.prototype.clearController = function() { - return this.setController(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.dlt.DltPeerStatus.prototype.hasController = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional DltStatusEnum status = 2; - * @return {!proto.dlt.DltStatusEnum} - */ -proto.dlt.DltPeerStatus.prototype.getStatus = function() { - return /** @type {!proto.dlt.DltStatusEnum} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {!proto.dlt.DltStatusEnum} value - * @return {!proto.dlt.DltPeerStatus} returns this - */ -proto.dlt.DltPeerStatus.prototype.setStatus = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array<number>} - * @const - */ -proto.dlt.DltPeerStatusList.repeatedFields_ = [1]; - - - -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.dlt.DltPeerStatusList.prototype.toObject = function(opt_includeInstance) { - return proto.dlt.DltPeerStatusList.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.dlt.DltPeerStatusList} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltPeerStatusList.toObject = function(includeInstance, msg) { - var f, obj = { - peersList: jspb.Message.toObjectList(msg.getPeersList(), - proto.dlt.DltPeerStatus.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.dlt.DltPeerStatusList} - */ -proto.dlt.DltPeerStatusList.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.dlt.DltPeerStatusList; - return proto.dlt.DltPeerStatusList.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.dlt.DltPeerStatusList} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.dlt.DltPeerStatusList} - */ -proto.dlt.DltPeerStatusList.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.dlt.DltPeerStatus; - reader.readMessage(value,proto.dlt.DltPeerStatus.deserializeBinaryFromReader); - msg.addPeers(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.dlt.DltPeerStatusList.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.dlt.DltPeerStatusList.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.dlt.DltPeerStatusList} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.dlt.DltPeerStatusList.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPeersList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.dlt.DltPeerStatus.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated DltPeerStatus peers = 1; - * @return {!Array<!proto.dlt.DltPeerStatus>} - */ -proto.dlt.DltPeerStatusList.prototype.getPeersList = function() { - return /** @type{!Array<!proto.dlt.DltPeerStatus>} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.dlt.DltPeerStatus, 1)); -}; - - -/** - * @param {!Array<!proto.dlt.DltPeerStatus>} value - * @return {!proto.dlt.DltPeerStatusList} returns this -*/ -proto.dlt.DltPeerStatusList.prototype.setPeersList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.dlt.DltPeerStatus=} opt_value - * @param {number=} opt_index - * @return {!proto.dlt.DltPeerStatus} - */ -proto.dlt.DltPeerStatusList.prototype.addPeers = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.dlt.DltPeerStatus, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.dlt.DltPeerStatusList} returns this - */ -proto.dlt.DltPeerStatusList.prototype.clearPeersList = function() { - return this.setPeersList([]); -}; - - -/** - * @enum {number} - */ -proto.dlt.DltRecordTypeEnum = { - DLTRECORDTYPE_UNDEFINED: 0, - DLTRECORDTYPE_CONTEXT: 1, - DLTRECORDTYPE_TOPOLOGY: 2, - DLTRECORDTYPE_DEVICE: 3, - DLTRECORDTYPE_LINK: 4, - DLTRECORDTYPE_SERVICE: 5, - DLTRECORDTYPE_SLICE: 6 -}; - -/** - * @enum {number} - */ -proto.dlt.DltRecordOperationEnum = { - DLTRECORDOPERATION_UNDEFINED: 0, - DLTRECORDOPERATION_ADD: 1, - DLTRECORDOPERATION_UPDATE: 2, - DLTRECORDOPERATION_DELETE: 3 -}; - -/** - * @enum {number} - */ -proto.dlt.DltRecordStatusEnum = { - DLTRECORDSTATUS_UNDEFINED: 0, - DLTRECORDSTATUS_SUCCEEDED: 1, - DLTRECORDSTATUS_FAILED: 2 -}; - -/** - * @enum {number} - */ -proto.dlt.DltStatusEnum = { - DLTSTATUS_UNDEFINED: 0, - DLTSTATUS_NOTAVAILABLE: 1, - DLTSTATUS_INITIALIZED: 2, - DLTSTATUS_AVAILABLE: 3, - DLTSTATUS_DEINIT: 4 -}; - -goog.object.extend(exports, proto.dlt); diff --git a/src/dlt/gateway/dltApp/src/dltGateway.js b/src/dlt/gateway/dltApp/src/dltGateway.js index 374be6464..656397dc8 100644 --- a/src/dlt/gateway/dltApp/src/dltGateway.js +++ b/src/dlt/gateway/dltApp/src/dltGateway.js @@ -20,7 +20,7 @@ const { connectToNetwork } = require('../dist/fabricConnect'); const utf8Decoder = new TextDecoder(); // Load the protocol buffer definitions -const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_service.proto'); +const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_gateway.proto'); const packageDefinition = protoLoader.loadSync(PROTO_PATH, { keepCase: true, longs: String, diff --git a/src/dlt/gateway/dltApp/tests/testEvents.js b/src/dlt/gateway/dltApp/tests/testEvents.js index 2590d40d4..d788f04e1 100644 --- a/src/dlt/gateway/dltApp/tests/testEvents.js +++ b/src/dlt/gateway/dltApp/tests/testEvents.js @@ -17,7 +17,7 @@ const grpc = require('@grpc/grpc-js'); const protoLoader = require('@grpc/proto-loader'); const path = require('path'); -const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_service.proto'); +const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_gateway.proto'); const packageDefinition = protoLoader.loadSync(PROTO_PATH, { keepCase: true, longs: String, diff --git a/src/dlt/gateway/dltApp/tests/testGateway.js b/src/dlt/gateway/dltApp/tests/testGateway.js index 778c0f909..099837567 100644 --- a/src/dlt/gateway/dltApp/tests/testGateway.js +++ b/src/dlt/gateway/dltApp/tests/testGateway.js @@ -20,7 +20,7 @@ const fs = require('fs').promises; const { v4: uuidv4 } = require('uuid'); // Import the UUID library -const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_service.proto'); +const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_gateway.proto'); const packageDefinition = protoLoader.loadSync(PROTO_PATH, { keepCase: true, longs: String, -- GitLab