2018-11-19 22:22:39 +00:00
|
|
|
"use strict";
|
|
|
|
|
2019-09-11 14:11:15 +00:00
|
|
|
import { Map, Decoder, Encoder, Discard, Capture, Observe } from "@syndicate-lang/core";
|
2018-11-19 22:22:39 +00:00
|
|
|
|
2019-05-12 22:26:01 +00:00
|
|
|
message type Connect(scope);
|
|
|
|
|
2019-06-08 20:10:31 +00:00
|
|
|
message type Turn(items);
|
2019-05-30 22:06:15 +00:00
|
|
|
|
2018-11-19 22:22:39 +00:00
|
|
|
message type Assert(endpointName, assertion);
|
|
|
|
message type Clear(endpointName);
|
|
|
|
message type Message(body);
|
|
|
|
|
|
|
|
message type Add(endpointName, captures);
|
|
|
|
message type Del(endpointName, captures);
|
|
|
|
message type Msg(endpointName, captures);
|
2019-06-06 14:10:48 +00:00
|
|
|
message type End(endpointName);
|
2019-06-11 23:22:53 +00:00
|
|
|
message type Err(detail, context);
|
2018-11-19 22:22:39 +00:00
|
|
|
|
2019-03-18 23:29:43 +00:00
|
|
|
message type Ping();
|
|
|
|
message type Pong();
|
|
|
|
|
2018-11-19 22:22:39 +00:00
|
|
|
function makeDecoder(initialBuffer) {
|
2020-06-10 10:10:23 +00:00
|
|
|
return new Decoder(initialBuffer);
|
2019-09-11 14:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function makeEncoder() {
|
2020-06-10 10:10:23 +00:00
|
|
|
return new Encoder();
|
2018-11-19 22:22:39 +00:00
|
|
|
}
|
|
|
|
|
2019-06-20 12:35:04 +00:00
|
|
|
function shouldDebugPrint(m) {
|
|
|
|
// return !(Ping.isClassOf(m) || Pong.isClassOf(m));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-11-19 22:22:39 +00:00
|
|
|
Object.assign(module.exports, {
|
2019-06-08 20:14:00 +00:00
|
|
|
Connect,
|
2019-06-08 20:10:31 +00:00
|
|
|
Turn,
|
2018-11-19 22:22:39 +00:00
|
|
|
Assert, Clear, Message,
|
2019-06-06 14:10:48 +00:00
|
|
|
Add, Del, Msg, Err, End,
|
2019-03-18 23:29:43 +00:00
|
|
|
Ping, Pong,
|
2019-09-11 14:11:15 +00:00
|
|
|
makeDecoder, makeEncoder,
|
2019-06-20 12:35:04 +00:00
|
|
|
shouldDebugPrint,
|
2018-11-19 22:22:39 +00:00
|
|
|
});
|