studiokit-scaffolding-js 5.2.0-next.2.8 → 5.2.0-next.2.9
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.
|
@@ -2,7 +2,6 @@ import { Action } from 'redux';
|
|
|
2
2
|
import { CasV1LoginRequestBody, IdentityProvider } from '../../types';
|
|
3
3
|
import { LocalLoginRequestBody } from '../../types/auth/LocalLoginRequestBody';
|
|
4
4
|
import { OAuthToken, OAuthTokenOrNull } from '../../types/net';
|
|
5
|
-
import { BaseModelFetchRequestAction } from './ModelAction';
|
|
6
5
|
export declare enum AUTH_ACTION_TYPE {
|
|
7
6
|
CAS_LOGIN_REQUESTED = "auth/CAS_LOGIN_REQUESTED",
|
|
8
7
|
LOGIN_REQUESTED = "auth/LOGIN_REQUESTED",
|
|
@@ -43,12 +42,12 @@ export interface AuthIdentityProviderRequestAction extends Action<AUTH_IDENTITY_
|
|
|
43
42
|
export declare enum AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE {
|
|
44
43
|
CAS_V1_LOGIN_REQUEST = "auth/CAS_V1_LOGIN_REQUEST"
|
|
45
44
|
}
|
|
46
|
-
export interface AuthCasV1LoginRequestAction extends
|
|
45
|
+
export interface AuthCasV1LoginRequestAction extends Action<AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE> {
|
|
47
46
|
body: CasV1LoginRequestBody;
|
|
48
47
|
}
|
|
49
48
|
export declare enum AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE {
|
|
50
49
|
LOCAL_LOGIN_REQUEST = "auth/LOCAL_LOGIN_REQUEST"
|
|
51
50
|
}
|
|
52
|
-
export interface AuthLocalLoginRequestAction extends
|
|
51
|
+
export interface AuthLocalLoginRequestAction extends Action<AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE> {
|
|
53
52
|
body: LocalLoginRequestBody;
|
|
54
53
|
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
3
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
4
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
@@ -236,9 +225,16 @@ function credentialsLoginFlow(action, modelName) {
|
|
|
236
225
|
return __generator(this, function (_a) {
|
|
237
226
|
switch (_a.label) {
|
|
238
227
|
case 0:
|
|
239
|
-
modelFetchRequestAction =
|
|
240
|
-
// set required
|
|
241
|
-
type: actions_1.MODEL_FETCH_REQUEST_ACTION_TYPE.FETCH_REQUEST,
|
|
228
|
+
modelFetchRequestAction = {
|
|
229
|
+
// set required defaults
|
|
230
|
+
type: actions_1.MODEL_FETCH_REQUEST_ACTION_TYPE.FETCH_REQUEST,
|
|
231
|
+
modelName: modelName,
|
|
232
|
+
noStore: true,
|
|
233
|
+
// force no retry
|
|
234
|
+
noRetry: true,
|
|
235
|
+
// pass thru body
|
|
236
|
+
body: action.body
|
|
237
|
+
};
|
|
242
238
|
return [4 /*yield*/, effects_1.call(loginFlow, modelFetchRequestAction)];
|
|
243
239
|
case 1: return [2 /*return*/, _a.sent()];
|
|
244
240
|
}
|
|
@@ -323,7 +319,7 @@ var getOAuthToken = function (modelName) {
|
|
|
323
319
|
};
|
|
324
320
|
exports.getOAuthToken = getOAuthToken;
|
|
325
321
|
function authSaga(clientCredentialsParam, tokenPersistenceServiceParam, ticketProviderService, codeProviderService) {
|
|
326
|
-
var casTicket, service, code, _a, casV1Action,
|
|
322
|
+
var casTicket, service, code, _a, casV1Action, localLoginAction;
|
|
327
323
|
if (tokenPersistenceServiceParam === void 0) { tokenPersistenceServiceParam = tokenPersistenceService_1.tokenPersistenceService; }
|
|
328
324
|
if (ticketProviderService === void 0) { ticketProviderService = ticketProviderService_1.ticketProviderService; }
|
|
329
325
|
if (codeProviderService === void 0) { codeProviderService = codeProviderService_1.codeProviderService; }
|
|
@@ -381,10 +377,10 @@ function authSaga(clientCredentialsParam, tokenPersistenceServiceParam, ticketPr
|
|
|
381
377
|
if (!!oauthToken) return [3 /*break*/, 16];
|
|
382
378
|
return [4 /*yield*/, effects_1.race({
|
|
383
379
|
casV1Action: effects_1.take(actions_1.AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE.CAS_V1_LOGIN_REQUEST),
|
|
384
|
-
|
|
380
|
+
localLoginAction: effects_1.take(actions_1.AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE.LOCAL_LOGIN_REQUEST)
|
|
385
381
|
})];
|
|
386
382
|
case 11:
|
|
387
|
-
_a = _b.sent(), casV1Action = _a.casV1Action,
|
|
383
|
+
_a = _b.sent(), casV1Action = _a.casV1Action, localLoginAction = _a.localLoginAction;
|
|
388
384
|
return [4 /*yield*/, effects_1.put({ type: actions_1.AUTH_ACTION_TYPE.LOGIN_REQUESTED })];
|
|
389
385
|
case 12:
|
|
390
386
|
_b.sent();
|
|
@@ -394,8 +390,8 @@ function authSaga(clientCredentialsParam, tokenPersistenceServiceParam, ticketPr
|
|
|
394
390
|
oauthToken = _b.sent();
|
|
395
391
|
return [3 /*break*/, 16];
|
|
396
392
|
case 14:
|
|
397
|
-
if (!
|
|
398
|
-
return [4 /*yield*/, effects_1.call(localLoginFlow,
|
|
393
|
+
if (!localLoginAction) return [3 /*break*/, 16];
|
|
394
|
+
return [4 /*yield*/, effects_1.call(localLoginFlow, localLoginAction)];
|
|
399
395
|
case 15:
|
|
400
396
|
oauthToken = _b.sent();
|
|
401
397
|
_b.label = 16;
|
|
@@ -308,7 +308,7 @@ function modelFetch(modelFetchRequestAction) {
|
|
|
308
308
|
// log to the console
|
|
309
309
|
logger.error(error);
|
|
310
310
|
didFail = true;
|
|
311
|
-
// Do not
|
|
311
|
+
// Do not retry if the response is between 400-500 (except 408: request timeout)
|
|
312
312
|
if (errorData.status >= types_1.HTTP_STATUS_CODE.BAD_REQUEST &&
|
|
313
313
|
errorData.status < types_1.HTTP_STATUS_CODE.INTERNAL_SERVER_ERROR &&
|
|
314
314
|
errorData.status !== types_1.HTTP_STATUS_CODE.REQUEST_TIMEOUT) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "studiokit-scaffolding-js",
|
|
3
|
-
"version": "5.2.0-next.2.
|
|
3
|
+
"version": "5.2.0-next.2.9",
|
|
4
4
|
"description": "Common scaffolding for Studio apps at Purdue",
|
|
5
5
|
"repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
|
|
6
6
|
"license": "MIT",
|