@aloma.io/integration-sdk 3.0.0-9 → 3.0.0

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.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/build/builder/index.d.mts +10 -0
  3. package/build/builder/index.mjs +46 -0
  4. package/build/builder/runtime-context.d.mts +7 -0
  5. package/build/builder/runtime-context.mjs +50 -0
  6. package/build/builder/transform/index.d.mts +5 -0
  7. package/build/builder/transform/index.mjs +71 -0
  8. package/build/controller/index.d.mts +19 -0
  9. package/build/controller/index.mjs +44 -0
  10. package/build/index.d.mts +2 -0
  11. package/build/index.mjs +2 -0
  12. package/build/internal/dispatcher/index.cjs +150 -0
  13. package/build/internal/dispatcher/index.d.cts +32 -0
  14. package/build/internal/index.cjs +461 -0
  15. package/build/internal/index.d.cts +14 -0
  16. package/build/internal/util/jwe/cli.cjs +13 -0
  17. package/build/internal/util/jwe/cli.d.cts +1 -0
  18. package/build/internal/util/jwe/index.cjs +57 -0
  19. package/build/internal/util/jwe/index.d.cts +32 -0
  20. package/build/internal/websocket/config.cjs +79 -0
  21. package/build/internal/websocket/config.d.cts +41 -0
  22. package/build/internal/websocket/connection/constants.cjs +21 -0
  23. package/build/internal/websocket/connection/constants.d.cts +2 -0
  24. package/build/internal/websocket/connection/index.cjs +53 -0
  25. package/build/internal/websocket/connection/index.d.cts +11 -0
  26. package/build/internal/websocket/connection/registration.cjs +31 -0
  27. package/build/internal/websocket/connection/registration.d.cts +5 -0
  28. package/build/internal/websocket/index.cjs +41 -0
  29. package/build/internal/websocket/index.d.cts +16 -0
  30. package/build/internal/websocket/transport/durable.cjs +61 -0
  31. package/build/internal/websocket/transport/durable.d.cts +20 -0
  32. package/build/internal/websocket/transport/index.cjs +148 -0
  33. package/build/internal/websocket/transport/index.d.cts +37 -0
  34. package/build/internal/websocket/transport/packet.cjs +44 -0
  35. package/build/internal/websocket/transport/packet.d.cts +16 -0
  36. package/build/internal/websocket/transport/processor.cjs +58 -0
  37. package/build/internal/websocket/transport/processor.d.cts +11 -0
  38. package/examples/hello-world/Containerfile +1 -1
  39. package/examples/hello-world/package.json +16 -1
  40. package/examples/hello-world/src/controller/index.mts +13 -0
  41. package/examples/hello-world/src/index.mts +6 -0
  42. package/examples/hello-world/tsconfig.json +27 -0
  43. package/package.json +2 -2
  44. package/src/builder/runtime-context.mts +5 -4
  45. package/src/internal/dispatcher/index.cjs +0 -1
  46. package/examples/hello-world/src/controller/index.js +0 -14
  47. package/examples/hello-world/src/index.js +0 -29
  48. package/examples/kitchen-sink/01-hello-world.js +0 -26
  49. package/examples/kitchen-sink/02-config.js +0 -54
  50. package/examples/kitchen-sink/03-oauth.js +0 -36
