UNPKG

@temporalio/worker

Version:
38 lines 1.49 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDefaultConnectionOptions = getDefaultConnectionOptions; exports.compileConnectionOptions = compileConnectionOptions; const internal_non_workflow_1 = require("@temporalio/common/lib/internal-non-workflow"); const pkg_1 = __importDefault(require("./pkg")); /** * The default Temporal Server's TCP port for public gRPC connections. */ const DEFAULT_TEMPORAL_GRPC_PORT = 7233; function getDefaultConnectionOptions() { return { address: 'localhost:7233', sdkVersion: pkg_1.default.version, }; } function compileConnectionOptions(options) { const { address, ...rest } = options; const proxyOpts = {}; if (options.proxy?.targetHost) { const { targetHost: target, basicAuth } = options.proxy; const { hostname: host, port } = (0, internal_non_workflow_1.parseHttpConnectProxyAddress)(target); proxyOpts.proxy = { type: 'http-connect', targetHost: (0, internal_non_workflow_1.joinProtoHostPort)({ hostname: host, port }), basicAuth, }; } return { ...rest, address: (0, internal_non_workflow_1.normalizeGrpcEndpointAddress)(address, DEFAULT_TEMPORAL_GRPC_PORT), ...proxyOpts, }; } //# sourceMappingURL=connection-options.js.map