rocketmq-client-nodejs-beta
Version:
RocketMQ Node.js Client
47 lines • 3.23 kB
JavaScript
;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserAgent = void 0;
const node_os_1 = __importDefault(require("node:os"));
const node_path_1 = __importDefault(require("node:path"));
const node_fs_1 = require("node:fs");
const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
const VERSION = JSON.parse((0, node_fs_1.readFileSync)(node_path_1.default.join(__dirname, '../../package.json'), 'utf-8')).version;
class UserAgent {
static INSTANCE = new UserAgent(VERSION, node_os_1.default.platform(), node_os_1.default.hostname());
version;
platform;
hostname;
constructor(version, platform, hostname) {
this.version = version;
this.platform = platform;
this.hostname = hostname;
}
toProtobuf() {
return new definition_pb_1.UA()
.setLanguage(definition_pb_1.Language.NODE_JS)
.setVersion(this.version)
.setPlatform(this.platform)
.setHostname(this.hostname);
}
}
exports.UserAgent = UserAgent;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXNlckFnZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaWVudC9Vc2VyQWdlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7Ozs7O0FBRUgsc0RBQXlCO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