"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.adapter = void 0;
const datasource_fetcher_1 = require("./datasource-fetcher");
const key = 'github-releases-datasource-v2';
const query = datasource_fetcher_1.GithubGraphqlDatasourceFetcher.prepareQuery(`
  releases(
    first: $count
    after: $cursor
    orderBy: {field: CREATED_AT, direction: DESC}
  ) {
    pageInfo {
      hasNextPage
      endCursor
    }
    nodes {
      version: tagName
      releaseTimestamp: publishedAt
      isDraft
      isPrerelease
      url
      id: databaseId
      name
      description
    }
  }
`);
function transform(item) {
    const { version, releaseTimestamp, isDraft, isPrerelease, url, id, name, description, } = item;
    if (isDraft) {
        return null;
    }
    const result = {
        version,
        releaseTimestamp,
        url,
        id,
        name,
        description,
    };
    if (isPrerelease) {
        result.isStable = false;
    }
    return result;
}
exports.adapter = { key, query, transform };
//# sourceMappingURL=releases-adapter.js.map