You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/npm/ng-packs/dist/permission-management/esm2015/lib/states/permission-management.state.js

96 lines
7.1 KiB

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { State, Action, Selector } from '@ngxs/store';
import { GetPermissions, UpdatePermissions } from '../actions/permission-management.actions';
import { PermissionManagementService } from '../services/permission-management.service';
import { tap } from 'rxjs/operators';
let PermissionManagementState = class PermissionManagementState {
/**
* @param {?} permissionManagementService
*/
constructor(permissionManagementService) {
this.permissionManagementService = permissionManagementService;
}
/**
* @param {?} __0
* @return {?}
*/
static getPermissionGroups({ permissionRes }) {
return permissionRes.groups || [];
}
/**
* @param {?} __0
* @return {?}
*/
static getEntitiyDisplayName({ permissionRes }) {
return permissionRes.entityDisplayName;
}
/**
* @param {?} __0
* @param {?} __1
* @return {?}
*/
permissionManagementGet({ patchState }, { payload }) {
return this.permissionManagementService.getPermissions(payload).pipe(tap((/**
* @param {?} permissionResponse
* @return {?}
*/
permissionResponse => patchState({
permissionRes: permissionResponse,
}))));
}
/**
* @param {?} _
* @param {?} __1
* @return {?}
*/
permissionManagementUpdate(_, { payload }) {
return this.permissionManagementService.updatePermissions(payload);
}
};
PermissionManagementState.ctorParameters = () => [
{ type: PermissionManagementService }
];
tslib_1.__decorate([
Action(GetPermissions),
tslib_1.__metadata("design:type", Function),
tslib_1.__metadata("design:paramtypes", [Object, GetPermissions]),
tslib_1.__metadata("design:returntype", void 0)
], PermissionManagementState.prototype, "permissionManagementGet", null);
tslib_1.__decorate([
Action(UpdatePermissions),
tslib_1.__metadata("design:type", Function),
tslib_1.__metadata("design:paramtypes", [Object, UpdatePermissions]),
tslib_1.__metadata("design:returntype", void 0)
], PermissionManagementState.prototype, "permissionManagementUpdate", null);
tslib_1.__decorate([
Selector(),
tslib_1.__metadata("design:type", Function),
tslib_1.__metadata("design:paramtypes", [Object]),
tslib_1.__metadata("design:returntype", void 0)
], PermissionManagementState, "getPermissionGroups", null);
tslib_1.__decorate([
Selector(),
tslib_1.__metadata("design:type", Function),
tslib_1.__metadata("design:paramtypes", [Object]),
tslib_1.__metadata("design:returntype", String)
], PermissionManagementState, "getEntitiyDisplayName", null);
PermissionManagementState = tslib_1.__decorate([
State({
name: 'PermissionManagementState',
defaults: (/** @type {?} */ ({ permissionRes: {} })),
}),
tslib_1.__metadata("design:paramtypes", [PermissionManagementService])
], PermissionManagementState);
export { PermissionManagementState };
if (false) {
/**
* @type {?}
* @private
*/
PermissionManagementState.prototype.permissionManagementService;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGVybWlzc2lvbi1tYW5hZ2VtZW50LnN0YXRlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGFicC9uZy5wZXJtaXNzaW9uLW1hbmFnZW1lbnQvIiwic291cmNlcyI6WyJsaWIvc3RhdGVzL3Blcm1pc3Npb24tbWFuYWdlbWVudC5zdGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFnQixRQUFRLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDcEUsT0FBTyxFQUFFLGNBQWMsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBRTdGLE9BQU8sRUFBRSwyQkFBMkIsRUFBRSxNQUFNLDJDQUEyQyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztJQU14Qix5QkFBeUIsU0FBekIseUJBQXlCOzs7O0lBV3BDLFlBQW9CLDJCQUF3RDtRQUF4RCxnQ0FBMkIsR0FBM0IsMkJBQTJCLENBQTZCO0lBQUcsQ0FBQzs7Ozs7SUFUaEYsTUFBTSxDQUFDLG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