You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dictionary.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -261,7 +261,7 @@ Software Development Kit. A collection of tools and libraries to create a softwa
261
261
262
262
### Sequence
263
263
264
-
It is a compressed package (`*.tar.gz`) containing file with a manifest(eg. `package.json`), describing the app and its configuration (such as main file to run); and a **main file** (eg. `index.js`, `app.ts`) that contains a developer's code that consists of chained functions with a lightweight application business logic. Minimal sequence consists of 1 [function](#function).
264
+
It is a package (application) containing a set of files. A file with a manifest(eg. `package.json`), describing the app and its configuration (such as main file to run); and a __main file__ (eg. `index.js`, `app.ts`) that contains a developer's code that consists of chained functions with a lightweight application business logic. Minimal Sequence consists of 1 [function](#function).
265
265
266
266
### Socket
267
267
@@ -277,9 +277,7 @@ standard input/standard output. Application communication channels with the outs
277
277
278
278
### STH <!--TODO-->
279
279
280
-
### Supervisor
281
-
282
-
An application supervising work of a single [instance](#instance). Communicates with [host](#host), returns health status of the sequence, runner, etc
We have prepared some sample code for you to try out. Some is written in JavaScript and some in TypeScript.
3
+
Try out our samples prepared some samples for you. We differentiated them according to the language in which they were written.
4
4
5
-
> :bulb:**Please note that samples below require some previous installations before you start running them. Instructions are [here](../README.md#3-install-scramjet-transform-hub).**
5
+
> 💡**Please note that samples below require some previous installations before you start running them. Instructions are [here](../README.md#3-install-scramjet-transform-hub).**
6
6
7
7
## JavaScript samples
8
8
9
-
-[hello](hello) - Sequence that modifies incoming stream of strings by saying Hello :).
9
+
-[hello](hello) - Sequence that modifies incoming stream of strings by saying "Hello".
10
10
-[hello-snowman](hello-snowman) - Sequence that reads incoming stream, and modifies it by adding a text message according to the incoming data.
11
11
-[simple-counter-js](simple-counter-js) - Sequence, that counts to 1000, and logs the number in one-second intervals.
12
-
-[test-output](test-output) - Sequence that just writes random values to the output stream.
12
+
-[test-output](test-output) - Sequence that simply writes random values to the output stream.
13
13
14
14
## TypeScript samples
15
15
16
-
-[crypto-prices](crypto-prices) - Sequence that keeps printing current crypto prices for a provided pair of currencies every 1s.
16
+
-[crypto-prices](crypto-prices) - Sequence that keeps printing current crypto prices for a provided pair of currencies every 3s.
17
+
-[discord-slack-connection](discord-slack-connection) - a set of Sequences that enable communication between Slack and Discord.
17
18
-[mediawiki](mediawiki) - Sequence that keeps printing mediawiki event stream.
19
+
-[rss](rss) - Sequence that gets a list of RSS and then retrieves each feed and passes links to scraper.
18
20
-[scraping](scraping) - Sequence that scrapes web pages.
19
21
-[stack-overflow](stack-overflow) - Sequence that gets a number of changes in Stack Overflow tag count.
20
22
-[transform-string-stream](transform-string-stream) - Sequence that modifies incoming stream of strings by adding a prefix and a suffix.
Sequence that keeps printing current crypto prices for a provided pair of currencies every 1s.
3
+
Sequence that keeps printing current crypto prices for a provided pair of currencies every 3 seconds.
5
4
6
-
> :bulb:**Please note that the sample below requires some previous installations before you start running it, you will find them [here](../../README.md#3-install-scramjet-transform-hub).**
5
+
> 💡**Please note that the sample below requires some previous installations before you start running it, you will find them [here](../../README.md#3-install-scramjet-transform-hub).**
7
6
8
-
###Running
7
+
## Running
9
8
10
9
Open two terminals and run the following commands:
11
10
@@ -35,15 +34,15 @@ si pack dist/ -o crypto-prices.tar.gz
35
34
si seq send crypto-prices.tar.gz
36
35
37
36
# start a sequence with currency parameters, this will output Instance ID
38
-
si seq start <sequence-id> ETH USD
37
+
si seq start - ETH USD
39
38
40
-
#See output
41
-
si inst output <instance-id>
39
+
#see output
40
+
si inst output -
42
41
```
43
42
44
-
###Output
43
+
## Output
45
44
46
-
Once you run `si inst output <instance-id>` command you will get output like this one:
45
+
Once you run `si inst output -` command you should get an output similar to this one:
47
46
48
47
```bash
49
48
Request ok: http://127.0.0.1:8000/api/v1/instance/87442a03-a8ca-451c-b89f-d5371774c2f3/output status: 200 OK
Copy file name to clipboardExpand all lines: samples/discord-slack-connection/README.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Discord to Slack (and vice versa) Connection
2
2
3
-
In this project you will find 4 STH sequences:
3
+
> 💡 **Please note that the sample below requires some previous installations before you start running it, you will find them [here](../../README.md#3-install-scramjet-transform-hub).**
4
+
5
+
In this project you will find 4 STH Sequences:
4
6
5
7
*[discord-read](./discord-read/)
6
8
*[discord-write](./discord-write/)
@@ -9,21 +11,23 @@ In this project you will find 4 STH sequences:
9
11
10
12
You must run at least two (discord-read, slack write or discord-write, slack-read) in order to get one directional communication or all four for bi-directional communication.
11
13
12
-
Each sequence either reads or writes to specified application respectively and uses `const TOPIC = ...` topic to exchange data between applications. You need two topics for bi-directional communication.
14
+
Each Sequence either reads or writes to specified application respectively and uses `const TOPIC = ...` topic to exchange data between applications. You need two topics for bi-directional communication.
13
15
14
16
## TODO
15
17
16
18
As there is no way to map message IDs between the two applications, threads are not supported.
17
19
18
-
In order to get this working, sequences must keep a track of posted and written IDs.
20
+
In order to get this working, Sequences must keep a track of posted and written IDs.
21
+
22
+
## Known Issues
19
23
20
-
## Know Issues
24
+
<!-- TODO - check if this issues still apply -->
21
25
22
26
STH `v0.13` if installed via `npm` has an issue with `objectMode: true`. You will get an error like:
23
27
24
28
```bash
25
-
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array.
26
-
Received an instance of Object
29
+
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an Instance of Buffer or Uint8Array.
30
+
Received an Instance of Object
27
31
```
28
32
29
33
If that happens either use `v0.14` if available or rebuild and run STH from repo. Please check [transform-hub documentation](https://github.com/scramjetorg/transform-hub/#build-the-packages-building_construction) for details.
@@ -9,14 +9,14 @@ In order to read messages from Discord we need to create a bot first:
9
9
* Go to Developer Portal and click on [Applications](https://discord.com/developers/applications)
10
10
* Click on `New Application` button and give it a name. Then click on `Create`.
11
11
* In the newly created and selected app, click on `Bot` and click on `Add Bot` button.
12
-
* Under `Build-A-Bot` either click on `Click to Reveal Token` link or on `Copy` button to get Discord Bot Token. *This is important!*
13
-
* You can uncheck Public Bot
14
-
* You can customize its name and icon
15
-
* Expand `OAuth2` and select `URL Generator`
16
-
* Select `bot` under scopes and `Read Messages/View Channels` under bot permissions. Copy URL
17
-
* Paste the URL into web browser address bar. Connect to Discord message will appear. Select your server from `Add To Server` dropdown and click on `Continue`
18
-
* Confirm permissions on the next screen by clicking `Authorise` button.
19
-
* You will get a confirmation saying: _you may now close this window or tab_.
12
+
* Under `Build-A-Bot` either click on `Click to Reveal Token` link or on `Copy` button to get Discord Bot Token. **This is important!**
13
+
* You can uncheck Public Bot.
14
+
* You can customize its name and icon.
15
+
* Expand `OAuth2` and select `URL Generator`.
16
+
* Select `bot` under scopes and `Read Messages/View Channels` under bot permissions. Copy URL.
17
+
* Paste the URL into web browser address bar. Connect to Discord message will appear. Select your server from `Add To Server` dropdown and click on `Continue`.
18
+
* Confirm permissions on the next screen by clicking `Authorize` button.
19
+
* You will get a confirmation saying: *you may now close this window or tab*.
20
20
21
21
Create a file called `config.json` and add:
22
22
@@ -37,14 +37,14 @@ npm install
37
37
# transpile TS->JS to dist/
38
38
npm run build
39
39
40
-
# make a compressed package with sequence
40
+
# make a compressed package with Sequence
41
41
si pack dist
42
42
43
-
# send sequence to transform hub, this will output Sequence ID
43
+
# send Sequence to transform hub, this will output Sequence ID
Before you start you need `DISCORD_WEBHOOK_URL`. In Discord go your server. Then next to server name click on the drop down menu and select `Server Settings` -> `Integrations` -> `Webhooks` -> `Create webhook` -> Select channel name and save changes. You can copy webhook URL by clicking on `Copy webhook URL` button.
9
+
Before start you need `DISCORD_WEBHOOK_URL`. In Discord go to your server. Then next to the server name click on the drop down menu and select `Server Settings` -> `Integrations` -> `Webhooks` -> `Create webhook` -> Select channel name and save changes. You can copy webhook URL by clicking on `Copy webhook URL` button.
10
10
11
-
WebHook URL has following format: `https://discord.com/api/webhooks/{webhook.id}/{webhook.token}`
12
-
13
-
where `webhook.id` are numbers and `webhook.token` are letters and numbers.
11
+
WebHook URL has following format: `https://discord.com/api/webhooks/{webhook.id}/{webhook.token}` where `webhook.id` are numbers and `webhook.token` are letters and numbers.
14
12
15
13
```bash
16
14
# install dependencies
@@ -19,14 +17,14 @@ npm install
19
17
# transpile TS->JS to dist/
20
18
npm run build
21
19
22
-
# make a compressed package with sequence
20
+
# make a compressed package with Sequence
23
21
si pack dist
24
22
25
-
# send sequence to transform hub, this will output Sequence ID
23
+
# send Sequence to transform hub, this will output Sequence ID
26
24
si seq send dist.tar.gz
27
25
28
-
# start a sequence, this will output Instance ID. Provide DISCORD_WEBHOOK_URL as the second parameter
29
-
si seq start <sequence-id><DISCORD_WEBHOOK_URL>
26
+
# start a Sequence, provide DISCORD_WEBHOOK_URL as the second parameter
Copy file name to clipboardExpand all lines: samples/hello-snowman/README.md
+25-15Lines changed: 25 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,26 @@
1
-
##hello-snowman :snowman:
1
+
# hello-snowman ⛄
2
2
3
-
----
4
3
Sequence that reads incoming stream (input), and and modifies it by adding a text message according to the incoming data.
5
4
6
-
Stream is generated in [stream-gen.js](../tools/stream-gen-tool/stream-gen.js) file, where numbers in range of <-50,50> are randomly chosen and sent as Celsius degrees to `hello-snowman`instance API endpoint `/input`.
5
+
Stream is generated in [stream-gen.js](../tools/stream-gen-tool/stream-gen.js) file, where numbers in range of <-50,50> are randomly chosen and sent as Celsius degrees to `hello-snowman`Instance API endpoint `/input`.
7
6
8
7
Our `hello-snowman` app will read and interpret these Celsius degrees, and will inform us about state of our Snowman:
9
8
10
-
- if temperature will be 0 or below, sequence will return message: `Snowman is freezing ... :)`
11
-
- in the other case (temperature above 0 degrees), sequence will return message: `Snowman is melting! :(`
9
+
- if temperature will be 0 or below, Sequence will return message:
12
10
13
-
> :bulb:**Please note that the sample below requires some previous installations before you start running it, you will find them [here](../../README.md#3-install-scramjet-transform-hub).**
11
+
```bash
12
+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
13
+
```
14
+
15
+
- in the other case (temperature above 0 degrees), Sequence will return message:
16
+
17
+
```bash
18
+
Snowman ⛄ is melting! 🥵
19
+
```
14
20
15
-
### Running
21
+
> 💡 **Please note that the sample below requires some previous installations before you start running it, you will find them [here](../../README.md#3-install-scramjet-transform-hub).**
22
+
23
+
## Running
16
24
17
25
Open three terminals and run the following commands:
18
26
@@ -32,27 +40,29 @@ cd samples/hello-snowman
32
40
# install dependencies
33
41
npm install
34
42
35
-
# make a compressed package with sequence
43
+
# make a compressed package with Sequence
36
44
si pack . -o hello-snowman.tar.gz
37
45
38
-
# send sequence to transform hub, this will output Sequence ID
46
+
# send Sequence to transform hub, this will output Sequence ID
39
47
si seq send hello-snowman.tar.gz
40
48
41
-
# start a sequence, this will output Instance ID
42
-
si seq start <sequence-id>
49
+
# start a Sequence, this will output Instance ID
50
+
si seq start -
43
51
44
-
# See output of instance process
45
-
si inst output <instance-id>
52
+
# See output of Instance process
53
+
si inst output -
46
54
```
47
55
48
56
**In the third terminal**
49
57
50
58
```bash
51
-
# Start stream generator tool with instance ID as parameter
59
+
# Start stream generator tool with Instance ID as parameter
0 commit comments