{
  "version": 3,
  "sources": ["../dist-src/index.js", "../dist-src/error-request.js", "../dist-src/wrap-request.js"],
  "sourcesContent": ["import { Octokit } from \"@octokit/core\";\nimport { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nconst VERSION = \"6.0.1\";\nfunction retry(octokit, octokitOptions) {\n  const state = Object.assign(\n    {\n      enabled: true,\n      retryAfterBaseValue: 1e3,\n      doNotRetry: [400, 401, 403, 404, 422, 451],\n      retries: 3\n    },\n    octokitOptions.retry\n  );\n  if (state.enabled) {\n    octokit.hook.error(\"request\", errorRequest.bind(null, state, octokit));\n    octokit.hook.wrap(\"request\", wrapRequest.bind(null, state, octokit));\n  }\n  return {\n    retry: {\n      retryRequest: (error, retries, retryAfter) => {\n        error.request.request = Object.assign({}, error.request.request, {\n          retries,\n          retryAfter\n        });\n        return error;\n      }\n    }\n  };\n}\nretry.VERSION = VERSION;\nexport {\n  VERSION,\n  retry\n};\n", "async function errorRequest(state, octokit, error, options) {\n  if (!error.request || !error.request.request) {\n    throw error;\n  }\n  if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n    const retries = options.request.retries != null ? options.request.retries : state.retries;\n    const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n    throw octokit.retry.retryRequest(error, retries, retryAfter);\n  }\n  throw error;\n}\nexport {\n  errorRequest\n};\n", "import Bottleneck from \"bottleneck/light\";\nimport { RequestError } from \"@octokit/request-error\";\nimport { errorRequest } from \"./error-request\";\nasync function wrapRequest(state, octokit, request, options) {\n  const limiter = new Bottleneck();\n  limiter.on(\"failed\", function(error, info) {\n    const maxRetries = ~~error.request.request.retries;\n    const after = ~~error.request.request.retryAfter;\n    options.request.retryCount = info.retryCount + 1;\n    if (maxRetries > info.retryCount) {\n      return after * state.retryAfterBaseValue;\n    }\n  });\n  return limiter.schedule(\n    requestWithGraphqlErrorHandling.bind(null, state, octokit, request),\n    options\n  );\n}\nasync function requestWithGraphqlErrorHandling(state, octokit, request, options) {\n  const response = await request(request, options);\n  if (response.data && response.data.errors && /Something went wrong while executing your query/.test(\n    response.data.errors[0].message\n  )) {\n    const error = new RequestError(response.data.errors[0].message, 500, {\n      request: options,\n      response\n    });\n    return errorRequest(state, octokit, error, options);\n  }\n  return response;\n}\nexport {\n  wrapRequest\n};\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;;;ACAxB,eAAe,aAAa,OAAO,SAAS,OAAO,SAAS;AAC1D,MAAI,CAAC,MAAM,WAAW,CAAC,MAAM,QAAQ,SAAS;AAC5C,UAAM;AAAA,EACR;AACA,MAAI,MAAM,UAAU,OAAO,CAAC,MAAM,WAAW,SAAS,MAAM,MAAM,GAAG;AACnE,UAAM,UAAU,QAAQ,QAAQ,WAAW,OAAO,QAAQ,QAAQ,UAAU,MAAM;AAClF,UAAM,aAAa,KAAK,KAAK,QAAQ,QAAQ,cAAc,KAAK,GAAG,CAAC;AACpE,UAAM,QAAQ,MAAM,aAAa,OAAO,SAAS,UAAU;AAAA,EAC7D;AACA,QAAM;AACR;;;ACVA,mBAAuB;AACvB,2BAA6B;AAE7B,eAAe,YAAY,OAAO,SAAS,SAAS,SAAS;AAC3D,QAAM,UAAU,IAAI,aAAAA,QAAW;AAC/B,UAAQ,GAAG,UAAU,SAAS,OAAO,MAAM;AACzC,UAAM,aAAa,CAAC,CAAC,MAAM,QAAQ,QAAQ;AAC3C,UAAM,QAAQ,CAAC,CAAC,MAAM,QAAQ,QAAQ;AACtC,YAAQ,QAAQ,aAAa,KAAK,aAAa;AAC/C,QAAI,aAAa,KAAK,YAAY;AAChC,aAAO,QAAQ,MAAM;AAAA,IACvB;AAAA,EACF,CAAC;AACD,SAAO,QAAQ;AAAA,IACb,gCAAgC,KAAK,MAAM,OAAO,SAAS,OAAO;AAAA,IAClE;AAAA,EACF;AACF;AACA,eAAe,gCAAgC,OAAO,SAAS,SAAS,SAAS;AAC/E,Q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