From c9e445375edf0725f78fa9f71f44e1778a4bed42 Mon Sep 17 00:00:00 2001 From: Kyle Corbelli Date: Fri, 15 Sep 2017 20:26:52 -0700 Subject: [PATCH] Recompile javascript files --- dist/actions.js | 36 +++++++------------------ dist/actions.js.map | 2 +- dist/index.js | 18 ------------- dist/index.js.map | 2 +- dist/reducers/current-user/index.js | 7 ++++- dist/reducers/current-user/index.js.map | 2 +- dist/services/auth.js | 12 +++++++++ dist/services/auth.js.map | 2 +- dist/services/utility.js | 11 ++++++++ dist/services/utility.js.map | 1 + dist/types.js.map | 2 +- package.json | 2 +- 12 files changed, 46 insertions(+), 51 deletions(-) create mode 100644 dist/services/utility.js create mode 100644 dist/services/utility.js.map diff --git a/dist/actions.js b/dist/actions.js index 308e386..c66a776 100644 --- a/dist/actions.js +++ b/dist/actions.js @@ -101,27 +101,6 @@ exports.signOutRequestFailed = function () { return ({ // firstName: 'name' // }, // } -// extract this service somewhere and unit test it: -var invertHash = function (hash) { - var newHash = {}; - for (var key in hash) { - var val = hash[key]; - newHash[val] = key; - } - return newHash; -}; -// extract this service somewhere and unit test it: -var getUserAttributesFromResponse = function (userAttributes, response) { - var invertedUserAttributes = invertHash(userAttributes); - var userAttributesBackendKeys = Object.keys(invertedUserAttributes); - var userAttributesToReturn = {}; - Object.keys(response.data.data).forEach(function (key) { - if (userAttributesBackendKeys.indexOf(key) !== -1) { - userAttributesToReturn[invertedUserAttributes[key]] = response.data.data[key]; - } - }); - return userAttributesToReturn; -}; var generateAuthActions = function (config) { var authUrl = config.authUrl, userAttributes = config.userAttributes, userRegistrationAttributes = config.userRegistrationAttributes; var registerUser = function (userRegistrationDetails) { return function (dispatch) { @@ -154,7 +133,7 @@ var generateAuthActions = function (config) { auth_1.setAuthHeaders(response.headers); // Have to check what type of platform it is, depending on the key provided by the end-user... like "browser", "iphone", or "android", etc.: auth_1.persistAuthHeadersInLocalStorage(response.headers); - userAttributesToSave = getUserAttributesFromResponse(userAttributes, response); + userAttributesToSave = auth_1.getUserAttributesFromResponse(userAttributes, response); dispatch(exports.registrationRequestSucceeded(userAttributesToSave)); // <- need to make this reducer more flexible return [3 /*break*/, 4]; case 3: @@ -186,7 +165,7 @@ var generateAuthActions = function (config) { auth_1.setAuthHeaders(response.headers); // Have to check what type of platform it is, depending on the key provided by the end-user... like "browser", "iphone", or "android", etc.: auth_1.persistAuthHeadersInLocalStorage(response.headers); - userAttributesToSave = getUserAttributesFromResponse(userAttributes, response); + userAttributesToSave = auth_1.getUserAttributesFromResponse(userAttributes, response); dispatch(exports.verifyTokenRequestSucceeded(userAttributesToSave)); return [3 /*break*/, 4]; case 3: @@ -222,7 +201,7 @@ var generateAuthActions = function (config) { auth_1.setAuthHeaders(response.headers); // Have to check what type of platform it is, depending on the key provided by the end-user... like "browser", "iphone", or "android", etc.: auth_1.persistAuthHeadersInLocalStorage(response.headers); - userAttributesToSave = getUserAttributesFromResponse(userAttributes, response); + userAttributesToSave = auth_1.getUserAttributesFromResponse(userAttributes, response); dispatch(exports.signInRequestSucceeded(userAttributesToSave)); return [3 /*break*/, 4]; case 3: @@ -234,12 +213,17 @@ var generateAuthActions = function (config) { }); }); }; }; - var signOutUser = function (userSignOutCredentials) { return function (dispatch) { + var signOutUser = function () { return function (dispatch) { return __awaiter(this, void 0, void 0, function () { - var error_4; + var userSignOutCredentials, error_4; return __generator(this, function (_a) { switch (_a.label) { case 0: + userSignOutCredentials = { + 'access-token': localStorage.getItem('access-token'), + client: localStorage.getItem('client'), + uid: localStorage.getItem('uid'), + }; dispatch(exports.signOutRequestSent()); _a.label = 1; case 1: diff --git a/dist/actions.js.map b/dist/actions.js.map index 1645202..33aa3d3 100644 --- a/dist/actions.js.map +++ b/dist/actions.js.map @@ -1 +1 @@ -{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyB;AAKzB,iCAgCgB;AAChB,wCAKwB,CAAC,kHAAk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AU,YAAA;QACV,WAAW,aAAA;QACX,iBAAiB,mBAAA;KAClB,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,mBAAmB,CAAA"} \ No newline at end of file +{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyB;AAKzB,iCAgCgB;AAChB,wCAMwB,CAAC,kHAAkH;AAE3I,wHAAwH;AACxH,sBAAsB;AACtB,wHAAwH;AAE3G,QAAA,uBAAuB,GAAG,cAAqC,OAAA,CAAC;IAC3E,IAAI,EAAE,iCAAyB;CAChC,CAAC,EAF0E,CAE1E,CAAA;AAEW,QAAA,4BAA4B,GAAG,UAAC,cAA8B,IAAyC,OAAA,CAAC;IACnH,IAAI,EAAE,sCAA8B;IACpC,OAAO,EAAE;QACP,cAAc,gBAAA;KACf;CACF,CAAC,EALkH,CAKlH,CAAA;AAEW,QAAA,yBAAyB,GAAG,cAAuC,OAAA,CAAC;IAC/E,IAAI,EAAE,mCAA2B;CAClC,CAAC,EAF8E,CAE9E,CAAA;AAEW,QAAA,sBAAsB,GAAG,cAAoC,OAAA,CAAC;IACzE,IAAI,EAAE,iCAAyB;CAChC,CAAC,EAFwE,CAExE,CAAA;AAEW,QAAA,2BAA2B,GAAG,UAAC,cAA8B,IAAwC,OAAA,CAAC;IACjH,IAAI,EAAE,sCAA8B;IACpC,OAAO,EAAE;QACP,cAAc,gBAAA;KACf;CACF,CAAC,EALgH,CAKhH,CAAA;AAEW,QAAA,wBAAwB,GAAG,cAAsC,OAAA,CAAC;IAC7E,IAAI,EAAE,mCAA2B;CAClC,CAAC,EAF4E,CAE5E,CAAA;AAEW,QAAA,iBAAiB,GAAG,cAA+B,OAAA,CAAC;IAC/D,IAAI,EAAE,2BAAmB;CAC1B,CAAC,EAF8D,CAE9D,CAAA;AAEW,QAAA,sBAAsB,GAAG,UAAC,cAA8B,IAAmC,OAAA,CAAC;IACvG,IA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,EAAA;;wBAJF,SAIE,CAAA;wBACF,wBAAiB,EAAE,CAAA;wBACnB,4IAA4I;wBAC5I,wCAAiC,EAAE,CAAA;wBACnC,QAAQ,CAAC,+BAAuB,EAAE,CAAC,CAAA;;;;wBAEnC,QAAQ,CAAC,4BAAoB,EAAE,CAAC,CAAA;wBAChC,MAAM,OAAK,CAAA;;;;;KAEd,EArByB,CAqBzB,CAAA;IAED,IAAM,iBAAiB,GAAG,UAAC,KAAgB;QACzC,oCAAoC;QACpC,EAAE,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YACzC,IAAM,kBAAkB,GAAuB;gBAC7C,cAAc,EAAE,YAAY,CAAC,OAAO,CAAC,cAAc,CAAW;gBAC9D,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAW;gBAChD,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAW;aAC3C,CAAA;YACD,KAAK,CAAC,QAAQ,CAAM,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAA;QACtD,CAAC;IACH,CAAC,CAAA;IAED,MAAM,CAAC;QACL,YAAY,cAAA;QACZ,WAAW,aAAA;QACX,UAAU,YAAA;QACV,WAAW,aAAA;QACX,iBAAiB,mBAAA;KAClB,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index bb2a66d..c416f1d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4,22 +4,4 @@ var actions_1 = require("./actions"); exports.generateAuthActions = actions_1.default; var reducers_1 = require("./reducers"); exports.reduxTokenAuthReducer = reducers_1.default; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Example of how the end-user will import the actions -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// import { -// generateAuthFunctions, -// } from 'redux-token-auth' -// -// const authUrl: string = 'http://www.someapp.com/auth' -// const userAttributes = { -// firstName: 'name', -// imageUrl: 'image_url', -// } -// const { -// registerUser, -// verifyToken, -// signInUser, -// signOutUser, -// } = generateAuthFunctions(authUrl, userAttributes) //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map index 802e865..044df7b 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAIzC,8BAJK,iBAAmB,CAIL;AAHrB,uCAA8C;AAI5C,gCAJK,kBAAqB,CAIL;AAGvB,wHAAwH;AACxH,sDAAsD;AACtD,wHAAwH;AAExH,WAAW;AACX,2BAA2B;AAC3B,4BAA4B;AAC5B,EAAE;AACF,wDAAwD;AACxD,2BAA2B;AAC3B,uBAAuB;AACvB,2BAA2B;AAC3B,IAAI;AACJ,UAAU;AACV,kBAAkB;AAClB,iBAAiB;AACjB,gBAAgB;AAChB,iBAAiB;AACjB,qDAAqD"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAIzC,8BAJK,iBAAmB,CAIL;AAHrB,uCAA8C;AAI5C,gCAJK,kBAAqB,CAIL"} \ No newline at end of file diff --git a/dist/reducers/current-user/index.js b/dist/reducers/current-user/index.js index 9ed6e79..a11be2c 100644 --- a/dist/reducers/current-user/index.js +++ b/dist/reducers/current-user/index.js @@ -29,7 +29,12 @@ var currentUser = function (state, action) { case types_1.SIGNIN_REQUEST_FAILED: return __assign({}, state, { isLoading: false, isLoggedIn: false }); case types_1.SIGNOUT_REQUEST_SUCCEEDED: - return __assign({}, state, { attributes: __assign({}, state.attributes, { firstName: null }), isLoading: false, isLoggedIn: false }); + var userAttributeKeys = Object.keys(state.attributes); + var allNullUserAttributes = userAttributeKeys.reduce(function (accumulatedNullUserAttributes, currentUserAttributeKey) { + return __assign({}, accumulatedNullUserAttributes, (_a = {}, _a[currentUserAttributeKey] = null, _a)); + var _a; + }, {}); + return __assign({}, state, { attributes: allNullUserAttributes, isLoading: false, isLoggedIn: false }); case types_1.SIGNOUT_REQUEST_FAILED: return __assign({}, state, { isLoading: false }); default: diff --git a/dist/reducers/current-user/index.js.map b/dist/reducers/current-user/index.js.map index 5777b43..f4b969d 100644 --- a/dist/reducers/current-user/index.js.map +++ b/dist/reducers/current-user/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reducers/current-user/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qCAeoB;AACpB,qDAA8C;AAG5C,IAAA,iDAAwB,CACV;AAEhB,IAAM,WAAW,GAAG,UAAC,KAAyB,EAAE,MAAmB;IAA9C,sBAAA,EAAA,mBAAyB;IAC5C,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACpB,KAAK,iCAAyB,CAAC;QAC/B,KAAK,iCAAyB,CAAC;QAC/B,KAAK,2BAAmB,CAAC;QACzB,KAAK,4BAAoB;YACvB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,IAAI,IAChB;QACH,KAAK,sCAA8B,CAAC;QACpC,KAAK,sCAA8B,CAAC;QACpC,KAAK,gCAAwB;YACnB,IAAA,8CAAc,CAAmB;YACzC,MAAM,cACD,KAAK,IACR,UAAU,eAAO,cAAc,GAC/B,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,IAAI,IACjB;QACH,KAAK,mCAA2B,CAAC;QACjC,KAAK,mCAA2B,CAAC;QACjC,KAAK,6BAAqB;YACxB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,IAClB;QACH,KAAK,iCAAyB;YAC5B,MAAM,cACD,KAAK,IACR,UAAU,eACL,KAAK,CAAC,UAAU,IACnB,SAAS,EAAE,IAAI,KAEjB,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,IAClB;QACH,KAAK,8BAAsB;YACzB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,IACjB;QACH;YACE,MAAM,CAAC,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reducers/current-user/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qCAgBoB;AACpB,qDAA8C;AAG5C,IAAA,iDAAwB,CACV;AAEhB,IAAM,WAAW,GAAG,UAAC,KAAyB,EAAE,MAAmB;IAA9C,sBAAA,EAAA,mBAAyB;IAC5C,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACpB,KAAK,iCAAyB,CAAC;QAC/B,KAAK,iCAAyB,CAAC;QAC/B,KAAK,2BAAmB,CAAC;QACzB,KAAK,4BAAoB;YACvB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,IAAI,IAChB;QACH,KAAK,sCAA8B,CAAC;QACpC,KAAK,sCAA8B,CAAC;QACpC,KAAK,gCAAwB;YACnB,IAAA,8CAAc,CAAmB;YACzC,MAAM,cACD,KAAK,IACR,UAAU,eAAO,cAAc,GAC/B,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,IAAI,IACjB;QACH,KAAK,mCAA2B,CAAC;QACjC,KAAK,mCAA2B,CAAC;QACjC,KAAK,6BAAqB;YACxB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,IAClB;QACH,KAAK,iCAAyB;YAC5B,IAAM,iBAAiB,GAAa,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;YACjE,IAAM,qBAAqB,GAAmB,iBAAiB,CAAC,MAAM,CACpE,UAAC,6BAA6C,EAAE,uBAA+B;gBAC7E,MAAM,cACD,6BAA6B,eAC/B,uBAAuB,IAAG,IAAI,OAChC;;YACH,CAAC,EACD,EAAE,CACH,CAAA;YACD,MAAM,cACD,KAAK,IACR,UAAU,EAAE,qBAAqB,EACjC,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,IAClB;QACH,KAAK,8BAAsB;YACzB,MAAM,cACD,KAAK,IACR,SAAS,EAAE,KAAK,IACjB;QACH;YACE,MAAM,CAAC,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"} \ No newline at end of file diff --git a/dist/services/auth.js b/dist/services/auth.js index c25fb23..9ba2e5b 100644 --- a/dist/services/auth.js +++ b/dist/services/auth.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var axios_1 = require("axios"); +var utility_1 = require("./utility"); var authHeaderKeys = [ 'access-token', 'token-type', @@ -30,4 +31,15 @@ exports.deleteAuthHeadersFromLocalStorage = function () { localStorage.removeItem(key); }); }; +exports.getUserAttributesFromResponse = function (userAttributes, response) { + var invertedUserAttributes = utility_1.invertMapKeysAndValues(userAttributes); + var userAttributesBackendKeys = Object.keys(invertedUserAttributes); + var userAttributesToReturn = {}; + Object.keys(response.data.data).forEach(function (key) { + if (userAttributesBackendKeys.indexOf(key) !== -1) { + userAttributesToReturn[invertedUserAttributes[key]] = response.data.data[key]; + } + }); + return userAttributesToReturn; +}; //# sourceMappingURL=auth.js.map \ No newline at end of file diff --git a/dist/services/auth.js.map b/dist/services/auth.js.map index 2214dee..0c66972 100644 --- a/dist/services/auth.js.map +++ b/dist/services/auth.js.map @@ -1 +1 @@ -{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/services/auth.ts"],"names":[],"mappings":";;AAAA,+BAAyB;AAGzB,IAAM,cAAc,GAAkB;IACpC,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,KAAK;CACN,CAAA;AAEY,QAAA,cAAc,GAAG,UAAC,OAAoB;IACjD,cAAc,CAAC,OAAO,CAAC,UAAC,GAAW;QACjC,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAA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,CAAA;IACzC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAEY,QAAA,iBAAiB,GAAG;IAC/B,cAAc,CAAC,OAAO,CAAC,UAAC,GAAW;QACjC,OAAO,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,iHAAiH;AACpG,QAAA,iCAAiC,GAAG;IAC/C,cAAc,CAAC,OAAO,CAAC,UAAC,GAAW;QACjC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAEY,QAAA,6BAA6B,GAAG,UAC3C,cAAoC,EACpC,QAAsB;IAEtB,IAAM,sBAAsB,GAAyB,gCAAsB,CAAC,cAAc,CAAC,CAAA;IAC3F,IAAM,yBAAyB,GAAa,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;IAC/E,IAAM,sBAAsB,GAAyB,EAAE,CAAA;IACvD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAC,GAAW;QAClD,EAAE,CAAC,CAAC,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAClD,sBAAsB,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC/E,CAAC;IACH,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,sBAAsB,CAAA;AAC/B,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/services/utility.js b/dist/services/utility.js new file mode 100644 index 0000000..bb797d5 --- /dev/null +++ b/dist/services/utility.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.invertMapKeysAndValues = function (stringMap) { + var newStringMap = {}; + for (var key in stringMap) { + var val = stringMap[key]; + newStringMap[val] = key; + } + return newStringMap; +}; +//# sourceMappingURL=utility.js.map \ No newline at end of file diff --git a/dist/services/utility.js.map b/dist/services/utility.js.map new file mode 100644 index 0000000..1f3aaeb --- /dev/null +++ b/dist/services/utility.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utility.js","sourceRoot":"","sources":["../../src/services/utility.ts"],"names":[],"mappings":";;AAEa,QAAA,sBAAsB,GAAG,UAAC,SAA+B;IACpE,IAAM,YAAY,GAAyB,EAAE,CAAA;IAC7C,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC;QAC1B,IAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QAC1B,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IACzB,CAAC;IACD,MAAM,CAAC,YAAY,CAAA;AACrB,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map index 937697e..35d215d 100644 --- a/dist/types.js.map +++ b/dist/types.js.map @@ -1 +1 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AAwCa,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,mBAAmB,GAAwB,sCAAsC,CAAA;AAGjF,QAAA,wBAAwB,GAA6B,2CAA2C,CAAA;AAGhG,QAAA,qBAAqB,GAA0B,wCAAwC,CAAA;AAGvF,QAAA,oBAAoB,GAAyB,uCAAuC,CAAA;AAGpF,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,sBAAsB,GAA2B,yCAAyC,CAAA"} \ No newline at end of file +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AAyCa,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,8BAA8B,GAAmC,iDAAiD,CAAA;AAGlH,QAAA,2BAA2B,GAAgC,8CAA8C,CAAA;AAGzG,QAAA,mBAAmB,GAAwB,sCAAsC,CAAA;AAGjF,QAAA,wBAAwB,GAA6B,2CAA2C,CAAA;AAGhG,QAAA,qBAAqB,GAA0B,wCAAwC,CAAA;AAGvF,QAAA,oBAAoB,GAAyB,uCAAuC,CAAA;AAGpF,QAAA,yBAAyB,GAA8B,4CAA4C,CAAA;AAGnG,QAAA,sBAAsB,GAA2B,yCAAyC,CAAA"} \ No newline at end of file diff --git a/package.json b/package.json index dce73c9..8ab4a30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redux-token-auth", - "version": "0.13.0", + "version": "0.14.0", "description": "Redux actions and reducers to integrate with Devise Token Auth", "main": "dist/index.js", "types": "index.d.ts",