Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjhogan committed Nov 29, 2023
1 parent 9c26147 commit c340e70
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e

cd "$(dirname "$0")"
docker run --rm --name comma-api-build -v $(pwd):/app -w /app node:16-alpine sh -c "yarn install --immutable --immutable-cache --check-cache && yarn lint && yarn build && yarn generate"
3 changes: 2 additions & 1 deletion dist/athena.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Config from './config';
import ConfigRequest from './instance';
var request = new ConfigRequest(Config.ATHENA_URL_ROOT);
export function configure(accessToken) {
request.configure(accessToken);
var unauthorizedHandler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
request.configure(accessToken, unauthorizedHandler);
}
export function postJsonRpcPayload(_x, _x2) {
return _postJsonRpcPayload.apply(this, arguments);
Expand Down
3 changes: 2 additions & 1 deletion dist/billing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Config from './config';
import ConfigRequest from './instance';
var request = new ConfigRequest(Config.BILLING_URL_ROOT);
export function configure(accessToken) {
request.configure(accessToken);
var unauthorizedHandler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
request.configure(accessToken, unauthorizedHandler);
}
export function getSubscription(_x) {
return _getSubscription.apply(this, arguments);
Expand Down
23 changes: 16 additions & 7 deletions dist/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ export var RequestError = /*#__PURE__*/function (_Error) {
}( /*#__PURE__*/_wrapNativeSuper(Error));
var ConfigRequest = /*#__PURE__*/function () {
function ConfigRequest(baseUrl) {
var unauthorizedHandler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
_classCallCheck(this, ConfigRequest);
this.defaultHeaders = {
'Content-Type': 'application/json'
};
this.baseUrl = baseUrl + (!baseUrl.endsWith('/') ? '/' : '');
this.unauthorizedHandler = unauthorizedHandler;
}
_createClass(ConfigRequest, [{
key: "configure",
Expand Down Expand Up @@ -83,23 +85,30 @@ var ConfigRequest = /*#__PURE__*/function () {
case 8:
resp = _context.sent;
if (resp.ok) {
_context.next = 14;
_context.next = 17;
break;
}
_context.next = 12;
if (!(resp.status === 401 && this.unauthorizedHandler)) {
_context.next = 13;
break;
}
_context.next = 13;
return this.unauthorizedHandler();
case 13:
_context.next = 15;
return resp.text();
case 12:
case 15:
error = _context.sent;
throw new RequestError(resp, "".concat(resp.status, ": ").concat(error));
case 14:
case 17:
if (respJson) {
_context.next = 16;
_context.next = 19;
break;
}
return _context.abrupt("return", resp);
case 16:
case 19:
return _context.abrupt("return", resp.json());
case 17:
case 20:
case "end":
return _context.stop();
}
Expand Down

0 comments on commit c340e70

Please sign in to comment.