@aloma.io/integration-sdk 3.0.7-rc1 → 3.0.7-rc3
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/build/builder/runtime-context.mjs +1 -1
- package/build/cli.mjs +1 -1
- package/build/internal/dispatcher/{index.cjs → index.mjs} +1 -3
- package/build/internal/{index.d.cts → index.d.mts} +1 -1
- package/build/internal/{index.cjs → index.mjs} +17 -15
- package/build/internal/util/jwe/{cli.cjs → cli.mjs} +1 -3
- package/build/internal/util/jwe/{index.d.cts → index.d.mts} +2 -2
- package/build/internal/util/jwe/{index.cjs → index.mjs} +2 -4
- package/build/internal/websocket/{config.d.cts → config.d.mts} +1 -1
- package/build/internal/websocket/{config.cjs → config.mjs} +3 -5
- package/build/internal/websocket/connection/constants.d.mts +5 -0
- package/build/internal/websocket/connection/{constants.cjs → constants.mjs} +1 -3
- package/build/internal/websocket/connection/{index.cjs → index.mjs} +4 -6
- package/build/internal/websocket/connection/{registration.cjs → registration.mjs} +3 -5
- package/build/internal/websocket/{index.d.cts → index.d.mts} +2 -2
- package/build/internal/websocket/{index.cjs → index.mjs} +4 -6
- package/build/internal/websocket/transport/{durable.cjs → durable.mjs} +2 -4
- package/build/internal/websocket/transport/{index.d.cts → index.d.mts} +2 -2
- package/build/internal/websocket/transport/{index.cjs → index.mjs} +7 -9
- package/build/internal/websocket/transport/{packet.cjs → packet.mjs} +3 -5
- package/build/internal/websocket/transport/{processor.cjs → processor.mjs} +2 -4
- package/package.json +1 -1
- package/src/builder/runtime-context.mts +1 -1
- package/src/cli.mts +1 -1
- package/src/internal/dispatcher/{index.cjs → index.mjs} +1 -1
- package/src/internal/{index.cjs → index.mjs} +18 -13
- package/src/internal/util/jwe/{cli.cjs → cli.mjs} +1 -1
- package/src/internal/util/jwe/{index.cjs → index.mjs} +2 -2
- package/src/internal/websocket/{config.cjs → config.mjs} +3 -3
- package/src/internal/websocket/connection/{constants.cjs → constants.mjs} +1 -1
- package/src/internal/websocket/connection/{index.cjs → index.mjs} +4 -4
- package/src/internal/websocket/connection/{registration.cjs → registration.mjs} +3 -3
- package/src/internal/websocket/{index.cjs → index.mjs} +4 -4
- package/src/internal/websocket/transport/{durable.cjs → durable.mjs} +2 -2
- package/src/internal/websocket/transport/{index.cjs → index.mjs} +8 -7
- package/src/internal/websocket/transport/{packet.cjs → packet.mjs} +3 -3
- package/src/internal/websocket/transport/{processor.cjs → processor.mjs} +2 -2
- package/build/internal/websocket/connection/constants.d.cts +0 -2
- /package/build/internal/dispatcher/{index.d.cts → index.d.mts} +0 -0
- /package/build/internal/util/jwe/{cli.d.cts → cli.d.mts} +0 -0
- /package/build/internal/websocket/connection/{index.d.cts → index.d.mts} +0 -0
- /package/build/internal/websocket/connection/{registration.d.cts → registration.d.mts} +0 -0
- /package/build/internal/websocket/transport/{durable.d.cts → durable.d.mts} +0 -0
- /package/build/internal/websocket/transport/{packet.d.cts → packet.d.mts} +0 -0
- /package/build/internal/websocket/transport/{processor.d.cts → processor.d.mts} +0 -0
package/build/cli.mjs
CHANGED
@@ -3,7 +3,7 @@ import { Command } from "commander";
|
|
3
3
|
import fs from "node:fs";
|
4
4
|
import { fileURLToPath } from "node:url";
|
5
5
|
import path from "node:path";
|
6
|
-
import JWE from './internal/util/jwe/index.
|
6
|
+
import JWE from './internal/util/jwe/index.mjs';
|
7
7
|
import util from 'node:util';
|
8
8
|
import ChildProcess from 'node:child_process';
|
9
9
|
const exec = util.promisify(ChildProcess.exec);
|
@@ -1,5 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
1
|
class Dispatcher {
|
4
2
|
constructor() {
|
5
3
|
this._config = { fields: {} };
|
@@ -158,4 +156,4 @@ class Dispatcher {
|
|
158
156
|
};
|
159
157
|
}
|
160
158
|
}
|
161
|
-
|
159
|
+
export { Dispatcher };
|
@@ -1,16 +1,18 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
1
|
// @ts-nocheck
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
+
import cuid from "@paralleldrive/cuid2";
|
13
|
+
import express from 'express';
|
14
|
+
import PromClient from 'prom-client';
|
15
|
+
cuid.init({ length: 32 });
|
14
16
|
// TODO fetch with retry
|
15
17
|
const handlePacketError = (packet, e, transport) => {
|
16
18
|
if (!packet.cb()) {
|
@@ -165,7 +167,7 @@ class Connector {
|
|
165
167
|
async run() {
|
166
168
|
var local = this;
|
167
169
|
const makeMetrics = () => {
|
168
|
-
const metrics =
|
170
|
+
const metrics = PromClient;
|
169
171
|
const defaultLabels = {
|
170
172
|
service: local.name,
|
171
173
|
connectorId: local.id,
|
@@ -177,7 +179,7 @@ class Connector {
|
|
177
179
|
return metrics;
|
178
180
|
};
|
179
181
|
const makeMetricsServer = (metrics) => {
|
180
|
-
const app =
|
182
|
+
const app = express();
|
181
183
|
app.get("/metrics", async (request, response, next) => {
|
182
184
|
response.status(200);
|
183
185
|
response.set("Content-type", metrics.contentType);
|
@@ -473,4 +475,4 @@ ${text}
|
|
473
475
|
await server.start();
|
474
476
|
}
|
475
477
|
}
|
476
|
-
|
478
|
+
export { Connector };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export
|
1
|
+
export default JWE;
|
2
2
|
declare class JWE {
|
3
3
|
constructor({ algorithm }: {
|
4
4
|
algorithm?: string | undefined;
|
@@ -29,4 +29,4 @@ declare class JWE {
|
|
29
29
|
encrypt(what: any, expiration: string | undefined, audience: any, algorithm?: string): Promise<string>;
|
30
30
|
decrypt(what: any, audience: any): Promise<unknown>;
|
31
31
|
}
|
32
|
-
import jose
|
32
|
+
import * as jose from "jose";
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const jose = require("jose");
|
1
|
+
import * as jose from "jose";
|
4
2
|
class JWE {
|
5
3
|
constructor({ algorithm = "PS256" }) {
|
6
4
|
this.issuer = "home.aloma.io";
|
@@ -54,4 +52,4 @@ class JWE {
|
|
54
52
|
return payload._data;
|
55
53
|
}
|
56
54
|
}
|
57
|
-
|
55
|
+
export default JWE;
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const C = require("./connection/constants.cjs");
|
4
|
-
const JWE = require("../util/jwe/index.cjs");
|
1
|
+
import C from "./connection/constants.mjs";
|
2
|
+
import JWE from "../util/jwe/index.mjs";
|
5
3
|
class Config {
|
6
4
|
constructor({ registrationToken, version, name, id, endpoint, wsEndpoint, privateKey, publicKey, introspect, configSchema, }) {
|
7
5
|
this._token = null;
|
@@ -76,4 +74,4 @@ class Config {
|
|
76
74
|
this._token = what;
|
77
75
|
}
|
78
76
|
}
|
79
|
-
|
77
|
+
export { Config };
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const { Registration } = require("./registration.cjs");
|
5
|
-
const C = require("./constants.cjs");
|
1
|
+
import fetch from "node-fetch";
|
2
|
+
import { Registration } from "./registration.mjs";
|
3
|
+
import C from "./constants.mjs";
|
6
4
|
class Connection {
|
7
5
|
constructor({ config, onStart }) {
|
8
6
|
this.config = config;
|
@@ -50,4 +48,4 @@ class Connection {
|
|
50
48
|
}
|
51
49
|
}
|
52
50
|
}
|
53
|
-
|
51
|
+
export { Connection };
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const fetch = require("node-fetch");
|
4
|
-
const C = require("./constants.cjs");
|
1
|
+
import fetch from "node-fetch";
|
2
|
+
import C from "./constants.mjs";
|
5
3
|
class Registration {
|
6
4
|
constructor(config) {
|
7
5
|
this.config = config;
|
@@ -28,4 +26,4 @@ class Registration {
|
|
28
26
|
throw new Error("authentication failed");
|
29
27
|
}
|
30
28
|
}
|
31
|
-
|
29
|
+
export { Registration };
|
@@ -12,5 +12,5 @@ export class WebsocketConnector {
|
|
12
12
|
close(): Promise<void>;
|
13
13
|
leaving(): Promise<void>;
|
14
14
|
}
|
15
|
-
import { Transport } from "./transport/index.
|
16
|
-
import { Connection } from "./connection/index.
|
15
|
+
import { Transport } from "./transport/index.mjs";
|
16
|
+
import { Connection } from "./connection/index.mjs";
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const { Connection } = require("./connection/index.cjs");
|
5
|
-
const { Transport } = require("./transport/index.cjs");
|
1
|
+
import WebSocket from "ws";
|
2
|
+
import { Connection } from "./connection/index.mjs";
|
3
|
+
import { Transport } from "./transport/index.mjs";
|
6
4
|
class WebsocketConnector {
|
7
5
|
constructor({ config, onMessage, onConnect }) {
|
8
6
|
var local = this;
|
@@ -38,4 +36,4 @@ class WebsocketConnector {
|
|
38
36
|
await local.connection.close();
|
39
37
|
}
|
40
38
|
}
|
41
|
-
|
39
|
+
export { WebsocketConnector };
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const WebSocket = require("ws");
|
1
|
+
import WebSocket from "ws";
|
4
2
|
class DurableWebsocket {
|
5
3
|
constructor({ endpoint, secret, onConnect, onMessage }) {
|
6
4
|
this.endpoint = endpoint;
|
@@ -58,4 +56,4 @@ class DurableWebsocket {
|
|
58
56
|
await this.ws?.close();
|
59
57
|
}
|
60
58
|
}
|
61
|
-
|
59
|
+
export { DurableWebsocket };
|
@@ -33,5 +33,5 @@ export class Transport {
|
|
33
33
|
close(): void;
|
34
34
|
connected: boolean | undefined;
|
35
35
|
}
|
36
|
-
import { DurableWebsocket } from "./durable.
|
37
|
-
import { Packet } from "./packet.
|
36
|
+
import { DurableWebsocket } from "./durable.mjs";
|
37
|
+
import { Packet } from "./packet.mjs";
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const WebSocket = require("ws");
|
8
|
-
const { Packet, Callback } = require("./packet.cjs");
|
1
|
+
import C from "../connection/constants.mjs";
|
2
|
+
import cuid from "@paralleldrive/cuid2";
|
3
|
+
cuid.init({ length: 32 });
|
4
|
+
import { DurableWebsocket } from "./durable.mjs";
|
5
|
+
import WebSocket from "ws";
|
6
|
+
import { Packet, Callback } from "./packet.mjs";
|
9
7
|
const cleanInterval = 45 * 1000;
|
10
8
|
const pingInterval = 30 * 1000;
|
11
9
|
class Transport {
|
@@ -145,4 +143,4 @@ class Transport {
|
|
145
143
|
}
|
146
144
|
}
|
147
145
|
}
|
148
|
-
|
146
|
+
export { Transport };
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const fetch = require("node-fetch");
|
4
|
-
const cuid = require("@paralleldrive/cuid2").init({ length: 32 });
|
1
|
+
import cuid from "@paralleldrive/cuid2";
|
2
|
+
cuid.init({ length: 32 });
|
5
3
|
class Packet {
|
6
4
|
constructor(data = {}) {
|
7
5
|
this.data = data;
|
@@ -41,4 +39,4 @@ class Callback {
|
|
41
39
|
this.created = Date.now();
|
42
40
|
}
|
43
41
|
}
|
44
|
-
|
42
|
+
export { Callback, Packet };
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const { Packet, Callback } = require("./packet.cjs");
|
1
|
+
import { Packet, Callback } from "./packet.mjs";
|
4
2
|
class Processor {
|
5
3
|
constructor({ transport, processPacket }) {
|
6
4
|
var local = this;
|
@@ -55,4 +53,4 @@ class Processor {
|
|
55
53
|
}
|
56
54
|
}
|
57
55
|
}
|
58
|
-
|
56
|
+
export { Processor };
|
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AbstractController } from "../controller/index.mjs";
|
2
|
-
import { Connector } from "../internal/index.
|
2
|
+
import { Connector } from "../internal/index.mjs";
|
3
3
|
|
4
4
|
export default class RuntimeContext {
|
5
5
|
constructor(private controller: AbstractController, private data: any) {}
|
package/src/cli.mts
CHANGED
@@ -4,7 +4,7 @@ import { Command } from "commander";
|
|
4
4
|
import fs from "node:fs";
|
5
5
|
import { fileURLToPath } from "node:url";
|
6
6
|
import path from "node:path";
|
7
|
-
import JWE from './internal/util/jwe/index.
|
7
|
+
import JWE from './internal/util/jwe/index.mjs'
|
8
8
|
import util from 'node:util';
|
9
9
|
import ChildProcess from 'node:child_process';
|
10
10
|
|
@@ -1,14 +1,19 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
+
import cuid from "@paralleldrive/cuid2"
|
13
|
+
import express from 'express';
|
14
|
+
import PromClient from 'prom-client'
|
15
|
+
|
16
|
+
cuid.init({ length: 32 });
|
12
17
|
|
13
18
|
// TODO fetch with retry
|
14
19
|
|
@@ -209,7 +214,7 @@ class Connector {
|
|
209
214
|
var local = this;
|
210
215
|
|
211
216
|
const makeMetrics = () => {
|
212
|
-
const metrics =
|
217
|
+
const metrics = PromClient;
|
213
218
|
|
214
219
|
const defaultLabels = {
|
215
220
|
service: local.name,
|
@@ -224,7 +229,7 @@ class Connector {
|
|
224
229
|
};
|
225
230
|
|
226
231
|
const makeMetricsServer = (metrics) => {
|
227
|
-
const app =
|
232
|
+
const app = express();
|
228
233
|
|
229
234
|
app.get("/metrics", async (request, response, next) => {
|
230
235
|
response.status(200);
|
@@ -585,4 +590,4 @@ ${text}
|
|
585
590
|
}
|
586
591
|
}
|
587
592
|
|
588
|
-
|
593
|
+
export {Connector};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import C from "./connection/constants.mjs";
|
2
|
+
import JWE from "../util/jwe/index.mjs";
|
3
3
|
|
4
4
|
class Config {
|
5
5
|
constructor({
|
@@ -104,4 +104,4 @@ class Config {
|
|
104
104
|
}
|
105
105
|
}
|
106
106
|
|
107
|
-
|
107
|
+
export { Config };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import fetch from "node-fetch";
|
2
|
+
import { Registration } from "./registration.mjs";
|
3
|
+
import C from "./constants.mjs";
|
4
4
|
|
5
5
|
class Connection {
|
6
6
|
constructor({ config, onStart }) {
|
@@ -67,4 +67,4 @@ class Connection {
|
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
70
|
-
|
70
|
+
export { Connection };
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import fetch from "node-fetch";
|
2
|
+
import C from "./constants.mjs";
|
3
3
|
|
4
4
|
class Registration {
|
5
5
|
constructor(config) {
|
@@ -37,4 +37,4 @@ class Registration {
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
|
40
|
-
|
40
|
+
export { Registration };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import WebSocket from "ws";
|
2
|
+
import { Connection } from "./connection/index.mjs";
|
3
|
+
import { Transport } from "./transport/index.mjs";
|
4
4
|
|
5
5
|
class WebsocketConnector {
|
6
6
|
constructor({ config, onMessage, onConnect }) {
|
@@ -43,4 +43,4 @@ class WebsocketConnector {
|
|
43
43
|
}
|
44
44
|
}
|
45
45
|
|
46
|
-
|
46
|
+
export { WebsocketConnector };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import WebSocket from "ws";
|
2
2
|
|
3
3
|
class DurableWebsocket {
|
4
4
|
constructor({ endpoint, secret, onConnect, onMessage }) {
|
@@ -68,4 +68,4 @@ class DurableWebsocket {
|
|
68
68
|
}
|
69
69
|
}
|
70
70
|
|
71
|
-
|
71
|
+
export { DurableWebsocket };
|
@@ -1,9 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
import C from "../connection/constants.mjs";
|
2
|
+
import cuid from "@paralleldrive/cuid2"
|
3
|
+
cuid.init({ length: 32 });
|
4
|
+
|
5
|
+
import { DurableWebsocket } from "./durable.mjs";
|
6
|
+
import WebSocket from "ws";
|
7
|
+
import { Packet, Callback } from "./packet.mjs";
|
7
8
|
|
8
9
|
const cleanInterval = 45 * 1000;
|
9
10
|
const pingInterval = 30 * 1000;
|
@@ -184,4 +185,4 @@ class Transport {
|
|
184
185
|
}
|
185
186
|
}
|
186
187
|
|
187
|
-
|
188
|
+
export { Transport };
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import cuid from "@paralleldrive/cuid2";
|
2
|
+
cuid.init({ length: 32 });
|
3
3
|
|
4
4
|
class Packet {
|
5
5
|
constructor(data = {}) {
|
@@ -51,4 +51,4 @@ class Callback {
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
54
|
-
|
54
|
+
export { Callback, Packet };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import { Packet, Callback } from "./packet.mjs";
|
2
2
|
|
3
3
|
class Processor {
|
4
4
|
constructor({ transport, processPacket }) {
|
@@ -66,4 +66,4 @@ class Processor {
|
|
66
66
|
}
|
67
67
|
}
|
68
68
|
|
69
|
-
|
69
|
+
export { Processor };
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|