@@ -0,0 +1,41 @@
1
+ export class Config {
2
+ constructor({ registrationToken, version, name, id, endpoint, wsEndpoint, privateKey, publicKey, introspect, configSchema, }: {
3
+ registrationToken: any;
4
+ version: any;
5
+ name: any;
6
+ id: any;
7
+ endpoint: any;
8
+ wsEndpoint: any;
9
+ privateKey: any;
10
+ publicKey: any;
11
+ introspect: any;
12
+ configSchema: any;
13
+ });
14
+ _token: any;
15
+ _registrationToken: any;
16
+ _version: any;
17
+ _name: any;
18
+ _endpoint: any;
19
+ _wsEndpoint: any;
20
+ _id: any;
21
+ _data: {};
22
+ _privateKey: any;
23
+ _publicKey: any;
24
+ _jwe: JWE;
25
+ _introspect: any;
26
+ _configSchema: any;
27
+ validateKeys(algorithm: any): Promise<JWE>;
28
+ data(what: any): {};
29
+ introspect(): any;
30
+ configSchema(): any;
31
+ publicKey(): any;
32
+ id(): any;
33
+ version(): any;
34
+ name(): any;
35
+ url(): any;
36
+ wsUrl(): any;
37
+ registrationToken(): any;
38
+ token(): any;
39
+ setToken(what: any): void;
40
+ }
41
+ import JWE = require("../util/jwe/index.cjs");
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AUTHORIZATION = 'Authorization';
4
+ module.exports = {
5
+ augmentRequest: (what, config) => {
6
+ what.headers = {
7
+ ...what.headers,
8
+ 'User-Agent': config.id() + '/' + config.version(),
9
+ };
10
+ what.headers[AUTHORIZATION] = `Connector ${config.token()}`;
11
+ return what;
12
+ },
13
+ augmentRegistration: (what, config) => {
14
+ what.headers = {
15
+ ...what.headers,
16
+ 'User-Agent': config.id() + '/' + config.version(),
17
+ };
18
+ what.headers[AUTHORIZATION] = `Connector ${config.registrationToken()}`;
19
+ return what;
20
+ },
21
+ };
@@ -0,0 +1,2 @@
1
+ export function augmentRequest(what: any, config: any): any;
2
+ export function augmentRegistration(what: any, config: any): any;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fetch = require('node-fetch');
4
+ const { Registration } = require('./registration.cjs');
5
+ const C = require('./constants.cjs');
6
+ class Connection {
7
+ constructor({ config, onStart }) {
8
+ this.config = config;
9
+ this.onStart = onStart;
10
+ }
11
+ async start() {
12
+ var local = this, config = local.config;
13
+ try {
14
+ const response = await fetch(config.url() + 'connect', C.augmentRequest({
15
+ method: 'POST',
16
+ body: JSON.stringify({}),
17
+ headers: { 'Content-Type': 'application/json' },
18
+ }, config));
19
+ if (response.status === 401) {
20
+ config.setToken(await new Registration(local.config).run());
21
+ return await local.start();
22
+ }
23
+ else if (response.status === 200) {
24
+ config.data(await response.json());
25
+ await local.onStart(() => local.onDisconnect());
26
+ }
27
+ else {
28
+ setTimeout(() => local.start(), 5000);
29
+ }
30
+ }
31
+ catch (e) {
32
+ console.log(e);
33
+ setTimeout(() => local.start(), 5000);
34
+ }
35
+ }
36
+ onDisconnect() {
37
+ var local = this;
38
+ setTimeout(() => local.start(), 5000);
39
+ }
40
+ async close() {
41
+ try {
42
+ await fetch(this.config.url() + 'disconnect', C.augmentRequest({
43
+ method: 'POST',
44
+ body: JSON.stringify({}),
45
+ headers: { 'Content-Type': 'application/json' },
46
+ }, this.config));
47
+ }
48
+ catch (e) {
49
+ // blank
50
+ }
51
+ }
52
+ }
53
+ module.exports = { Connection };
@@ -0,0 +1,11 @@
1
+ export class Connection {
2
+ constructor({ config, onStart }: {
3
+ config: any;
4
+ onStart: any;
5
+ });
6
+ config: any;
7
+ onStart: any;
8
+ start(): any;
9
+ onDisconnect(): void;
10
+ close(): Promise<void>;
11
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fetch = require('node-fetch');
4
+ const C = require('./constants.cjs');
5
+ class Registration {
6
+ constructor(config) {
7
+ this.config = config;
8
+ }
9
+ async run() {
10
+ var local = this;
11
+ const config = this.config;
12
+ const configSchema = config.configSchema();
13
+ const intro = await config.introspect();
14
+ const response = await fetch(config.url() + 'register', C.augmentRegistration({
15
+ method: 'POST',
16
+ body: JSON.stringify({
17
+ deployment: process.env.DEPLOYMENT || '',
18
+ name: config.name(),
19
+ version: config.version(),
20
+ id: config.id(),
21
+ publicKey: config.publicKey(),
22
+ schema: { configSchema, introspect: intro },
23
+ }),
24
+ headers: { 'Content-Type': 'application/json' },
25
+ }, config));
26
+ if (response.status === 200)
27
+ return (await response.json()).key;
28
+ throw new Error('authentication failed');
29
+ }
30
+ }
31
+ module.exports = { Registration };
@@ -0,0 +1,5 @@
1
+ export class Registration {
2
+ constructor(config: any);
3
+ config: any;
4
+ run(): Promise<any>;
5
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const WebSocket = require('ws');
4
+ const { Connection } = require('./connection/index.cjs');
5
+ const { Transport } = require('./transport/index.cjs');
6
+ class WebsocketConnector {
7
+ constructor({ config, onMessage, onConnect }) {
8
+ var local = this;
9
+ this.config = config;
10
+ this.transport = new Transport({ config, onMessage, onConnect });
11
+ }
12
+ async start() {
13
+ var local = this;
14
+ const config = this.config;
15
+ local.connection = new Connection({
16
+ config,
17
+ onStart: () => {
18
+ local.transport.start(() => setTimeout(() => local.start(), 1000));
19
+ },
20
+ });
21
+ await local.connection.start();
22
+ }
23
+ send(message) {
24
+ if (!message)
25
+ return;
26
+ this.transport.send(this.transport.newPacket(message));
27
+ }
28
+ async close() {
29
+ var local = this;
30
+ if (local.transport)
31
+ await local.transport.close();
32
+ }
33
+ async leaving() {
34
+ var local = this;
35
+ if (local.transport)
36
+ await local.transport.leaving();
37
+ if (local.connection)
38
+ await local.connection.close();
39
+ }
40
+ }
41
+ module.exports = { WebsocketConnector };
@@ -0,0 +1,16 @@
1
+ export class WebsocketConnector {
2
+ constructor({ config, onMessage, onConnect }: {
3
+ config: any;
4
+ onMessage: any;
5
+ onConnect: any;
6
+ });
7
+ config: any;
8
+ transport: Transport;
9
+ start(): Promise<void>;
10
+ connection: Connection | undefined;
11
+ send(message: any): void;
12
+ close(): Promise<void>;
13
+ leaving(): Promise<void>;
14
+ }
15
+ import { Transport } from "./transport/index.cjs";
16
+ import { Connection } from "./connection/index.cjs";
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const WebSocket = require('ws');
4
+ class DurableWebsocket {
5
+ constructor({ endpoint, secret, onConnect, onMessage }) {
6
+ this.endpoint = endpoint;
7
+ this.secret = secret;
8
+ this.onConnect = onConnect;
9
+ this.onMessage = onMessage;
10
+ this.failed = [];
11
+ this.fails = 0;
12
+ this.start();
13
+ }
14
+ async send(what) {
15
+ try {
16
+ return await this.ws.send(JSON.stringify(what));
17
+ }
18
+ catch (e) {
19
+ this.failed.push(what);
20
+ }
21
+ }
22
+ start() {
23
+ var local = this;
24
+ if (local.connecting || local.closed)
25
+ return;
26
+ local.connecting = true;
27
+ const ws = (local.ws = new WebSocket(local.endpoint, [], {
28
+ rejectUnauthorized: false,
29
+ headers: { Authorization: `Bearer ${local.secret}` },
30
+ }));
31
+ ws.on('open', () => {
32
+ local.connecting = false;
33
+ local.fails = 0;
34
+ var item;
35
+ while ((item = local.failed.shift())) {
36
+ local.send(item);
37
+ }
38
+ local.onConnect(local);
39
+ });
40
+ ws.on('message', (message) => {
41
+ setImmediate(() => local.onMessage(JSON.parse(message)));
42
+ });
43
+ ws.on('error', (message) => {
44
+ if (local.fails > 50)
45
+ console.log('error:', message.message);
46
+ ++local.fails;
47
+ });
48
+ ws.on('close', (message) => {
49
+ local.connecting = false;
50
+ if (!local.closed)
51
+ setTimeout(() => local.start(), 5000);
52
+ });
53
+ }
54
+ async close() {
55
+ if (this.closed)
56
+ return;
57
+ this.closed = true;
58
+ await this.ws?.close();
59
+ }
60
+ }
61
+ module.exports = { DurableWebsocket };
@@ -0,0 +1,20 @@
1
+ export class DurableWebsocket {
2
+ constructor({ endpoint, secret, onConnect, onMessage }: {
3
+ endpoint: any;
4
+ secret: any;
5
+ onConnect: any;
6
+ onMessage: any;
7
+ });
8
+ endpoint: any;
9
+ secret: any;
10
+ onConnect: any;
11
+ onMessage: any;
12
+ failed: any[];
13
+ fails: number;
14
+ send(what: any): Promise<any>;
15
+ start(): void;
16
+ connecting: boolean | undefined;
17
+ ws: any;
18
+ close(): Promise<void>;
19
+ closed: boolean | undefined;
20
+ }
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fetch = require('node-fetch');
4
+ const C = require('../connection/constants.cjs');
5
+ const cuid = require('@paralleldrive/cuid2').init({ length: 32 });
6
+ const { DurableWebsocket } = require('./durable.cjs');
7
+ const WebSocket = require('ws');
8
+ const { Packet, Callback } = require('./packet.cjs');
9
+ const cleanInterval = 45 * 1000;
10
+ const pingInterval = 30 * 1000;
11
+ class Transport {
12
+ constructor({ config, onMessage, onConnect }) {
13
+ var local = this;
14
+ this.config = config;
15
+ this.callbacks = {};
16
+ this.running = true;
17
+ this.pinger = null;
18
+ this.cleaner = setInterval(() => local.clean(), cleanInterval);
19
+ this.acks = [];
20
+ this.packets = [];
21
+ this.onConnect = onConnect;
22
+ this._onMessage = onMessage;
23
+ }
24
+ schedule() {
25
+ var local = this;
26
+ setTimeout(() => local.schedule0(), 0);
27
+ }
28
+ schedule0() {
29
+ var local = this, packets = [], packet;
30
+ if (!local.packets.length || !local.connected)
31
+ return;
32
+ while ((packet = local.packets.shift())) {
33
+ packets.push(packet.data);
34
+ }
35
+ if (!packets.length)
36
+ return;
37
+ try {
38
+ local.ws.send(JSON.stringify({ p: packets }));
39
+ }
40
+ catch (e) {
41
+ console.log('could not send packets ', e);
42
+ packets.forEach((packet) => local.packets.unshift(packet));
43
+ }
44
+ }
45
+ async start(ondisconnect) {
46
+ var local = this, config = local.config;
47
+ if (local._leaving)
48
+ return;
49
+ local.close();
50
+ this.running = true;
51
+ const ws = (local.ws = new WebSocket(config.wsUrl(), ['connector'], C.augmentRequest({ headers: {} }, config)));
52
+ ws.on('open', () => {
53
+ console.log('websocket connected');
54
+ local.connected = true;
55
+ local.pinger = setInterval(() => ws.ping(() => null), pingInterval);
56
+ local.onConnect(local);
57
+ });
58
+ ws.on('message', (message) => {
59
+ setTimeout(() => local.onMessages(JSON.parse(message)), 0);
60
+ });
61
+ ws.on('error', (message) => {
62
+ console.log('error:', message);
63
+ });
64
+ ws.on('close', (message) => {
65
+ local.connected = false;
66
+ clearInterval(local.pinger);
67
+ if (local.running)
68
+ ondisconnect();
69
+ });
70
+ }
71
+ newDurableWebsocket({ endpoint, secret, onConnect, onMessage }) {
72
+ return new DurableWebsocket({ endpoint, secret, onConnect, onMessage });
73
+ }
74
+ send(packet) {
75
+ if (!packet)
76
+ return;
77
+ this.packets.push(packet);
78
+ this.schedule();
79
+ }
80
+ onMessages(msgs) {
81
+ var local = this;
82
+ msgs.p?.forEach((item) => {
83
+ local.onMessage(item);
84
+ });
85
+ }
86
+ onMessage(data) {
87
+ if (!data)
88
+ return;
89
+ const packet = new Packet(data);
90
+ if (packet.cb() && this.callbacks[packet.cb()]) {
91
+ try {
92
+ this.callbacks[packet.cb()].cb(packet.args());
93
+ }
94
+ catch (e) {
95
+ console.log('error processing packet', e, packet);
96
+ }
97
+ finally {
98
+ delete this.callbacks[packet.cb()];
99
+ }
100
+ return;
101
+ }
102
+ return this._onMessage(packet, this);
103
+ }
104
+ newPacket(data, cb, cbKey) {
105
+ const packet = new Packet({ ...data });
106
+ if (cb) {
107
+ this.callbacks[cbKey || packet.id()] = new Callback({ cb });
108
+ packet.cb(cbKey || packet.id());
109
+ }
110
+ return packet;
111
+ }
112
+ clean() {
113
+ var local = this;
114
+ const cbs = { ...this.callbacks }, then = Date.now() - 5 * 60 * 1000;
115
+ Object.keys(cbs).forEach((key) => {
116
+ const cb = cbs[key];
117
+ if (!cb)
118
+ return;
119
+ if (cb.created < then) {
120
+ console.log('callback timeout', key);
121
+ try {
122
+ cb.cb({ error: 'timeout' });
123
+ }
124
+ catch (e) {
125
+ console.log('error while callback', key, cb, e);
126
+ }
127
+ delete local.callbacks[key];
128
+ }
129
+ });
130
+ }
131
+ leaving() {
132
+ this._leaving = true;
133
+ this.running = false;
134
+ }
135
+ close() {
136
+ clearInterval(this.pinger);
137
+ clearInterval(this.cleaner);
138
+ this.running = false;
139
+ this.connected = false;
140
+ try {
141
+ local.ws.terminate();
142
+ }
143
+ catch (e) {
144
+ // blank
145
+ }
146
+ }
147
+ }
148
+ module.exports = { Transport };
@@ -0,0 +1,37 @@
1
+ export class Transport {
2
+ constructor({ config, onMessage, onConnect }: {
3
+ config: any;
4
+ onMessage: any;
5
+ onConnect: any;
6
+ });
7
+ config: any;
8
+ callbacks: {};
9
+ running: boolean;
10
+ pinger: any;
11
+ cleaner: NodeJS.Timer;
12
+ acks: any[];
13
+ packets: any[];
14
+ onConnect: any;
15
+ _onMessage: any;
16
+ schedule(): void;
17
+ schedule0(): void;
18
+ start(ondisconnect: any): Promise<void>;
19
+ ws: any;
20
+ newDurableWebsocket({ endpoint, secret, onConnect, onMessage }: {
21
+ endpoint: any;
22
+ secret: any;
23
+ onConnect: any;
24
+ onMessage: any;
25
+ }): DurableWebsocket;
26
+ send(packet: any): void;
27
+ onMessages(msgs: any): void;
28
+ onMessage(data: any): any;
29
+ newPacket(data: any, cb: any, cbKey: any): Packet;
30
+ clean(): void;
31
+ leaving(): void;
32
+ _leaving: boolean | undefined;
33
+ close(): void;
34
+ connected: boolean | undefined;
35
+ }
36
+ import { DurableWebsocket } from "./durable.cjs";
37
+ import { Packet } from "./packet.cjs";
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fetch = require('node-fetch');
4
+ const cuid = require('@paralleldrive/cuid2').init({ length: 32 });
5
+ class Packet {
6
+ constructor(data = {}) {
7
+ this.data = data;
8
+ this.data.id ||= cuid();
9
+ }
10
+ id() {
11
+ return this.data.id;
12
+ }
13
+ cb(what) {
14
+ if (what) {
15
+ this.data.c = what;
16
+ }
17
+ return this.data.c;
18
+ }
19
+ method(what) {
20
+ if (what) {
21
+ this.data.m = what;
22
+ }
23
+ return this.data.m;
24
+ }
25
+ event(what) {
26
+ if (what) {
27
+ this.data.e = what;
28
+ }
29
+ return this.data.e;
30
+ }
31
+ args(what) {
32
+ if (what) {
33
+ this.data.a = what;
34
+ }
35
+ return this.data.a;
36
+ }
37
+ }
38
+ class Callback {
39
+ constructor({ cb }) {
40
+ this.cb = cb;
41
+ this.created = Date.now();
42
+ }
43
+ }
44
+ module.exports = { Callback, Packet };
@@ -0,0 +1,16 @@
1
+ export class Callback {
2
+ constructor({ cb }: {
3
+ cb: any;
4
+ });
5
+ cb: any;
6
+ created: number;
7
+ }
8
+ export class Packet {
9
+ constructor(data?: {});
10
+ data: {};
11
+ id(): any;
12
+ cb(what: any): any;
13
+ method(what: any): any;
14
+ event(what: any): any;
15
+ args(what: any): any;
16
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { Packet, Callback } = require('./packet.cjs');
4
+ class Processor {
5
+ constructor({ transport, processPacket }) {
6
+ var local = this;
7
+ this.transport = transport;
8
+ this._processPacket = processPacket;
9
+ }
10
+ async onMessages(what) {
11
+ var local = this;
12
+ const messages = what.p;
13
+ const packets = messages.map((message) => {
14
+ const packet = new Packet(message);
15
+ local.transport.acks.push(packet.id());
16
+ return local.processPacket(packet);
17
+ });
18
+ await Promise.all(packets);
19
+ }
20
+ async processPacket(packet) {
21
+ var local = this;
22
+ if (packet.args().packet) {
23
+ await local.processPacket0(local.transport.newPacket(packet.args().packet), packet);
24
+ }
25
+ else {
26
+ await local.processPacket0(packet, packet);
27
+ }
28
+ }
29
+ async processPacket0(packet, original) {
30
+ var local = this, callbacks = local.transport.callbacks;
31
+ if (packet.cb() && callbacks[packet.cb()]) {
32
+ try {
33
+ callbacks[packet.cb()](packet.args());
34
+ }
35
+ catch (e) {
36
+ console.log('error in callback', callbacks[packet.cb()], packet);
37
+ }
38
+ delete local.transport.callbacks[packet.cb()];
39
+ }
40
+ else if (packet.event()) {
41
+ console.log('handle event packet', packet);
42
+ }
43
+ else {
44
+ try {
45
+ const result = await local._processPacket(packet);
46
+ const reply = local.transport.newPacket({});
47
+ reply.method('connector.reply');
48
+ reply.cb(original.cb());
49
+ reply.args({ ...result });
50
+ local.transport.send(reply);
51
+ }
52
+ catch (e) {
53
+ console.log('error processing packet', e, packet);
54
+ }
55
+ }
56
+ }
57
+ }
58
+ module.exports = { Processor };
@@ -0,0 +1,11 @@
1
+ export class Processor {
2
+ constructor({ transport, processPacket }: {
3
+ transport: any;
4
+ processPacket: any;
5
+ });
6
+ transport: any;
7
+ _processPacket: any;
8
+ onMessages(what: any): Promise<void>;
9
+ processPacket(packet: any): Promise<void>;
10
+ processPacket0(packet: any, original: any): Promise<void>;
11
+ }
@@ -10,7 +10,7 @@ COPY ./src ./src
10
10
 
11
11
  RUN set -e; adduser -S -u 1111 connector
12
12
 
13
- RUN set -e; apk add --no-cache git; yarn config set --home enableTelemetry 0; chmod 755 /connector/entrypoint.sh; cd /connector/; yarn install; rm -rf package.json; rm -rf yarn.lock;
13
+ RUN set -e; apk add --no-cache git; yarn config set --home enableTelemetry 0; chmod 755 /connector/entrypoint.sh; cd /connector/; yarn install;
14
14
 
15
15
  USER connector
16
16
 
@@ -3,9 +3,24 @@
3
3
  "version": "1.0.0",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
+ "connectorId": "TODO",
6
7
  "license": "Apache-2.0",
7
8
  "scripts": {},
9
+ "type": "module",
10
+ "scripts": {
11
+ "start": "node build/index.mjs",
12
+ "dev": "./node_modules/typescript/bin/tsc --watch",
13
+ "build": "rm -rf build; mkdir -p build/controller; cp ./src/controller/index.mts ./build/controller/.controller-for-types.mts; ./node_modules/typescript/bin/tsc",
14
+ "test": "./node_modules/mocha/bin/_mocha --recursive",
15
+ "format": "yarn prettier --write src/"
16
+ },
8
17
  "dependencies": {
9
- "@aloma.io/integration-sdk": "^3"
18
+ "@aloma.io/integration-sdk": "3.0.0-12"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^18",
22
+ "mocha": "^10",
23
+ "prettier": "^2",
24
+ "typescript": "^5"
10
25
  }
11
26
  }
@@ -0,0 +1,13 @@
1
+ import {AbstractController} from '@aloma.io/integration-sdk';
2
+
3
+ export default class Controller extends AbstractController {
4
+ private knex: any;
5
+
6
+ /**
7
+ * say hello
8
+ */
9
+ async hello(args: any)
10
+ {
11
+ return "hello world";
12
+ }
13
+ }