UNPKG

@eastsideco/escshopify

Version:

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

1,463 lines 35.5 kB
{ "type": "File", "start": 0, "end": 801, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 28, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 801, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 28, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 136, "end": 800, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 27, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 151, "end": 800, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 27, "column": 1 } }, "id": { "type": "Identifier", "start": 157, "end": 173, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 37 }, "identifierName": "CurrencyResolver" }, "name": "CurrencyResolver", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 174, "end": 800, "loc": { "start": { "line": 6, "column": 38 }, "end": { "line": 27, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 337, "end": 446, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 14, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 343, "end": 360, "loc": { "start": { "line": 12, "column": 10 }, "end": { "line": 12, "column": 27 }, "identifierName": "listCurrencyCodes" }, "name": "listCurrencyCodes" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [], "body": { "type": "BlockStatement", "start": 363, "end": 446, "loc": { "start": { "line": 12, "column": 30 }, "end": { "line": 14, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 373, "end": 440, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 75 } }, "argument": { "type": "CallExpression", "start": 379, "end": 439, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 74 } }, "callee": { "type": "Identifier", "start": 379, "end": 384, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 385, "end": 438, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 73 } }, "extra": { "rawValue": "CurrencyResolver should implement listCurrencyCodes", "raw": "'CurrencyResolver should implement listCurrencyCodes'" }, "value": "CurrencyResolver should implement listCurrencyCodes" } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * List the available currencies.\n * @return {String[]}\n * @throws {Error} - CurrencyResolver should implement listCurrencyCodes\n ", "start": 180, "end": 332, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get conversion rate for a specific currency pair.\n * @param {String}\tfrom\n * @param {String}\tto\n * @return {Number}\n * @throws {Error} - CurrencyResolver should implement getConversionRate\n ", "start": 453, "end": 676, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 23, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 681, "end": 798, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 687, "end": 704, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 24, "column": 27 }, "identifierName": "getConversionRate" }, "name": "getConversionRate" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "Identifier", "start": 705, "end": 709, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 32 }, "identifierName": "from" }, "name": "from" }, { "type": "Identifier", "start": 711, "end": 713, "loc": { "start": { "line": 24, "column": 34 }, "end": { "line": 24, "column": 36 }, "identifierName": "to" }, "name": "to" } ], "body": { "type": "BlockStatement", "start": 715, "end": 798, "loc": { "start": { "line": 24, "column": 38 }, "end": { "line": 26, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 725, "end": 792, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 75 } }, "argument": { "type": "CallExpression", "start": 731, "end": 791, "loc": { "start": { "line": 25, "column": 14 }, "end": { "line": 25, "column": 74 } }, "callee": { "type": "Identifier", "start": 731, "end": 736, "loc": { "start": { "line": 25, "column": 14 }, "end": { "line": 25, "column": 19 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 737, "end": 790, "loc": { "start": { "line": 25, "column": 20 }, "end": { "line": 25, "column": 73 } }, "extra": { "rawValue": "CurrencyResolver should implement getConversionRate", "raw": "'CurrencyResolver should implement getConversionRate'" }, "value": "CurrencyResolver should implement getConversionRate" } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get conversion rate for a specific currency pair.\n * @param {String}\tfrom\n * @param {String}\tto\n * @return {Number}\n * @throws {Error} - CurrencyResolver should implement getConversionRate\n ", "start": 453, "end": 676, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 23, "column": 7 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Provides information about available currencies.\n * This is an abstract class which resolvers should extend from.\n * @public\n ", "start": 0, "end": 135, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Provides information about available currencies.\n * This is an abstract class which resolvers should extend from.\n * @public\n ", "start": 0, "end": 135, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Provides information about available currencies.\n * This is an abstract class which resolvers should extend from.\n * @public\n ", "start": 0, "end": 135, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * List the available currencies.\n * @return {String[]}\n * @throws {Error} - CurrencyResolver should implement listCurrencyCodes\n ", "start": 180, "end": 332, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 11, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Get conversion rate for a specific currency pair.\n * @param {String}\tfrom\n * @param {String}\tto\n * @return {Number}\n * @throws {Error} - CurrencyResolver should implement getConversionRate\n ", "start": 453, "end": 676, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 23, "column": 7 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * Provides information about available currencies.\n * This is an abstract class which resolvers should extend from.\n * @public\n ", "start": 0, "end": 135, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 136, "end": 142, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 143, "end": 150, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 14 } } }, { "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": 151, "end": 156, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 6, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "CurrencyResolver", "start": 157, "end": 173, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 37 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 174, "end": 175, "loc": { "start": { "line": 6, "column": 38 }, "end": { "line": 6, "column": 39 } } }, { "type": "CommentBlock", "value": "*\n * List the available currencies.\n * @return {String[]}\n * @throws {Error} - CurrencyResolver should implement listCurrencyCodes\n ", "start": 180, "end": 332, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 11, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "async", "start": 337, "end": 342, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "listCurrencyCodes", "start": 343, "end": 360, "loc": { "start": { "line": 12, "column": 10 }, "end": { "line": 12, "column": 27 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 360, "end": 361, "loc": { "start": { "line": 12, "column": 27 }, "end": { "line": 12, "column": 28 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 361, "end": 362, "loc": { "start": { "line": 12, "column": 28 }, "end": { "line": 12, "column": 29 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 363, "end": 364, "loc": { "start": { "line": 12, "column": 30 }, "end": { "line": 12, "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": 373, "end": 378, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Error", "start": 379, "end": 384, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 19 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 384, "end": 385, "loc": { "start": { "line": 13, "column": 19 }, "end": { "line": 13, "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": 385, "end": 438, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 73 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 438, "end": 439, "loc": { "start": { "line": 13, "column": 73 }, "end": { "line": 13, "column": 74 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 439, "end": 440, "loc": { "start": { "line": 13, "column": 74 }, "end": { "line": 13, "column": 75 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 445, "end": 446, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 5 } } }, { "type": "CommentBlock", "value": "*\n * Get conversion rate for a specific currency pair.\n * @param {String}\tfrom\n * @param {String}\tto\n * @return {Number}\n * @throws {Error} - CurrencyResolver should implement getConversionRate\n ", "start": 453, "end": 676, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 23, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "async", "start": 681, "end": 686, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "getConversionRate", "start": 687, "end": 704, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 24, "column": 27 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 704, "end": 705, "loc": { "start": { "line": 24, "column": 27 }, "end": { "line": 24, "column": 28 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 705, "end": 709, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 32 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 709, "end": 710, "loc": { "start": { "line": 24, "column": 32 }, "end": { "line": 24, "column": 33 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "to", "start": 711, "end": 713, "loc": { "start": { "line": 24, "column": 34 }, "end": { "line": 24, "column": 36 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 713, "end": 714, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 24, "column": 37 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 715, "end": 716, "loc": { "start": { "line": 24, "column": 38 }, "end": { "line": 24, "column": 39 } } }, { "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": 725, "end": 730, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Error", "start": 731, "end": 736, "loc": { "start": { "line": 25, "column": 14 }, "end": { "line": 25, "column": 19 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 736, "end": 737, "loc": { "start": { "line": 25, "column": 19 }, "end": { "line": 25, "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 getConversionRate", "start": 737, "end": 790, "loc": { "start": { "line": 25, "column": 20 }, "end": { "line": 25, "column": 73 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 790, "end": 791, "loc": { "start": { "line": 25, "column": 73 }, "end": { "line": 25, "column": 74 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 791, "end": 792, "loc": { "start": { "line": 25, "column": 74 }, "end": { "line": 25, "column": 75 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 797, "end": 798, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 5 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 799, "end": 800, "loc": { "start": { "line": 27, "column": 0 }, "end": { "line": 27, "column": 1 } } }, { "type": { "label": "eof", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 801, "end": 801, "loc": { "start": { "line": 28, "column": 0 }, "end": { "line": 28, "column": 0 } } } ] }