Chore/fix-install-warnings (#6243)

* gql

* lock file

* upgrade jwt-auith to httplease-asap

* upgrade vite dep

* bump ts eslint parser

* match gql versions

* fix test

* fix package
This commit is contained in:
Jack Kavanagh 2023-08-10 13:37:37 +02:00 committed by GitHub
parent 1b3dab6229
commit 175921e40d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 309 additions and 1199 deletions

1355
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@
"test:bundled-inso": "npm run build --workspace=packages/insomnia-inso && npm run test:bundled-inso --workspace=packages/insomnia-inso",
"watch:app": "npm run build:main.min.js --workspace=packages/insomnia && npm run start:dev-server --workspace=packages/insomnia",
"app-build": "npm run build --workspace=packages/insomnia",
"app-package": "npm run build --workspace=packages/insomnia && npm run package --workspace=packages/insomnia",
"app-package": "npm run package --workspace=packages/insomnia",
"test:smoke:dev": "npm run test:dev --workspace=packages/insomnia-smoke-test -- --project=Smoke",
"test:smoke:build": "npm run test:build --workspace=packages/insomnia-smoke-test -- --project=Smoke",
"test:smoke:package": "npm run test:package --workspace=packages/insomnia-smoke-test -- --project=Smoke",
@ -47,11 +47,13 @@
"devDependencies": {
"@jest/globals": "^28.1.0",
"@jest/types": "^28.1.0",
"@types/chai": "^4.3.5",
"@types/eslint": "^8.4.3",
"@types/mocha": "^10.0.1",
"@types/node": "^20.3.3",
"@types/svgo": "^2.6.3",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"esbuild": "^0.16.0",
"esbuild-runner": "^2.2.2",
"eslint": "^8.44.0",
@ -59,7 +61,7 @@
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",

View File

@ -9,7 +9,6 @@
],
"exclude": [
"**/*.test.ts",
"**/@types/mocha",
"**/__mocks__/*",
"**/__snapshots__/**",
"assets",

View File

@ -28,9 +28,7 @@
"@ravanallc/grpc-server-reflection": "^0.1.6",
"@types/concurrently": "^6.0.1",
"@types/express": "^4.17.11",
"@types/express-graphql": "^0.9.0",
"@types/faker": "^5.5.5",
"@types/graphql": "^14.5.0",
"@types/oidc-provider": "^8.2.0",
"@types/uuid": "^8.3.4",
"@types/ws": "^8.5.4",
@ -40,9 +38,9 @@
"execa": "^5.0.0",
"express": "^4.17.1",
"express-basic-auth": "^1.2.0",
"express-graphql": "^0.12.0",
"graphql-http": "^1.21.0",
"faker": "^5.1.0",
"graphql": "^15.8.0",
"graphql": "^16.7.1",
"jest": "^28.1.0",
"oidc-provider": "^7.10.6",
"uuid": "^8.3.2",

View File

@ -1,33 +1,33 @@
import { buildSchema } from 'graphql';
import { GraphQLEnumType, GraphQLObjectType, GraphQLSchema, GraphQLString } from 'graphql';
// Construct a schema, using GraphQL schema language
export const schema = buildSchema(`
"""Characters who at any time bore a Ring of Power."""
enum RingBearer {
Frodo
Bilbo
Thror
Gandalf
Galadriel
WitchKing
Nazgul
Elrond
GilGalad
Cirdan
Thrain
}
type Query {
hello: String,
bearer: RingBearer!
}
`);
// The root provides a resolver function for each API endpoint
export const root = {
hello: () => {
return 'Hello world!';
},
bearer: () => {
return 'Gandalf';
},
};
export const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
hello: {
type: GraphQLString,
resolve: () => 'Hello world!',
},
bearer: {
type: new GraphQLEnumType({
name: 'RingBearer',
description: 'Characters who at any time bore a Ring of Power.',
values: {
Frodo: { value: 0 },
Bilbo: { value: 1 },
Thror: { value: 2 },
Gandalf: { value: 3 },
Galadriel: { value: 4 },
WitchKing: { value: 5 },
Nazgul: { value: 6 },
Elrond: { value: 7 },
GilGalad: { value: 8 },
Cirdan: { value: 9 },
Thrain: { value: 10 },
},
}),
resolve: () => 3,
},
},
}),
});

View File

@ -1,15 +1,15 @@
import crypto from 'node:crypto';
import express from 'express';
import { graphqlHTTP } from 'express-graphql';
import { readFileSync } from 'fs';
import { createHandler } from 'graphql-http/lib/use/http';
import { createServer } from 'https';
import { join } from 'path';
import { basicAuthRouter } from './basic-auth';
import githubApi from './github-api';
import gitlabApi from './gitlab-api';
import { root, schema } from './graphql';
import { schema } from './graphql';
import { startGRPCServer } from './grpc';
import { oauthRoutes } from './oauth';
import { startWebSocketServer } from './websocket';
@ -54,11 +54,8 @@ app.get('/', (_req, res) => {
res.status(200).send();
});
app.use('/graphql', graphqlHTTP({
schema: schema,
rootValue: root,
graphiql: true,
}));
app.all('/graphql', createHandler({ schema }));
app.use(express.json()); // Used to parse JSON bodies
// SSE routes

View File

