@orxataguy/tyr 1.0.50 → 1.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orxataguy/tyr",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "tyr": "./bin/tyr.js"
@@ -50,51 +50,6 @@ export class SQLManager {
50
50
  return result.recordset;
51
51
  }
52
52
 
53
- /**
54
- * @method searchBrokerOnDB
55
- * @description Looks up a broker by hostname using the encoded query.
56
- * @param {string | URL} url - URL or string to extract the hostname from.
57
- * @returns {Promise<string>} Broker name.
58
- * @example
59
- * const broker = await db.searchBrokerOnDB('https://www.foo.com');
60
- */
61
- public async searchBrokerOnDB(url: string | URL): Promise<string> {
62
- let urlString = url.toString();
63
-
64
- if (!urlString.startsWith("http://") && !urlString.startsWith("https://")) {
65
- urlString = "https://" + urlString;
66
- }
67
- let urlObj = new URL(urlString).hostname;
68
-
69
- if (urlObj.split('.').length < 3) {
70
- urlObj = ['www', urlObj].join('.');
71
- }
72
-
73
- const isWeb = urlObj.startsWith('www') ||
74
- urlObj.startsWith('horizon') ||
75
- urlObj.startsWith('ambiance') ||
76
- urlObj.startsWith('panorama') ||
77
- urlObj.startsWith('flow') ||
78
- urlObj.startsWith('panorama') ||
79
- urlObj.startsWith('avantio') ||
80
- urlObj.startsWith('demo');
81
-
82
-
83
- const query = isWeb ? `SELECT basedir as BROKER from ftpUsers where CONCAT(prefijo, '.', dominio) = '${urlObj}'` : `SELECT LOGIN_DS AS BROKER from CR_CANALVENTAS WHERE WEB_DS = '${urlObj}'`;
84
-
85
- await this.init();
86
-
87
- const result = await this.pool.request().query(query);
88
-
89
- await this.close();
90
-
91
- if (!result.recordset[0] || !result.recordset[0].BROKER) {
92
- throw new Error(`No broker found for ${urlObj}`);
93
- }
94
-
95
- return result.recordset[0].BROKER as string;
96
- }
97
-
98
53
  private async close(): Promise<void> {
99
54
  if (this.connected && this.pool) {
100
55
  await this.pool.close();