"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.doesResourceExist = doesResourceExist;
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
/**
 * Given an item ID, and a resource name, check if the resource exists
 *
 * @param id Item ID
 * @param name Resource name
 * @param ro Request options
 * @returns boolean
 */
async function doesResourceExist(id, name, ro) {
    return (0, arcgis_rest_portal_1.getItemResources)(id, ro).then((resp) => {
        // if the resource exists, return true
        const foundResource = resp.resources.find((e) => {
            return e.resource === name;
        });
        return !!foundResource;
    });
}
//# sourceMappingURL=doesResourceExist.js.map