UNPKG

soocrate-core

Version:

this is the core of soocrate application

1,810 lines (1,809 loc) 338 kB
{ "type": "File", "start": 0, "end": 1917, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 64, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1917, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 64, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 2, "end": 33, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 9, "end": 14, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 12 } }, "local": { "type": "Identifier", "start": 9, "end": 14, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 12 }, "identifierName": "Spray" }, "name": "Spray" } } ], "source": { "type": "StringLiteral", "start": 20, "end": 32, "loc": { "start": { "line": 2, "column": 18 }, "end": { "line": 2, "column": 30 } }, "extra": { "rawValue": "spray-wrtc", "raw": "\"spray-wrtc\"" }, "value": "spray-wrtc" } }, { "type": "ImportDeclaration", "start": 35, "end": 93, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 58 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 42, "end": 57, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 22 } }, "local": { "type": "Identifier", "start": 42, "end": 57, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 22 }, "identifierName": "CausalBroadcast" }, "name": "CausalBroadcast" } } ], "source": { "type": "StringLiteral", "start": 63, "end": 92, "loc": { "start": { "line": 3, "column": 28 }, "end": { "line": 3, "column": 57 } }, "extra": { "rawValue": "causal-broadcast-definition", "raw": "\"causal-broadcast-definition\"" }, "value": "causal-broadcast-definition" } }, { "type": "ImportDeclaration", "start": 95, "end": 145, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 50 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 102, "end": 106, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 11 } }, "local": { "type": "Identifier", "start": 102, "end": 106, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 11 }, "identifierName": "VVwE" }, "name": "VVwE" } } ], "source": { "type": "StringLiteral", "start": 112, "end": 144, "loc": { "start": { "line": 4, "column": 17 }, "end": { "line": 4, "column": 49 } }, "extra": { "rawValue": "version-vector-with-exceptions", "raw": "\"version-vector-with-exceptions\"" }, "value": "version-vector-with-exceptions" } }, { "type": "VariableDeclaration", "start": 149, "end": 220, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 7, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "start": 153, "end": 219, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 7, "column": 35 } }, "id": { "type": "Identifier", "start": 153, "end": 157, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 8 }, "identifierName": "opts" }, "name": "opts" }, "init": { "type": "ObjectExpression", "start": 160, "end": 219, "loc": { "start": { "line": 6, "column": 11 }, "end": { "line": 7, "column": 35 } }, "properties": [ { "type": "ObjectProperty", "start": 161, "end": 181, "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 32 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 161, "end": 170, "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 21 }, "identifierName": "deltatime" }, "name": "deltatime" }, "value": { "type": "BinaryExpression", "start": 172, "end": 181, "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 32 } }, "left": { "type": "BinaryExpression", "start": 172, "end": 179, "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 30 } }, "left": { "type": "NumericLiteral", "start": 172, "end": 176, "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 27 } }, "extra": { "rawValue": 1000, "raw": "1000" }, "value": 1000 }, "operator": "*", "right": { "type": "NumericLiteral", "start": 177, "end": 179, "loc": { "start": { "line": 6, "column": 28 }, "end": { "line": 6, "column": 30 } }, "extra": { "rawValue": 60, "raw": "60" }, "value": 60 } }, "operator": "*", "right": { "type": "NumericLiteral", "start": 180, "end": 181, "loc": { "start": { "line": 6, "column": 31 }, "end": { "line": 6, "column": 32 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } }, { "type": "ObjectProperty", "start": 196, "end": 218, "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 34 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 196, "end": 202, "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 18 }, "identifierName": "webrtc" }, "name": "webrtc" }, "value": { "type": "ObjectExpression", "start": 204, "end": 218, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 34 } }, "properties": [ { "type": "ObjectProperty", "start": 205, "end": 217, "loc": { "start": { "line": 7, "column": 21 }, "end": { "line": 7, "column": 33 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 205, "end": 212, "loc": { "start": { "line": 7, "column": 21 }, "end": { "line": 7, "column": 28 }, "identifierName": "trickle" }, "name": "trickle" }, "value": { "type": "BooleanLiteral", "start": 213, "end": 217, "loc": { "start": { "line": 7, "column": 29 }, "end": { "line": 7, "column": 33 } }, "value": true } } ] } } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 224, "end": 251, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 228, "end": 250, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 26 } }, "id": { "type": "Identifier", "start": 228, "end": 232, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 8 }, "identifierName": "rps1" }, "name": "rps1" }, "init": { "type": "NewExpression", "start": 235, "end": 250, "loc": { "start": { "line": 9, "column": 11 }, "end": { "line": 9, "column": 26 } }, "callee": { "type": "Identifier", "start": 239, "end": 244, "loc": { "start": { "line": 9, "column": 15 }, "end": { "line": 9, "column": 20 }, "identifierName": "Spray" }, "name": "Spray" }, "arguments": [ { "type": "Identifier", "start": 245, "end": 249, "loc": { "start": { "line": 9, "column": 21 }, "end": { "line": 9, "column": 25 }, "identifierName": "opts" }, "name": "opts" } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 253, "end": 280, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 257, "end": 279, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 26 } }, "id": { "type": "Identifier", "start": 257, "end": 261, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 8 }, "identifierName": "rps2" }, "name": "rps2" }, "init": { "type": "NewExpression", "start": 264, "end": 279, "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 26 } }, "callee": { "type": "Identifier", "start": 268, "end": 273, "loc": { "start": { "line": 10, "column": 15 }, "end": { "line": 10, "column": 20 }, "identifierName": "Spray" }, "name": "Spray" }, "arguments": [ { "type": "Identifier", "start": 274, "end": 278, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 10, "column": 25 }, "identifierName": "opts" }, "name": "opts" } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 282, "end": 309, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 286, "end": 308, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 26 } }, "id": { "type": "Identifier", "start": 286, "end": 290, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 8 }, "identifierName": "rps3" }, "name": "rps3" }, "init": { "type": "NewExpression", "start": 293, "end": 308, "loc": { "start": { "line": 11, "column": 11 }, "end": { "line": 11, "column": 26 } }, "callee": { "type": "Identifier", "start": 297, "end": 302, "loc": { "start": { "line": 11, "column": 15 }, "end": { "line": 11, "column": 20 }, "identifierName": "Spray" }, "name": "Spray" }, "arguments": [ { "type": "Identifier", "start": 303, "end": 307, "loc": { "start": { "line": 11, "column": 21 }, "end": { "line": 11, "column": 25 }, "identifierName": "opts" }, "name": "opts" } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 311, "end": 335, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 24 } }, "declarations": [ { "type": "VariableDeclarator", "start": 315, "end": 334, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 23 } }, "id": { "type": "Identifier", "start": 315, "end": 320, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 9 }, "identifierName": "vvwe1" }, "name": "vvwe1" }, "init": { "type": "NewExpression", "start": 323, "end": 334, "loc": { "start": { "line": 12, "column": 12 }, "end": { "line": 12, "column": 23 } }, "callee": { "type": "Identifier", "start": 327, "end": 331, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "VVwE" }, "name": "VVwE" }, "arguments": [ { "type": "NumericLiteral", "start": 332, "end": 333, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 22 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 337, "end": 361, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 24 } }, "declarations": [ { "type": "VariableDeclarator", "start": 341, "end": 360, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 23 } }, "id": { "type": "Identifier", "start": 341, "end": 346, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 }, "identifierName": "vvwe2" }, "name": "vvwe2" }, "init": { "type": "NewExpression", "start": 349, "end": 360, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 23 } }, "callee": { "type": "Identifier", "start": 353, "end": 357, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 20 }, "identifierName": "VVwE" }, "name": "VVwE" }, "arguments": [ { "type": "NumericLiteral", "start": 358, "end": 359, "loc": { "start": { "line": 13, "column": 21 }, "end": { "line": 13, "column": 22 } }, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 363, "end": 387, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 24 } }, "declarations": [ { "type": "VariableDeclarator", "start": 367, "end": 386, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 23 } }, "id": { "type": "Identifier", "start": 367, "end": 372, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 9 }, "identifierName": "vvwe3" }, "name": "vvwe3" }, "init": { "type": "NewExpression", "start": 375, "end": 386, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 23 } }, "callee": { "type": "Identifier", "start": 379, "end": 383, "loc": { "start": { "line": 14, "column": 16 }, "end": { "line": 14, "column": 20 }, "identifierName": "VVwE" }, "name": "VVwE" }, "arguments": [ { "type": "NumericLiteral", "start": 384, "end": 385, "loc": { "start": { "line": 14, "column": 21 }, "end": { "line": 14, "column": 22 } }, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 389, "end": 438, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 49 } }, "declarations": [ { "type": "VariableDeclarator", "start": 393, "end": 437, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 48 } }, "id": { "type": "Identifier", "start": 393, "end": 403, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 14 }, "identifierName": "broadcast1" }, "name": "broadcast1" }, "init": { "type": "NewExpression", "start": 406, "end": 437, "loc": { "start": { "line": 15, "column": 17 }, "end": { "line": 15, "column": 48 } }, "callee": { "type": "Identifier", "start": 410, "end": 425, "loc": { "start": { "line": 15, "column": 21 }, "end": { "line": 15, "column": 36 }, "identifierName": "CausalBroadcast" }, "name": "CausalBroadcast" }, "arguments": [ { "type": "Identifier", "start": 426, "end": 430, "loc": { "start": { "line": 15, "column": 37 }, "end": { "line": 15, "column": 41 }, "identifierName": "rps1" }, "name": "rps1" }, { "type": "Identifier", "start": 431, "end": 436, "loc": { "start": { "line": 15, "column": 42 }, "end": { "line": 15, "column": 47 }, "identifierName": "vvwe1" }, "name": "vvwe1" } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 440, "end": 489, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 49 } }, "declarations": [ { "type": "VariableDeclarator", "start": 444, "end": 488, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 48 } }, "id": { "type": "Identifier", "start": 444, "end": 454, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 14 }, "identifierName": "broadcast2" }, "name": "broadcast2" }, "init": { "type": "NewExpression", "start": 457, "end": 488, "loc": { "start": { "line": 16, "column": 17 }, "end": { "line": 16, "column": 48 } }, "callee": { "type": "Identifier", "start": 461, "end": 476, "loc": { "start": { "line": 16, "column": 21 }, "end": { "line": 16, "column": 36 }, "identifierName": "CausalBroadcast" }, "name": "CausalBroadcast" }, "arguments": [ { "type": "Identifier", "start": 477, "end": 481, "loc": { "start": { "line": 16, "column": 37 }, "end": { "line": 16, "column": 41 }, "identifierName": "rps2" }, "name": "rps2" }, { "type": "Identifier", "start": 482, "end": 487, "loc": { "start": { "line": 16, "column": 42 }, "end": { "line": 16, "column": 47 }, "identifierName": "vvwe2" }, "name": "vvwe2" } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 491, "end": 540, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 49 } }, "declarations": [ { "type": "VariableDeclarator", "start": 495, "end": 539, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 48 } }, "id": { "type": "Identifier", "start": 495, "end": 505, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 14 }, "identifierName": "broadcast3" }, "name": "broadcast3" }, "init": { "type": "NewExpression", "start": 508, "end": 539, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 48 } }, "callee": { "type": "Identifier", "start": 512, "end": 527, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 36 }, "identifierName": "CausalBroadcast" }, "name": "CausalBroadcast" }, "arguments": [ { "type": "Identifier", "start": 528, "end": 532, "loc": { "start": { "line": 17, "column": 37 }, "end": { "line": 17, "column": 41 }, "identifierName": "rps3" }, "name": "rps3" }, { "type": "Identifier", "start": 533, "end": 538, "loc": { "start": { "line": 17, "column": 42 }, "end": { "line": 17, "column": 47 }, "identifierName": "vvwe3" }, "name": "vvwe3" } ] } } ], "kind": "var", "trailingComments": [ { "type": "CommentLine", "value": " #A establish connection between the peers", "start": 544, "end": 588, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 44 } } } ] }, { "type": "VariableDeclaration", "start": 590, "end": 939, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 32, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 594, "end": 938, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 32, "column": 1 } }, "id": { "type": "Identifier", "start": 594, "end": 603, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 13 }, "identifierName": "callbacks" }, "name": "callbacks", "leadingComments": null }, "init": { "type": "FunctionExpression", "start": 606, "end": 938, "loc": { "start": { "line": 20, "column": 16 }, "end": { "line": 32, "column": 1 } }, "id": { "type": "Identifier", "start": 594, "end": 603, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 13 }, "identifierName": "callbacks" }, "name": "callbacks", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 615, "end": 618, "loc": { "start": { "line": 20, "column": 25 }, "end": { "line": 20, "column": 28 }, "identifierName": "src" }, "name": "src" }, { "type": "Identifier", "start": 620, "end": 624, "loc": { "start": { "line": 20, "column": 30 }, "end": { "line": 20, "column": 34 }, "identifierName": "dest" }, "name": "dest" } ], "body": { "type": "BlockStatement", "start": 625, "end": 938, "loc": { "start": { "line": 20, "column": 35 }, "end": { "line": 32, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 632, "end": 935, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 31, "column": 6 } }, "argument": { "type": "ObjectExpression", "start": 639, "end": 934, "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 31, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 650, "end": 748, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 24, "column": 9 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 650, "end": 660, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 18 }, "identifierName": "onInitiate" }, "name": "onInitiate" }, "value": { "type": "FunctionExpression", "start": 662, "end": 748, "loc": { "start": { "line": 22, "column": 20 }, "end": { "line": 24, "column": 9 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 671, "end": 676, "loc": { "start": { "line": 22, "column": 29 }, "end": { "line": 22, "column": 34 }, "identifierName": "offer" }, "name": "offer" } ], "body": { "type": "BlockStatement", "start": 677, "end": 748, "loc": { "start": { "line": 22, "column": 35 }, "end": { "line": 24, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 692, "end": 737, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 57 } }, "expression": { "type": "CallExpression", "start": 692, "end": 736, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 56 } }, "callee": { "type": "MemberExpression", "start": 692, "end": 707, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 27