@fluxo-dev/api-client-base 25.2.1 → 25.2.2
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/index.cjs.js +301 -161
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/lib/auth/auth-service.d.ts +32 -1
- package/src/lib/auth/index.d.ts +1 -0
- package/src/lib/configuration/configuration.service.d.ts +4 -0
- package/src/lib/configuration/models/index.d.ts +1 -0
- package/src/lib/configuration/models/update-routes-command.d.ts +14 -0
- package/src/lib/infrastructure/base-common-service.d.ts +4 -1
- package/src/lib/interfaces/crud-service-interface.d.ts +7 -1
- package/src/lib/security/user/user.d.ts +6 -0
package/index.cjs.js
CHANGED
|
@@ -3293,6 +3293,22 @@ class AuthService {
|
|
|
3293
3293
|
console.log("🔐 AuthService: Setup completato");
|
|
3294
3294
|
});
|
|
3295
3295
|
}
|
|
3296
|
+
getProfile() {
|
|
3297
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3298
|
+
console.log("🔐 AuthService: Recupero profilo utente");
|
|
3299
|
+
try {
|
|
3300
|
+
const response = yield HttpClient.Instance().client.get('/identity/me', {
|
|
3301
|
+
withCredentials: true
|
|
3302
|
+
});
|
|
3303
|
+
const data = response;
|
|
3304
|
+
console.log("🔐 AuthService: Profilo utente recuperato con successo");
|
|
3305
|
+
return data;
|
|
3306
|
+
} catch (error) {
|
|
3307
|
+
console.error("🔐 AuthService: Errore durante il recupero del profilo utente", error);
|
|
3308
|
+
return null;
|
|
3309
|
+
}
|
|
3310
|
+
});
|
|
3311
|
+
}
|
|
3296
3312
|
tryAutoLogin() {
|
|
3297
3313
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3298
3314
|
console.log("🔐 AuthService: Tentativo di auto-login");
|
|
@@ -3353,6 +3369,14 @@ class AuthService {
|
|
|
3353
3369
|
withCredentials: true
|
|
3354
3370
|
});
|
|
3355
3371
|
const data = response;
|
|
3372
|
+
if (data.requiresTwoFactor) {
|
|
3373
|
+
console.warn("🔐 AuthService: Login richiede autenticazione a due fattori.");
|
|
3374
|
+
return {
|
|
3375
|
+
success: false,
|
|
3376
|
+
require2FA: true,
|
|
3377
|
+
userId: data.userId
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3356
3380
|
console.log("🔐 AuthService: Login riuscito, token ricevuto");
|
|
3357
3381
|
localStorage.setItem(LocalStorageConstants.accessToken, data.token);
|
|
3358
3382
|
localStorage.setItem(LocalStorageConstants.userData, JSON.stringify(data.userData));
|
|
@@ -3369,14 +3393,126 @@ class AuthService {
|
|
|
3369
3393
|
FluxoStateDispatcher.dispatchUserLogin({
|
|
3370
3394
|
data
|
|
3371
3395
|
});
|
|
3372
|
-
return
|
|
3396
|
+
return {
|
|
3397
|
+
success: true,
|
|
3398
|
+
require2FA: false,
|
|
3399
|
+
userId: data.userId
|
|
3400
|
+
};
|
|
3373
3401
|
} catch (error) {
|
|
3374
3402
|
console.error("🔐 AuthService: Errore durante il login", error);
|
|
3375
3403
|
FluxoStateDispatcher.dispatchUserLogin(null);
|
|
3404
|
+
return {
|
|
3405
|
+
success: false,
|
|
3406
|
+
require2FA: false,
|
|
3407
|
+
userId: ''
|
|
3408
|
+
};
|
|
3409
|
+
}
|
|
3410
|
+
});
|
|
3411
|
+
}
|
|
3412
|
+
verify2FA(code, userId) {
|
|
3413
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3414
|
+
console.log("🔐 AuthService: Tentativo di verifica 2FA");
|
|
3415
|
+
try {
|
|
3416
|
+
console.log("🔐 AuthService: Invio codice 2FA per verifica");
|
|
3417
|
+
const response = yield HttpClient.Instance().client.post('/identity/verify-2fa', {
|
|
3418
|
+
code,
|
|
3419
|
+
userId
|
|
3420
|
+
}, {
|
|
3421
|
+
withCredentials: true
|
|
3422
|
+
});
|
|
3423
|
+
const data = response;
|
|
3424
|
+
console.log("🔐 AuthService: Verifica 2FA riuscita, token ricevuto");
|
|
3425
|
+
localStorage.setItem(LocalStorageConstants.accessToken, data.token);
|
|
3426
|
+
localStorage.setItem(LocalStorageConstants.userData, JSON.stringify(data.userData));
|
|
3427
|
+
console.log("🔐 AuthService: Token e dati utente salvati in localStorage");
|
|
3428
|
+
const remainingLifetimeMs = AuthService.getJwtTokenRemainingLifetime();
|
|
3429
|
+
if (remainingLifetimeMs) {
|
|
3430
|
+
const timeoutMs = remainingLifetimeMs - REFRESH_TOKEN_SAFETY_MARGIN_MS;
|
|
3431
|
+
console.log(`🔐 AuthService: Imposto refresh token tra ${timeoutMs}ms`);
|
|
3432
|
+
TabSyncAuthManager.Instance.start(timeoutMs);
|
|
3433
|
+
} else {
|
|
3434
|
+
console.log("🔐 AuthService: Impossibile calcolare tempo rimanente per il token");
|
|
3435
|
+
}
|
|
3436
|
+
console.log("🔐 AuthService: Dispatch evento login utente dopo verifica 2FA");
|
|
3437
|
+
FluxoStateDispatcher.dispatchUserLogin({
|
|
3438
|
+
data
|
|
3439
|
+
});
|
|
3440
|
+
return true;
|
|
3441
|
+
} catch (error) {
|
|
3442
|
+
console.error("🔐 AuthService: Errore durante la verifica 2FA", error);
|
|
3443
|
+
FluxoStateDispatcher.dispatchUserLogin(null);
|
|
3376
3444
|
return false;
|
|
3377
3445
|
}
|
|
3378
3446
|
});
|
|
3379
3447
|
}
|
|
3448
|
+
enable2FA(userId) {
|
|
3449
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3450
|
+
console.log("🔐 AuthService: Tentativo di abilitazione 2FA");
|
|
3451
|
+
try {
|
|
3452
|
+
console.log("🔐 AuthService: Invio richiesta di abilitazione 2FA");
|
|
3453
|
+
const response = yield HttpClient.Instance().client.post('/identity/enable-2fa', {
|
|
3454
|
+
userId
|
|
3455
|
+
}, {
|
|
3456
|
+
withCredentials: true
|
|
3457
|
+
});
|
|
3458
|
+
const data = response;
|
|
3459
|
+
console.log("🔐 AuthService: 2FA abilitata con successo, QR code e chiave condivisa ricevuti");
|
|
3460
|
+
return data;
|
|
3461
|
+
} catch (error) {
|
|
3462
|
+
console.error("🔐 AuthService: Errore durante l'abilitazione 2FA", error);
|
|
3463
|
+
return null;
|
|
3464
|
+
}
|
|
3465
|
+
});
|
|
3466
|
+
}
|
|
3467
|
+
confirmEnable2FA(code, userId) {
|
|
3468
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3469
|
+
console.log("🔐 AuthService: Tentativo di conferma abilitazione 2FA");
|
|
3470
|
+
try {
|
|
3471
|
+
console.log("🔐 AuthService: Invio codice 2FA per conferma abilitazione");
|
|
3472
|
+
const response = yield HttpClient.Instance().client.post('/identity/confirm-2fa', {
|
|
3473
|
+
code,
|
|
3474
|
+
userId
|
|
3475
|
+
}, {
|
|
3476
|
+
withCredentials: true
|
|
3477
|
+
});
|
|
3478
|
+
const data = response;
|
|
3479
|
+
console.log("🔐 AuthService: Abilitazione 2FA confermata con successo, codici di recupero ricevuti");
|
|
3480
|
+
return data;
|
|
3481
|
+
} catch (error) {
|
|
3482
|
+
console.error("🔐 AuthService: Errore durante la conferma abilitazione 2FA", error);
|
|
3483
|
+
throw error;
|
|
3484
|
+
}
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
disable2FA(userId) {
|
|
3488
|
+
console.log("🔐 AuthService: Tentativo di disabilitazione 2FA");
|
|
3489
|
+
return HttpClient.Instance().client.post('/identity/disable-2fa', {
|
|
3490
|
+
userId
|
|
3491
|
+
}, {
|
|
3492
|
+
withCredentials: true
|
|
3493
|
+
}).then(() => {
|
|
3494
|
+
console.log("🔐 AuthService: 2FA disabilitata con successo");
|
|
3495
|
+
return true;
|
|
3496
|
+
}).catch(error => {
|
|
3497
|
+
console.error("🔐 AuthService: Errore durante la disabilitazione 2FA", error);
|
|
3498
|
+
return false;
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
updateSecurityPolicyInfo(userId, info) {
|
|
3502
|
+
console.log("🔐 AuthService: Aggiornamento informazioni policy di sicurezza");
|
|
3503
|
+
return HttpClient.Instance().client.post('/identity/securitypolicy', {
|
|
3504
|
+
userId,
|
|
3505
|
+
canChangePassword: info.canChangePassword,
|
|
3506
|
+
canHandle2FA: info.canHandle2FA
|
|
3507
|
+
}, {
|
|
3508
|
+
withCredentials: true
|
|
3509
|
+
}).then(() => {
|
|
3510
|
+
console.log("🔐 AuthService: Informazioni policy di sicurezza aggiornate con successo");
|
|
3511
|
+
}).catch(error => {
|
|
3512
|
+
console.error("🔐 AuthService: Errore durante l'aggiornamento delle informazioni della policy di sicurezza", error);
|
|
3513
|
+
throw error;
|
|
3514
|
+
});
|
|
3515
|
+
}
|
|
3380
3516
|
logout() {
|
|
3381
3517
|
console.log("🔐 AuthService: Esecuzione logout");
|
|
3382
3518
|
TabSyncAuthManager.Instance.stop();
|
|
@@ -3857,6 +3993,141 @@ $$8({ target: 'Iterator', proto: true, real: true }, {
|
|
|
3857
3993
|
}
|
|
3858
3994
|
});
|
|
3859
3995
|
|
|
3996
|
+
var defineBuiltIn = defineBuiltIn$6;
|
|
3997
|
+
|
|
3998
|
+
var defineBuiltIns$1 = function (target, src, options) {
|
|
3999
|
+
for (var key in src) defineBuiltIn(target, key, src[key], options);
|
|
4000
|
+
return target;
|
|
4001
|
+
};
|
|
4002
|
+
|
|
4003
|
+
// `CreateIterResultObject` abstract operation
|
|
4004
|
+
// https://tc39.es/ecma262/#sec-createiterresultobject
|
|
4005
|
+
var createIterResultObject$1 = function (value, done) {
|
|
4006
|
+
return { value: value, done: done };
|
|
4007
|
+
};
|
|
4008
|
+
|
|
4009
|
+
var call$2 = functionCall;
|
|
4010
|
+
var create$1 = objectCreate;
|
|
4011
|
+
var createNonEnumerableProperty = createNonEnumerableProperty$6;
|
|
4012
|
+
var defineBuiltIns = defineBuiltIns$1;
|
|
4013
|
+
var wellKnownSymbol$4 = wellKnownSymbol$h;
|
|
4014
|
+
var InternalStateModule = internalState;
|
|
4015
|
+
var getMethod = getMethod$4;
|
|
4016
|
+
var IteratorPrototype = iteratorsCore.IteratorPrototype;
|
|
4017
|
+
var createIterResultObject = createIterResultObject$1;
|
|
4018
|
+
var iteratorClose$1 = iteratorClose$3;
|
|
4019
|
+
|
|
4020
|
+
var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
|
|
4021
|
+
var ITERATOR_HELPER = 'IteratorHelper';
|
|
4022
|
+
var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
|
|
4023
|
+
var setInternalState = InternalStateModule.set;
|
|
4024
|
+
|
|
4025
|
+
var createIteratorProxyPrototype = function (IS_ITERATOR) {
|
|
4026
|
+
var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
|
|
4027
|
+
|
|
4028
|
+
return defineBuiltIns(create$1(IteratorPrototype), {
|
|
4029
|
+
next: function next() {
|
|
4030
|
+
var state = getInternalState(this);
|
|
4031
|
+
// for simplification:
|
|
4032
|
+
// for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject`
|
|
4033
|
+
// for `%IteratorHelperPrototype%.next` - just a value
|
|
4034
|
+
if (IS_ITERATOR) return state.nextHandler();
|
|
4035
|
+
try {
|
|
4036
|
+
var result = state.done ? undefined : state.nextHandler();
|
|
4037
|
+
return createIterResultObject(result, state.done);
|
|
4038
|
+
} catch (error) {
|
|
4039
|
+
state.done = true;
|
|
4040
|
+
throw error;
|
|
4041
|
+
}
|
|
4042
|
+
},
|
|
4043
|
+
'return': function () {
|
|
4044
|
+
var state = getInternalState(this);
|
|
4045
|
+
var iterator = state.iterator;
|
|
4046
|
+
state.done = true;
|
|
4047
|
+
if (IS_ITERATOR) {
|
|
4048
|
+
var returnMethod = getMethod(iterator, 'return');
|
|
4049
|
+
return returnMethod ? call$2(returnMethod, iterator) : createIterResultObject(undefined, true);
|
|
4050
|
+
}
|
|
4051
|
+
if (state.inner) try {
|
|
4052
|
+
iteratorClose$1(state.inner.iterator, 'normal');
|
|
4053
|
+
} catch (error) {
|
|
4054
|
+
return iteratorClose$1(iterator, 'throw', error);
|
|
4055
|
+
}
|
|
4056
|
+
iteratorClose$1(iterator, 'normal');
|
|
4057
|
+
return createIterResultObject(undefined, true);
|
|
4058
|
+
}
|
|
4059
|
+
});
|
|
4060
|
+
};
|
|
4061
|
+
|
|
4062
|
+
var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
|
|
4063
|
+
var IteratorHelperPrototype = createIteratorProxyPrototype(false);
|
|
4064
|
+
|
|
4065
|
+
createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
|
|
4066
|
+
|
|
4067
|
+
var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
|
|
4068
|
+
var IteratorProxy = function Iterator(record, state) {
|
|
4069
|
+
if (state) {
|
|
4070
|
+
state.iterator = record.iterator;
|
|
4071
|
+
state.next = record.next;
|
|
4072
|
+
} else state = record;
|
|
4073
|
+
state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
|
|
4074
|
+
state.nextHandler = nextHandler;
|
|
4075
|
+
state.counter = 0;
|
|
4076
|
+
state.done = false;
|
|
4077
|
+
setInternalState(this, state);
|
|
4078
|
+
};
|
|
4079
|
+
|
|
4080
|
+
IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
|
|
4081
|
+
|
|
4082
|
+
return IteratorProxy;
|
|
4083
|
+
};
|
|
4084
|
+
|
|
4085
|
+
var anObject$4 = anObject$i;
|
|
4086
|
+
var iteratorClose = iteratorClose$3;
|
|
4087
|
+
|
|
4088
|
+
// call something on iterator step with safe closing on error
|
|
4089
|
+
var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
|
|
4090
|
+
try {
|
|
4091
|
+
return ENTRIES ? fn(anObject$4(value)[0], value[1]) : fn(value);
|
|
4092
|
+
} catch (error) {
|
|
4093
|
+
iteratorClose(iterator, 'throw', error);
|
|
4094
|
+
}
|
|
4095
|
+
};
|
|
4096
|
+
|
|
4097
|
+
var call$1 = functionCall;
|
|
4098
|
+
var aCallable$3 = aCallable$d;
|
|
4099
|
+
var anObject$3 = anObject$i;
|
|
4100
|
+
var getIteratorDirect$3 = getIteratorDirect$5;
|
|
4101
|
+
var createIteratorProxy$1 = iteratorCreateProxy;
|
|
4102
|
+
var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
|
|
4103
|
+
|
|
4104
|
+
var IteratorProxy$1 = createIteratorProxy$1(function () {
|
|
4105
|
+
var iterator = this.iterator;
|
|
4106
|
+
var result = anObject$3(call$1(this.next, iterator));
|
|
4107
|
+
var done = this.done = !!result.done;
|
|
4108
|
+
if (!done) return callWithSafeIterationClosing$1(iterator, this.mapper, [result.value, this.counter++], true);
|
|
4109
|
+
});
|
|
4110
|
+
|
|
4111
|
+
// `Iterator.prototype.map` method
|
|
4112
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
4113
|
+
var iteratorMap = function map(mapper) {
|
|
4114
|
+
anObject$3(this);
|
|
4115
|
+
aCallable$3(mapper);
|
|
4116
|
+
return new IteratorProxy$1(getIteratorDirect$3(this), {
|
|
4117
|
+
mapper: mapper
|
|
4118
|
+
});
|
|
4119
|
+
};
|
|
4120
|
+
|
|
4121
|
+
var $$7 = _export;
|
|
4122
|
+
var map = iteratorMap;
|
|
4123
|
+
var IS_PURE$1 = isPure;
|
|
4124
|
+
|
|
4125
|
+
// `Iterator.prototype.map` method
|
|
4126
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
4127
|
+
$$7({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
|
|
4128
|
+
map: map
|
|
4129
|
+
});
|
|
4130
|
+
|
|
3860
4131
|
class BaseCommonService {
|
|
3861
4132
|
get baseApiPath() {
|
|
3862
4133
|
return this._baseApiPath;
|
|
@@ -3864,13 +4135,17 @@ class BaseCommonService {
|
|
|
3864
4135
|
constructor(baseApiPath) {
|
|
3865
4136
|
this._baseApiPath = baseApiPath;
|
|
3866
4137
|
}
|
|
3867
|
-
find(take, skip, filters, include, namedFilters,
|
|
3868
|
-
let url = `/${this._baseApiPath}?take=${take}&skip=${skip}${filters ? `&filter=${encodeURIComponent(filters)}` : ''}${include ? `&includes=${encodeURIComponent(include)}` : ''}
|
|
4138
|
+
find(take, skip, filters, include, namedFilters, sort) {
|
|
4139
|
+
let url = `/${this._baseApiPath}?take=${take}&skip=${skip}${filters ? `&filter=${encodeURIComponent(filters)}` : ''}${include ? `&includes=${encodeURIComponent(include)}` : ''}`;
|
|
3869
4140
|
if (namedFilters) {
|
|
3870
4141
|
namedFilters.forEach(filter => {
|
|
3871
4142
|
url += `&${filter.key}=${filter.value}`;
|
|
3872
4143
|
});
|
|
3873
4144
|
}
|
|
4145
|
+
if (sort && sort.length > 0) {
|
|
4146
|
+
const orderBy = sort.map(s => `${s.selector} ${s.desc ? 'desc' : 'asc'}`).join(',');
|
|
4147
|
+
url += `&orderBy=${encodeURIComponent(orderBy)}`;
|
|
4148
|
+
}
|
|
3874
4149
|
return HttpClient.Instance().client.get(url);
|
|
3875
4150
|
}
|
|
3876
4151
|
create(entity) {
|
|
@@ -4128,9 +4403,9 @@ var flattenIntoArray_1 = flattenIntoArray$1;
|
|
|
4128
4403
|
var isArray = isArray$4;
|
|
4129
4404
|
var isConstructor = isConstructor$2;
|
|
4130
4405
|
var isObject$1 = isObject$e;
|
|
4131
|
-
var wellKnownSymbol$
|
|
4406
|
+
var wellKnownSymbol$3 = wellKnownSymbol$h;
|
|
4132
4407
|
|
|
4133
|
-
var SPECIES = wellKnownSymbol$
|
|
4408
|
+
var SPECIES = wellKnownSymbol$3('species');
|
|
4134
4409
|
var $Array = Array;
|
|
4135
4410
|
|
|
4136
4411
|
// a part of `ArraySpeciesCreate` abstract operation
|
|
@@ -4156,7 +4431,7 @@ var arraySpeciesCreate$1 = function (originalArray, length) {
|
|
|
4156
4431
|
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
4157
4432
|
};
|
|
4158
4433
|
|
|
4159
|
-
var $$
|
|
4434
|
+
var $$6 = _export;
|
|
4160
4435
|
var flattenIntoArray = flattenIntoArray_1;
|
|
4161
4436
|
var toObject = toObject$5;
|
|
4162
4437
|
var lengthOfArrayLike = lengthOfArrayLike$5;
|
|
@@ -4165,7 +4440,7 @@ var arraySpeciesCreate = arraySpeciesCreate$1;
|
|
|
4165
4440
|
|
|
4166
4441
|
// `Array.prototype.flat` method
|
|
4167
4442
|
// https://tc39.es/ecma262/#sec-array.prototype.flat
|
|
4168
|
-
$$
|
|
4443
|
+
$$6({ target: 'Array', proto: true }, {
|
|
4169
4444
|
flat: function flat(/* depthArg = 1 */) {
|
|
4170
4445
|
var depthArg = arguments.length ? arguments[0] : undefined;
|
|
4171
4446
|
var O = toObject(this);
|
|
@@ -4176,11 +4451,11 @@ $$7({ target: 'Array', proto: true }, {
|
|
|
4176
4451
|
}
|
|
4177
4452
|
});
|
|
4178
4453
|
|
|
4179
|
-
var wellKnownSymbol$
|
|
4180
|
-
var create
|
|
4454
|
+
var wellKnownSymbol$2 = wellKnownSymbol$h;
|
|
4455
|
+
var create = objectCreate;
|
|
4181
4456
|
var defineProperty = objectDefineProperty.f;
|
|
4182
4457
|
|
|
4183
|
-
var UNSCOPABLES = wellKnownSymbol$
|
|
4458
|
+
var UNSCOPABLES = wellKnownSymbol$2('unscopables');
|
|
4184
4459
|
var ArrayPrototype = Array.prototype;
|
|
4185
4460
|
|
|
4186
4461
|
// Array.prototype[@@unscopables]
|
|
@@ -4188,7 +4463,7 @@ var ArrayPrototype = Array.prototype;
|
|
|
4188
4463
|
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
4189
4464
|
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
4190
4465
|
configurable: true,
|
|
4191
|
-
value: create
|
|
4466
|
+
value: create(null)
|
|
4192
4467
|
});
|
|
4193
4468
|
}
|
|
4194
4469
|
|
|
@@ -4204,176 +4479,41 @@ var addToUnscopables$1 = addToUnscopables$2;
|
|
|
4204
4479
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
4205
4480
|
addToUnscopables$1('flat');
|
|
4206
4481
|
|
|
4207
|
-
var
|
|
4208
|
-
|
|
4209
|
-
var
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
// https://tc39.es/ecma262/#sec-createiterresultobject
|
|
4216
|
-
var createIterResultObject$1 = function (value, done) {
|
|
4217
|
-
return { value: value, done: done };
|
|
4218
|
-
};
|
|
4219
|
-
|
|
4220
|
-
var call$2 = functionCall;
|
|
4221
|
-
var create = objectCreate;
|
|
4222
|
-
var createNonEnumerableProperty = createNonEnumerableProperty$6;
|
|
4223
|
-
var defineBuiltIns = defineBuiltIns$1;
|
|
4224
|
-
var wellKnownSymbol$2 = wellKnownSymbol$h;
|
|
4225
|
-
var InternalStateModule = internalState;
|
|
4226
|
-
var getMethod = getMethod$4;
|
|
4227
|
-
var IteratorPrototype = iteratorsCore.IteratorPrototype;
|
|
4228
|
-
var createIterResultObject = createIterResultObject$1;
|
|
4229
|
-
var iteratorClose$1 = iteratorClose$3;
|
|
4230
|
-
|
|
4231
|
-
var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
|
|
4232
|
-
var ITERATOR_HELPER = 'IteratorHelper';
|
|
4233
|
-
var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
|
|
4234
|
-
var setInternalState = InternalStateModule.set;
|
|
4235
|
-
|
|
4236
|
-
var createIteratorProxyPrototype = function (IS_ITERATOR) {
|
|
4237
|
-
var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
|
|
4238
|
-
|
|
4239
|
-
return defineBuiltIns(create(IteratorPrototype), {
|
|
4240
|
-
next: function next() {
|
|
4241
|
-
var state = getInternalState(this);
|
|
4242
|
-
// for simplification:
|
|
4243
|
-
// for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject`
|
|
4244
|
-
// for `%IteratorHelperPrototype%.next` - just a value
|
|
4245
|
-
if (IS_ITERATOR) return state.nextHandler();
|
|
4246
|
-
try {
|
|
4247
|
-
var result = state.done ? undefined : state.nextHandler();
|
|
4248
|
-
return createIterResultObject(result, state.done);
|
|
4249
|
-
} catch (error) {
|
|
4250
|
-
state.done = true;
|
|
4251
|
-
throw error;
|
|
4252
|
-
}
|
|
4253
|
-
},
|
|
4254
|
-
'return': function () {
|
|
4255
|
-
var state = getInternalState(this);
|
|
4256
|
-
var iterator = state.iterator;
|
|
4257
|
-
state.done = true;
|
|
4258
|
-
if (IS_ITERATOR) {
|
|
4259
|
-
var returnMethod = getMethod(iterator, 'return');
|
|
4260
|
-
return returnMethod ? call$2(returnMethod, iterator) : createIterResultObject(undefined, true);
|
|
4261
|
-
}
|
|
4262
|
-
if (state.inner) try {
|
|
4263
|
-
iteratorClose$1(state.inner.iterator, 'normal');
|
|
4264
|
-
} catch (error) {
|
|
4265
|
-
return iteratorClose$1(iterator, 'throw', error);
|
|
4266
|
-
}
|
|
4267
|
-
iteratorClose$1(iterator, 'normal');
|
|
4268
|
-
return createIterResultObject(undefined, true);
|
|
4269
|
-
}
|
|
4270
|
-
});
|
|
4271
|
-
};
|
|
4272
|
-
|
|
4273
|
-
var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
|
|
4274
|
-
var IteratorHelperPrototype = createIteratorProxyPrototype(false);
|
|
4275
|
-
|
|
4276
|
-
createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
|
|
4277
|
-
|
|
4278
|
-
var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
|
|
4279
|
-
var IteratorProxy = function Iterator(record, state) {
|
|
4280
|
-
if (state) {
|
|
4281
|
-
state.iterator = record.iterator;
|
|
4282
|
-
state.next = record.next;
|
|
4283
|
-
} else state = record;
|
|
4284
|
-
state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
|
|
4285
|
-
state.nextHandler = nextHandler;
|
|
4286
|
-
state.counter = 0;
|
|
4287
|
-
state.done = false;
|
|
4288
|
-
setInternalState(this, state);
|
|
4289
|
-
};
|
|
4290
|
-
|
|
4291
|
-
IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
|
|
4292
|
-
|
|
4293
|
-
return IteratorProxy;
|
|
4294
|
-
};
|
|
4295
|
-
|
|
4296
|
-
var anObject$4 = anObject$i;
|
|
4297
|
-
var iteratorClose = iteratorClose$3;
|
|
4298
|
-
|
|
4299
|
-
// call something on iterator step with safe closing on error
|
|
4300
|
-
var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
|
|
4301
|
-
try {
|
|
4302
|
-
return ENTRIES ? fn(anObject$4(value)[0], value[1]) : fn(value);
|
|
4303
|
-
} catch (error) {
|
|
4304
|
-
iteratorClose(iterator, 'throw', error);
|
|
4305
|
-
}
|
|
4306
|
-
};
|
|
4307
|
-
|
|
4308
|
-
var $$6 = _export;
|
|
4309
|
-
var call$1 = functionCall;
|
|
4310
|
-
var aCallable$3 = aCallable$d;
|
|
4311
|
-
var anObject$3 = anObject$i;
|
|
4312
|
-
var getIteratorDirect$3 = getIteratorDirect$5;
|
|
4313
|
-
var createIteratorProxy$1 = iteratorCreateProxy;
|
|
4314
|
-
var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
|
|
4315
|
-
var IS_PURE$1 = isPure;
|
|
4482
|
+
var $$5 = _export;
|
|
4483
|
+
var call = functionCall;
|
|
4484
|
+
var aCallable$2 = aCallable$d;
|
|
4485
|
+
var anObject$2 = anObject$i;
|
|
4486
|
+
var getIteratorDirect$2 = getIteratorDirect$5;
|
|
4487
|
+
var createIteratorProxy = iteratorCreateProxy;
|
|
4488
|
+
var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
|
|
4489
|
+
var IS_PURE = isPure;
|
|
4316
4490
|
|
|
4317
|
-
var IteratorProxy
|
|
4491
|
+
var IteratorProxy = createIteratorProxy(function () {
|
|
4318
4492
|
var iterator = this.iterator;
|
|
4319
4493
|
var predicate = this.predicate;
|
|
4320
4494
|
var next = this.next;
|
|
4321
4495
|
var result, done, value;
|
|
4322
4496
|
while (true) {
|
|
4323
|
-
result = anObject$
|
|
4497
|
+
result = anObject$2(call(next, iterator));
|
|
4324
4498
|
done = this.done = !!result.done;
|
|
4325
4499
|
if (done) return;
|
|
4326
4500
|
value = result.value;
|
|
4327
|
-
if (callWithSafeIterationClosing
|
|
4501
|
+
if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value;
|
|
4328
4502
|
}
|
|
4329
4503
|
});
|
|
4330
4504
|
|
|
4331
4505
|
// `Iterator.prototype.filter` method
|
|
4332
4506
|
// https://github.com/tc39/proposal-iterator-helpers
|
|
4333
|
-
$$
|
|
4507
|
+
$$5({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
|
4334
4508
|
filter: function filter(predicate) {
|
|
4335
|
-
anObject$
|
|
4336
|
-
aCallable$
|
|
4337
|
-
return new IteratorProxy
|
|
4509
|
+
anObject$2(this);
|
|
4510
|
+
aCallable$2(predicate);
|
|
4511
|
+
return new IteratorProxy(getIteratorDirect$2(this), {
|
|
4338
4512
|
predicate: predicate
|
|
4339
4513
|
});
|
|
4340
4514
|
}
|
|
4341
4515
|
});
|
|
4342
4516
|
|
|
4343
|
-
var call = functionCall;
|
|
4344
|
-
var aCallable$2 = aCallable$d;
|
|
4345
|
-
var anObject$2 = anObject$i;
|
|
4346
|
-
var getIteratorDirect$2 = getIteratorDirect$5;
|
|
4347
|
-
var createIteratorProxy = iteratorCreateProxy;
|
|
4348
|
-
var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
|
|
4349
|
-
|
|
4350
|
-
var IteratorProxy = createIteratorProxy(function () {
|
|
4351
|
-
var iterator = this.iterator;
|
|
4352
|
-
var result = anObject$2(call(this.next, iterator));
|
|
4353
|
-
var done = this.done = !!result.done;
|
|
4354
|
-
if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
|
|
4355
|
-
});
|
|
4356
|
-
|
|
4357
|
-
// `Iterator.prototype.map` method
|
|
4358
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
4359
|
-
var iteratorMap = function map(mapper) {
|
|
4360
|
-
anObject$2(this);
|
|
4361
|
-
aCallable$2(mapper);
|
|
4362
|
-
return new IteratorProxy(getIteratorDirect$2(this), {
|
|
4363
|
-
mapper: mapper
|
|
4364
|
-
});
|
|
4365
|
-
};
|
|
4366
|
-
|
|
4367
|
-
var $$5 = _export;
|
|
4368
|
-
var map = iteratorMap;
|
|
4369
|
-
var IS_PURE = isPure;
|
|
4370
|
-
|
|
4371
|
-
// `Iterator.prototype.map` method
|
|
4372
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
4373
|
-
$$5({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
|
4374
|
-
map: map
|
|
4375
|
-
});
|
|
4376
|
-
|
|
4377
4517
|
var $$4 = _export;
|
|
4378
4518
|
var iterate$1 = iterate$5;
|
|
4379
4519
|
var aCallable$1 = aCallable$d;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxo-dev/api-client-base",
|
|
3
|
-
"version": "25.2.
|
|
3
|
+
"version": "25.2.2",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "^18.3.1",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"react-router-dom": "^6.11.2",
|
|
9
9
|
"react-redux": "^8.0.5",
|
|
10
10
|
"@reduxjs/toolkit": "^1.9.1",
|
|
11
|
-
"@fluxo-dev/state": "^25.2.
|
|
11
|
+
"@fluxo-dev/state": "^25.2.2"
|
|
12
12
|
},
|
|
13
13
|
"main": "./index.cjs.js",
|
|
14
14
|
"types": "./index.cjs.d.ts"
|
package/src/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './lib/security/user';
|
|
|
13
13
|
export * from './lib/security/apikey';
|
|
14
14
|
export * from './lib/security/domain-role';
|
|
15
15
|
export * from './lib/security/permission';
|
|
16
|
+
export * from './lib/auth';
|
|
16
17
|
export * from './lib/communication';
|
|
17
18
|
export * from './lib/korebi';
|
|
18
19
|
export * from './lib/apps';
|
|
@@ -1,9 +1,40 @@
|
|
|
1
|
+
import { SecurityPolicyInfo } from '../security/user';
|
|
2
|
+
export interface FluxoUserProfile {
|
|
3
|
+
userId: string;
|
|
4
|
+
firstname: string;
|
|
5
|
+
lastname: string;
|
|
6
|
+
username: string;
|
|
7
|
+
email: string;
|
|
8
|
+
lastLogin: string | null;
|
|
9
|
+
domainRoles: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
roles: string[];
|
|
13
|
+
twoFactorEnabled: boolean;
|
|
14
|
+
canChangePassword: boolean;
|
|
15
|
+
canHandle2FA: boolean;
|
|
16
|
+
}
|
|
1
17
|
export declare class AuthService {
|
|
2
18
|
private isRefreshingToken;
|
|
3
19
|
constructor();
|
|
4
20
|
setup(): Promise<void>;
|
|
21
|
+
getProfile(): Promise<FluxoUserProfile | null>;
|
|
5
22
|
private tryAutoLogin;
|
|
6
|
-
login(username: string, password: string): Promise<
|
|
23
|
+
login(username: string, password: string): Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
require2FA: boolean;
|
|
26
|
+
userId: string;
|
|
27
|
+
}>;
|
|
28
|
+
verify2FA(code: string, userId: string): Promise<boolean>;
|
|
29
|
+
enable2FA(userId: string): Promise<{
|
|
30
|
+
qrCodeUri: string;
|
|
31
|
+
sharedKey: string;
|
|
32
|
+
} | null>;
|
|
33
|
+
confirmEnable2FA(code: string, userId: string): Promise<{
|
|
34
|
+
recoveryCodes: string[];
|
|
35
|
+
}>;
|
|
36
|
+
disable2FA(userId: string): Promise<boolean>;
|
|
37
|
+
updateSecurityPolicyInfo(userId: string, info: SecurityPolicyInfo): Promise<void>;
|
|
7
38
|
logout(): void;
|
|
8
39
|
refreshToken(): Promise<boolean>;
|
|
9
40
|
static getJwtTokenRemainingLifetime(): number | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FluxoUserProfile } from './auth-service';
|
|
@@ -21,10 +21,14 @@ export type InitialConfiguration = {
|
|
|
21
21
|
hasDataAnalystAccess: boolean;
|
|
22
22
|
systemSettings: SystemSettings;
|
|
23
23
|
userId: string;
|
|
24
|
+
enabledRoutes: {
|
|
25
|
+
[key: string]: string[];
|
|
26
|
+
};
|
|
24
27
|
};
|
|
25
28
|
export type SystemSettings = {
|
|
26
29
|
aclMode: FluxoACLMode;
|
|
27
30
|
allowExternalUsers: boolean;
|
|
31
|
+
twoFactorEnabled: boolean;
|
|
28
32
|
};
|
|
29
33
|
export declare enum FluxoACLMode {
|
|
30
34
|
DomainRole = 1,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface UpdateRoutesCommand {
|
|
2
|
+
routes: {
|
|
3
|
+
[key: string]: UpdateRouteItem[];
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export interface UpdateRouteItem {
|
|
7
|
+
id: string;
|
|
8
|
+
description: string;
|
|
9
|
+
frontend: string;
|
|
10
|
+
isExternal: boolean;
|
|
11
|
+
moduleScope: string;
|
|
12
|
+
moduleName: string;
|
|
13
|
+
moduleDescription: string;
|
|
14
|
+
}
|
|
@@ -7,7 +7,10 @@ export declare abstract class BaseCommonService<TFind, TCreate = TFind, TCreateO
|
|
|
7
7
|
find(take: number, skip: number, filters?: string, include?: string, namedFilters?: {
|
|
8
8
|
key: string;
|
|
9
9
|
value: string;
|
|
10
|
-
}[],
|
|
10
|
+
}[], sort?: {
|
|
11
|
+
selector: string;
|
|
12
|
+
desc: boolean;
|
|
13
|
+
}[]): Promise<PaginatedResult<TFind>>;
|
|
11
14
|
create(entity: TCreate): Promise<TCreateOut>;
|
|
12
15
|
update(id: string, entity: TUpdate): Promise<TUpdateOut>;
|
|
13
16
|
delete(entityId: string): Promise<any>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { PaginatedResult } from "./rc-paginated-result";
|
|
2
2
|
export interface CrudServiceInterface<TFind, TCreate = TFind, TCreateOut = TCreate, TUpdate = TCreate, TUpdateOut = TUpdate> {
|
|
3
|
-
find(take: number, skip: number, filters?: string, include?: string
|
|
3
|
+
find(take: number, skip: number, filters?: string, include?: string, namedFilters?: {
|
|
4
|
+
key: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}[], sort?: {
|
|
7
|
+
selector: string;
|
|
8
|
+
desc: boolean;
|
|
9
|
+
}[]): Promise<PaginatedResult<TFind>>;
|
|
4
10
|
create(entity: TCreate): Promise<TCreateOut>;
|
|
5
11
|
update(id: string, entity: TUpdate): Promise<TUpdateOut>;
|
|
6
12
|
get(id: string): Promise<TFind>;
|
|
@@ -12,8 +12,14 @@ export interface User {
|
|
|
12
12
|
lockoutEnd: string | null;
|
|
13
13
|
lockoutEnabled: boolean;
|
|
14
14
|
isLockedOut: boolean;
|
|
15
|
+
twoFactorEnabled: boolean;
|
|
16
|
+
securityPolicyInfo: SecurityPolicyInfo;
|
|
15
17
|
}
|
|
16
18
|
export interface UserData {
|
|
17
19
|
FirstName: string;
|
|
18
20
|
LastName: string;
|
|
19
21
|
}
|
|
22
|
+
export interface SecurityPolicyInfo {
|
|
23
|
+
canChangePassword: boolean;
|
|
24
|
+
canHandle2FA: boolean;
|
|
25
|
+
}
|