@aloma.io/integration-sdk 3.3.82 → 3.3.84

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.
@@ -1,18 +1,12 @@
1
- // @ts-nocheck
2
- import dotenv from "dotenv";
3
- dotenv.config();
4
- import fs from "node:fs";
5
- import { Config } from "./websocket/config.mjs";
6
- import { Connection } from "./websocket/connection/index.mjs";
7
- import { Transport } from "./websocket/transport/index.mjs";
8
- import { Dispatcher } from "./dispatcher/index.mjs";
9
- import { WebsocketConnector } from "./websocket/index.mjs";
10
- import JWE from "./util/jwe/index.mjs";
11
- import fetch from "node-fetch";
12
1
  import { init } from "@paralleldrive/cuid2";
13
- const cuid = init({ length: 32 });
14
2
  import express from "express";
3
+ import fetch from "node-fetch";
15
4
  import PromClient from "prom-client";
5
+ import { Dispatcher } from "./dispatcher/index.mjs";
6
+ import JWE from "./util/jwe/index.mjs";
7
+ import { Config } from "./websocket/config.mjs";
8
+ import { WebsocketConnector } from "./websocket/index.mjs";
9
+ const cuid = init({ length: 32 });
16
10
  // TODO fetch with retry
17
11
  const handlePacketError = (packet, e, transport) => {
18
12
  if (!packet.cb()) {
@@ -70,12 +64,13 @@ class Fetcher {
70
64
  var local = this, baseUrl = local.baseUrl;
71
65
  if (retries == null)
72
66
  retries = local.retry;
73
- const theURL = `${baseUrl?.endsWith("/") ? baseUrl : baseUrl + "/"}${url}`.replace(/\/\/+/gi, "/");
67
+ let theURL = `${baseUrl?.endsWith("/") ? baseUrl : baseUrl + "/"}${url}`.replace(/\/\/+/gi, "/");
74
68
  try {
75
69
  options.url = url;
76
70
  await local.customize(options, args);
77
71
  url = options.url;
78
72
  delete (options.url);
73
+ theURL = `${baseUrl?.endsWith("/") ? baseUrl : baseUrl + "/"}${url}`.replace(/\/\/+/gi, "/");
79
74
  if (!options?.headers || !options?.headers?.Accept) {
80
75
  options.headers = {
81
76
  ...options.headers,
@@ -218,10 +213,7 @@ class OAuth {
218
213
  async invalidate(err) {
219
214
  if (true)
220
215
  return;
221
- if (this._data.access_token === "invalid")
222
- return;
223
- console.log("could not obtain access token, marking connector as disconnected", err);
224
- await this.update("invalid", null);
216
+ //if (this._data.access_token === "invalid") return;
225
217
  }
226
218
  getClient(arg = {}) {
227
219
  const client = new OAuthFetcher({ ...arg, oauth: this });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.3.82",
3
+ "version": "3.3.84",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -1,18 +1,12 @@
1
- // @ts-nocheck
2
- import dotenv from "dotenv";
3
- dotenv.config();
4
- import fs from "node:fs";
5
- import { Config } from "./websocket/config.mjs";
6
- import { Connection } from "./websocket/connection/index.mjs";
7
- import { Transport } from "./websocket/transport/index.mjs";
8
- import { Dispatcher } from "./dispatcher/index.mjs";
9
- import { WebsocketConnector } from "./websocket/index.mjs";
10
- import JWE from "./util/jwe/index.mjs";
11
- import fetch from "node-fetch";
12
1
  import { init } from "@paralleldrive/cuid2";
13
- const cuid = init({ length: 32 });
14
2
  import express from "express";
3
+ import fetch from "node-fetch";
15
4
  import PromClient from "prom-client";
5
+ import { Dispatcher } from "./dispatcher/index.mjs";
6
+ import JWE from "./util/jwe/index.mjs";
7
+ import { Config } from "./websocket/config.mjs";
8
+ import { WebsocketConnector } from "./websocket/index.mjs";
9
+ const cuid = init({ length: 32 });
16
10
 
17
11
  // TODO fetch with retry
18
12
 
@@ -85,7 +79,7 @@ class Fetcher {
85
79
 
86
80
  if (retries == null) retries = local.retry;
87
81
 
88
- const theURL = `${
82
+ let theURL = `${
89
83
  baseUrl?.endsWith("/") ? baseUrl : baseUrl + "/"
90
84
  }${url}`.replace(/\/\/+/gi, "/");
91
85
 
@@ -96,6 +90,10 @@ class Fetcher {
96
90
  url = options.url;
97
91
  delete(options.url);
98
92
 
93
+ theURL = `${
94
+ baseUrl?.endsWith("/") ? baseUrl : baseUrl + "/"
95
+ }${url}`.replace(/\/\/+/gi, "/");
96
+
99
97
  if (!options?.headers || !options?.headers?.Accept) {
100
98
  options.headers = {
101
99
  ...options.headers,
@@ -280,14 +278,8 @@ class OAuth {
280
278
 
281
279
  async invalidate(err) {
282
280
  if (true) return;
283
- if (this._data.access_token === "invalid") return;
284
-
285
- console.log(
286
- "could not obtain access token, marking connector as disconnected",
287
- err,
288
- );
281
+ //if (this._data.access_token === "invalid") return;
289
282
 
290
- await this.update("invalid", null);
291
283
  }
292
284
 
293
285
  getClient(arg = {}) {