@aloma.io/integration-sdk 3.7.26 → 3.7.28

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.
@@ -57,8 +57,6 @@ export default class RuntimeContext {
57
57
  clearInterval(healthInterval);
58
58
  await controller._doStop();
59
59
  await controller._doStart(config, oauth, newTask, updateTask, getClient, getBlob, getBlobContent, createBlob);
60
- // TODO remove
61
- console.log('scheduling health check');
62
60
  healthInterval = setInterval(() => healthCheck(controller), 30000);
63
61
  }
64
62
  catch (e) {
@@ -343,7 +343,18 @@ ${text}
343
343
  getBlobContent,
344
344
  createBlob,
345
345
  healthCheck: async (controller) => {
346
- console.log('health check', await controller.__healthCheck());
346
+ let result = { ok: true };
347
+ try {
348
+ await controller.__healthCheck();
349
+ }
350
+ catch (e) {
351
+ result.ok = false;
352
+ result.error = e.message;
353
+ }
354
+ const packet = transport.newPacket({});
355
+ packet.method("connector.health.check");
356
+ packet.args(result);
357
+ transport.send(packet);
347
358
  },
348
359
  getClient: (arg) => theOAuth ? theOAuth.getClient(arg) : new Fetcher(arg),
349
360
  newTask: (name, data) => {
@@ -1,9 +1,9 @@
1
- import C from "../connection/constants.mjs";
2
1
  import { init } from "@paralleldrive/cuid2";
2
+ import C from "../connection/constants.mjs";
3
3
  const cuid = init({ length: 32 });
4
- import { DurableWebsocket } from "./durable.mjs";
5
4
  import WebSocket from "ws";
6
- import { Packet, Callback } from "./packet.mjs";
5
+ import { DurableWebsocket } from "./durable.mjs";
6
+ import { Callback, Packet } from "./packet.mjs";
7
7
  const cleanInterval = 45 * 1000;
8
8
  const pingInterval = 30 * 1000;
9
9
  class Transport {
@@ -56,7 +56,7 @@ class Transport {
56
56
  }, 30000 + 15000);
57
57
  };
58
58
  ws.on("open", () => {
59
- console.log("websocket connected");
59
+ console.log("transport connected");
60
60
  local.connected = true;
61
61
  ws.onPing();
62
62
  local.pinger = setInterval(() => ws.ping(() => null), pingInterval);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.7.26",
3
+ "version": "3.7.28",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -94,8 +94,6 @@ export default class RuntimeContext {
94
94
  createBlob,
95
95
  );
96
96
 
97
- // TODO remove
98
- console.log('scheduling health check')
99
97
  healthInterval = setInterval(() => healthCheck(controller), 30000);
100
98
  } catch (e) {
101
99
  console.log(e);
@@ -433,7 +433,22 @@ ${text}
433
433
  getBlobContent,
434
434
  createBlob,
435
435
  healthCheck: async (controller) => {
436
- console.log('health check', await controller.__healthCheck());
436
+ let result: any = {ok: true};
437
+
438
+ try
439
+ {
440
+ await controller.__healthCheck()
441
+ } catch(e: any) {
442
+ result.ok = false;
443
+ result.error = e.message;
444
+ }
445
+
446
+ const packet = transport.newPacket({});
447
+
448
+ packet.method("connector.health.check");
449
+ packet.args(result);
450
+
451
+ transport.send(packet);
437
452
  },
438
453
  getClient: (arg) =>
439
454
  theOAuth ? theOAuth.getClient(arg) : new Fetcher(arg),
@@ -1,10 +1,10 @@
1
- import C from "../connection/constants.mjs";
2
1
  import { init } from "@paralleldrive/cuid2";
2
+ import C from "../connection/constants.mjs";
3
3
  const cuid = init({ length: 32 });
4
4
 
5
- import { DurableWebsocket } from "./durable.mjs";
6
5
  import WebSocket from "ws";
7
- import { Packet, Callback } from "./packet.mjs";
6
+ import { DurableWebsocket } from "./durable.mjs";
7
+ import { Callback, Packet } from "./packet.mjs";
8
8
 
9
9
  const cleanInterval = 45 * 1000;
10
10
  const pingInterval = 30 * 1000;
@@ -77,7 +77,7 @@ class Transport {
77
77
  };
78
78
 
79
79
  ws.on("open", () => {
80
- console.log("websocket connected");
80
+ console.log("transport connected");
81
81
  local.connected = true;
82
82
  ws.onPing();
83
83
  local.pinger = setInterval(() => ws.ping(() => null), pingInterval);