From f6d7501aefcbbec5e0250f54b520e1224fb15344 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 14:01:25 +0000 Subject: [PATCH 1/2] Initial plan From 83cfc7dfb1f1c6ac82fb1a1fc6808d533bd46b7a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 14:06:10 +0000 Subject: [PATCH 2/2] fix(owrap.ch): correct indentation in getElasticQuery and getK8sRemoteURLArrayFunc Co-authored-by: nmaguiar <11761746+nmaguiar@users.noreply.github.com> --- js/owrap.ch.js | 194 ++++++++++++++++++++++++------------------------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/js/owrap.ch.js b/js/owrap.ch.js index 565bca7ad..0ac92eb56 100755 --- a/js/owrap.ch.js +++ b/js/owrap.ch.js @@ -4465,113 +4465,113 @@ OpenWrap.ch.prototype.utils = { * Returns a query map using aQueryString (using lucene query string (like in Kibana)) to be used on getAll, for example. * */ - getElasticQuery: function(aQueryString) { - _$(aQueryString).isString(); + getElasticQuery: function(aQueryString) { + _$(aQueryString).isString(); - return { - query: { - query_string: { - query: aQueryString - } + return { + query: { + query_string: { + query: aQueryString } - }; - }, + } + }; + }, - /** - * - * ow.ch.utils.getK8sRemoteURLArrayFunc(aOptions) : Function - * Returns a function to be used as aRemoteURLArray in ow.ch.server.peer. It will resolve - * all IP addresses from a Kubernetes DNS name (typically a headless service for deployments) - * using ow.net.getDNS and return an array of remote channel URLs.\ - * \ - * aOptions map entries:\ - * - dnsName (String, mandatory) Kubernetes DNS name to resolve\ - * - recordType (String, optional) DNS record type (defaults to "a")\ - * - dnsServer (String, optional) DNS server to use\ - * - protocol (String, optional) URL protocol (defaults to "http")\ - * - port (Number, optional) Port to use (defaults to local peer port when numeric)\ - * - path (String, optional) URL path (defaults to peer path argument)\ - * - excludeCurrentIP (Boolean, optional) Excludes current instance IP from result (defaults to false)\ - * - currentIP (String, optional) Explicit current instance IP (otherwise uses POD_IP env var or ow.net.getHostAddress())\ - * - urlFn (Function, optional) Custom URL builder fn(ip, ctx)\ - * \ - * Example:\ - * \ - * var peersFn = ow.ch.utils.getK8sRemoteURLArrayFunc({\ - * dnsName: "openaf-peers.default.svc.cluster.local",\ - * protocol: "http",\ - * port: 8090,\ - * path: "/log"\ - * });\ - * ow.ch.server.peer("__log", 8090, "/log", peersFn);\ - * - */ - getK8sRemoteURLArrayFunc: function(aOptions) { - aOptions = _$(aOptions, "aOptions").isMap().default({}); - _$(aOptions.dnsName, "aOptions.dnsName").isString().$_("Please provide aOptions.dnsName."); - - return function(aName, aLocalPortORServer, aPath, aUUID) { - ow.loadNet(); - - var res = []; - var dnsRes = ow.net.getDNS(aOptions.dnsName, aOptions.recordType, aOptions.dnsServer, true); - var dnsArr = isArray(dnsRes) ? dnsRes : [ dnsRes ]; - var protocol = _$(aOptions.protocol).isString().default("http"); - var port = aOptions.port; - var path = _$(aOptions.path).isString().default(aPath); - var excludeCurrentIP = _$(aOptions.excludeCurrentIP).isBoolean().default(false); - var currentIP = _$(aOptions.currentIP).isString().default(__); - - if (isUnDef(port) && isNumber(aLocalPortORServer)) port = aLocalPortORServer; - if (isString(path) && path.length > 0 && path.substring(0, 1) != "/") path = "/" + path; - if (excludeCurrentIP && isUnDef(currentIP) && isDef(getEnv("POD_IP"))) currentIP = String(getEnv("POD_IP")); - if (excludeCurrentIP && isUnDef(currentIP)) { - try { currentIP = String(ow.net.getHostAddress()); } catch(e) {} - } + /** + * + * ow.ch.utils.getK8sRemoteURLArrayFunc(aOptions) : Function + * Returns a function to be used as aRemoteURLArray in ow.ch.server.peer. It will resolve + * all IP addresses from a Kubernetes DNS name (typically a headless service for deployments) + * using ow.net.getDNS and return an array of remote channel URLs.\ + * \ + * aOptions map entries:\ + * - dnsName (String, mandatory) Kubernetes DNS name to resolve\ + * - recordType (String, optional) DNS record type (defaults to "a")\ + * - dnsServer (String, optional) DNS server to use\ + * - protocol (String, optional) URL protocol (defaults to "http")\ + * - port (Number, optional) Port to use (defaults to local peer port when numeric)\ + * - path (String, optional) URL path (defaults to peer path argument)\ + * - excludeCurrentIP (Boolean, optional) Excludes current instance IP from result (defaults to false)\ + * - currentIP (String, optional) Explicit current instance IP (otherwise uses POD_IP env var or ow.net.getHostAddress())\ + * - urlFn (Function, optional) Custom URL builder fn(ip, ctx)\ + * \ + * Example:\ + * \ + * var peersFn = ow.ch.utils.getK8sRemoteURLArrayFunc({\ + * dnsName: "openaf-peers.default.svc.cluster.local",\ + * protocol: "http",\ + * port: 8090,\ + * path: "/log"\ + * });\ + * ow.ch.server.peer("__log", 8090, "/log", peersFn);\ + * + */ + getK8sRemoteURLArrayFunc: function(aOptions) { + aOptions = _$(aOptions, "aOptions").isMap().default({}); + _$(aOptions.dnsName, "aOptions.dnsName").isString().$_("Please provide aOptions.dnsName."); - function _extractIP(aDNSRecord) { - if (isString(aDNSRecord)) return aDNSRecord; - if (isMap(aDNSRecord) && isDef(aDNSRecord.Address)) { - if (isString(aDNSRecord.Address)) return aDNSRecord.Address; - if (isMap(aDNSRecord.Address) && isDef(aDNSRecord.Address.HostAddress)) return aDNSRecord.Address.HostAddress; - } - if (isMap(aDNSRecord) && isString(aDNSRecord.RdataToString)) return aDNSRecord.RdataToString; - return __; - } + return function(aName, aLocalPortORServer, aPath, aUUID) { + ow.loadNet(); - function _mkURL(aIP) { - var host = aIP; - if (isString(aIP) && aIP.indexOf(":") >= 0 && aIP.substring(0, 1) != "[") host = "[" + aIP + "]"; - var u = protocol + "://" + host; - if (isDef(port)) u += ":" + port; - if (isDef(path)) u += path; - return u; + var res = []; + var dnsRes = ow.net.getDNS(aOptions.dnsName, aOptions.recordType, aOptions.dnsServer, true); + var dnsArr = isArray(dnsRes) ? dnsRes : [ dnsRes ]; + var protocol = _$(aOptions.protocol).isString().default("http"); + var port = aOptions.port; + var path = _$(aOptions.path).isString().default(aPath); + var excludeCurrentIP = _$(aOptions.excludeCurrentIP).isBoolean().default(false); + var currentIP = _$(aOptions.currentIP).isString().default(__); + + if (isUnDef(port) && isNumber(aLocalPortORServer)) port = aLocalPortORServer; + if (isString(path) && path.length > 0 && path.substring(0, 1) != "/") path = "/" + path; + if (excludeCurrentIP && isUnDef(currentIP) && isDef(getEnv("POD_IP"))) currentIP = String(getEnv("POD_IP")); + if (excludeCurrentIP && isUnDef(currentIP)) { + try { currentIP = String(ow.net.getHostAddress()); } catch(e) {} + } + + function _extractIP(aDNSRecord) { + if (isString(aDNSRecord)) return aDNSRecord; + if (isMap(aDNSRecord) && isDef(aDNSRecord.Address)) { + if (isString(aDNSRecord.Address)) return aDNSRecord.Address; + if (isMap(aDNSRecord.Address) && isDef(aDNSRecord.Address.HostAddress)) return aDNSRecord.Address.HostAddress; } + if (isMap(aDNSRecord) && isString(aDNSRecord.RdataToString)) return aDNSRecord.RdataToString; + return __; + } - for (var i in dnsArr) { - var ip = _extractIP(dnsArr[i]); - if (isDef(ip)) { - if (excludeCurrentIP && isDef(currentIP) && String(ip) == String(currentIP)) continue; - var u = isFunction(aOptions.urlFn) - ? aOptions.urlFn(ip, { - name: aName, - localPortOrServer: aLocalPortORServer, - path: aPath, - uuid: aUUID, - options: aOptions - }) - : _mkURL(ip); - if (isDef(u)) res.push(u); - } + function _mkURL(aIP) { + var host = aIP; + if (isString(aIP) && aIP.indexOf(":") >= 0 && aIP.substring(0, 1) != "[") host = "[" + aIP + "]"; + var u = protocol + "://" + host; + if (isDef(port)) u += ":" + port; + if (isDef(path)) u += path; + return u; + } + + for (var i in dnsArr) { + var ip = _extractIP(dnsArr[i]); + if (isDef(ip)) { + if (excludeCurrentIP && isDef(currentIP) && String(ip) == String(currentIP)) continue; + var u = isFunction(aOptions.urlFn) + ? aOptions.urlFn(ip, { + name: aName, + localPortOrServer: aLocalPortORServer, + path: aPath, + uuid: aUUID, + options: aOptions + }) + : _mkURL(ip); + if (isDef(u)) res.push(u); } + } - return $from(res).distinct().select(); - }; - }, + return $from(res).distinct().select(); + }; + }, - /** - * - * ow.ch.utils.poolChanges(aCh, idKeys, aChM) + /** + * + * ow.ch.utils.poolChanges(aCh, idKeys, aChM) * When executed pools to find all changes in aCh, using an idKeys array of key map fields, and executing a setAll on aCh for * the changed entries. To compare it stores the last version in a 'aCh + "::chMemory"' channel that can be created with aChM map options * ($ch type and options entries). Usefull to trigger channel subscribed functions when the aCh type doesn't detect automatically changes.