UNPKG

@eastsideco/escshopify

Version:

WIP JS library for Shopify, containing a variety of useful functionality.

1,654 lines 135 kB
{ "type": "File", "start": 0, "end": 892, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 54, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 892, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 54, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 106, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 8, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 19, "end": 105, "loc": { "start": { "line": 2, "column": 4 }, "end": { "line": 8, "column": 1 } }, "id": { "type": "Identifier", "start": 19, "end": 22, "loc": { "start": { "line": 2, "column": 4 }, "end": { "line": 2, "column": 7 }, "identifierName": "map" }, "name": "map", "leadingComments": null }, "init": { "type": "ObjectExpression", "start": 25, "end": 105, "loc": { "start": { "line": 2, "column": 10 }, "end": { "line": 8, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 31, "end": 41, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 14 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "NumericLiteral", "start": 31, "end": 32, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 5 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, "value": { "type": "StringLiteral", "start": 34, "end": 41, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 14 } }, "extra": { "rawValue": "DEBUG", "raw": "'DEBUG'" }, "value": "DEBUG" } }, { "type": "ObjectProperty", "start": 47, "end": 56, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 13 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "NumericLiteral", "start": 47, "end": 48, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 5 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "value": { "type": "StringLiteral", "start": 50, "end": 56, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 13 } }, "extra": { "rawValue": "INFO", "raw": "'INFO'" }, "value": "INFO" } }, { "type": "ObjectProperty", "start": 62, "end": 71, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 13 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "NumericLiteral", "start": 62, "end": 63, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 5 } }, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 }, "value": { "type": "StringLiteral", "start": 65, "end": 71, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 13 } }, "extra": { "rawValue": "WARN", "raw": "'WARN'" }, "value": "WARN" } }, { "type": "ObjectProperty", "start": 77, "end": 87, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 14 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "NumericLiteral", "start": 77, "end": 78, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 5 } }, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 }, "value": { "type": "StringLiteral", "start": 80, "end": 87, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 14 } }, "extra": { "rawValue": "ERROR", "raw": "'ERROR'" }, "value": "ERROR" } }, { "type": "ObjectProperty", "start": 93, "end": 103, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 14 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "NumericLiteral", "start": 93, "end": 94, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 5 } }, "extra": { "rawValue": 4, "raw": "4" }, "value": 4 }, "value": { "type": "StringLiteral", "start": 96, "end": 103, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 14 } }, "extra": { "rawValue": "FATAL", "raw": "'FATAL'" }, "value": "FATAL" } } ] }, "leadingComments": null } ], "kind": "var", "leadingComments": [ { "type": "CommentBlock", "value": "* @ignore ", "start": 0, "end": 14, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 14 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Encapsulates logging levels\n ", "start": 109, "end": 147, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 13, "column": 3 } } } ] }, { "type": "Identifier", "start": 148, "end": 765, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 46, "column": 1 } }, "id": { "type": "Identifier", "start": 154, "end": 162, "loc": { "start": { "line": 14, "column": 6 }, "end": { "line": 14, "column": 14 }, "identifierName": "LogLevel" }, "name": "LogLevel", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 163, "end": 765, "loc": { "start": { "line": 14, "column": 15 }, "end": { "line": 46, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 270, "end": 306, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 21, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 270, "end": 276, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 10 }, "identifierName": "getMap" }, "name": "getMap", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 279, "end": 306, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 21, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 289, "end": 300, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 19 } }, "argument": { "type": "Identifier", "start": 296, "end": 299, "loc": { "start": { "line": 20, "column": 15 }, "end": { "line": 20, "column": 18 }, "identifierName": "map" }, "name": "map" } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get a map of availble logging levels.\n * @return {Object<Number, String>}\n ", "start": 169, "end": 265, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 18, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get level name by level identifier.\n * @param {String}\tlevel\n * @return {Number}\n ", "start": 313, "end": 420, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 28, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 425, "end": 480, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 31, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 425, "end": 438, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 17 }, "identifierName": "levelToString" }, "name": "levelToString", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 439, "end": 444, "loc": { "start": { "line": 29, "column": 18 }, "end": { "line": 29, "column": 23 }, "identifierName": "level" }, "name": "level" } ], "body": { "type": "BlockStatement", "start": 446, "end": 480, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 456, "end": 474, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 26 } }, "argument": { "type": "MemberExpression", "start": 463, "end": 473, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 25 } }, "object": { "type": "Identifier", "start": 463, "end": 466, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 18 }, "identifierName": "map" }, "name": "map" }, "property": { "type": "Identifier", "start": 467, "end": 472, "loc": { "start": { "line": 30, "column": 19 }, "end": { "line": 30, "column": 24 }, "identifierName": "level" }, "name": "level" }, "computed": true } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get level name by level identifier.\n * @param {String}\tlevel\n * @return {Number}\n ", "start": 313, "end": 420, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 28, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get level identifier by level name.\n * @param {String}\tlevel\n * @return {Number}\n ", "start": 486, "end": 593, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 37, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 598, "end": 763, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 45, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 598, "end": 611, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 38, "column": 17 }, "identifierName": "stringToLevel" }, "name": "stringToLevel", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 612, "end": 615, "loc": { "start": { "line": 38, "column": 18 }, "end": { "line": 38, "column": 21 }, "identifierName": "str" }, "name": "str" } ], "body": { "type": "BlockStatement", "start": 617, "end": 763, "loc": { "start": { "line": 38, "column": 23 }, "end": { "line": 45, "column": 5 } }, "body": [ { "type": "ForInStatement", "start": 627, "end": 736, "loc": { "start": { "line": 39, "column": 8 }, "end": { "line": 43, "column": 9 } }, "left": { "type": "VariableDeclaration", "start": 632, "end": 639, "loc": { "start": { "line": 39, "column": 13 }, "end": { "line": 39, "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", "start": 636, "end": 639, "loc": { "start": { "line": 39, "column": 17 }, "end": { "line": 39, "column": 20 } }, "id": { "type": "Identifier", "start": 636, "end": 639, "loc": { "start": { "line": 39, "column": 17 }, "end": { "line": 39, "column": 20 }, "identifierName": "key" }, "name": "key" }, "init": null } ], "kind": "let" }, "right": { "type": "Identifier", "start": 643, "end": 646, "loc": { "start": { "line": 39, "column": 24 }, "end": { "line": 39, "column": 27 }, "identifierName": "map" }, "name": "map" }, "body": { "type": "BlockStatement", "start": 648, "end": 736, "loc": { "start": { "line": 39, "column": 29 }, "end": { "line": 43, "column": 9 } }, "body": [ { "type": "IfStatement", "start": 662, "end": 726, "loc": { "start": { "line": 40, "column": 12 }, "end": { "line": 42, "column": 13 } }, "test": { "type": "BinaryExpression", "start": 666, "end": 681, "loc": { "start": { "line": 40, "column": 16 }, "end": { "line": 40, "column": 31 } }, "left": { "type": "MemberExpression", "start": 666, "end": 674, "loc": { "start": { "line": 40, "column": 16 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "Identifier", "start": 666, "end": 669, "loc": { "start": { "line": 40, "column": 16 }, "end": { "line": 40, "column": 19 }, "identifierName": "map" }, "name": "map" }, "property": { "type": "Identifier", "start": 670, "end": 673, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 40, "column": 23 }, "identifierName": "key" }, "name": "key" }, "computed": true }, "operator": "==", "right": { "type": "Identifier", "start": 678, "end": 681, "loc": { "start": { "line": 40, "column": 28 }, "end": { "line": 40, "column": 31 }, "identifierName": "str" }, "name": "str" } }, "consequent": { "type": "BlockStatement", "start": 683, "end": 726, "loc": { "start": { "line": 40, "column": 33 }, "end": { "line": 42, "column": 13 } }, "body": [ { "type": "ReturnStatement", "start": 701, "end": 712, "loc": { "start": { "line": 41, "column": 16 }, "end": { "line": 41, "column": 27 } }, "argument": { "type": "Identifier", "start": 708, "end": 711, "loc": { "start": { "line": 41, "column": 23 }, "end": { "line": 41, "column": 26 }, "identifierName": "key" }, "name": "key" } } ], "directives": [] }, "alternate": null } ], "directives": [] } }, { "type": "ReturnStatement", "start": 745, "end": 757, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 20 } }, "argument": { "type": "NullLiteral", "start": 752, "end": 756, "loc": { "start": { "line": 44, "column": 15 }, "end": { "line": 44, "column": 19 } } } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get level identifier by level name.\n * @param {String}\tlevel\n * @return {Number}\n ", "start": 486, "end": 593, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 37, "column": 7 } } } ] } ] }, "leadingComments": [], "name": "_", "trailingComments": [] }, { "type": "ForInStatement", "start": 767, "end": 831, "loc": { "start": { "line": 48, "column": 0 }, "end": { "line": 50, "column": 1 } }, "left": { "type": "VariableDeclaration", "start": 772, "end": 779, "loc": { "start": { "line": 48, "column": 5 }, "end": { "line": 48, "column": 12 } }, "declarations": [ { "type": "VariableDeclarator", "start": 776, "end": 779, "loc": { "start": { "line": 48, "column": 9 }, "end": { "line": 48, "column": 12 } }, "id": { "type": "Identifier", "start": 776, "end": 779, "loc": { "start": { "line": 48, "column": 9 }, "end": { "line": 48, "column": 12 }, "identifierName": "key" }, "name": "key" }, "init": null } ], "kind": "var" }, "right": { "type": "Identifier", "start": 783, "end": 786, "loc": { "start": { "line": 48, "column": 16 }, "end": { "line": 48, "column": 19 }, "identifierName": "map" }, "name": "map" }, "body": { "type": "BlockStatement", "start": 788, "end": 831, "loc": { "start": { "line": 48, "column": 21 }, "end": { "line": 50, "column": 1 } }, "body": [ { "type": "ExpressionStatement", "start": 794, "end": 829, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 39 } }, "expression": { "type": "AssignmentExpression", "start": 794, "end": 828, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 794, "end": 822, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 32 } }, "object": { "type": "MemberExpression", "start": 794, "end": 812, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 22 } }, "object": { "type": "Identifier", "start": 794, "end": 802, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 12 }, "identifierName": "LogLevel" }, "name": "LogLevel" }, "property": { "type": "Identifier", "start": 803, "end": 812, "loc": { "start": { "line": 49, "column": 13 }, "end": { "line": 49, "column": 22 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "MemberExpression", "start": 813, "end": 821, "loc": { "start": { "line": 49, "column": 23 }, "end": { "line": 49, "column": 31 } }, "object": { "type": "Identifier", "start": 813, "end": 816, "loc": { "start": { "line": 49, "column": 23 }, "end": { "line": 49, "column": 26 }, "identifierName": "map" }, "name": "map" }, "property": { "type": "Identifier", "start": 817, "end": 820, "loc": { "start": { "line": 49, "column": 27 }, "end": { "line": 49, "column": 30 }, "identifierName": "key" }, "name": "key" }, "computed": true }, "computed": true }, "right": { "type": "Identifier", "start": 825, "end": 828, "loc": { "start": { "line": 49, "column": 35 }, "end": { "line": 49, "column": 38 }, "identifierName": "key" }, "name": "key" } } } ], "directives": [], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "* Instance of LogLevel ", "start": 833, "end": 860, "loc": { "start": { "line": 52, "column": 0 }, "end": { "line": 52, "column": 27 } } } ] }, { "type": "Identifier", "start": 861, "end": 891, "loc": { "start": { "line": 53, "column": 0 }, "end": { "line": 53, "column": 30 } }, "declaration": { "type": "NewExpression", "start": 876, "end": 890, "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 53, "column": 29 } }, "callee": { "type": "Identifier", "start": 880, "end": 888, "loc": { "start": { "line": 53, "column": 19 }, "end": { "line": 53, "column": 27 }, "identifierName": "LogLevel" }, "name": "LogLevel" }, "arguments": [], "leadingComments": null }, "leadingComments": [], "name": "_", "trailingComments": [] }, { "type": "ExportDefaultDeclaration", "start": 861, "end": 891, "loc": { "start": { "line": 53, "column": 0 }, "end": { "line": 53, "column": 30 } }, "declaration": { "type": "ClassDeclaration", "start": 148, "end": 765, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 46, "column": 1 } }, "id": { "type": "Identifier", "start": 154, "end": 162, "loc": { "start": { "line": 14, "column": 6 }, "end": { "line": 14, "column": 14 }, "identifierName": "LogLevel" }, "name": "LogLevel", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 163, "end": 765, "loc": { "start": { "line": 14, "column": 15 }, "end": { "line": 46, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 270, "end": 306, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 21, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 270, "end": 276, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 10 }, "identifierName": "getMap" }, "name": "getMap", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 279, "end": 306, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 21, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 289, "end": 300, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 19 } }, "argument": { "type": "Identifier", "start": 296, "end": 299, "loc": { "start": { "line": 20, "column": 15 }, "end": { "line": 20, "column": 18 }, "identifierName": "map" }, "name": "map" } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get a map of availble logging levels.\n * @return {Object<Number, String>}\n