UNPKG

@xailabs/altx

Version:

Flux flavor based on alt.js

1,464 lines (1,463 loc) 600 kB
{ "type": "File", "start": 0, "end": 4354, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 105, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 4354, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 105, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 46, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 46 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 12, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 12 } }, "imported": { "type": "Identifier", "start": 8, "end": 12, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 12 }, "identifierName": "bind" }, "name": "bind" }, "local": { "type": "Identifier", "start": 8, "end": 12, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 12 }, "identifierName": "bind" }, "name": "bind" } } ], "source": { "type": "StringLiteral", "start": 19, "end": 45, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 45 } }, "extra": { "rawValue": "alt-utils/lib/decorators", "raw": "'alt-utils/lib/decorators'" }, "value": "alt-utils/lib/decorators" } }, { "type": "ImportDeclaration", "start": 48, "end": 87, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 39 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 55, "end": 62, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 55, "end": 62, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "flatten" }, "name": "flatten" } } ], "source": { "type": "StringLiteral", "start": 68, "end": 86, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 38 } }, "extra": { "rawValue": "../utils/flatten", "raw": "'../utils/flatten'" }, "value": "../utils/flatten" } }, { "type": "ImportDeclaration", "start": 89, "end": 156, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 67 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 97, "end": 120, "loc": { "start": { "line": 3, "column": 8 }, "end": { "line": 3, "column": 31 } }, "imported": { "type": "Identifier", "start": 97, "end": 105, "loc": { "start": { "line": 3, "column": 8 }, "end": { "line": 3, "column": 16 }, "identifierName": "getLevel" }, "name": "getLevel" }, "local": { "type": "Identifier", "start": 109, "end": 120, "loc": { "start": { "line": 3, "column": 20 }, "end": { "line": 3, "column": 31 }, "identifierName": "getLogLevel" }, "name": "getLogLevel" } }, { "type": "ImportSpecifier", "start": 122, "end": 130, "loc": { "start": { "line": 3, "column": 33 }, "end": { "line": 3, "column": 41 } }, "imported": { "type": "Identifier", "start": 122, "end": 130, "loc": { "start": { "line": 3, "column": 33 }, "end": { "line": 3, "column": 41 }, "identifierName": "logLevel" }, "name": "logLevel" }, "local": { "type": "Identifier", "start": 122, "end": 130, "loc": { "start": { "line": 3, "column": 33 }, "end": { "line": 3, "column": 41 }, "identifierName": "logLevel" }, "name": "logLevel" } } ], "source": { "type": "StringLiteral", "start": 137, "end": 155, "loc": { "start": { "line": 3, "column": 48 }, "end": { "line": 3, "column": 66 } }, "extra": { "rawValue": "../utils/logging", "raw": "'../utils/logging'" }, "value": "../utils/logging" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Decorates a store with any number of call definitions.\r\n ", "start": 158, "end": 225, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 227, "end": 465, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 13, "column": 1 } }, "declaration": { "type": "FunctionDeclaration", "start": 242, "end": 465, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 13, "column": 1 } }, "id": { "type": "Identifier", "start": 251, "end": 260, "loc": { "start": { "line": 7, "column": 24 }, "end": { "line": 7, "column": 33 }, "identifierName": "bindCalls" }, "name": "bindCalls", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 261, "end": 268, "loc": { "start": { "line": 7, "column": 34 }, "end": { "line": 7, "column": 41 } }, "argument": { "type": "Identifier", "start": 264, "end": 268, "loc": { "start": { "line": 7, "column": 37 }, "end": { "line": 7, "column": 41 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 270, "end": 465, "loc": { "start": { "line": 7, "column": 43 }, "end": { "line": 13, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 277, "end": 462, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 12, "column": 6 } }, "argument": { "type": "FunctionExpression", "start": 284, "end": 461, "loc": { "start": { "line": 8, "column": 11 }, "end": { "line": 12, "column": 5 } }, "id": { "type": "Identifier", "start": 293, "end": 301, "loc": { "start": { "line": 8, "column": 20 }, "end": { "line": 8, "column": 28 }, "identifierName": "decorate" }, "name": "decorate" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 302, "end": 312, "loc": { "start": { "line": 8, "column": 29 }, "end": { "line": 8, "column": 39 }, "identifierName": "storeClass" }, "name": "storeClass" } ], "body": { "type": "BlockStatement", "start": 314, "end": 461, "loc": { "start": { "line": 8, "column": 41 }, "end": { "line": 12, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 325, "end": 353, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "start": 331, "end": 352, "loc": { "start": { "line": 9, "column": 14 }, "end": { "line": 9, "column": 35 } }, "id": { "type": "Identifier", "start": 331, "end": 336, "loc": { "start": { "line": 9, "column": 14 }, "end": { "line": 9, "column": 19 }, "identifierName": "calls" }, "name": "calls" }, "init": { "type": "CallExpression", "start": 339, "end": 352, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 35 } }, "callee": { "type": "Identifier", "start": 339, "end": 346, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 29 }, "identifierName": "flatten" }, "name": "flatten" }, "arguments": [ { "type": "Identifier", "start": 347, "end": 351, "loc": { "start": { "line": 9, "column": 30 }, "end": { "line": 9, "column": 34 }, "identifierName": "args" }, "name": "args" } ] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 363, "end": 426, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 71 } }, "expression": { "type": "CallExpression", "start": 363, "end": 425, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 70 } }, "callee": { "type": "MemberExpression", "start": 363, "end": 376, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 21 } }, "object": { "type": "Identifier", "start": 363, "end": 368, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 13 }, "identifierName": "calls" }, "name": "calls" }, "property": { "type": "Identifier", "start": 369, "end": 376, "loc": { "start": { "line": 10, "column": 14 }, "end": { "line": 10, "column": 21 }, "identifierName": "forEach" }, "name": "forEach" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 377, "end": 424, "loc": { "start": { "line": 10, "column": 22 }, "end": { "line": 10, "column": 69 } }, "id": null, "generator": false, "expression": true, "async": false, "params": [ { "type": "Identifier", "start": 377, "end": 381, "loc": { "start": { "line": 10, "column": 22 }, "end": { "line": 10, "column": 26 }, "identifierName": "call" }, "name": "call" } ], "body": { "type": "CallExpression", "start": 385, "end": 424, "loc": { "start": { "line": 10, "column": 30 }, "end": { "line": 10, "column": 69 } }, "callee": { "type": "Identifier", "start": 385, "end": 406, "loc": { "start": { "line": 10, "column": 30 }, "end": { "line": 10, "column": 51 }, "identifierName": "decorateStoreWithCall" }, "name": "decorateStoreWithCall" }, "arguments": [ { "type": "Identifier", "start": 407, "end": 417, "loc": { "start": { "line": 10, "column": 52 }, "end": { "line": 10, "column": 62 }, "identifierName": "storeClass" }, "name": "storeClass" }, { "type": "Identifier", "start": 419, "end": 423, "loc": { "start": { "line": 10, "column": 64 }, "end": { "line": 10, "column": 68 }, "identifierName": "call" }, "name": "call" } ] } } ] } }, { "type": "ReturnStatement", "start": 436, "end": 454, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 26 } }, "argument": { "type": "Identifier", "start": 443, "end": 453, "loc": { "start": { "line": 11, "column": 15 }, "end": { "line": 11, "column": 25 }, "identifierName": "storeClass" }, "name": "storeClass" } } ], "directives": [] } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Decorates a store with any number of call definitions.\r\n ", "start": 158, "end": 225, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 3 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Decorates a store with a single call definition.\r\n * Attaches the dataSource specified in the call definition using alt's datasource decorator.\r\n * Creates and binds a handler function for all reducers and actions specified in the call definition.\r\n ", "start": 469, "end": 729, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 19, "column": 3 } } } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Decorates a store with any number of call definitions.\r\n ", "start": 158, "end": 225, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 3 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Decorates a store with a single call definition.\r\n * Attaches the dataSource specified in the call definition using alt's datasource decorator.\r\n * Creates and binds a handler function for all reducers and actions specified in the call definition.\r\n ", "start": 469, "end": 729, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 19, "column": 3 } } } ] }, { "type": "FunctionDeclaration", "start": 731, "end": 1199, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 31, "column": 1 } }, "id": { "type": "Identifier", "start": 740, "end": 761, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 30 }, "identifierName": "decorateStoreWithCall" }, "name": "decorateStoreWithCall", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 762, "end": 772, "loc": { "start": { "line": 20, "column": 31 }, "end": { "line": 20, "column": 41 }, "identifierName": "storeClass" }, "name": "storeClass" }, { "type": "Identifier", "start": 774, "end": 788, "loc": { "start": { "line": 20, "column": 43 }, "end": { "line": 20, "column": 57 }, "identifierName": "callDefinition" }, "name": "callDefinition" } ], "body": { "type": "BlockStatement", "start": 790, "end": 1199, "loc": { "start": { "line": 20, "column": 59 }, "end": { "line": 31, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 797, "end": 1075, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 11 } }, "declarations": [ { "type": "VariableDeclarator", "start": 803, "end": 1074, "loc": { "start": { "line": 21, "column": 10 }, "end": { "line": 27, "column": 10 } }, "id": { "type": "Identifier", "start": 803, "end": 814, "loc": { "start": { "line": 21, "column": 10 }, "end": { "line": 21, "column": 21 }, "identifierName": "actionNames" }, "name": "actionNames" }, "init": { "type": "CallExpression", "start": 817, "end": 1074, "loc": { "start": { "line": 21, "column": 24 }, "end": { "line": 27, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 817, "end": 859, "loc": { "start": { "line": 21, "column": 24 }, "end": { "line": 21, "column": 66 } }, "object": { "type": "CallExpression", "start": 817, "end": 852, "loc": { "start": { "line": 21, "column": 24 }, "end": { "line": 21, "column": 59 } }, "callee": { "type": "MemberExpression", "start": 817, "end": 828, "loc": { "start": { "line": 21, "column": 24 }, "end": { "line": 21, "column": 35 } }, "object": { "type": "Identifier", "start": 817, "end": 823, "loc": { "start": { "line": 21, "column": 24 }, "end": { "line": 21, "column": 30 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 824, "end": 828, "loc": { "start": { "line": 21, "column": 31 }, "end": { "line": 21, "column": 35 }, "identifierName": "keys" }, "name": "keys" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 829, "end": 851, "loc": { "start": { "line": 21, "column": 36 }, "end": { "line": 21, "column": 58 } }, "object": { "type": "Identifier", "start": 829, "end": 843, "loc": { "start": { "line": 21, "column": 36 }, "end": { "line": 21, "column": 50 }, "identifierName": "callDefinition" }, "name": "callDefinition" }, "property": { "type": "Identifier", "start": 844, "end": 851, "loc": { "start": { "line": 21, "column": 51 }, "end": { "line": 21, "column": 58 }, "identifierName": "actions" }, "name": "actions" }, "computed": false } ] }, "property": { "type": "Identifier", "start": 853, "end": 859, "loc": { "start": { "line": 21, "column": 60 }, "end": { "line": 21, "column": 66 }, "identifierName": "reduce" }, "name": "reduce" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 860, "end": 1069, "loc": { "start": { "line": 21, "column": 67 }, "end": { "line": 27, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 861, "end": 867, "loc": { "start": { "line": 21, "column": 68 }, "end": { "line": 21, "column": 74 }, "identifierName": "result" }, "name": "result" }, { "type": "Identifier", "start": 869, "end": 872, "loc": { "start": { "line": 21, "column": 76 }, "end": { "line": 21, "column": 79 }, "identifierName": "key" }, "name": "key" } ], "body": { "type": "BlockStatement", "start": 877, "end": 1069, "loc": { "start": { "line": 21, "column": 84 }, "end": { "line": 27, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 949, "end": 1038, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 25, "column": 9 } }, "test": { "type": "BinaryExpression", "start": 953, "end": 993, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 52 } }, "left": { "type": "CallExpression", "start": 953, "end": 986, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 45 } }, "callee": { "type": "MemberExpression", "start": 953, "end": 967, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 26 } }, "object": { "type": "Identifier", "start": 953, "end": 959, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 18 }, "identifierName": "result" }, "name": "result", "leadingComments": null }, "property": { "type": "Identifier", "start": 960, "end": 967, "loc": { "start": { "line": 23, "column": 19 }, "end": { "line": 23, "column": 26 }, "identifierName": "indexOf" }, "name": "indexOf" }, "computed": false, "leadingComments": null }, "arguments": [ { "type": "CallExpression", "start": 968, "end": 985, "loc": { "start": { "line": 23, "column": 27 }, "end": { "line": 23, "column": 44 } }, "callee": { "type": "MemberExpression", "start": 968, "end": 983, "loc": { "start": { "line": 23, "column": 27 }, "end": { "line": 23, "column": 42 } }, "object": { "type": "Identifier", "start": 968, "end": 971, "loc": { "start": { "line": 23, "column": 27 }, "end": { "line": 23, "column": 30 }, "identifierName": "key" }, "name": "key" }, "property": { "type": "Identifier", "start": 972, "end": 983, "loc": { "start": { "line": 23, "column": 31 }, "end": { "line": 23, "column": 42 }, "identifierName": "toLowerCase" }, "name": "toLowerCase" }, "computed": false }, "arguments": [] } ], "leadingComments": null }, "operator": "===", "right": { "type": "UnaryExpression", "start": 991, "end": 993, "loc": { "start": { "line": 23, "column": 50 }, "end": {