@aloma.io/integration-sdk 3.0.0-13 → 3.0.0-15

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Prerequisites
4
4
 
5
- * You can find the `REGISTRATION_TOKEN` in your aloma workspace in the integration section.
5
+ * You can find the `REGISTRATION_TOKEN` in your aloma workspace in the integration section when adding a connector.
6
6
 
7
7
  ## Integration Examples
8
8
 
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ import {Builder} from '@aloma.io/integration-sdk';
2
+
3
+ const builder = new Builder();
4
+ const runtime = await builder.build();
5
+
6
+ await runtime.start();
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "skipLibCheck": true,
5
+ "module": "node16",
6
+ "moduleResolution": "node16",
7
+ "lib": ["es2015", "es6", "esnext"],
8
+ "declaration": true,
9
+ "allowJs": true,
10
+ "outDir": "build",
11
+ "rootDir": "src/",
12
+ "strict": true,
13
+ "noImplicitAny": false,
14
+ "esModuleInterop": true,
15
+ "resolveJsonModule": true,
16
+ "experimentalDecorators": true,
17
+ "emitDecoratorMetadata": true,
18
+ "allowSyntheticDefaultImports": true
19
+ },
20
+ "include": [
21
+ "src/**/*"
22
+ ],
23
+ "exclude": [
24
+ "node_modules/**/*",
25
+ "dist/**/*"
26
+ ]
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.0.0-13",
3
+ "version": "3.0.0-15",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@paralleldrive/cuid2": "^2",
26
+ "@ts-ast-parser/core": "^0",
26
27
  "dotenv": "*",
27
28
  "express": "^4",
28
29
  "jose": "^4",
@@ -35,7 +36,6 @@
35
36
  "utf-8-validate": "^6"
36
37
  },
37
38
  "devDependencies": {
38
- "@ts-ast-parser/core": "^0",
39
39
  "@types/node": "^18",
40
40
  "mocha": "^10",
41
41
  "prettier": "^2",
@@ -1,14 +0,0 @@
1
- class Controller
2
- {
3
- setConfig({newTask, config})
4
- {
5
- // blank
6
- }
7
-
8
- async hello(args)
9
- {
10
- return "world";
11
- }
12
- }
13
-
14
- module.exports = {Controller}
@@ -1,29 +0,0 @@
1
- const {Connector} = require('@aloma-io/integration-sdk');
2
- const {Controller} = require('./controller');
3
-
4
- const connector = new Connector({id: 'TODO your connector id', version: '1.0.0'});
5
- const controller = new Controller();
6
-
7
- connector.configure()
8
- // types are the calls available in the step, these are typescript definitions
9
- .types
10
- (`
11
- declare function hello(arg: {}): any;
12
- `)
13
- // resolvers hold the calls
14
- .resolvers
15
- ({
16
- hello: async (args) =>
17
- {
18
- return controller.hello(args);
19
- },
20
- })
21
- // main will be called once the connector is connected
22
- .main(({newTask, config}) =>
23
- {
24
- // the config might have changed, so the connector should be able to deal with multiple setConfigs over it's lifetime
25
- controller.setConfig({newTask, config});
26
- });
27
-
28
- // start the connector
29
- connector.run();
@@ -1,26 +0,0 @@
1
- const {Connector} = require('@aloma-io/integration-sdk');
2
-
3
- const connector = new Connector({id: 'TODO your connector id', version: '1.0.0'});
4
-
5
- connector.configure()
6
- // types are the calls available in the step, these are typescript definitions
7
- .types
8
- (`
9
- declare function hello(arg: {}): any;
10
- `)
11
- // resolvers hold the calls
12
- .resolvers
13
- ({
14
- hello: async (args) =>
15
- {
16
- return "world";
17
- },
18
- })
19
- // main will be called once the connector is connected
20
- .main(({newTask, config}) =>
21
- {
22
- // the config might have changed, so the connector should be able to deal with multiple setConfigs over it's lifetime
23
- });
24
-
25
- // start the connector
26
- connector.run();
@@ -1,54 +0,0 @@
1
- const {Connector} = require('@aloma-io/integration-sdk');
2
-
3
- const connector = new Connector({id: 'TODO your connector id', version: '1.0.0'});
4
-
5
- connector.configure()
6
- // these config fields can be configured from the aloma ui. these require a private and a public key which the connector will generate on start
7
- .config({fields:
8
- {
9
- // this is then available from config.type
10
- type: {
11
- // name and placeholder for ui configuration
12
- name: 'Database Type',
13
- placeholder: 'e.g. mysql, pg, tedious',
14
- // type
15
- type: 'line',
16
- // this is an unencrypted value, by default everything is encrypted
17
- plain: true
18
- },
19
- user: {
20
- name: 'User',
21
- placeholder: 'e.g. john',
22
- type: 'line',
23
- plain: true,
24
- // this is marked as optional in the ui, so does not have to be provided, everything else is mandatory
25
- optional: true
26
- },
27
- // this is encrypted in the ui via public key, can only be decrypted by the connector having the private key
28
- password: {
29
- name: 'Password',
30
- placeholder: 'e.g. x3gsadg',
31
- type: 'line',
32
- optional: true
33
- },
34
-
35
- }})
36
- .types
37
- (`
38
- declare function hello(arg: {}): any;
39
- `)
40
- .resolvers
41
- ({
42
- hello: async (args) =>
43
- {
44
- return "world";
45
- },
46
- })
47
- .main(({newTask, config}) =>
48
- {
49
- console.log(config.type)
50
- console.log(config.password)
51
- console.log(config.user)
52
- });
53
-
54
- connector.run();
@@ -1,36 +0,0 @@
1
- const {Connector} = require('@aloma-io/integration-sdk');
2
-
3
- const connector = new Connector({id: 'TODO your connector id', version: '1.0.0'});
4
-
5
- connector.configure()
6
- // these require a private and a public key which the connector will generate on start
7
- // after a connector is added to a workspace it can be connected from the aloma ui
8
- .oauth
9
- ({
10
- // the authorization url, the placeholders {{clientId}}, {{redirectURI}}, {{scope}} will be filled in by aloma
11
- authorizationURL: 'https://github.com/login/oauth/authorize?client_id={{clientId}}&redirect_uri={{redirectURI}}&scope={{scope}}&allow_signup=false',
12
- tokenURL: 'https://github.com/login/oauth/access_token',
13
- clientId: 'clientId',
14
- clientSecret: 'clientSecret',
15
- scope: 'repo, user:email'
16
- })
17
- .types
18
- (`
19
- declare function hello(arg: {}): any;
20
- `)
21
- .resolvers
22
- ({
23
- hello: async (args) =>
24
- {
25
- return "world";
26
- },
27
- })
28
- .main(({newTask, config, oauth}) =>
29
- {
30
- // one can access oauth.accessToken()
31
- // one can get a fetch client: oauth.getClient()
32
- // the client supports retries and will also do an automatic token refresh if a refresh_token is provided
33
- // oauth.getClient().fetch({url, options = {method: 'POST', headers: {}, body: ''})
34
- });
35
-
36
- connector.run();