@ -20,16 +20,6 @@
"build": "tsc --build tsconfig.build.json",
"watch": "npm run build -- --watch"
},
"devDependencies": {
"@jest/globals": "^28.1.0",
"@types/chai": "^4.2.15",
"@types/mocha": "^10.0.1",
"typescript": "^5.1.6"
},
"dependencies": {
"chai": "^4.3.4",
"mocha": "^10.2.0"
},
"homepage": "https://github.com/Kong/insomnia#readme",
"description": ""
}

View File

@ -22,7 +22,7 @@
"build:main.min.js": "cross-env NODE_ENV=development esr esbuild.main.ts",
"build:sr": "esr esbuild.sr.ts && tsc --build tsconfig.build.sr.json",
"lint": "eslint . --ext .js,.ts,.tsx --cache",
"package": "cross-env USE_HARD_LINKS=false electron-builder build --config electron-builder.config.js",
"package": "npm run build:app && cross-env USE_HARD_LINKS=false electron-builder build --config electron-builder.config.js",
"start": "concurrently -n dev,app --kill-others \"npm run start:dev-server\" \"npm run start:electron\"",
"start:dev-server": "vite dev",
"start:electron": "cross-env NODE_ENV=development esr esbuild.main.ts && electron .",
@ -50,6 +50,7 @@
"apiconnect-wsdl": "1.8.31",
"aws4": "^1.12.0",
"axios": "^1.4.0",
"chai": "^4.3.4",
"change-case": "^4.1.2",
"clone": "^2.1.0",
"color": "^3.1.2",
@ -69,9 +70,9 @@
"jshint": "^2.13.6",
"jsonlint-mod-fixed": "1.7.7",
"jsonpath-plus": "^6.0.1",
"jwt-authentication": "^0.4.0",
"marked": "^5.1.1",
"mime-types": "^2.1.35",
"mocha": "^10.2.0",
"multiparty": "^4.2.3",
"nedb": "^1.8.0",
"node-forge": "^1.3.1",
@ -126,7 +127,7 @@
"@types/vkbeautify": "^0.99.2",
"@types/ws": "^8.5.4",
"@types/xmldom": "0.1.30",
"@vitejs/plugin-react": "^2.2.0",
"@vitejs/plugin-react": "^4.0.4",
"autoprefixer": "^10.4.2",
"buffer": "^6.0.3",
"classnames": "^2.3.1",
@ -144,8 +145,9 @@
"esbuild-plugin-alias": "0.2.1",
"esbuild-runner": "^2.2.2",
"fuzzysort": "^1.2.1",
"graphql": "^16.3.0",
"graphql": "^16.7.1",
"highlight.js": "^11.5.1",
"httplease-asap": "^0.6.0",
"jest": "^28.1.0",
"jest-environment-jsdom": "^28.0.2",
"jest-mock": "^28.0.2",

View File

@ -114,14 +114,8 @@ export async function getAuthHeader(renderedRequest: RenderedRequest, url: strin
if (authentication.type === AUTH_ASAP) {
const { issuer, subject, audience, keyId, additionalClaims, privateKey } = authentication;
const generator = (await import('jwt-authentication')).client.create();
let claims = {
iss: issuer,
sub: subject,
aud: audience,
};
let parsedAdditionalClaims;
let parsedAdditionalClaims;
try {
parsedAdditionalClaims = JSON.parse(additionalClaims || '{}');
} catch (err) {
@ -134,26 +128,21 @@ export async function getAuthHeader(renderedRequest: RenderedRequest, url: strin
`additional-claims must be an object received: '${typeof parsedAdditionalClaims}' instead`,
);
}
claims = Object.assign(parsedAdditionalClaims, claims);
}
const options = {
const generator = (await import('httplease-asap')).createAuthHeaderGenerator({
privateKey,
kid: keyId,
};
return new Promise<Header>((resolve, reject) => {
generator.generateAuthorizationHeader(claims, options, (error, headerValue) => {
if (error) {
reject(error);
} else {
resolve({
name: 'Authorization',
value: headerValue,
});
}
});
issuer,
keyId,
audience,
subject,
additionalClaims: parsedAdditionalClaims,
tokenExpiryMs: 10 * 60 * 1000, // Optional, max is 1 hour. This is how long the generated token stays valid.
tokenMaxAgeMs: 9 * 60 * 1000, // Optional, must be less than tokenExpiryMs. How long to cache the token.
});
return {
name: 'Authorization',
value: generator(),
};
}
return;

View File

@ -19,7 +19,6 @@
"exclude": [
"**/*.test.ts",
"**/*.test.tsx",
"**/@types/mocha",
"**/__jest__",
"**/__mocks__",
"**/__snapshots__",

View File

@ -17,7 +17,6 @@
"vite-plugin-electron-node-require"
],
"exclude": [
"**/@types/mocha",
"bin",
"build",
"config",

View File

@ -46,13 +46,11 @@ export default defineConfig(({ mode }) => {
modules: [
'electron',
...Object.keys(pkg.dependencies),
...Object.keys(testingPkgs.dependencies),
...builtinModules.filter(m => m !== 'buffer'),
...builtinModules.map(m => `node:${m}`),
],
}),
react({
fastRefresh: __DEV__,
jsxRuntime: 'automatic',
babel: {
plugins: [