Skip to content

Commit c7c303b

Browse files
authored
Merge pull request #32 from scramjetorg/fix/emoji
Emoji fix for website docs
2 parents 4b7a163 + a58c652 commit c7c303b

File tree

21 files changed

+343
-274
lines changed

21 files changed

+343
-274
lines changed

README.md

Lines changed: 131 additions & 63 deletions
Large diffs are not rendered by default.

dictionary.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Software Development Kit. A collection of tools and libraries to create a softwa
261261

262262
### Sequence
263263

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).
265265

266266
### Socket
267267

@@ -277,9 +277,7 @@ standard input/standard output. Application communication channels with the outs
277277

278278
### STH <!--TODO-->
279279

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
280+
shortcut for Scramjet Transform Hub
283281

284282
### Synchronous
285283

samples/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
# Samples :books:
1+
# Samples
22

3-
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.
44

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).**
66
77
## JavaScript samples
88

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".
1010
- [hello-snowman](hello-snowman) - Sequence that reads incoming stream, and modifies it by adding a text message according to the incoming data.
1111
- [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.
1313

1414
## TypeScript samples
1515

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.
1718
- [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.
1820
- [scraping](scraping) - Sequence that scrapes web pages.
1921
- [stack-overflow](stack-overflow) - Sequence that gets a number of changes in Stack Overflow tag count.
2022
- [transform-string-stream](transform-string-stream) - Sequence that modifies incoming stream of strings by adding a prefix and a suffix.

samples/crypto-prices/README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
## crypto-prices ![bitcoin](../../images/bitcoin1.png) ![zcash](../../images/zcash1.png) ![ethereum](../../images/etherum1.png)
1+
# crypto-prices ![bitcoin](../../images/bitcoin1.png) ![zcash](../../images/zcash1.png) ![ethereum](../../images/etherum1.png)
22

3-
---
4-
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.
54

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).**
76
8-
### Running
7+
## Running
98

109
Open two terminals and run the following commands:
1110

@@ -35,15 +34,15 @@ si pack dist/ -o crypto-prices.tar.gz
3534
si seq send crypto-prices.tar.gz
3635

3736
# 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
3938

40-
# See output
41-
si inst output <instance-id>
39+
# see output
40+
si inst output -
4241
```
4342

44-
### Output
43+
## Output
4544

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:
4746

4847
```bash
4948
Request ok: http://127.0.0.1:8000/api/v1/instance/87442a03-a8ca-451c-b89f-d5371774c2f3/output status: 200 OK

samples/discord-slack-connection/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Discord to Slack (and vice versa) Connection
22

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:
46

57
* [discord-read](./discord-read/)
68
* [discord-write](./discord-write/)
@@ -9,21 +11,23 @@ In this project you will find 4 STH sequences:
911

1012
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.
1113

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.
1315

1416
## TODO
1517

1618
As there is no way to map message IDs between the two applications, threads are not supported.
1719

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
1923

20-
## Know Issues
24+
<!-- TODO - check if this issues still apply -->
2125

2226
STH `v0.13` if installed via `npm` has an issue with `objectMode: true`. You will get an error like:
2327

2428
```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
2731
```
2832

2933
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.

samples/discord-slack-connection/discord-read/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Discord Read
22

3-
Read messages from discord channel and write to topic
3+
Read messages from Discord channel and write to topic.
44

55
[Discord Documentation](https://discord.js.org/#/docs/discord.js/stable/general/welcome)
66

@@ -9,14 +9,14 @@ In order to read messages from Discord we need to create a bot first:
99
* Go to Developer Portal and click on [Applications](https://discord.com/developers/applications)
1010
* Click on `New Application` button and give it a name. Then click on `Create`.
1111
* 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*.
2020

2121
Create a file called `config.json` and add:
2222

@@ -37,14 +37,14 @@ npm install
3737
# transpile TS->JS to dist/
3838
npm run build
3939

40-
# make a compressed package with sequence
40+
# make a compressed package with Sequence
4141
si pack dist
4242

43-
# send sequence to transform hub, this will output Sequence ID
43+
# send Sequence to transform hub, this will output Sequence ID
4444
si seq send dist.tar.gz
4545

46-
# start a sequence, this will output Instance ID.
47-
si seq start <sequence-id>
46+
# start a Sequence
47+
si seq start -
4848

4949
# view messages in topic
5050
si topic get messages

samples/discord-slack-connection/discord-write/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# Discord Write
22

3-
Read messages from topic and write to discord via webhook
3+
Read messages from topic and write to Discord via webhook.
44

55
[Discord Documentation](https://discord.com/developers/docs/resources/webhook)
66

77
## Running
88

9-
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.
1010

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.
1412

1513
```bash
1614
# install dependencies
@@ -19,14 +17,14 @@ npm install
1917
# transpile TS->JS to dist/
2018
npm run build
2119

22-
# make a compressed package with sequence
20+
# make a compressed package with Sequence
2321
si pack dist
2422

25-
# send sequence to transform hub, this will output Sequence ID
23+
# send Sequence to transform hub, this will output Sequence ID
2624
si seq send dist.tar.gz
2725

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
27+
si seq start - <DISCORD_WEBHOOK_URL>
3028

3129
# view messages in topic
3230
si topic get messages

samples/discord-slack-connection/slack-read/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ npm install
2121
# transpile TS->JS to dist/
2222
npm run build
2323

24-
# make a compressed package with sequence
24+
# make a compressed package with Sequence
2525
si pack dist
2626

27-
# send sequence to transform hub, this will output Sequence ID
27+
# send Sequence to transform hub, this will output Sequence ID
2828
si seq send dist.tar.gz
2929

30-
# start a sequence, this will output Instance ID. Provide SOCKET_MODE_TOKEN as the second parameter
31-
si seq start <sequence-id> <SOCKET_MODE_TOKEN>
30+
# start a Sequence, provide SOCKET_MODE_TOKEN as the second parameter
31+
si seq start - <SOCKET_MODE_TOKEN>
3232

3333
# view messages in topic
3434
si topic get messages

samples/discord-slack-connection/slack-write/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Slack Write
22

3-
Read messages from topic and write to slack.
3+
Read messages from topic and write to Slack.
44

55
In order to get SLACK_WEBHOOK_URL you need to create application in Slack first.
66
Please refer to notes in [slack-read](../slack-read/) example.
@@ -20,14 +20,14 @@ npm install
2020
# transpile TS->JS to dist/
2121
npm run build
2222

23-
# make a compressed package with sequence
23+
# make a compressed package with Sequence
2424
si pack dist
2525

26-
# send sequence to transform hub, this will output Sequence ID
26+
# send Sequence to transform hub, this will output Sequence ID
2727
si seq send dist.tar.gz
2828

29-
# start a sequence, this will output Instance ID. Provide SLACK_WEBHOOK_URL as the second parameter
30-
si seq start <sequence-id> <SLACK_WEBHOOK_URL>
29+
# start a Sequence, provide SLACK_WEBHOOK_URL as the second parameter
30+
si seq start - <SLACK_WEBHOOK_URL>
3131

3232
# view messages in topic
3333
si topic get messages

samples/hello-snowman/README.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
## hello-snowman :snowman:
1+
# hello-snowman
22

3-
----
43
Sequence that reads incoming stream (input), and and modifies it by adding a text message according to the incoming data.
54

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`.
76

87
Our `hello-snowman` app will read and interpret these Celsius degrees, and will inform us about state of our Snowman:
98

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:
1210

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+
```
1420

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
1624

1725
Open three terminals and run the following commands:
1826

@@ -32,27 +40,29 @@ cd samples/hello-snowman
3240
# install dependencies
3341
npm install
3442

35-
# make a compressed package with sequence
43+
# make a compressed package with Sequence
3644
si pack . -o hello-snowman.tar.gz
3745

38-
# send sequence to transform hub, this will output Sequence ID
46+
# send Sequence to transform hub, this will output Sequence ID
3947
si seq send hello-snowman.tar.gz
4048

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 -
4351

44-
# See output of instance process
45-
si inst output <instance-id>
52+
# See output of Instance process
53+
si inst output -
4654
```
4755

4856
**In the third terminal**
4957

5058
```bash
51-
# Start stream generator tool with instance ID as parameter
59+
# Start stream generator tool with Instance ID as parameter
5260
node ./tools/stream-gen-tool/stream-gen.js <instance_id>
5361
```
5462

55-
### Now you should see something like this in output console:
63+
## Output
64+
65+
Now you should see the output in the console:
5666

5767
```js
5868
----------------------------------------

0 commit comments

Comments
 (0)