"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _utils = require("../utils");
var initializeDataSource = function initializeDataSource(dataSource, suffix) {
  var _dataSource$extraConf;
  var _initializeRequestExp = (0, _utils.initializeRequestExpression)(dataSource, '$dataSource', suffix),
    expression = _initializeRequestExp.expression,
    scope = _initializeRequestExp.scope;
  return expression ? {
    reactions: [expression],
    scope: scope,
    data: {
      readOnlyOnLoading: (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$extraConf = dataSource.extraConfig) === null || _dataSource$extraConf === void 0 ? void 0 : _dataSource$extraConf.readOnly) !== false
    }
  } : {
    reactions: [],
    scope: {},
    dataSource: dataSource
  };
};
var _default = initializeDataSource;
exports.default = _default;