@backstage-community/plugin-graphiql
Advanced tools
Comparing version 0.3.8 to 0.3.9
{ | ||
"name": "@backstage-community/plugin-graphiql", | ||
"version": "0.3.8", | ||
"name": "@backstage-community/plugin-graphiql__alpha", | ||
"version": "0.3.9", | ||
"main": "../dist/alpha.esm.js", | ||
@@ -5,0 +5,0 @@ "module": "../dist/alpha.esm.js", |
# @backstage-community/plugin-graphiql | ||
## 0.3.9 | ||
### Patch Changes | ||
- 0c53302: Backstage version bump to v1.29.2 | ||
## 0.3.8 | ||
@@ -4,0 +10,0 @@ |
@@ -5,3 +5,3 @@ import React from 'react'; | ||
import { createApiFactory } from '@backstage/core-plugin-api'; | ||
import { g as graphiQLRouteRef } from './esm/route-refs-CExgS2ye.esm.js'; | ||
import { graphiQLRouteRef } from './route-refs.esm.js'; | ||
import { convertLegacyRouteRef, compatWrapper, convertLegacyRouteRefs } from '@backstage/core-compat-api'; | ||
@@ -12,3 +12,3 @@ | ||
routeRef: convertLegacyRouteRef(graphiQLRouteRef), | ||
loader: () => import('./esm/index-CJ7s9XYX.esm.js').then((m) => compatWrapper(/* @__PURE__ */ React.createElement(m.GraphiQLPage, null))) | ||
loader: () => import('./components/index.esm.js').then((m) => compatWrapper(/* @__PURE__ */ React.createElement(m.GraphiQLPage, null))) | ||
}); | ||
@@ -38,3 +38,2 @@ const graphiqlNavItem = createNavItemExtension({ | ||
function createGraphiQLEndpointExtension(options) { | ||
var _a; | ||
return createExtension({ | ||
@@ -46,3 +45,3 @@ kind: "graphiql-endpoint", | ||
configSchema: options.configSchema, | ||
disabled: (_a = options.disabled) != null ? _a : false, | ||
disabled: options.disabled ?? false, | ||
output: { | ||
@@ -49,0 +48,0 @@ endpoint: endpointDataRef |
@@ -1,148 +0,8 @@ | ||
import { createPlugin, createApiFactory, createRoutableExtension } from '@backstage/core-plugin-api'; | ||
import { g as graphQlBrowseApiRef } from './esm/GraphiQLPage-C4_-jXKh.esm.js'; | ||
export { G as Router } from './esm/GraphiQLPage-C4_-jXKh.esm.js'; | ||
import { g as graphiQLRouteRef } from './esm/route-refs-CExgS2ye.esm.js'; | ||
import React from 'react'; | ||
import SvgIcon from '@material-ui/core/SvgIcon'; | ||
import 'react-use/esm/useAsync'; | ||
import 'graphiql/graphiql.css'; | ||
import '@material-ui/core/Tabs'; | ||
import '@material-ui/core/Tab'; | ||
import '@material-ui/core/Typography'; | ||
import '@material-ui/core/Divider'; | ||
import '@material-ui/core/styles'; | ||
import '@backstage/core-components'; | ||
class GraphQLEndpoints { | ||
constructor(endpoints) { | ||
this.endpoints = endpoints; | ||
} | ||
// Create a support | ||
static create(config) { | ||
const { id, title, url, method = "POST", fetchApi } = config; | ||
return { | ||
id, | ||
title, | ||
fetcher: async (params, options = {}) => { | ||
var _a; | ||
const body = JSON.stringify(params); | ||
const headers = { | ||
"Content-Type": "application/json", | ||
...config.headers, | ||
...options.headers | ||
}; | ||
const res = await ((_a = fetchApi == null ? void 0 : fetchApi.fetch) != null ? _a : fetch)(await url, { | ||
method, | ||
headers, | ||
body | ||
}); | ||
return res.json(); | ||
} | ||
}; | ||
} | ||
/** | ||
* Creates a GitHub GraphQL endpoint that uses the GithubAuth API to authenticate requests. | ||
* | ||
* If a request requires more permissions than is granted by the existing session, | ||
* the fetcher will automatically ask for the additional scopes that are required. | ||
*/ | ||
static github(config) { | ||
const { | ||
id, | ||
title, | ||
url = "https://api.github.com/graphql", | ||
errorApi, | ||
fetchApi, | ||
githubAuthApi | ||
} = config; | ||
return { | ||
id, | ||
title, | ||
fetcher: async (params, options = {}) => { | ||
let retried = false; | ||
const doRequest = async () => { | ||
var _a; | ||
const res = await ((_a = fetchApi == null ? void 0 : fetchApi.fetch) != null ? _a : fetch)(url, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Bearer ${await githubAuthApi.getAccessToken()}`, | ||
...options.headers | ||
}, | ||
body: JSON.stringify(params) | ||
}); | ||
if (!res.ok) { | ||
throw new Error( | ||
`Request failed with status ${res.status} ${res.statusText}` | ||
); | ||
} | ||
const data = await res.json(); | ||
if (!data.errors || retried) { | ||
return data; | ||
} | ||
retried = true; | ||
const missingScopes = data.errors.filter(({ type }) => type === "INSUFFICIENT_SCOPES").flatMap(({ message }) => { | ||
const scopesMatch = message.match( | ||
/one of the following scopes: (\[.*?\])/ | ||
); | ||
if (!scopesMatch) { | ||
return []; | ||
} | ||
try { | ||
const scopes = JSON.parse(scopesMatch[1].replace(/'/g, '"')); | ||
return scopes; | ||
} catch (error) { | ||
if (errorApi) { | ||
errorApi.post( | ||
new Error( | ||
`Failed to parse scope string "${scopesMatch[1]}", ${error}` | ||
) | ||
); | ||
} | ||
return []; | ||
} | ||
}); | ||
await githubAuthApi.getAccessToken(missingScopes); | ||
return doRequest(); | ||
}; | ||
return await doRequest(); | ||
} | ||
}; | ||
} | ||
static from(endpoints) { | ||
return new GraphQLEndpoints(endpoints); | ||
} | ||
async getEndpoints() { | ||
return this.endpoints; | ||
} | ||
} | ||
const graphiqlPlugin = createPlugin({ | ||
id: "graphiql", | ||
apis: [ | ||
// GitLab is used as an example endpoint, but most will want to plug in | ||
// their own instead. | ||
createApiFactory( | ||
graphQlBrowseApiRef, | ||
GraphQLEndpoints.from([ | ||
GraphQLEndpoints.create({ | ||
id: "gitlab", | ||
title: "GitLab", | ||
url: "https://gitlab.com/api/graphql" | ||
}) | ||
]) | ||
) | ||
] | ||
}); | ||
const GraphiQLPage = graphiqlPlugin.provide( | ||
createRoutableExtension({ | ||
name: "GraphiQLPage", | ||
component: () => import('./esm/index-CJ7s9XYX.esm.js').then((m) => m.GraphiQLPage), | ||
mountPoint: graphiQLRouteRef | ||
}) | ||
); | ||
const GraphiQLIcon = () => /* @__PURE__ */ React.createElement(SvgIcon, null, /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("path", { d: "M 3.449219 18.160156 L 2.585938 17.660156 L 12.195312 1.019531 L 13.058594 1.515625 Z M 3.449219 18.160156" }), /* @__PURE__ */ React.createElement("path", { d: "M 2.386719 16.332031 L 21.605469 16.332031 L 21.605469 17.328125 L 2.386719 17.328125 Z M 2.386719 16.332031" }), /* @__PURE__ */ React.createElement("path", { d: "M 12.382812 22.441406 L 2.769531 16.890625 L 3.265625 16.027344 L 12.878906 21.578125 Z M 12.382812 22.441406" }), /* @__PURE__ */ React.createElement("path", { d: "M 20.730469 7.976562 L 11.117188 2.425781 L 11.617188 1.5625 L 21.230469 7.113281 Z M 20.730469 7.976562" }), /* @__PURE__ */ React.createElement("path", { d: "M 3.269531 7.972656 L 2.769531 7.109375 L 12.382812 1.558594 L 12.882812 2.421875 Z M 3.269531 7.972656" }), /* @__PURE__ */ React.createElement("path", { d: "M 20.554688 18.160156 L 10.945312 1.515625 L 11.808594 1.019531 L 21.417969 17.660156 Z M 20.554688 18.160156" }), /* @__PURE__ */ React.createElement("path", { d: "M 3.148438 6.449219 L 4.144531 6.449219 L 4.144531 17.550781 L 3.148438 17.550781 Z M 3.148438 6.449219" }), /* @__PURE__ */ React.createElement("path", { d: "M 19.855469 6.449219 L 20.851562 6.449219 L 20.851562 17.550781 L 19.855469 17.550781 Z M 19.855469 6.449219" }), /* @__PURE__ */ React.createElement("path", { d: "M 12.210938 22.019531 L 11.777344 21.265625 L 20.136719 16.441406 L 20.570312 17.191406 Z M 12.210938 22.019531" }), /* @__PURE__ */ React.createElement("path", { d: "M 22.171875 17.875 C 21.59375 18.875 20.308594 19.21875 19.308594 18.640625 C 18.304688 18.066406 17.964844 16.78125 18.539062 15.78125 C 19.117188 14.777344 20.398438 14.4375 21.402344 15.011719 C 22.410156 15.59375 22.753906 16.871094 22.171875 17.875" }), /* @__PURE__ */ React.createElement("path", { d: "M 5.453125 8.21875 C 4.878906 9.222656 3.59375 9.5625 2.59375 8.988281 C 1.589844 8.410156 1.246094 7.128906 1.824219 6.125 C 2.398438 5.125 3.683594 4.78125 4.6875 5.359375 C 5.6875 5.941406 6.03125 7.21875 5.453125 8.21875" }), /* @__PURE__ */ React.createElement("path", { d: "M 1.828125 17.875 C 1.253906 16.871094 1.597656 15.59375 2.597656 15.011719 C 3.601562 14.4375 4.878906 14.777344 5.460938 15.78125 C 6.035156 16.78125 5.695312 18.058594 4.691406 18.640625 C 3.683594 19.21875 2.40625 18.875 1.828125 17.875" }), /* @__PURE__ */ React.createElement("path", { d: "M 18.546875 8.21875 C 17.96875 7.21875 18.3125 5.941406 19.3125 5.359375 C 20.316406 4.78125 21.59375 5.125 22.175781 6.125 C 22.753906 7.128906 22.410156 8.40625 21.40625 8.988281 C 20.40625 9.5625 19.121094 9.222656 18.546875 8.21875" }), /* @__PURE__ */ React.createElement("path", { d: "M 12 23.746094 C 10.84375 23.746094 9.90625 22.8125 9.90625 21.652344 C 9.90625 20.496094 10.84375 19.558594 12 19.558594 C 13.15625 19.558594 14.09375 20.496094 14.09375 21.652344 C 14.09375 22.804688 13.15625 23.746094 12 23.746094" }), /* @__PURE__ */ React.createElement("path", { d: "M 12 4.441406 C 10.84375 4.441406 9.90625 3.503906 9.90625 2.347656 C 9.90625 1.1875 10.84375 0.253906 12 0.253906 C 13.15625 0.253906 14.09375 1.1875 14.09375 2.347656 C 14.09375 3.503906 13.15625 4.441406 12 4.441406" }))); | ||
export { GraphQLEndpoints, GraphiQLIcon, GraphiQLPage, graphQlBrowseApiRef, graphiQLRouteRef, graphiqlPlugin, graphiqlPlugin as plugin }; | ||
export { GraphiQLPage, graphiqlPlugin, graphiqlPlugin as plugin } from './plugin.esm.js'; | ||
export { GraphiQLIcon } from './GraphiQLIcon.esm.js'; | ||
export { GraphiQLPage as Router } from './components/GraphiQLPage/GraphiQLPage.esm.js'; | ||
import './components/GraphiQLBrowser/GraphiQLBrowser.esm.js'; | ||
export { GraphQLEndpoints } from './lib/api/GraphQLEndpoints.esm.js'; | ||
export { graphQlBrowseApiRef } from './lib/api/types.esm.js'; | ||
export { graphiQLRouteRef } from './route-refs.esm.js'; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "@backstage-community/plugin-graphiql", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"description": "Backstage plugin for browsing GraphQL APIs", | ||
"backstage": { | ||
"role": "frontend-plugin" | ||
"role": "frontend-plugin", | ||
"pluginId": "graphiql", | ||
"pluginPackages": [ | ||
"@backstage-community/plugin-graphiql" | ||
] | ||
}, | ||
@@ -51,6 +55,6 @@ "publishConfig": { | ||
"dependencies": { | ||
"@backstage/core-compat-api": "^0.2.4", | ||
"@backstage/core-components": "^0.14.4", | ||
"@backstage/core-plugin-api": "^1.9.2", | ||
"@backstage/frontend-plugin-api": "^0.6.4", | ||
"@backstage/core-compat-api": "^0.2.7", | ||
"@backstage/core-components": "^0.14.9", | ||
"@backstage/core-plugin-api": "^1.9.3", | ||
"@backstage/frontend-plugin-api": "^0.6.7", | ||
"@material-ui/core": "^4.12.2", | ||
@@ -65,5 +69,5 @@ "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0", | ||
"devDependencies": { | ||
"@backstage/cli": "^0.26.3", | ||
"@backstage/dev-utils": "^1.0.31", | ||
"@backstage/test-utils": "^1.5.4", | ||
"@backstage/cli": "^0.26.11", | ||
"@backstage/dev-utils": "^1.0.36", | ||
"@backstage/test-utils": "^1.5.9", | ||
"@testing-library/dom": "^10.0.0", | ||
@@ -70,0 +74,0 @@ "@testing-library/jest-dom": "^6.0.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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
96163
28
512
3
+ Addedzod-to-json-schema@3.23.3(transitive)
- Removedzod-to-json-schema@3.23.2(transitive)