UNPKG

@eastsideco/escshopify

Version:

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

1,881 lines 65.1 kB
{ "type": "File", "start": 0, "end": 485, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 20, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 485, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 20, "column": 0 } }, "sourceType": "module", "body": [ { "type": "Identifier", "start": 60, "end": 431, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 16, "column": 1 } }, "id": { "type": "Identifier", "start": 66, "end": 82, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 22 }, "identifierName": "CurrencyResolver" }, "name": "CurrencyResolver", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 83, "end": 431, "loc": { "start": { "line": 4, "column": 23 }, "end": { "line": 16, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 89, "end": 198, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 95, "end": 112, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 27 }, "identifierName": "listCurrencyCodes" }, "name": "listCurrencyCodes" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [], "body": { "type": "BlockStatement", "start": 115, "end": 198, "loc": { "start": { "line": 5, "column": 30 }, "end": { "line": 7, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 125, "end": 192, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 75 } }, "argument": { "type": "CallExpression", "start": 131, "end": 191, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 74 } }, "callee": { "type": "Identifier", "start": 131, "end": 136, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 137, "end": 190, "loc": { "start": { "line": 6, "column": 20 }, "end": { "line": 6, "column": 73 } }, "extra": { "rawValue": "CurrencyResolver should implement listCurrencyCodes", "raw": "'CurrencyResolver should implement listCurrencyCodes'" }, "value": "CurrencyResolver should implement listCurrencyCodes" } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 204, "end": 321, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 210, "end": 227, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 27 }, "identifierName": "getConversionRate" }, "name": "getConversionRate" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "Identifier", "start": 228, "end": 232, "loc": { "start": { "line": 9, "column": 28 }, "end": { "line": 9, "column": 32 }, "identifierName": "from" }, "name": "from" }, { "type": "Identifier", "start": 234, "end": 236, "loc": { "start": { "line": 9, "column": 34 }, "end": { "line": 9, "column": 36 }, "identifierName": "to" }, "name": "to" } ], "body": { "type": "BlockStatement", "start": 238, "end": 321, "loc": { "start": { "line": 9, "column": 38 }, "end": { "line": 11, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 248, "end": 315, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 75 } }, "argument": { "type": "CallExpression", "start": 254, "end": 314, "loc": { "start": { "line": 10, "column": 14 }, "end": { "line": 10, "column": 74 } }, "callee": { "type": "Identifier", "start": 254, "end": 259, "loc": { "start": { "line": 10, "column": 14 }, "end": { "line": 10, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 260, "end": 313, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 73 } }, "extra": { "rawValue": "CurrencyResolver should implement getConversionRate", "raw": "'CurrencyResolver should implement getConversionRate'" }, "value": "CurrencyResolver should implement getConversionRate" } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 327, "end": 429, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 15, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 333, "end": 339, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 16 }, "identifierName": "format" }, "name": "format" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "Identifier", "start": 340, "end": 345, "loc": { "start": { "line": 13, "column": 17 }, "end": { "line": 13, "column": 22 }, "identifierName": "value" }, "name": "value" }, { "type": "Identifier", "start": 347, "end": 355, "loc": { "start": { "line": 13, "column": 24 }, "end": { "line": 13, "column": 32 }, "identifierName": "currency" }, "name": "currency" } ], "body": { "type": "BlockStatement", "start": 357, "end": 429, "loc": { "start": { "line": 13, "column": 34 }, "end": { "line": 15, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 367, "end": 423, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 64 } }, "argument": { "type": "CallExpression", "start": 373, "end": 422, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 63 } }, "callee": { "type": "Identifier", "start": 373, "end": 378, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 379, "end": 421, "loc": { "start": { "line": 14, "column": 20 }, "end": { "line": 14, "column": 62 } }, "extra": { "rawValue": "CurrencyResolver should implement format", "raw": "'CurrencyResolver should implement format'" }, "value": "CurrencyResolver should implement format" } ] } } ], "directives": [] } } ], "trailingComments": null }, "leadingComments": [], "trailingComments": [], "name": "_" }, { "type": "Identifier", "start": 448, "end": 484, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 36 } }, "declaration": { "type": "NewExpression", "start": 463, "end": 483, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 35 } }, "callee": { "type": "Identifier", "start": 467, "end": 483, "loc": { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 35 }, "identifierName": "CurrencyResolver" }, "name": "CurrencyResolver" }, "arguments": [], "leadingComments": null }, "leadingComments": [], "name": "_", "trailingComments": [] }, { "type": "ExportDefaultDeclaration", "start": 448, "end": 484, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 36 } }, "declaration": { "type": "ClassDeclaration", "start": 60, "end": 431, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 16, "column": 1 } }, "id": { "type": "Identifier", "start": 66, "end": 82, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 22 }, "identifierName": "CurrencyResolver" }, "name": "CurrencyResolver", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 83, "end": 431, "loc": { "start": { "line": 4, "column": 23 }, "end": { "line": 16, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 89, "end": 198, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 95, "end": 112, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 27 }, "identifierName": "listCurrencyCodes" }, "name": "listCurrencyCodes" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [], "body": { "type": "BlockStatement", "start": 115, "end": 198, "loc": { "start": { "line": 5, "column": 30 }, "end": { "line": 7, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 125, "end": 192, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 75 } }, "argument": { "type": "CallExpression", "start": 131, "end": 191, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 74 } }, "callee": { "type": "Identifier", "start": 131, "end": 136, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 137, "end": 190, "loc": { "start": { "line": 6, "column": 20 }, "end": { "line": 6, "column": 73 } }, "extra": { "rawValue": "CurrencyResolver should implement listCurrencyCodes", "raw": "'CurrencyResolver should implement listCurrencyCodes'" }, "value": "CurrencyResolver should implement listCurrencyCodes" } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 204, "end": 321, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 210, "end": 227, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 27 }, "identifierName": "getConversionRate" }, "name": "getConversionRate" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "Identifier", "start": 228, "end": 232, "loc": { "start": { "line": 9, "column": 28 }, "end": { "line": 9, "column": 32 }, "identifierName": "from" }, "name": "from" }, { "type": "Identifier", "start": 234, "end": 236, "loc": { "start": { "line": 9, "column": 34 }, "end": { "line": 9, "column": 36 }, "identifierName": "to" }, "name": "to" } ], "body": { "type": "BlockStatement", "start": 238, "end": 321, "loc": { "start": { "line": 9, "column": 38 }, "end": { "line": 11, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 248, "end": 315, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 75 } }, "argument": { "type": "CallExpression", "start": 254, "end": 314, "loc": { "start": { "line": 10, "column": 14 }, "end": { "line": 10, "column": 74 } }, "callee": { "type": "Identifier", "start": 254, "end": 259, "loc": { "start": { "line": 10, "column": 14 }, "end": { "line": 10, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 260, "end": 313, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 73 } }, "extra": { "rawValue": "CurrencyResolver should implement getConversionRate", "raw": "'CurrencyResolver should implement getConversionRate'" }, "value": "CurrencyResolver should implement getConversionRate" } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 327, "end": 429, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 15, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 333, "end": 339, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 16 }, "identifierName": "format" }, "name": "format" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "Identifier", "start": 340, "end": 345, "loc": { "start": { "line": 13, "column": 17 }, "end": { "line": 13, "column": 22 }, "identifierName": "value" }, "name": "value" }, { "type": "Identifier", "start": 347, "end": 355, "loc": { "start": { "line": 13, "column": 24 }, "end": { "line": 13, "column": 32 }, "identifierName": "currency" }, "name": "currency" } ], "body": { "type": "BlockStatement", "start": 357, "end": 429, "loc": { "start": { "line": 13, "column": 34 }, "end": { "line": 15, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 367, "end": 423, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 64 } }, "argument": { "type": "CallExpression", "start": 373, "end": 422, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 63 } }, "callee": { "type": "Identifier", "start": 373, "end": 378, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 379, "end": 421, "loc": { "start": { "line": 14, "column": 20 }, "end": { "line": 14, "column": 62 } }, "extra": { "rawValue": "CurrencyResolver should implement format", "raw": "'CurrencyResolver should implement format'" }, "value": "CurrencyResolver should implement format" } ] } } ], "directives": [] } } ], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Provides information about available currencies.\n ", "start": 0, "end": 59, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "* @ignore ", "start": 433, "end": 447, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 14 } } } ], "__PseudoExport__": true }, "leadingComments": null }, { "type": "ExportDefaultDeclaration", "start": 448, "end": 484, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 36 } }, "declaration": { "type": "VariableDeclaration", "kind": "let", "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "currencyResolver" }, "init": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "CurrencyResolver" } } } ], "leadingComments": [ { "type": "CommentBlock", "value": "* @ignore ", "start": 433, "end": 447, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 14 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "* @ignore ", "start": 433, "end": 447, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 14 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Provides information about available currencies.\n ", "start": 0, "end": 59, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": "CommentBlock", "value": "* @ignore ", "start": 433, "end": 447, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 14 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * Provides information about available currencies.\n ", "start": 0, "end": 59, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 60, "end": 65, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 5 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "CurrencyResolver", "start": 66, "end": 82, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 22 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 83, "end": 84, "loc": { "start": { "line": 4, "column": 23 }, "end": { "line": 4, "column": 24 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "async", "start": 89, "end": 94, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "listCurrencyCodes", "start": 95, "end": 112, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 27 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 112, "end": 113, "loc": { "start": { "line": 5, "column": 27 }, "end": { "line": 5, "column": 28 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 113, "end": 114, "loc": { "start": { "line": 5, "column": 28 }, "end": { "line": 5, "column": 29 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 115, "end": 116, "loc": { "start": { "line": 5, "column": 30 }, "end": { "line": 5, "column": 31 } } }, { "type": { "label": "throw", "keyword": "throw", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "throw", "start": 125, "end": 130, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Error", "start": 131, "end": 136, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 19 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 136, "end": 137, "loc": { "start": { "line": 6, "column": 19 }, "end": { "line": 6, "column": 20 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "CurrencyResolver should implement listCurrencyCodes", "start": 137, "end": 190, "loc": { "start": { "line": 6, "column": 20 }, "end": { "line": 6, "column": 73 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 190, "end": 191, "loc": { "start": { "line": 6, "column": 73 }, "end": { "line": 6, "column": 74 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 191, "end": 192, "loc": { "start": { "line": 6, "column": 74 }, "end": { "line": 6, "column": 75 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 197, "end": 198, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 5 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "async", "start": 204, "end": 209, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "getConversionRate", "start": 210, "end": 227, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 27 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 227, "end": 228, "loc": { "start": { "line": 9, "column": 27 }, "end": { "line": 9, "column": 28 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 228, "end": 232, "loc": { "start": { "line": 9, "column": 28 }, "end": { "line": 9, "column": 32 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 232, "end": 233, "loc": { "start": { "line": 9, "column": 32 }, "end": { "line": 9, "column": 33 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "to", "start": 234, "end": 236, "loc": { "start": { "line": 9, "column": 34 }, "end": { "line": 9, "column": 36 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 236, "end": 237, "loc": { "start": { "line": 9, "column": 36 }, "end": { "line": 9, "column": 37 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 238, "end": 239, "loc": { "start": { "line": 9, "column": 38 }, "end": { "line": 9, "column": 39 } } }, { "type": { "label": "throw", "keyword": "throw", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false