node_modules

This commit is contained in:
softprops 2019-09-09 21:38:33 +09:00
parent 29058f2f68
commit a40b254993
445 changed files with 83959 additions and 2 deletions

16
node_modules/@octokit/graphql/lib/error.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
module.exports = class GraphqlError extends Error {
constructor (request, response) {
const message = response.data.errors[0].message
super(message)
Object.assign(this, response.data)
this.name = 'GraphqlError'
this.request = request
// Maintains proper stack trace (only available on V8)
/* istanbul ignore next */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor)
}
}
}

36
node_modules/@octokit/graphql/lib/graphql.js generated vendored Normal file
View file

@ -0,0 +1,36 @@
module.exports = graphql
const GraphqlError = require('./error')
const NON_VARIABLE_OPTIONS = ['method', 'baseUrl', 'url', 'headers', 'request', 'query']
function graphql (request, query, options) {
if (typeof query === 'string') {
options = Object.assign({ query }, options)
} else {
options = query
}
const requestOptions = Object.keys(options).reduce((result, key) => {
if (NON_VARIABLE_OPTIONS.includes(key)) {
result[key] = options[key]
return result
}
if (!result.variables) {
result.variables = {}
}
result.variables[key] = options[key]
return result
}, {})
return request(requestOptions)
.then(response => {
if (response.data.errors) {
throw new GraphqlError(requestOptions, response)
}
return response.data.data
})
}

13
node_modules/@octokit/graphql/lib/with-defaults.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
module.exports = withDefaults
const graphql = require('./graphql')
function withDefaults (request, newDefaults) {
const newRequest = request.defaults(newDefaults)
const newApi = function (query, options) {
return graphql(newRequest, query, options)
}
newApi.defaults = withDefaults.bind(null, newRequest)
return newApi
}