"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchModelFromItem = fetchModelFromItem;
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
const shouldFetchData_1 = require("../content/_internal/shouldFetchData");
/**
 * Given an Item, fetch the data json and return an IModel
 * @param item
 * @param requestOptions
 * @returns
 */
async function fetchModelFromItem(item, requestOptions) {
    const data = (0, shouldFetchData_1.shouldFetchData)(item)
        ? (await (0, arcgis_rest_portal_1.getItemData)(item.id, requestOptions).catch(() => null))
        : null;
    return {
        item,
        data,
    };
}
//# sourceMappingURL=fetchModelFromItem.js.map