0.6.0 • Published 2 years ago
@machinat/stream v0.6.0
Machinat Stream
Reactive programming stream for handling events in back-end.
⚠ This package is still on early experimental. There might be breaking changes in the future for supporting cluster. You can check the future road map here.
Install
npm install @machinat/stream
# or with yarn
yarn add @machinat/stream
Docs
Check the Reactive Programming document and the package reference.
Example
import { makeContainer, IntentRecognizer } from '@machinat/core';
import { fromApp } from '@machinat/stream';
import { map, filter } from '@machinat/stream/operators';
import app from './app';
const event$ = fromApp(app);
const textMsg$ = events$.pipe(
filter(({ event }) => event.type === 'text'),
map(
makeContainer({ deps: [IntentRecognizer] })(
(recognizer) =>
async (context) => {
const { channel, text } = context.event;
const intent = await recognizer.detectText(channel, text);
return { ...context, intent };
}
)
)
);
textMsg$.subscribe(async ({ intent, reply }) => {
const action = intent.type;
if (action) {
await reply(`start ${action}...`);
}
});
0.6.0
2 years ago
0.6.0-canary.0
2 years ago
0.6.0-beta.0
2 years ago
0.5.0-beta.11
2 years ago
0.5.0-beta.12
2 years ago
0.5.0-beta.10
2 years ago
0.5.0-beta.36
2 years ago
0.5.0-beta.14
2 years ago
0.5.0-beta.41
2 years ago
0.5.0-beta.44
2 years ago
0.5.0
2 years ago
0.5.0-beta.3
3 years ago
0.5.0-beta.2
3 years ago
0.5.0-beta.1
3 years ago
0.5.0-beta.0
3 years ago
0.4.1-alpha.44
3 years ago
0.4.1-alpha.39
3 years ago
0.4.1-alpha.34
3 years ago
0.4.1-alpha.33
3 years ago
0.4.1-alpha.31
3 years ago
0.4.1-alpha.29
3 years ago
0.4.1-alpha.28
3 years ago
0.4.1-alpha.27
3 years ago
0.4.1-alpha.24
3 years ago
0.4.1-alpha.18
3 years ago
0.4.1-alpha.5
3 years ago
0.4.1-alpha.3
3 years ago
0.4.1-alpha.1
3 years ago
0.4.0-beta.4
3 years ago
0.4.0-beta.1
3 years ago