HEX
Server: Apache
System: Linux webm006.cluster111.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: perditaeyz (838589)
PHP: 7.3.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/perditaeyz/www/wp-content/plugins/better-wp-security/core/packages/data/src/resolvers.js
/**
 * External dependencies
 */
import { get } from 'lodash';

/**
 * Internal dependencies
 */
import { apiFetch, select } from './controls';
import { receiveActors, receiveActorTypes, receiveIndex, receiveUser } from './actions';

export function* getIndex() {
	const index = yield apiFetch( { path: '/ithemes-security/v1?context=help' } );
	yield receiveIndex( index );
}

export const getUser = {
	* fulfill( userId ) {
		const user = yield apiFetch( {
			path: `/wp/v2/users/${ userId }`,
		} );

		yield receiveUser( user );
	},
	isFulfilled( state, userId ) {
		return !! state.users.byId[ userId ];
	},
};

export const getActorTypes = {
	* fulfill() {
		const response = yield apiFetch( {
			path: '/ithemes-security/v1/actors?_embed=1',
		} );

		const types = [];

		for ( const type of response ) {
			const actors = get( type, [ '_embedded', 'wp:items', 0 ], [] );

			yield receiveActors( type.slug, actors );
			types.push( { slug: type.slug, label: type.label } );
		}

		yield receiveActorTypes( types );
	},

	isFulfilled( state ) {
		return state.actors.types.length > 0;
	},
};

export const getActors = {
	*fulfill() {
		yield select( 'ithemes-security/core', 'getActorTypes' );
	},
	isFulfilled( state, type ) {
		return !! state.actors.byType[ type ];
	},
};