mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-28 22:26:02 +00:00
node_modules
This commit is contained in:
parent
5e3f23f92c
commit
806116bda4
734 changed files with 224451 additions and 0 deletions
21
node_modules/@octokit/graphql/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/graphql/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
380
node_modules/@octokit/graphql/README.md
generated
vendored
Normal file
380
node_modules/@octokit/graphql/README.md
generated
vendored
Normal file
|
@ -0,0 +1,380 @@
|
|||
# graphql.js
|
||||
|
||||
> GitHub GraphQL API client for browsers and Node
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/graphql)
|
||||
[](https://travis-ci.com/octokit/graphql.js)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [Send a simple query](#send-a-simple-query)
|
||||
- [Authentication](#authentication)
|
||||
- [Variables](#variables)
|
||||
- [Pass query together with headers and variables](#pass-query-together-with-headers-and-variables)
|
||||
- [Use your own `@octokit/request` instance](#)
|
||||
- [Errors](#errors)
|
||||
- [Partial responses](#partial-responses)
|
||||
- [Writing tests](#writing-tests)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/graphql` directly from [cdn.pika.dev](https://cdn.pika.dev)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { endpoint } from "https://cdn.pika.dev/@octokit/graphql";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/graphql</code>
|
||||
|
||||
```js
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
// or: import { graphql } from "@octokit/graphql";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Send a simple query
|
||||
|
||||
```js
|
||||
const { repository } = await graphql(
|
||||
`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
headers: {
|
||||
authorization: `token secret123`
|
||||
}
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Authentication
|
||||
|
||||
The simplest way to authenticate a request is to set the `Authorization` header, e.g. to a [personal access token](https://github.com/settings/tokens/).
|
||||
|
||||
```js
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`
|
||||
}
|
||||
});
|
||||
const { repository } = await graphqlWithAuth(`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
For more complex authentication strategies such as GitHub Apps or Basic, we recommend the according authentication library exported by [`@octokit/auth`](https://github.com/octokit/auth.js).
|
||||
|
||||
```js
|
||||
const { createAppAuth } = require("@octokit/auth-app");
|
||||
const auth = createAppAuth({
|
||||
id: process.env.APP_ID,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
installationId: 123
|
||||
});
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
request: {
|
||||
hook: auth.hook
|
||||
}
|
||||
});
|
||||
|
||||
const { repository } = await graphqlWithAuth(
|
||||
`{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
);
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
⚠️ Do not use [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) in the query strings as they make your code vulnerable to query injection attacks (see [#2](https://github.com/octokit/graphql.js/issues/2)). Use variables instead:
|
||||
|
||||
```js
|
||||
const { lastIssues } = await graphql(`query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner:$owner, name:$repo) {
|
||||
issues(last:$num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`, {
|
||||
owner: 'octokit',
|
||||
repo: 'graphql.js'
|
||||
headers: {
|
||||
authorization: `token secret123`
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Pass query together with headers and variables
|
||||
|
||||
```js
|
||||
const { graphql } = require('@octokit/graphql')
|
||||
const { lastIssues } = await graphql({
|
||||
query: `query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner:$owner, name:$repo) {
|
||||
issues(last:$num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
owner: 'octokit',
|
||||
repo: 'graphql.js'
|
||||
headers: {
|
||||
authorization: `token secret123`
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Use with GitHub Enterprise
|
||||
|
||||
```js
|
||||
let { graphql } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api",
|
||||
headers: {
|
||||
authorization: `token secret123`
|
||||
}
|
||||
});
|
||||
const { repository } = await graphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
### Use custom `@octokit/request` instance
|
||||
|
||||
```js
|
||||
const { request } = require("@octokit/request");
|
||||
const { withCustomRequest } = require("@octokit/graphql");
|
||||
|
||||
let requestCounter = 0
|
||||
const myRequest = request.defaults({
|
||||
headers: {
|
||||
authentication: 'token secret123'
|
||||
},
|
||||
request: {
|
||||
hook(request, options) {
|
||||
requestCounter++
|
||||
return request(options)
|
||||
}
|
||||
}
|
||||
})
|
||||
const myGraphql = withCustomRequest(myRequest)
|
||||
await request('/')
|
||||
await myGraphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
// requestCounter is now 2
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
In case of a GraphQL error, `error.message` is set to the first error from the response’s `errors` array. All errors can be accessed at `error.errors`. `error.request` has the request options such as query, variables and headers set for easier debugging.
|
||||
|
||||
```js
|
||||
let { graphql } = require("@octokit/graphql");
|
||||
graphqlt = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`
|
||||
}
|
||||
});
|
||||
const query = `{
|
||||
viewer {
|
||||
bioHtml
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
// server responds with
|
||||
// {
|
||||
// "data": null,
|
||||
// "errors": [{
|
||||
// "message": "Field 'bioHtml' doesn't exist on type 'User'",
|
||||
// "locations": [{
|
||||
// "line": 3,
|
||||
// "column": 5
|
||||
// }]
|
||||
// }]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // Field 'bioHtml' doesn't exist on type 'User'
|
||||
}
|
||||
```
|
||||
|
||||
## Partial responses
|
||||
|
||||
A GraphQL query may respond with partial data accompanied by errors. In this case we will throw an error but the partial data will still be accessible through `error.data`
|
||||
|
||||
```js
|
||||
let { graphql } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`
|
||||
}
|
||||
});
|
||||
const query = `{
|
||||
repository(name: "probot", owner: "probot") {
|
||||
name
|
||||
ref(qualifiedName: "master") {
|
||||
target {
|
||||
... on Commit {
|
||||
history(first: 25, after: "invalid cursor") {
|
||||
nodes {
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
// server responds with
|
||||
// {
|
||||
// "data": {
|
||||
// "repository": {
|
||||
// "name": "probot",
|
||||
// "ref": null
|
||||
// }
|
||||
// },
|
||||
// "errors": [
|
||||
// {
|
||||
// "type": "INVALID_CURSOR_ARGUMENTS",
|
||||
// "path": [
|
||||
// "repository",
|
||||
// "ref",
|
||||
// "target",
|
||||
// "history"
|
||||
// ],
|
||||
// "locations": [
|
||||
// {
|
||||
// "line": 7,
|
||||
// "column": 11
|
||||
// }
|
||||
// ],
|
||||
// "message": "`invalid cursor` does not appear to be a valid cursor."
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // `invalid cursor` does not appear to be a valid cursor.
|
||||
console.log(error.data); // { repository: { name: 'probot', ref: null } }
|
||||
}
|
||||
```
|
||||
|
||||
## Writing tests
|
||||
|
||||
You can pass a replacement for [the built-in fetch implementation](https://github.com/bitinn/node-fetch) as `request.fetch` option. For example, using [fetch-mock](http://www.wheresrhys.co.uk/fetch-mock/) works great to write tests
|
||||
|
||||
```js
|
||||
const assert = require("assert");
|
||||
const fetchMock = require("fetch-mock/es5/server");
|
||||
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
|
||||
graphql("{ viewer { login } }", {
|
||||
headers: {
|
||||
authorization: "token secret123"
|
||||
},
|
||||
request: {
|
||||
fetch: fetchMock
|
||||
.sandbox()
|
||||
.post("https://api.github.com/graphql", (url, options) => {
|
||||
assert.strictEqual(options.headers.authorization, "token secret123");
|
||||
assert.strictEqual(
|
||||
options.body,
|
||||
'{"query":"{ viewer { login } }"}',
|
||||
"Sends correct query"
|
||||
);
|
||||
return { data: {} };
|
||||
})
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
85
node_modules/@octokit/graphql/dist-node/index.js
generated
vendored
Normal file
85
node_modules/@octokit/graphql/dist-node/index.js
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var request = require('@octokit/request');
|
||||
var universalUserAgent = require('universal-user-agent');
|
||||
|
||||
const VERSION = "4.3.1";
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query"];
|
||||
function graphql(request, query, options) {
|
||||
options = typeof query === "string" ? options = Object.assign({
|
||||
query
|
||||
}, options) : 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, {
|
||||
data: response.data
|
||||
});
|
||||
}
|
||||
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
||||
|
||||
function withDefaults(request$1, newDefaults) {
|
||||
const newRequest = request$1.defaults(newDefaults);
|
||||
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: request.request.endpoint
|
||||
});
|
||||
}
|
||||
|
||||
const graphql$1 = withDefaults(request.request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
||||
|
||||
exports.graphql = graphql$1;
|
||||
exports.withCustomRequest = withCustomRequest;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@octokit/graphql/dist-node/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/graphql/dist-node/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/@octokit/graphql/dist-src/error.js
generated
vendored
Normal file
14
node_modules/@octokit/graphql/dist-src/error.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
export 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);
|
||||
}
|
||||
}
|
||||
}
|
34
node_modules/@octokit/graphql/dist-src/graphql.js
generated
vendored
Normal file
34
node_modules/@octokit/graphql/dist-src/graphql.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { GraphqlError } from "./error";
|
||||
const NON_VARIABLE_OPTIONS = [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"query"
|
||||
];
|
||||
export function graphql(request, query, options) {
|
||||
options =
|
||||
typeof query === "string"
|
||||
? (options = Object.assign({ query }, options))
|
||||
: (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, {
|
||||
data: response.data
|
||||
});
|
||||
}
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
17
node_modules/@octokit/graphql/dist-src/index.js
generated
vendored
Normal file
17
node_modules/@octokit/graphql/dist-src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { request } from "@octokit/request";
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version";
|
||||
import { withDefaults } from "./with-defaults";
|
||||
export const graphql = withDefaults(request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${getUserAgent()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
export function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
0
node_modules/@octokit/graphql/dist-src/types.js
generated
vendored
Normal file
0
node_modules/@octokit/graphql/dist-src/types.js
generated
vendored
Normal file
1
node_modules/@octokit/graphql/dist-src/version.js
generated
vendored
Normal file
1
node_modules/@octokit/graphql/dist-src/version.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export const VERSION = "4.3.1";
|
12
node_modules/@octokit/graphql/dist-src/with-defaults.js
generated
vendored
Normal file
12
node_modules/@octokit/graphql/dist-src/with-defaults.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { request as Request } from "@octokit/request";
|
||||
import { graphql } from "./graphql";
|
||||
export function withDefaults(request, newDefaults) {
|
||||
const newRequest = request.defaults(newDefaults);
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: Request.endpoint
|
||||
});
|
||||
}
|
7
node_modules/@octokit/graphql/dist-types/error.d.ts
generated
vendored
Normal file
7
node_modules/@octokit/graphql/dist-types/error.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { EndpointOptions, GraphQlQueryResponse } from "./types";
|
||||
export declare class GraphqlError<T extends GraphQlQueryResponse> extends Error {
|
||||
request: EndpointOptions;
|
||||
constructor(request: EndpointOptions, response: {
|
||||
data: Required<GraphQlQueryResponse>;
|
||||
});
|
||||
}
|
3
node_modules/@octokit/graphql/dist-types/graphql.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/graphql/dist-types/graphql.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { request as Request } from "@octokit/request";
|
||||
import { RequestParameters, GraphQlQueryResponseData } from "./types";
|
||||
export declare function graphql(request: typeof Request, query: string | RequestParameters, options?: RequestParameters): Promise<GraphQlQueryResponseData>;
|
3
node_modules/@octokit/graphql/dist-types/index.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/graphql/dist-types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { request } from "@octokit/request";
|
||||
export declare const graphql: import("./types").graphql;
|
||||
export declare function withCustomRequest(customRequest: typeof request): import("./types").graphql;
|
47
node_modules/@octokit/graphql/dist-types/types.d.ts
generated
vendored
Normal file
47
node_modules/@octokit/graphql/dist-types/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
import * as OctokitTypes from "@octokit/types";
|
||||
import { graphql } from "./graphql";
|
||||
export declare type EndpointOptions = OctokitTypes.EndpointOptions;
|
||||
export declare type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export declare type Query = string;
|
||||
export interface graphql {
|
||||
/**
|
||||
* Sends a GraphQL query request based on endpoint options
|
||||
* The GraphQL query must be specified in `options`.
|
||||
*
|
||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
(options: OctokitTypes.RequestParameters): GraphQlResponse;
|
||||
/**
|
||||
* Sends a GraphQL query request based on endpoint options
|
||||
*
|
||||
* @param {string} query GraphQL query. Example: `'query { viewer { login } }'`.
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
(query: Query, parameters?: OctokitTypes.RequestParameters): GraphQlResponse;
|
||||
/**
|
||||
* Returns a new `endpoint` with updated route and parameters
|
||||
*/
|
||||
defaults: (newDefaults: OctokitTypes.RequestParameters) => graphql;
|
||||
/**
|
||||
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
|
||||
*/
|
||||
endpoint: OctokitTypes.EndpointInterface;
|
||||
}
|
||||
export declare type GraphQlResponse = ReturnType<typeof graphql>;
|
||||
export declare type GraphQlQueryResponseData = {
|
||||
[key: string]: any;
|
||||
} | null;
|
||||
export declare type GraphQlQueryResponse = {
|
||||
data: GraphQlQueryResponseData;
|
||||
errors?: [{
|
||||
message: string;
|
||||
path: [string];
|
||||
extensions: {
|
||||
[key: string]: any;
|
||||
};
|
||||
locations: [{
|
||||
line: number;
|
||||
column: number;
|
||||
}];
|
||||
}];
|
||||
};
|
1
node_modules/@octokit/graphql/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/graphql/dist-types/version.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export declare const VERSION = "4.3.1";
|
3
node_modules/@octokit/graphql/dist-types/with-defaults.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/graphql/dist-types/with-defaults.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { request as Request } from "@octokit/request";
|
||||
import { graphql as ApiInterface, RequestParameters } from "./types";
|
||||
export declare function withDefaults(request: typeof Request, newDefaults: RequestParameters): ApiInterface;
|
81
node_modules/@octokit/graphql/dist-web/index.js
generated
vendored
Normal file
81
node_modules/@octokit/graphql/dist-web/index.js
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
import { request } from '@octokit/request';
|
||||
import { getUserAgent } from 'universal-user-agent';
|
||||
|
||||
const VERSION = "4.3.1";
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const NON_VARIABLE_OPTIONS = [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"query"
|
||||
];
|
||||
function graphql(request, query, options) {
|
||||
options =
|
||||
typeof query === "string"
|
||||
? (options = Object.assign({ query }, options))
|
||||
: (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, {
|
||||
data: response.data
|
||||
});
|
||||
}
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
||||
|
||||
function withDefaults(request$1, newDefaults) {
|
||||
const newRequest = request$1.defaults(newDefaults);
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: request.endpoint
|
||||
});
|
||||
}
|
||||
|
||||
const graphql$1 = withDefaults(request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${getUserAgent()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
||||
|
||||
export { graphql$1 as graphql, withCustomRequest };
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@octokit/graphql/dist-web/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/graphql/dist-web/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/error.js","../dist-src/graphql.js","../dist-src/with-defaults.js","../dist-src/index.js"],"sourcesContent":["export const VERSION = \"4.3.1\";\n","export class GraphqlError extends Error {\n constructor(request, response) {\n const message = response.data.errors[0].message;\n super(message);\n Object.assign(this, response.data);\n this.name = \"GraphqlError\";\n this.request = request;\n // Maintains proper stack trace (only available on V8)\n /* istanbul ignore next */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n","import { GraphqlError } from \"./error\";\nconst NON_VARIABLE_OPTIONS = [\n \"method\",\n \"baseUrl\",\n \"url\",\n \"headers\",\n \"request\",\n \"query\"\n];\nexport function graphql(request, query, options) {\n options =\n typeof query === \"string\"\n ? (options = Object.assign({ query }, options))\n : (options = query);\n const requestOptions = Object.keys(options).reduce((result, key) => {\n if (NON_VARIABLE_OPTIONS.includes(key)) {\n result[key] = options[key];\n return result;\n }\n if (!result.variables) {\n result.variables = {};\n }\n result.variables[key] = options[key];\n return result;\n }, {});\n return request(requestOptions).then(response => {\n if (response.data.errors) {\n throw new GraphqlError(requestOptions, {\n data: response.data\n });\n }\n return response.data.data;\n });\n}\n","import { request as Request } from \"@octokit/request\";\nimport { graphql } from \"./graphql\";\nexport function withDefaults(request, newDefaults) {\n const newRequest = request.defaults(newDefaults);\n const newApi = (query, options) => {\n return graphql(newRequest, query, options);\n };\n return Object.assign(newApi, {\n defaults: withDefaults.bind(null, newRequest),\n endpoint: Request.endpoint\n });\n}\n","import { request } from \"@octokit/request\";\nimport { getUserAgent } from \"universal-user-agent\";\nimport { VERSION } from \"./version\";\nimport { withDefaults } from \"./with-defaults\";\nexport const graphql = withDefaults(request, {\n headers: {\n \"user-agent\": `octokit-graphql.js/${VERSION} ${getUserAgent()}`\n },\n method: \"POST\",\n url: \"/graphql\"\n});\nexport function withCustomRequest(customRequest) {\n return withDefaults(customRequest, {\n method: \"POST\",\n url: \"/graphql\"\n });\n}\n"],"names":["request","Request","graphql"],"mappings":"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"}
|
54
node_modules/@octokit/graphql/package.json
generated
vendored
Normal file
54
node_modules/@octokit/graphql/package.json
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "@octokit/graphql",
|
||||
"description": "GitHub GraphQL API client for browsers and Node",
|
||||
"version": "4.3.1",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"graphql"
|
||||
],
|
||||
"homepage": "https://github.com/octokit/graphql.js#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/octokit/graphql.js/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/octokit/graphql.js.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/request": "^5.3.0",
|
||||
"@octokit/types": "^2.0.0",
|
||||
"universal-user-agent": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pika/pack": "^0.5.0",
|
||||
"@pika/plugin-build-node": "^0.7.0",
|
||||
"@pika/plugin-build-web": "^0.7.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.7.0",
|
||||
"@types/fetch-mock": "^7.2.5",
|
||||
"@types/jest": "^24.0.13",
|
||||
"@types/node": "^12.0.2",
|
||||
"fetch-mock": "^7.3.1",
|
||||
"jest": "^24.8.0",
|
||||
"prettier": "^1.17.1",
|
||||
"semantic-release": "^15.13.3",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^24.0.2",
|
||||
"typescript": "^3.4.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"main": "dist-node/index.js",
|
||||
"deno": "dist-web/index.js"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue