@aloma.io/integration-sdk 3.3.17 → 3.3.18
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/index.d.mts +1 -0
- package/build/builder/index.mjs +15 -0
- package/build/builder/runtime-context.mjs +1 -0
- package/build/cli.mjs +2 -1
- package/build/internal/index.d.mts +3 -1
- package/build/internal/index.mjs +3 -1
- package/build/internal/websocket/config.d.mts +4 -1
- package/build/internal/websocket/config.mjs +5 -1
- package/build/internal/websocket/connection/registration.mjs +2 -0
- package/package.json +1 -1
- package/src/builder/index.mts +20 -1
- package/src/builder/runtime-context.mts +1 -0
- package/src/cli.mts +2 -1
- package/src/internal/index.mjs +3 -1
- package/src/internal/websocket/config.mjs +6 -0
- package/src/internal/websocket/connection/registration.mjs +2 -0
package/build/builder/index.mjs
CHANGED
@@ -28,10 +28,25 @@ export class Builder {
|
|
28
28
|
async build() {
|
29
29
|
await this.parsePackageJson();
|
30
30
|
await this.discoverTypes();
|
31
|
+
await this.checkLogo();
|
31
32
|
// @ts-ignore
|
32
33
|
const Controller = (await import(__dirname + "/../../../../../build/controller/index.mjs")).default;
|
33
34
|
return new RuntimeContext(new Controller(), this.data);
|
34
35
|
}
|
36
|
+
async checkLogo() {
|
37
|
+
const data = this.data;
|
38
|
+
const root = __dirname + "/../../../../../";
|
39
|
+
const logo = ['logo.png'].find((name) => {
|
40
|
+
try {
|
41
|
+
fs.readFileSync(`${root}/${name}`);
|
42
|
+
return `${root}/${name}`;
|
43
|
+
}
|
44
|
+
catch (e) {
|
45
|
+
// blank
|
46
|
+
}
|
47
|
+
});
|
48
|
+
data.logo = logo;
|
49
|
+
}
|
35
50
|
async parsePackageJson() {
|
36
51
|
const data = this.data;
|
37
52
|
const packageJson = JSON.parse(fs.readFileSync(__dirname + "/../../../../../package.json", {
|
package/build/cli.mjs
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
export class Connector {
|
2
|
-
constructor({ version, id, name }: {
|
2
|
+
constructor({ version, id, name, icon }: {
|
3
3
|
version: any;
|
4
4
|
id: any;
|
5
5
|
name: any;
|
6
|
+
icon: any;
|
6
7
|
});
|
7
8
|
id: any;
|
8
9
|
version: any;
|
9
10
|
name: any;
|
11
|
+
icon: any;
|
10
12
|
configure(): Dispatcher;
|
11
13
|
dispatcher: Dispatcher | undefined;
|
12
14
|
run(): Promise<void>;
|
package/build/internal/index.mjs
CHANGED
@@ -184,10 +184,11 @@ class OAuth {
|
|
184
184
|
}
|
185
185
|
}
|
186
186
|
class Connector {
|
187
|
-
constructor({ version, id, name }) {
|
187
|
+
constructor({ version, id, name, icon }) {
|
188
188
|
this.id = id;
|
189
189
|
this.version = version;
|
190
190
|
this.name = name;
|
191
|
+
this.icon = icon;
|
191
192
|
}
|
192
193
|
configure() {
|
193
194
|
return (this.dispatcher = new Dispatcher());
|
@@ -229,6 +230,7 @@ class Connector {
|
|
229
230
|
publicKey: process.env.PUBLIC_KEY,
|
230
231
|
introspect,
|
231
232
|
configSchema,
|
233
|
+
icon
|
232
234
|
});
|
233
235
|
if (Object.keys(configSchema().fields).length) {
|
234
236
|
try {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export class Config {
|
2
|
-
constructor({ registrationToken, version, name, id, endpoint, wsEndpoint, privateKey, publicKey, introspect, configSchema, }: {
|
2
|
+
constructor({ registrationToken, version, name, id, endpoint, wsEndpoint, privateKey, publicKey, introspect, configSchema, icon }: {
|
3
3
|
registrationToken: any;
|
4
4
|
version: any;
|
5
5
|
name: any;
|
@@ -10,6 +10,7 @@ export class Config {
|
|
10
10
|
publicKey: any;
|
11
11
|
introspect: any;
|
12
12
|
configSchema: any;
|
13
|
+
icon: any;
|
13
14
|
});
|
14
15
|
_token: any;
|
15
16
|
_registrationToken: any;
|
@@ -24,6 +25,7 @@ export class Config {
|
|
24
25
|
_jwe: JWE;
|
25
26
|
_introspect: any;
|
26
27
|
_configSchema: any;
|
28
|
+
_icon: any;
|
27
29
|
validateKeys(algorithm: any): Promise<JWE>;
|
28
30
|
data(what: any): {};
|
29
31
|
introspect(): any;
|
@@ -36,6 +38,7 @@ export class Config {
|
|
36
38
|
wsUrl(): any;
|
37
39
|
registrationToken(): any;
|
38
40
|
token(): any;
|
41
|
+
icon(): any;
|
39
42
|
setToken(what: any): void;
|
40
43
|
}
|
41
44
|
import JWE from "../util/jwe/index.mjs";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import C from "./connection/constants.mjs";
|
2
2
|
import JWE from "../util/jwe/index.mjs";
|
3
3
|
class Config {
|
4
|
-
constructor({ registrationToken, version, name, id, endpoint, wsEndpoint, privateKey, publicKey, introspect, configSchema, }) {
|
4
|
+
constructor({ registrationToken, version, name, id, endpoint, wsEndpoint, privateKey, publicKey, introspect, configSchema, icon }) {
|
5
5
|
this._token = null;
|
6
6
|
this._registrationToken = registrationToken;
|
7
7
|
this._version = version;
|
@@ -15,6 +15,7 @@ class Config {
|
|
15
15
|
this._jwe = new JWE({});
|
16
16
|
this._introspect = introspect;
|
17
17
|
this._configSchema = configSchema;
|
18
|
+
this._icon = icon;
|
18
19
|
if (!registrationToken)
|
19
20
|
throw new Error("empty registration token (set env.REGISTRATION_TOKEN)");
|
20
21
|
if (!endpoint)
|
@@ -70,6 +71,9 @@ class Config {
|
|
70
71
|
token() {
|
71
72
|
return this._token;
|
72
73
|
}
|
74
|
+
icon() {
|
75
|
+
return this._icon;
|
76
|
+
}
|
73
77
|
setToken(what) {
|
74
78
|
this._token = what;
|
75
79
|
}
|
@@ -9,6 +9,7 @@ class Registration {
|
|
9
9
|
const config = this.config;
|
10
10
|
const configSchema = config.configSchema();
|
11
11
|
const intro = await config.introspect();
|
12
|
+
const icon = config.icon();
|
12
13
|
const response = await fetch(config.url() + "register", C.augmentRegistration({
|
13
14
|
method: "POST",
|
14
15
|
body: JSON.stringify({
|
@@ -18,6 +19,7 @@ class Registration {
|
|
18
19
|
id: config.id(),
|
19
20
|
publicKey: config.publicKey(),
|
20
21
|
schema: { configSchema, introspect: intro },
|
22
|
+
icon
|
21
23
|
}),
|
22
24
|
headers: { "Content-Type": "application/json" },
|
23
25
|
}, config));
|
package/package.json
CHANGED
package/src/builder/index.mts
CHANGED
@@ -37,7 +37,8 @@ export class Builder {
|
|
37
37
|
async build(): Promise<RuntimeContext> {
|
38
38
|
await this.parsePackageJson();
|
39
39
|
await this.discoverTypes();
|
40
|
-
|
40
|
+
await this.checkLogo();
|
41
|
+
|
41
42
|
// @ts-ignore
|
42
43
|
const Controller = (
|
43
44
|
await import(__dirname + "/../../../../../build/controller/index.mjs")
|
@@ -45,6 +46,24 @@ export class Builder {
|
|
45
46
|
|
46
47
|
return new RuntimeContext(new Controller(), this.data);
|
47
48
|
}
|
49
|
+
|
50
|
+
private async checkLogo() {
|
51
|
+
const data = this.data;
|
52
|
+
const root = __dirname + "/../../../../../"
|
53
|
+
|
54
|
+
const logo = ['logo.png'].find((name) =>
|
55
|
+
{
|
56
|
+
try
|
57
|
+
{
|
58
|
+
fs.readFileSync(`${root}/${name}`);
|
59
|
+
return `${root}/${name}`;
|
60
|
+
} catch(e) {
|
61
|
+
// blank
|
62
|
+
}
|
63
|
+
})
|
64
|
+
|
65
|
+
data.logo = logo;
|
66
|
+
}
|
48
67
|
|
49
68
|
private async parsePackageJson() {
|
50
69
|
const data = this.data;
|
package/src/cli.mts
CHANGED
package/src/internal/index.mjs
CHANGED
@@ -235,10 +235,11 @@ class OAuth {
|
|
235
235
|
}
|
236
236
|
|
237
237
|
class Connector {
|
238
|
-
constructor({ version, id, name }) {
|
238
|
+
constructor({ version, id, name, icon }) {
|
239
239
|
this.id = id;
|
240
240
|
this.version = version;
|
241
241
|
this.name = name;
|
242
|
+
this.icon = icon;
|
242
243
|
}
|
243
244
|
|
244
245
|
configure() {
|
@@ -293,6 +294,7 @@ class Connector {
|
|
293
294
|
publicKey: process.env.PUBLIC_KEY,
|
294
295
|
introspect,
|
295
296
|
configSchema,
|
297
|
+
icon
|
296
298
|
});
|
297
299
|
|
298
300
|
if (Object.keys(configSchema().fields).length) {
|
@@ -13,6 +13,7 @@ class Config {
|
|
13
13
|
publicKey,
|
14
14
|
introspect,
|
15
15
|
configSchema,
|
16
|
+
icon
|
16
17
|
}) {
|
17
18
|
this._token = null;
|
18
19
|
this._registrationToken = registrationToken;
|
@@ -27,6 +28,7 @@ class Config {
|
|
27
28
|
this._jwe = new JWE({});
|
28
29
|
this._introspect = introspect;
|
29
30
|
this._configSchema = configSchema;
|
31
|
+
this._icon = icon;
|
30
32
|
|
31
33
|
if (!registrationToken)
|
32
34
|
throw new Error("empty registration token (set env.REGISTRATION_TOKEN)");
|
@@ -98,6 +100,10 @@ class Config {
|
|
98
100
|
token() {
|
99
101
|
return this._token;
|
100
102
|
}
|
103
|
+
|
104
|
+
icon() {
|
105
|
+
return this._icon;
|
106
|
+
}
|
101
107
|
|
102
108
|
setToken(what) {
|
103
109
|
this._token = what;
|
@@ -11,6 +11,7 @@ class Registration {
|
|
11
11
|
const config = this.config;
|
12
12
|
const configSchema = config.configSchema();
|
13
13
|
const intro = await config.introspect();
|
14
|
+
const icon = config.icon();
|
14
15
|
|
15
16
|
const response = await fetch(
|
16
17
|
config.url() + "register",
|
@@ -24,6 +25,7 @@ class Registration {
|
|
24
25
|
id: config.id(),
|
25
26
|
publicKey: config.publicKey(),
|
26
27
|
schema: { configSchema, introspect: intro },
|
28
|
+
icon
|
27
29
|
}),
|
28
30
|
headers: { "Content-Type": "application/json" },
|
29
31
|
},
|