@octokit/graphql
Advanced tools
Comparing version 4.6.0 to 4.6.1
@@ -8,3 +8,3 @@ 'use strict'; | ||
const VERSION = "4.6.0"; | ||
const VERSION = "4.6.1"; | ||
@@ -32,6 +32,14 @@ class GraphqlError extends Error { | ||
const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; | ||
const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; | ||
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; | ||
function graphql(request, query, options) { | ||
if (typeof query === "string" && options && "query" in options) { | ||
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); | ||
if (options) { | ||
if (typeof query === "string" && "query" in options) { | ||
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); | ||
} | ||
for (const key in options) { | ||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue; | ||
return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`)); | ||
} | ||
} | ||
@@ -38,0 +46,0 @@ |
@@ -11,6 +11,14 @@ import { GraphqlError } from "./error"; | ||
]; | ||
const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; | ||
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; | ||
export function graphql(request, query, options) { | ||
if (typeof query === "string" && options && "query" in options) { | ||
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); | ||
if (options) { | ||
if (typeof query === "string" && "query" in options) { | ||
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); | ||
} | ||
for (const key in options) { | ||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) | ||
continue; | ||
return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`)); | ||
} | ||
} | ||
@@ -17,0 +25,0 @@ const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query; |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "4.6.0"; | ||
export const VERSION = "4.6.1"; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "4.6.0"; | ||
export declare const VERSION = "4.6.1"; |
import { request } from '@octokit/request'; | ||
import { getUserAgent } from 'universal-user-agent'; | ||
const VERSION = "4.6.0"; | ||
const VERSION = "4.6.1"; | ||
@@ -31,6 +31,14 @@ class GraphqlError extends Error { | ||
]; | ||
const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; | ||
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; | ||
function graphql(request, query, options) { | ||
if (typeof query === "string" && options && "query" in options) { | ||
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); | ||
if (options) { | ||
if (typeof query === "string" && "query" in options) { | ||
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); | ||
} | ||
for (const key in options) { | ||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) | ||
continue; | ||
return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`)); | ||
} | ||
} | ||
@@ -37,0 +45,0 @@ const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query; |
{ | ||
"name": "@octokit/graphql", | ||
"description": "GitHub GraphQL API client for browsers and Node", | ||
"version": "4.6.0", | ||
"version": "4.6.1", | ||
"license": "MIT", | ||
@@ -18,10 +18,3 @@ "files": [ | ||
], | ||
"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" | ||
}, | ||
"repository": "github:octokit/graphql.js", | ||
"dependencies": { | ||
@@ -28,0 +21,0 @@ "@octokit/request": "^5.3.0", |
@@ -38,3 +38,3 @@ # graphql.js | ||
<script type="module"> | ||
import { endpoint } from "https://cdn.skypack.dev/@octokit/graphql"; | ||
import { graphql } from "https://cdn.skypack.dev/@octokit/graphql"; | ||
</script> | ||
@@ -41,0 +41,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40129
365
2
1
1