@edx/frontend-platform 3.6.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analytics/MockAnalyticsService.js +31 -19
- package/analytics/MockAnalyticsService.js.map +1 -1
- package/analytics/SegmentAnalyticsService.js +53 -57
- package/analytics/SegmentAnalyticsService.js.map +1 -1
- package/analytics/index.js.map +1 -1
- package/analytics/interface.js +9 -9
- package/analytics/interface.js.map +1 -1
- package/auth/AxiosCsrfTokenService.js +36 -58
- package/auth/AxiosCsrfTokenService.js.map +1 -1
- package/auth/AxiosJwtAuthService.js +105 -150
- package/auth/AxiosJwtAuthService.js.map +1 -1
- package/auth/AxiosJwtTokenService.js +101 -148
- package/auth/AxiosJwtTokenService.js.map +1 -1
- package/auth/LocalForageCache.js +89 -108
- package/auth/LocalForageCache.js.map +1 -1
- package/auth/MockAuthService.js +114 -43
- package/auth/MockAuthService.js.map +1 -1
- package/auth/index.js.map +1 -1
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js +35 -50
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createJwtTokenProviderInterceptor.js +33 -47
- package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +15 -27
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
- package/auth/interceptors/createRetryInterceptor.js +75 -105
- package/auth/interceptors/createRetryInterceptor.js.map +1 -1
- package/auth/interface.js +41 -58
- package/auth/interface.js.map +1 -1
- package/auth/utils.js +22 -40
- package/auth/utils.js.map +1 -1
- package/config.js +6 -7
- package/config.js.map +1 -1
- package/constants.js +8 -8
- package/constants.js.map +1 -1
- package/i18n/countries.js +9 -15
- package/i18n/countries.js.map +1 -1
- package/i18n/index.js +1 -0
- package/i18n/index.js.map +1 -1
- package/i18n/injectIntlWithShim.js +4 -28
- package/i18n/injectIntlWithShim.js.map +1 -1
- package/i18n/languages.js +11 -17
- package/i18n/languages.js.map +1 -1
- package/i18n/lib.js +64 -56
- package/i18n/lib.js.map +1 -1
- package/i18n/scripts/transifex-utils.js +5 -20
- package/i18n/scripts/transifex-utils.js.map +1 -1
- package/index.js.map +1 -1
- package/initialize.js +176 -228
- package/initialize.js.map +1 -1
- package/logging/MockLoggingService.js +15 -9
- package/logging/MockLoggingService.js.map +1 -1
- package/logging/NewRelicLoggingService.js +9 -33
- package/logging/NewRelicLoggingService.js.map +1 -1
- package/logging/index.js.map +1 -1
- package/logging/interface.js +7 -6
- package/logging/interface.js.map +1 -1
- package/package.json +4 -4
- package/pubSub.js +4 -3
- package/pubSub.js.map +1 -1
- package/react/AppContext.js +1 -1
- package/react/AppContext.js.map +1 -1
- package/react/AppProvider.js +13 -23
- package/react/AppProvider.js.map +1 -1
- package/react/AuthenticatedPageRoute.js +5 -13
- package/react/AuthenticatedPageRoute.js.map +1 -1
- package/react/ErrorBoundary.js +4 -21
- package/react/ErrorBoundary.js.map +1 -1
- package/react/ErrorPage.js +7 -17
- package/react/ErrorPage.js.map +1 -1
- package/react/LoginRedirect.js +1 -1
- package/react/LoginRedirect.js.map +1 -1
- package/react/OptionalReduxProvider.js +2 -4
- package/react/OptionalReduxProvider.js.map +1 -1
- package/react/PageRoute.js +3 -3
- package/react/PageRoute.js.map +1 -1
- package/react/hooks.js +2 -6
- package/react/hooks.js.map +1 -1
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/testing/index.js +1 -0
- package/testing/index.js.map +1 -1
- package/testing/initializeMockApp.js +11 -11
- package/testing/initializeMockApp.js.map +1 -1
- package/testing/mockMessages.js.map +1 -1
- package/utils.js +15 -24
- package/utils.js.map +1 -1
package/auth/MockAuthService.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
|
|
7
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
8
|
-
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
6
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
10
|
import axios from 'axios';
|
|
14
11
|
import PropTypes from 'prop-types';
|
|
15
12
|
import { ensureDefinedConfig } from '../utils';
|
|
@@ -38,6 +35,7 @@ var optionsPropTypes = {
|
|
|
38
35
|
// Must be at least a valid user, but may have other fields.
|
|
39
36
|
hydratedAuthenticatedUser: userPropTypes
|
|
40
37
|
};
|
|
38
|
+
|
|
41
39
|
/**
|
|
42
40
|
* The MockAuthService class mocks authenticated user-fetching logic and allows for manually
|
|
43
41
|
* setting user data. It is compatible with axios-mock-adapter to wrap its HttpClients so that
|
|
@@ -83,7 +81,6 @@ var optionsPropTypes = {
|
|
|
83
81
|
* @implements {AuthService}
|
|
84
82
|
* @memberof module:Auth
|
|
85
83
|
*/
|
|
86
|
-
|
|
87
84
|
var MockAuthService = /*#__PURE__*/function () {
|
|
88
85
|
/**
|
|
89
86
|
* @param {Object} options
|
|
@@ -101,86 +98,174 @@ var MockAuthService = /*#__PURE__*/function () {
|
|
|
101
98
|
*/
|
|
102
99
|
function MockAuthService(options) {
|
|
103
100
|
var _this = this;
|
|
104
|
-
|
|
105
101
|
_classCallCheck(this, MockAuthService);
|
|
106
|
-
|
|
102
|
+
/**
|
|
103
|
+
* A Jest mock function (jest.fn())
|
|
104
|
+
*
|
|
105
|
+
* Gets the authenticated HTTP client instance, which is an axios client wrapped in
|
|
106
|
+
* MockAdapter from axios-mock-adapter.
|
|
107
|
+
*
|
|
108
|
+
* @returns {HttpClient} An HttpClient wrapped in MockAdapter.
|
|
109
|
+
*/
|
|
107
110
|
_defineProperty(this, "getAuthenticatedHttpClient", jest.fn(function () {
|
|
108
111
|
return _this.authenticatedHttpClient;
|
|
109
112
|
}));
|
|
110
|
-
|
|
113
|
+
/**
|
|
114
|
+
* A Jest mock function (jest.fn())
|
|
115
|
+
*
|
|
116
|
+
* Gets the unauthenticated HTTP client instance, which is an axios client wrapped in
|
|
117
|
+
* MockAdapter from axios-mock-adapter.
|
|
118
|
+
*
|
|
119
|
+
* @returns {HttpClient} An HttpClient wrapped in MockAdapter.
|
|
120
|
+
*/
|
|
111
121
|
_defineProperty(this, "getHttpClient", jest.fn(function () {
|
|
112
122
|
return _this.httpClient;
|
|
113
123
|
}));
|
|
114
|
-
|
|
124
|
+
/**
|
|
125
|
+
* A Jest mock function (jest.fn())
|
|
126
|
+
*
|
|
127
|
+
* Builds a URL to the login page with a post-login redirect URL attached as a query parameter.
|
|
128
|
+
*
|
|
129
|
+
* ```
|
|
130
|
+
* const url = getLoginRedirectUrl('http://localhost/mypage');
|
|
131
|
+
* console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @param {string} redirectUrl The URL the user should be redirected to after logging in.
|
|
135
|
+
*/
|
|
115
136
|
_defineProperty(this, "getLoginRedirectUrl", jest.fn(function () {
|
|
116
137
|
var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.config.BASE_URL;
|
|
117
138
|
return "".concat(_this.config.LOGIN_URL, "?next=").concat(encodeURIComponent(redirectUrl));
|
|
118
139
|
}));
|
|
119
|
-
|
|
140
|
+
/**
|
|
141
|
+
* A Jest mock function (jest.fn())
|
|
142
|
+
*
|
|
143
|
+
* Redirects the user to the logout page in the real implementation. Is a no-op here.
|
|
144
|
+
*
|
|
145
|
+
* @param {string} redirectUrl The URL the user should be redirected to after logging in.
|
|
146
|
+
*/
|
|
120
147
|
_defineProperty(this, "redirectToLogin", jest.fn(function () {
|
|
121
148
|
var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.config.BASE_URL;
|
|
122
|
-
|
|
123
149
|
// Do nothing after getting the URL - this preserves the calls properly, but doesn't redirect.
|
|
124
150
|
_this.getLoginRedirectUrl(redirectUrl);
|
|
125
151
|
}));
|
|
126
|
-
|
|
152
|
+
/**
|
|
153
|
+
* A Jest mock function (jest.fn())
|
|
154
|
+
*
|
|
155
|
+
* Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.
|
|
156
|
+
*
|
|
157
|
+
* ```
|
|
158
|
+
* const url = getLogoutRedirectUrl('http://localhost/mypage');
|
|
159
|
+
* console.log(url); // http://localhost/logout?next=http%3A%2F%2Flocalhost%2Fmypage
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @param {string} redirectUrl The URL the user should be redirected to after logging out.
|
|
163
|
+
*/
|
|
127
164
|
_defineProperty(this, "getLogoutRedirectUrl", jest.fn(function () {
|
|
128
165
|
var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.config.BASE_URL;
|
|
129
166
|
return "".concat(_this.config.LOGOUT_URL, "?redirect_url=").concat(encodeURIComponent(redirectUrl));
|
|
130
167
|
}));
|
|
131
|
-
|
|
168
|
+
/**
|
|
169
|
+
* A Jest mock function (jest.fn())
|
|
170
|
+
*
|
|
171
|
+
* Redirects the user to the logout page in the real implementation. Is a no-op here.
|
|
172
|
+
*
|
|
173
|
+
* @param {string} redirectUrl The URL the user should be redirected to after logging out.
|
|
174
|
+
*/
|
|
132
175
|
_defineProperty(this, "redirectToLogout", jest.fn(function () {
|
|
133
176
|
var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.config.BASE_URL;
|
|
134
|
-
|
|
135
177
|
// Do nothing after getting the URL - this preserves the calls properly, but doesn't redirect.
|
|
136
178
|
_this.getLogoutRedirectUrl(redirectUrl);
|
|
137
179
|
}));
|
|
138
|
-
|
|
180
|
+
/**
|
|
181
|
+
* A Jest mock function (jest.fn())
|
|
182
|
+
*
|
|
183
|
+
* If it exists, returns the user data representing the currently authenticated user. If the
|
|
184
|
+
* user is anonymous, returns null.
|
|
185
|
+
*
|
|
186
|
+
* @returns {UserData|null}
|
|
187
|
+
*/
|
|
139
188
|
_defineProperty(this, "getAuthenticatedUser", jest.fn(function () {
|
|
140
189
|
return _this.authenticatedUser;
|
|
141
190
|
}));
|
|
142
|
-
|
|
191
|
+
/**
|
|
192
|
+
* A Jest mock function (jest.fn())
|
|
193
|
+
*
|
|
194
|
+
* Sets the authenticated user to the provided value.
|
|
195
|
+
*
|
|
196
|
+
* @param {UserData} authUser
|
|
197
|
+
*/
|
|
143
198
|
_defineProperty(this, "setAuthenticatedUser", jest.fn(function (authUser) {
|
|
144
199
|
_this.authenticatedUser = authUser;
|
|
145
200
|
}));
|
|
146
|
-
|
|
201
|
+
/**
|
|
202
|
+
* A Jest mock function (jest.fn())
|
|
203
|
+
*
|
|
204
|
+
* Returns the current authenticated user details, as supplied in the `authenticatedUser` field
|
|
205
|
+
* of the config options. Resolves to null if the user is unauthenticated / the config option
|
|
206
|
+
* has not been set.
|
|
207
|
+
*
|
|
208
|
+
* @returns {UserData|null} Resolves to the user's access token if they are
|
|
209
|
+
* logged in.
|
|
210
|
+
*/
|
|
147
211
|
_defineProperty(this, "fetchAuthenticatedUser", jest.fn(function () {
|
|
148
212
|
return _this.getAuthenticatedUser();
|
|
149
213
|
}));
|
|
150
|
-
|
|
214
|
+
/**
|
|
215
|
+
* A Jest mock function (jest.fn())
|
|
216
|
+
*
|
|
217
|
+
* Ensures a user is authenticated. It will redirect to login when not authenticated.
|
|
218
|
+
*
|
|
219
|
+
* @param {string} [redirectUrl=config.BASE_URL] to return user after login when not
|
|
220
|
+
* authenticated.
|
|
221
|
+
* @returns {UserData|null} Resolves to the user's access token if they are
|
|
222
|
+
* logged in.
|
|
223
|
+
*/
|
|
151
224
|
_defineProperty(this, "ensureAuthenticatedUser", jest.fn(function () {
|
|
152
225
|
var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.config.BASE_URL;
|
|
153
|
-
|
|
154
226
|
_this.fetchAuthenticatedUser();
|
|
155
|
-
|
|
156
227
|
if (_this.getAuthenticatedUser() === null) {
|
|
157
228
|
// The user is not authenticated, send them to the login page.
|
|
158
229
|
_this.redirectToLogin(redirectUrl);
|
|
159
230
|
}
|
|
160
|
-
|
|
161
231
|
return _this.getAuthenticatedUser();
|
|
162
232
|
}));
|
|
163
|
-
|
|
233
|
+
/**
|
|
234
|
+
* A Jest mock function (jest.fn())
|
|
235
|
+
*
|
|
236
|
+
* Adds the user data supplied in the `hydratedAuthenticatedUser` config option into the object
|
|
237
|
+
* returned by `getAuthenticatedUser`. This emulates the behavior of a real auth service which
|
|
238
|
+
* would make a request to fetch this data prior to merging it in.
|
|
239
|
+
*
|
|
240
|
+
* ```
|
|
241
|
+
* console.log(authenticatedUser); // Will be sparse and only contain basic information.
|
|
242
|
+
* await hydrateAuthenticatedUser()
|
|
243
|
+
* const authenticatedUser = getAuthenticatedUser();
|
|
244
|
+
* console.log(authenticatedUser); // Will contain additional user information
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @returns {Promise<null>}
|
|
248
|
+
*/
|
|
164
249
|
_defineProperty(this, "hydrateAuthenticatedUser", jest.fn(function () {
|
|
165
250
|
var user = _this.getAuthenticatedUser();
|
|
166
|
-
|
|
167
251
|
if (user !== null) {
|
|
168
252
|
_this.setAuthenticatedUser(_objectSpread(_objectSpread({}, user), _this.hydratedAuthenticatedUser));
|
|
169
253
|
}
|
|
170
254
|
}));
|
|
171
|
-
|
|
172
255
|
this.authenticatedHttpClient = null;
|
|
173
256
|
this.httpClient = null;
|
|
174
257
|
ensureDefinedConfig(options, 'AuthService');
|
|
175
258
|
PropTypes.checkPropTypes(optionsPropTypes, options, 'options', 'AuthService');
|
|
176
259
|
this.config = options.config;
|
|
177
|
-
this.loggingService = options.loggingService;
|
|
260
|
+
this.loggingService = options.loggingService;
|
|
178
261
|
|
|
262
|
+
// Mock user
|
|
179
263
|
this.authenticatedUser = this.config.authenticatedUser ? this.config.authenticatedUser : null;
|
|
180
264
|
this.hydratedAuthenticatedUser = this.config.hydratedAuthenticatedUser ? this.config.hydratedAuthenticatedUser : {};
|
|
181
265
|
this.authenticatedHttpClient = axios.create();
|
|
182
266
|
this.httpClient = axios.create();
|
|
183
267
|
}
|
|
268
|
+
|
|
184
269
|
/**
|
|
185
270
|
* A Jest mock function (jest.fn())
|
|
186
271
|
*
|
|
@@ -188,14 +273,11 @@ var MockAuthService = /*#__PURE__*/function () {
|
|
|
188
273
|
*
|
|
189
274
|
* @param {Array} middleware Middleware to apply.
|
|
190
275
|
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
276
|
_createClass(MockAuthService, [{
|
|
194
277
|
key: "applyMiddleware",
|
|
195
278
|
value: function applyMiddleware() {
|
|
196
279
|
var middleware = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
197
280
|
var clients = [this.authenticatedHttpClient, this.httpClient, this.cachedAuthenticatedHttpClient, this.cachedHttpClient];
|
|
198
|
-
|
|
199
281
|
try {
|
|
200
282
|
middleware.forEach(function (middlewareFn) {
|
|
201
283
|
clients.forEach(function (client) {
|
|
@@ -206,19 +288,8 @@ var MockAuthService = /*#__PURE__*/function () {
|
|
|
206
288
|
throw new Error("Failed to apply middleware: ".concat(error.message, "."));
|
|
207
289
|
}
|
|
208
290
|
}
|
|
209
|
-
/**
|
|
210
|
-
* A Jest mock function (jest.fn())
|
|
211
|
-
*
|
|
212
|
-
* Gets the authenticated HTTP client instance, which is an axios client wrapped in
|
|
213
|
-
* MockAdapter from axios-mock-adapter.
|
|
214
|
-
*
|
|
215
|
-
* @returns {HttpClient} An HttpClient wrapped in MockAdapter.
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
291
|
}]);
|
|
219
|
-
|
|
220
292
|
return MockAuthService;
|
|
221
293
|
}();
|
|
222
|
-
|
|
223
294
|
export default MockAuthService;
|
|
224
295
|
//# sourceMappingURL=MockAuthService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockAuthService.js","names":["axios","PropTypes","ensureDefinedConfig","userPropTypes","shape","userId","string","isRequired","username","roles","arrayOf","administrator","optionsPropTypes","config","BASE_URL","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","authenticatedUser","hydratedAuthenticatedUser","MockAuthService","options","jest","fn","authenticatedHttpClient","httpClient","redirectUrl","encodeURIComponent","getLoginRedirectUrl","getLogoutRedirectUrl","authUser","getAuthenticatedUser","fetchAuthenticatedUser","redirectToLogin","user","setAuthenticatedUser","checkPropTypes","create","middleware","clients","cachedAuthenticatedHttpClient","cachedHttpClient","forEach","middlewareFn","client","error","Error","message"],"sources":["../../src/auth/MockAuthService.js"],"sourcesContent":["import axios from 'axios';\nimport PropTypes from 'prop-types';\nimport { ensureDefinedConfig } from '../utils';\n\nconst userPropTypes = PropTypes.shape({\n userId: PropTypes.string.isRequired,\n username: PropTypes.string.isRequired,\n roles: PropTypes.arrayOf(PropTypes.string),\n administrator: PropTypes.boolean,\n});\n\nconst optionsPropTypes = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n // The absence of authenticatedUser means the user is anonymous.\n authenticatedUser: userPropTypes,\n // Must be at least a valid user, but may have other fields.\n hydratedAuthenticatedUser: userPropTypes,\n};\n\n/**\n * The MockAuthService class mocks authenticated user-fetching logic and allows for manually\n * setting user data. It is compatible with axios-mock-adapter to wrap its HttpClients so that\n * they can be mocked for testing.\n *\n * It wraps all methods of the service with Jest mock functions (jest.fn()). This allows test code\n * to assert expectations on all functions of the service while preserving sensible behaviors. For\n * instance, the login/logout methods related to redirecting maintain their real behavior.\n *\n * This service is NOT suitable for use in an application itself - only tests. It depends on Jest,\n * which should only be a dev dependency of your project. You don't want to pull the entire suite\n * of test dependencies into your application at runtime, probably even in your dev server.\n *\n * In a test where you would like to mock out API requests - perhaps from a redux-thunk function -\n * you could do the following to set up a MockAuthService for your test:\n *\n * ```\n * import { getConfig, mergeConfig } from '@edx/frontend-platform';\n * import { configure, MockAuthService } from '@edx/frontend-platform/auth';\n * import MockAdapter from 'axios-mock-adapter';\n *\n * const mockLoggingService = {\n * logInfo: jest.fn(),\n * logError: jest.fn(),\n * };\n * mergeConfig({\n * authenticatedUser: {\n * userId: 'abc123',\n * username: 'Mock User',\n * roles: [],\n * administrator: false,\n * },\n * });\n * configure(MockAuthService, { config: getConfig(), loggingService: mockLoggingService });\n * const mockAdapter = new MockAdapter(getAuthenticatedHttpClient());\n * // Mock calls for your tests. This configuration can be done in any sort of test setup.\n * mockAdapter.onGet(...);\n * ```\n *\n * Also see the `initializeMockApp` function which also automatically uses mock services for\n * Logging and Analytics.\n *\n * @implements {AuthService}\n * @memberof module:Auth\n */\nclass MockAuthService {\n /**\n * @param {Object} options\n * @param {Object} options.config\n * @param {string} options.config.BASE_URL\n * @param {string} options.config.LMS_BASE_URL\n * @param {string} options.config.LOGIN_URL\n * @param {string} options.config.LOGOUT_URL\n * @param {string} options.config.REFRESH_ACCESS_TOKEN_ENDPOINT\n * @param {string} options.config.ACCESS_TOKEN_COOKIE_NAME\n * @param {string} options.config.CSRF_TOKEN_API_PATH\n * @param {Object} options.config.hydratedAuthenticatedUser\n * @param {Object} options.config.authenticatedUser\n * @param {Object} options.loggingService requires logError and logInfo methods\n */\n constructor(options) {\n this.authenticatedHttpClient = null;\n this.httpClient = null;\n\n ensureDefinedConfig(options, 'AuthService');\n PropTypes.checkPropTypes(optionsPropTypes, options, 'options', 'AuthService');\n\n this.config = options.config;\n this.loggingService = options.loggingService;\n\n // Mock user\n this.authenticatedUser = this.config.authenticatedUser ? this.config.authenticatedUser : null;\n this.hydratedAuthenticatedUser = this.config.hydratedAuthenticatedUser\n ? this.config.hydratedAuthenticatedUser\n : {};\n\n this.authenticatedHttpClient = axios.create();\n this.httpClient = axios.create();\n }\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Applies middleware to the axios instances in this service.\n *\n * @param {Array} middleware Middleware to apply.\n */\n applyMiddleware(middleware = []) {\n const clients = [\n this.authenticatedHttpClient, this.httpClient,\n this.cachedAuthenticatedHttpClient, this.cachedHttpClient,\n ];\n try {\n (middleware).forEach((middlewareFn) => {\n clients.forEach((client) => client && middlewareFn(client));\n });\n } catch (error) {\n throw new Error(`Failed to apply middleware: ${error.message}.`);\n }\n }\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Gets the authenticated HTTP client instance, which is an axios client wrapped in\n * MockAdapter from axios-mock-adapter.\n *\n * @returns {HttpClient} An HttpClient wrapped in MockAdapter.\n */\n getAuthenticatedHttpClient = jest.fn(() => this.authenticatedHttpClient);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Gets the unauthenticated HTTP client instance, which is an axios client wrapped in\n * MockAdapter from axios-mock-adapter.\n *\n * @returns {HttpClient} An HttpClient wrapped in MockAdapter.\n */\n getHttpClient = jest.fn(() => this.httpClient);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n getLoginRedirectUrl = jest.fn(\n (redirectUrl = this.config.BASE_URL) => `${this.config.LOGIN_URL}?next=${encodeURIComponent(redirectUrl)}`,\n );\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Redirects the user to the logout page in the real implementation. Is a no-op here.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n redirectToLogin = jest.fn((redirectUrl = this.config.BASE_URL) => {\n // Do nothing after getting the URL - this preserves the calls properly, but doesn't redirect.\n this.getLoginRedirectUrl(redirectUrl);\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n getLogoutRedirectUrl = jest.fn((redirectUrl = this.config.BASE_URL) => `${this.config.LOGOUT_URL}?redirect_url=${encodeURIComponent(redirectUrl)}`);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Redirects the user to the logout page in the real implementation. Is a no-op here.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n redirectToLogout = jest.fn((redirectUrl = this.config.BASE_URL) => {\n // Do nothing after getting the URL - this preserves the calls properly, but doesn't redirect.\n this.getLogoutRedirectUrl(redirectUrl);\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\n getAuthenticatedUser = jest.fn(() => this.authenticatedUser);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n */\n setAuthenticatedUser = jest.fn((authUser) => {\n this.authenticatedUser = authUser;\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Returns the current authenticated user details, as supplied in the `authenticatedUser` field\n * of the config options. Resolves to null if the user is unauthenticated / the config option\n * has not been set.\n *\n * @returns {UserData|null} Resolves to the user's access token if they are\n * logged in.\n */\n fetchAuthenticatedUser = jest.fn(() => this.getAuthenticatedUser());\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Ensures a user is authenticated. It will redirect to login when not authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {UserData|null} Resolves to the user's access token if they are\n * logged in.\n */\n ensureAuthenticatedUser = jest.fn((redirectUrl = this.config.BASE_URL) => {\n this.fetchAuthenticatedUser();\n\n if (this.getAuthenticatedUser() === null) {\n // The user is not authenticated, send them to the login page.\n this.redirectToLogin(redirectUrl);\n }\n\n return this.getAuthenticatedUser();\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Adds the user data supplied in the `hydratedAuthenticatedUser` config option into the object\n * returned by `getAuthenticatedUser`. This emulates the behavior of a real auth service which\n * would make a request to fetch this data prior to merging it in.\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @returns {Promise<null>}\n */\n hydrateAuthenticatedUser = jest.fn(() => {\n const user = this.getAuthenticatedUser();\n if (user !== null) {\n this.setAuthenticatedUser({ ...user, ...this.hydratedAuthenticatedUser });\n }\n });\n}\n\nexport default MockAuthService;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,mBAAT,QAAoC,UAApC;AAEA,IAAMC,aAAa,GAAGF,SAAS,CAACG,KAAV,CAAgB;EACpCC,MAAM,EAAEJ,SAAS,CAACK,MAAV,CAAiBC,UADW;EAEpCC,QAAQ,EAAEP,SAAS,CAACK,MAAV,CAAiBC,UAFS;EAGpCE,KAAK,EAAER,SAAS,CAACS,OAAV,CA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AAI;MAC/B,IAAMC,OAAO,GAAG,CACd,KAAKf,uBADS,EACgB,KAAKC,UADrB,EAEd,KAAKe,6BAFS,EAEsB,KAAKC,gBAF3B,CAAhB;;MAIA,IAAI;QACDH,UAAD,CAAaI,OAAb,CAAqB,UAACC,YAAD,EAAkB;UACrCJ,OAAO,CAACG,OAAR,CAAgB,UAACE,MAAD;YAAA,OAAYA,MAAM,IAAID,YAAY,CAACC,MAAD,CAAlC;UAAA,CAAhB;QACD,CAFD;MAGD,CAJD,CAIE,OAAOC,KAAP,EAAc;QACd,MAAM,IAAIC,KAAJ,uCAAyCD,KAAK,CAACE,OAA/C,OAAN;MACD;IACF;IAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAiJA,eAAe3B,eAAf"}
|
|
1
|
+
{"version":3,"file":"MockAuthService.js","names":["axios","PropTypes","ensureDefinedConfig","userPropTypes","shape","userId","string","isRequired","username","roles","arrayOf","administrator","optionsPropTypes","config","BASE_URL","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","authenticatedUser","hydratedAuthenticatedUser","MockAuthService","options","_this","_classCallCheck","_defineProperty","jest","fn","authenticatedHttpClient","httpClient","redirectUrl","arguments","length","undefined","concat","encodeURIComponent","getLoginRedirectUrl","getLogoutRedirectUrl","authUser","getAuthenticatedUser","fetchAuthenticatedUser","redirectToLogin","user","setAuthenticatedUser","_objectSpread","checkPropTypes","create","_createClass","key","value","applyMiddleware","middleware","clients","cachedAuthenticatedHttpClient","cachedHttpClient","forEach","middlewareFn","client","error","Error","message"],"sources":["../../src/auth/MockAuthService.js"],"sourcesContent":["import axios from 'axios';\nimport PropTypes from 'prop-types';\nimport { ensureDefinedConfig } from '../utils';\n\nconst userPropTypes = PropTypes.shape({\n userId: PropTypes.string.isRequired,\n username: PropTypes.string.isRequired,\n roles: PropTypes.arrayOf(PropTypes.string),\n administrator: PropTypes.boolean,\n});\n\nconst optionsPropTypes = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n // The absence of authenticatedUser means the user is anonymous.\n authenticatedUser: userPropTypes,\n // Must be at least a valid user, but may have other fields.\n hydratedAuthenticatedUser: userPropTypes,\n};\n\n/**\n * The MockAuthService class mocks authenticated user-fetching logic and allows for manually\n * setting user data. It is compatible with axios-mock-adapter to wrap its HttpClients so that\n * they can be mocked for testing.\n *\n * It wraps all methods of the service with Jest mock functions (jest.fn()). This allows test code\n * to assert expectations on all functions of the service while preserving sensible behaviors. For\n * instance, the login/logout methods related to redirecting maintain their real behavior.\n *\n * This service is NOT suitable for use in an application itself - only tests. It depends on Jest,\n * which should only be a dev dependency of your project. You don't want to pull the entire suite\n * of test dependencies into your application at runtime, probably even in your dev server.\n *\n * In a test where you would like to mock out API requests - perhaps from a redux-thunk function -\n * you could do the following to set up a MockAuthService for your test:\n *\n * ```\n * import { getConfig, mergeConfig } from '@edx/frontend-platform';\n * import { configure, MockAuthService } from '@edx/frontend-platform/auth';\n * import MockAdapter from 'axios-mock-adapter';\n *\n * const mockLoggingService = {\n * logInfo: jest.fn(),\n * logError: jest.fn(),\n * };\n * mergeConfig({\n * authenticatedUser: {\n * userId: 'abc123',\n * username: 'Mock User',\n * roles: [],\n * administrator: false,\n * },\n * });\n * configure(MockAuthService, { config: getConfig(), loggingService: mockLoggingService });\n * const mockAdapter = new MockAdapter(getAuthenticatedHttpClient());\n * // Mock calls for your tests. This configuration can be done in any sort of test setup.\n * mockAdapter.onGet(...);\n * ```\n *\n * Also see the `initializeMockApp` function which also automatically uses mock services for\n * Logging and Analytics.\n *\n * @implements {AuthService}\n * @memberof module:Auth\n */\nclass MockAuthService {\n /**\n * @param {Object} options\n * @param {Object} options.config\n * @param {string} options.config.BASE_URL\n * @param {string} options.config.LMS_BASE_URL\n * @param {string} options.config.LOGIN_URL\n * @param {string} options.config.LOGOUT_URL\n * @param {string} options.config.REFRESH_ACCESS_TOKEN_ENDPOINT\n * @param {string} options.config.ACCESS_TOKEN_COOKIE_NAME\n * @param {string} options.config.CSRF_TOKEN_API_PATH\n * @param {Object} options.config.hydratedAuthenticatedUser\n * @param {Object} options.config.authenticatedUser\n * @param {Object} options.loggingService requires logError and logInfo methods\n */\n constructor(options) {\n this.authenticatedHttpClient = null;\n this.httpClient = null;\n\n ensureDefinedConfig(options, 'AuthService');\n PropTypes.checkPropTypes(optionsPropTypes, options, 'options', 'AuthService');\n\n this.config = options.config;\n this.loggingService = options.loggingService;\n\n // Mock user\n this.authenticatedUser = this.config.authenticatedUser ? this.config.authenticatedUser : null;\n this.hydratedAuthenticatedUser = this.config.hydratedAuthenticatedUser\n ? this.config.hydratedAuthenticatedUser\n : {};\n\n this.authenticatedHttpClient = axios.create();\n this.httpClient = axios.create();\n }\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Applies middleware to the axios instances in this service.\n *\n * @param {Array} middleware Middleware to apply.\n */\n applyMiddleware(middleware = []) {\n const clients = [\n this.authenticatedHttpClient, this.httpClient,\n this.cachedAuthenticatedHttpClient, this.cachedHttpClient,\n ];\n try {\n (middleware).forEach((middlewareFn) => {\n clients.forEach((client) => client && middlewareFn(client));\n });\n } catch (error) {\n throw new Error(`Failed to apply middleware: ${error.message}.`);\n }\n }\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Gets the authenticated HTTP client instance, which is an axios client wrapped in\n * MockAdapter from axios-mock-adapter.\n *\n * @returns {HttpClient} An HttpClient wrapped in MockAdapter.\n */\n getAuthenticatedHttpClient = jest.fn(() => this.authenticatedHttpClient);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Gets the unauthenticated HTTP client instance, which is an axios client wrapped in\n * MockAdapter from axios-mock-adapter.\n *\n * @returns {HttpClient} An HttpClient wrapped in MockAdapter.\n */\n getHttpClient = jest.fn(() => this.httpClient);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n getLoginRedirectUrl = jest.fn(\n (redirectUrl = this.config.BASE_URL) => `${this.config.LOGIN_URL}?next=${encodeURIComponent(redirectUrl)}`,\n );\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Redirects the user to the logout page in the real implementation. Is a no-op here.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n redirectToLogin = jest.fn((redirectUrl = this.config.BASE_URL) => {\n // Do nothing after getting the URL - this preserves the calls properly, but doesn't redirect.\n this.getLoginRedirectUrl(redirectUrl);\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n getLogoutRedirectUrl = jest.fn((redirectUrl = this.config.BASE_URL) => `${this.config.LOGOUT_URL}?redirect_url=${encodeURIComponent(redirectUrl)}`);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Redirects the user to the logout page in the real implementation. Is a no-op here.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n redirectToLogout = jest.fn((redirectUrl = this.config.BASE_URL) => {\n // Do nothing after getting the URL - this preserves the calls properly, but doesn't redirect.\n this.getLogoutRedirectUrl(redirectUrl);\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\n getAuthenticatedUser = jest.fn(() => this.authenticatedUser);\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n */\n setAuthenticatedUser = jest.fn((authUser) => {\n this.authenticatedUser = authUser;\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Returns the current authenticated user details, as supplied in the `authenticatedUser` field\n * of the config options. Resolves to null if the user is unauthenticated / the config option\n * has not been set.\n *\n * @returns {UserData|null} Resolves to the user's access token if they are\n * logged in.\n */\n fetchAuthenticatedUser = jest.fn(() => this.getAuthenticatedUser());\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Ensures a user is authenticated. It will redirect to login when not authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {UserData|null} Resolves to the user's access token if they are\n * logged in.\n */\n ensureAuthenticatedUser = jest.fn((redirectUrl = this.config.BASE_URL) => {\n this.fetchAuthenticatedUser();\n\n if (this.getAuthenticatedUser() === null) {\n // The user is not authenticated, send them to the login page.\n this.redirectToLogin(redirectUrl);\n }\n\n return this.getAuthenticatedUser();\n });\n\n /**\n * A Jest mock function (jest.fn())\n *\n * Adds the user data supplied in the `hydratedAuthenticatedUser` config option into the object\n * returned by `getAuthenticatedUser`. This emulates the behavior of a real auth service which\n * would make a request to fetch this data prior to merging it in.\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @returns {Promise<null>}\n */\n hydrateAuthenticatedUser = jest.fn(() => {\n const user = this.getAuthenticatedUser();\n if (user !== null) {\n this.setAuthenticatedUser({ ...user, ...this.hydratedAuthenticatedUser });\n }\n });\n}\n\nexport default MockAuthService;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,mBAAmB,QAAQ,UAAU;AAE9C,IAAMC,aAAa,GAAGF,SAAS,CAACG,KAAK,CAAC;EACpCC,MAAM,EAAEJ,SAAS,CAACK,MAAM,CAACC,UAAU;EACnCC,QAAQ,EAAEP,SAAS,CAACK,MAAM,CAACC,UAAU;EACrCE,KAAK,EAAER,SAAS,CAACS,OAAO,CAACT,SAAS,CAACK,MAAM,CAAC;EAC1CK,aAAa,EAAEV,SAAS;AAC1B,CAAC,CAAC;AAEF,IAAMW,gBAAgB,GAAG;EACvBC,MAAM,EAAEZ,SAAS,CAACG,KAAK,CAAC;IACtBU,QAAQ,EAAEb,SAAS,CAACK,MAAM,CAACC,UAAU;IACrCQ,YAAY,EAAEd,SAAS,CAACK,MAAM,CAACC,UAAU;IACzCS,SAAS,EAAEf,SAAS,CAACK,MAAM,CAACC,UAAU;IACtCU,UAAU,EAAEhB,SAAS,CAACK,MAAM,CAACC,UAAU;IACvCW,6BAA6B,EAAEjB,SAAS,CAACK,MAAM,CAACC,UAAU;IAC1DY,wBAAwB,EAAElB,SAAS,CAACK,MAAM,CAACC,UAAU;IACrDa,mBAAmB,EAAEnB,SAAS,CAACK,MAAM,CAACC;EACxC,CAAC,CAAC,CAACA,UAAU;EACbc,cAAc,EAAEpB,SAAS,CAACG,KAAK,CAAC;IAC9BkB,QAAQ,EAAErB,SAAS,CAACsB,IAAI,CAAChB,UAAU;IACnCiB,OAAO,EAAEvB,SAAS,CAACsB,IAAI,CAAChB;EAC1B,CAAC,CAAC,CAACA,UAAU;EACb;EACAkB,iBAAiB,EAAEtB,aAAa;EAChC;EACAuB,yBAAyB,EAAEvB;AAC7B,CAAC;;AAED;AACA;AACA;AACA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AAM,CAACa,yBAAyB,GACrC,CAAC,CAAC;IAEN,IAAI,CAACQ,uBAAuB,GAAGlC,KAAK,CAACoD,MAAM,EAAE;IAC7C,IAAI,CAACjB,UAAU,GAAGnC,KAAK,CAACoD,MAAM,EAAE;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANEC,YAAA,CAAA1B,eAAA;IAAA2B,GAAA;IAAAC,KAAA,EAOA,SAAAC,gBAAA,EAAiC;MAAA,IAAjBC,UAAU,GAAApB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;MAC7B,IAAMqB,OAAO,GAAG,CACd,IAAI,CAACxB,uBAAuB,EAAE,IAAI,CAACC,UAAU,EAC7C,IAAI,CAACwB,6BAA6B,EAAE,IAAI,CAACC,gBAAgB,CAC1D;MACD,IAAI;QACDH,UAAU,CAAEI,OAAO,CAAC,UAACC,YAAY,EAAK;UACrCJ,OAAO,CAACG,OAAO,CAAC,UAACE,MAAM;YAAA,OAAKA,MAAM,IAAID,YAAY,CAACC,MAAM,CAAC;UAAA,EAAC;QAC7D,CAAC,CAAC;MACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd,MAAM,IAAIC,KAAK,gCAAAzB,MAAA,CAAgCwB,KAAK,CAACE,OAAO,OAAI;MAClE;IACF;EAAC;EAAA,OAAAvC,eAAA;AAAA;AA0JH,eAAeA,eAAe"}
|
package/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["AUTHENTICATED_USER_TOPIC","AUTHENTICATED_USER_CHANGED","configure","getAuthenticatedHttpClient","getAuthService","getHttpClient","getLoginRedirectUrl","redirectToLogin","getLogoutRedirectUrl","redirectToLogout","getAuthenticatedUser","setAuthenticatedUser","fetchAuthenticatedUser","ensureAuthenticatedUser","hydrateAuthenticatedUser","default","AxiosJwtAuthService","MockAuthService"],"sources":["../../src/auth/index.js"],"sourcesContent":["export {\n AUTHENTICATED_USER_TOPIC,\n AUTHENTICATED_USER_CHANGED,\n configure,\n getAuthenticatedHttpClient,\n getAuthService,\n getHttpClient,\n getLoginRedirectUrl,\n redirectToLogin,\n getLogoutRedirectUrl,\n redirectToLogout,\n getAuthenticatedUser,\n setAuthenticatedUser,\n fetchAuthenticatedUser,\n ensureAuthenticatedUser,\n hydrateAuthenticatedUser,\n} from './interface';\nexport { default as AxiosJwtAuthService } from './AxiosJwtAuthService';\nexport { default as MockAuthService } from './MockAuthService';\n"],"mappings":"AAAA,SACEA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["AUTHENTICATED_USER_TOPIC","AUTHENTICATED_USER_CHANGED","configure","getAuthenticatedHttpClient","getAuthService","getHttpClient","getLoginRedirectUrl","redirectToLogin","getLogoutRedirectUrl","redirectToLogout","getAuthenticatedUser","setAuthenticatedUser","fetchAuthenticatedUser","ensureAuthenticatedUser","hydrateAuthenticatedUser","default","AxiosJwtAuthService","MockAuthService"],"sources":["../../src/auth/index.js"],"sourcesContent":["export {\n AUTHENTICATED_USER_TOPIC,\n AUTHENTICATED_USER_CHANGED,\n configure,\n getAuthenticatedHttpClient,\n getAuthService,\n getHttpClient,\n getLoginRedirectUrl,\n redirectToLogin,\n getLogoutRedirectUrl,\n redirectToLogout,\n getAuthenticatedUser,\n setAuthenticatedUser,\n fetchAuthenticatedUser,\n ensureAuthenticatedUser,\n hydrateAuthenticatedUser,\n} from './interface';\nexport { default as AxiosJwtAuthService } from './AxiosJwtAuthService';\nexport { default as MockAuthService } from './MockAuthService';\n"],"mappings":"AAAA,SACEA,wBAAwB,EACxBC,0BAA0B,EAC1BC,SAAS,EACTC,0BAA0B,EAC1BC,cAAc,EACdC,aAAa,EACbC,mBAAmB,EACnBC,eAAe,EACfC,oBAAoB,EACpBC,gBAAgB,EAChBC,oBAAoB,EACpBC,oBAAoB,EACpBC,sBAAsB,EACtBC,uBAAuB,EACvBC,wBAAwB,QACnB,aAAa;AACpB,SAASC,OAAO,IAAIC,mBAAmB,QAAQ,uBAAuB;AACtE,SAASD,OAAO,IAAIE,eAAe,QAAQ,mBAAmB"}
|
|
@@ -1,72 +1,57 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
|
|
3
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
|
-
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
5
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6
|
-
|
|
7
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
-
|
|
9
5
|
var createCsrfTokenProviderInterceptor = function createCsrfTokenProviderInterceptor(options) {
|
|
10
6
|
var csrfTokenService = options.csrfTokenService,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// maintain reference to the options supplied.
|
|
7
|
+
CSRF_TOKEN_API_PATH = options.CSRF_TOKEN_API_PATH,
|
|
8
|
+
shouldSkip = options.shouldSkip;
|
|
14
9
|
|
|
10
|
+
// Creating the interceptor inside this closure to
|
|
11
|
+
// maintain reference to the options supplied.
|
|
15
12
|
var interceptor = /*#__PURE__*/function () {
|
|
16
13
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(axiosRequestConfig) {
|
|
17
14
|
var url, csrfToken, requestError, CSRF_HEADER_NAME;
|
|
18
15
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19
|
-
while (1) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_context.next = 2;
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return _context.abrupt("return", axiosRequestConfig);
|
|
28
|
-
|
|
29
|
-
case 2:
|
|
30
|
-
url = axiosRequestConfig.url;
|
|
31
|
-
_context.prev = 3;
|
|
32
|
-
_context.next = 6;
|
|
33
|
-
return csrfTokenService.getCsrfToken(url, CSRF_TOKEN_API_PATH);
|
|
34
|
-
|
|
35
|
-
case 6:
|
|
36
|
-
csrfToken = _context.sent;
|
|
37
|
-
_context.next = 15;
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
if (!shouldSkip(axiosRequestConfig)) {
|
|
19
|
+
_context.next = 2;
|
|
38
20
|
break;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
21
|
+
}
|
|
22
|
+
return _context.abrupt("return", axiosRequestConfig);
|
|
23
|
+
case 2:
|
|
24
|
+
url = axiosRequestConfig.url;
|
|
25
|
+
_context.prev = 3;
|
|
26
|
+
_context.next = 6;
|
|
27
|
+
return csrfTokenService.getCsrfToken(url, CSRF_TOKEN_API_PATH);
|
|
28
|
+
case 6:
|
|
29
|
+
csrfToken = _context.sent;
|
|
30
|
+
_context.next = 15;
|
|
31
|
+
break;
|
|
32
|
+
case 9:
|
|
33
|
+
_context.prev = 9;
|
|
34
|
+
_context.t0 = _context["catch"](3);
|
|
35
|
+
requestError = Object.create(_context.t0);
|
|
36
|
+
requestError.message = "[getCsrfToken] ".concat(requestError.message);
|
|
37
|
+
// Important: return the original axios request config
|
|
38
|
+
requestError.config = axiosRequestConfig;
|
|
39
|
+
return _context.abrupt("return", Promise.reject(requestError));
|
|
40
|
+
case 15:
|
|
41
|
+
CSRF_HEADER_NAME = 'X-CSRFToken'; // eslint-disable-next-line no-param-reassign
|
|
42
|
+
axiosRequestConfig.headers[CSRF_HEADER_NAME] = csrfToken;
|
|
43
|
+
return _context.abrupt("return", axiosRequestConfig);
|
|
44
|
+
case 18:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
59
47
|
}
|
|
60
48
|
}, _callee, null, [[3, 9]]);
|
|
61
49
|
}));
|
|
62
|
-
|
|
63
50
|
return function interceptor(_x) {
|
|
64
51
|
return _ref.apply(this, arguments);
|
|
65
52
|
};
|
|
66
53
|
}();
|
|
67
|
-
|
|
68
54
|
return interceptor;
|
|
69
55
|
};
|
|
70
|
-
|
|
71
56
|
export default createCsrfTokenProviderInterceptor;
|
|
72
57
|
//# sourceMappingURL=createCsrfTokenProviderInterceptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCsrfTokenProviderInterceptor.js","names":["createCsrfTokenProviderInterceptor","options","csrfTokenService","CSRF_TOKEN_API_PATH","shouldSkip","interceptor","axiosRequestConfig","url","getCsrfToken","csrfToken","requestError","Object","create","message","config","Promise","reject","CSRF_HEADER_NAME","headers"],"sources":["../../../src/auth/interceptors/createCsrfTokenProviderInterceptor.js"],"sourcesContent":["const createCsrfTokenProviderInterceptor = (options) => {\n const { csrfTokenService, CSRF_TOKEN_API_PATH, shouldSkip } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (axiosRequestConfig) => {\n if (shouldSkip(axiosRequestConfig)) {\n return axiosRequestConfig;\n }\n const { url } = axiosRequestConfig;\n let csrfToken;\n\n // Important: the job of this interceptor is to get a csrf token and update\n // the original request configuration. Errors thrown getting the csrf token\n // should contain the original request config. This allows other interceptors\n // (namely our retry request interceptor below) to access the original request\n // and handle it appropriately\n try {\n csrfToken = await csrfTokenService.getCsrfToken(url, CSRF_TOKEN_API_PATH);\n } catch (error) {\n const requestError = Object.create(error);\n requestError.message = `[getCsrfToken] ${requestError.message}`;\n // Important: return the original axios request config\n requestError.config = axiosRequestConfig;\n return Promise.reject(requestError);\n }\n\n const CSRF_HEADER_NAME = 'X-CSRFToken';\n // eslint-disable-next-line no-param-reassign\n axiosRequestConfig.headers[CSRF_HEADER_NAME] = csrfToken;\n return axiosRequestConfig;\n };\n\n return interceptor;\n};\n\nexport default createCsrfTokenProviderInterceptor;\n"],"mappings":";;+CACA,oJ;;;;;;AADA,IAAMA,kCAAkC,GAAG,SAArCA,kCAAqC,CAACC,OAAD,EAAa;EACtD,IAAQC,gBAAR,GAA8DD,OAA9D,CAAQC,gBAAR;EAAA,IAA0BC,mBAA1B,GAA8DF,OAA9D,CAA0BE,mBAA1B;EAAA,IAA+CC,UAA/C,GAA8DH,OAA9D,CAA+CG,UAA/C,CADsD,CAGtD;EACA;;EACA,IAAMC,WAAW;IAAA,sEAAG,iBAAOC,kBAAP;MAAA;MAAA;QAAA;UAAA;YAAA;cAAA,KACdF,UAAU,CAACE,kBAAD,CADI;gBAAA;gBAAA;cAAA;;cAAA,iCAETA,kBAFS;;YAAA;cAIVC,GAJU,GAIFD,kBAJE,CAIVC,GAJU;cAAA;cAAA;cAAA,OAaEL,gBAAgB,CAACM,YAAjB,CAA8BD,GAA9B,EAAmCJ,mBAAnC,CAbF;;YAAA;cAahBM,SAbgB;cAAA;cAAA;;YAAA;cAAA;cAAA;cAeVC,YAfU,GAeKC,MAAM,CAACC,MAAP,aAfL;cAgBhBF,YAAY,CAACG,OAAb,4BAAyCH,YAAY,CAACG,OAAtD,EAhBgB,CAiBhB;;cACAH,YAAY,CAACI,MAAb,GAAsBR,kBAAtB;cAlBgB,iCAmBTS,OAAO,CAACC,MAAR,CAAeN,YAAf,CAnBS;;YAAA;cAsBZO,gBAtBY,GAsBO,aAtBP,EAuBlB;;cACAX,kBAAkB,CAACY,OAAnB,CAA2BD,gBAA3B,IAA+CR,SAA/C;cAxBkB,iCAyBXH,kBAzBW;;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAAH;;IAAA,gBAAXD,WAAW;MAAA;IAAA;EAAA,GAAjB;;EA4BA,OAAOA,WAAP;AACD,CAlCD;;AAoCA,eAAeL,kCAAf"}
|
|
1
|
+
{"version":3,"file":"createCsrfTokenProviderInterceptor.js","names":["_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","done","methodName","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","_catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","createCsrfTokenProviderInterceptor","options","csrfTokenService","CSRF_TOKEN_API_PATH","shouldSkip","interceptor","_ref","_callee","axiosRequestConfig","url","csrfToken","requestError","CSRF_HEADER_NAME","_callee$","_context","getCsrfToken","t0","message","concat","config","headers","_x"],"sources":["../../../src/auth/interceptors/createCsrfTokenProviderInterceptor.js"],"sourcesContent":["const createCsrfTokenProviderInterceptor = (options) => {\n const { csrfTokenService, CSRF_TOKEN_API_PATH, shouldSkip } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (axiosRequestConfig) => {\n if (shouldSkip(axiosRequestConfig)) {\n return axiosRequestConfig;\n }\n const { url } = axiosRequestConfig;\n let csrfToken;\n\n // Important: the job of this interceptor is to get a csrf token and update\n // the original request configuration. Errors thrown getting the csrf token\n // should contain the original request config. This allows other interceptors\n // (namely our retry request interceptor below) to access the original request\n // and handle it appropriately\n try {\n csrfToken = await csrfTokenService.getCsrfToken(url, CSRF_TOKEN_API_PATH);\n } catch (error) {\n const requestError = Object.create(error);\n requestError.message = `[getCsrfToken] ${requestError.message}`;\n // Important: return the original axios request config\n requestError.config = axiosRequestConfig;\n return Promise.reject(requestError);\n }\n\n const CSRF_HEADER_NAME = 'X-CSRFToken';\n // eslint-disable-next-line no-param-reassign\n axiosRequestConfig.headers[CSRF_HEADER_NAME] = csrfToken;\n return axiosRequestConfig;\n };\n\n return interceptor;\n};\n\nexport default createCsrfTokenProviderInterceptor;\n"],"mappings":";+CACA,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,OAAA,SAAAA,OAAA,OAAAC,EAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,MAAA,GAAAH,EAAA,CAAAI,cAAA,EAAAC,cAAA,GAAAJ,MAAA,CAAAI,cAAA,cAAAC,GAAA,EAAAC,GAAA,EAAAC,IAAA,IAAAF,GAAA,CAAAC,GAAA,IAAAC,IAAA,CAAAC,KAAA,KAAAC,OAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,cAAA,GAAAF,OAAA,CAAAG,QAAA,kBAAAC,mBAAA,GAAAJ,OAAA,CAAAK,aAAA,uBAAAC,iBAAA,GAAAN,OAAA,CAAAO,WAAA,8BAAAC,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAR,MAAA,CAAAI,cAAA,CAAAC,GAAA,EAAAC,GAAA,IAAAE,KAAA,EAAAA,KAAA,EAAAU,UAAA,MAAAC,YAAA,MAAAC,QAAA,SAAAf,GAAA,CAAAC,GAAA,WAAAW,MAAA,mBAAAI,GAAA,IAAAJ,MAAA,YAAAA,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAH,GAAA,CAAAC,GAAA,IAAAE,KAAA,gBAAAc,KAAAC,OAAA,EAAAC,OAAA,EAAAC,IAAA,EAAAC,WAAA,QAAAC,cAAA,GAAAH,OAAA,IAAAA,OAAA,CAAAvB,SAAA,YAAA2B,SAAA,GAAAJ,OAAA,GAA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