"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.componentOverviewFields = exports.componentIdFields = exports.componentFieldsWithLogs = exports.componentFields = exports.SUB_SUBSCRIPTION_ADDED = exports.SUB_COMPONENT_REMOVED = exports.SUB_COMPONENT_CHANGED = exports.GET_COMPONENT_WITH_LOGS = exports.GET_COMPONENT = exports.COMPONENT_QUERY_LOG_FIELDS = void 0;
function _client() {
  const data = require("@apollo/client");
  _client = function () {
    return data;
  };
  return data;
}
const componentIdFields = exports.componentIdFields = (0, _client().gql)`
  fragment componentIdFields on ComponentID {
    name
    version
    scope
  }
`;
const componentOverviewFields = exports.componentOverviewFields = (0, _client().gql)`
  fragment componentOverviewFields on Component {
    id {
      ...componentIdFields
    }
    aspects(include: ["teambit.preview/preview", "teambit.envs/envs"]) {
      # 'id' property in gql refers to a *global* identifier and used for caching.
      # this makes aspect data cache under the same key, even when they are under different components.
      # renaming the property fixes that.
      id
      data
    }
    description
    deprecation {
      isDeprecate
      newId
    }
    labels
    displayName
    server {
      env
      url
      host
      basePath
    }
    buildStatus
    env {
      id
      icon
    }
    size {
      compressedTotal
    }
    preview {
      includesEnvTemplate
      legacyHeader
      isScaling
      skipIncludes
      onlyOverview
      useNameParam
    }
    compositions {
      identifier
      displayName
      filepath
    }
  }
  ${componentIdFields}
`;
const componentFields = exports.componentFields = (0, _client().gql)`
  fragment componentFields on Component {
    ...componentOverviewFields
    packageName
    latest
    compositions {
      identifier
      displayName
    }
    tags {
      version
    }
  }
  ${componentOverviewFields}
`;
const componentFieldsWithLogs = exports.componentFieldsWithLogs = (0, _client().gql)`
  fragment componentFieldWithLogs on Component {
    id {
      ...componentIdFields
    }
    packageName
    latest
    logs(
      type: $logType
      offset: $logOffset
      limit: $logLimit
      sort: $logSort
      head: $logHead
      takeHeadFromComponent: $logTakeHeadFromComponent
    ) {
      id
      message
      username
      email
      date
      hash
      tag
      displayName
    }
  }
  ${componentIdFields}
`;
const COMPONENT_QUERY_LOG_FIELDS = exports.COMPONENT_QUERY_LOG_FIELDS = `
  $logOffset: Int
  $logLimit: Int
  $logType: String
  $logHead: String
  $logSort: String
  $logTakeHeadFromComponent: Boolean
`;
const GET_COMPONENT = exports.GET_COMPONENT = (0, _client().gql)`
  query Component($extensionId: String!, $id: String!) {
    getHost(id: $extensionId) {
      id # used for GQL caching
      get(id: $id) {
        ...componentFields
      }
    }
  }
  ${componentFields}
`;
const GET_COMPONENT_WITH_LOGS = exports.GET_COMPONENT_WITH_LOGS = (0, _client().gql)`
  query Component(
    $extensionId: String!
    $id: String!
    ${COMPONENT_QUERY_LOG_FIELDS}
    ) {
    getHost(id: $extensionId) {
      id # used for GQL caching
      get(id: $id) {
        ...componentFieldWithLogs
      }
    }
  }
  ${componentFieldsWithLogs}
`;
const SUB_SUBSCRIPTION_ADDED = exports.SUB_SUBSCRIPTION_ADDED = (0, _client().gql)`
  subscription OnComponentAdded {
    componentAdded {
      component {
        ...componentFields
      }
    }
  }
  ${componentFields}
`;
const SUB_COMPONENT_CHANGED = exports.SUB_COMPONENT_CHANGED = (0, _client().gql)`
  subscription OnComponentChanged {
    componentChanged {
      component {
        ...componentFields
      }
    }
  }
  ${componentFields}
`;
const SUB_COMPONENT_REMOVED = exports.SUB_COMPONENT_REMOVED = (0, _client().gql)`
  subscription OnComponentRemoved {
    componentRemoved {
      componentIds {
        ...componentIdFields
      }
    }
  }
  ${componentIdFields}
`;

//# sourceMappingURL=use-component.fragments.js.map