@stepzen/graphiql-proxy 0.44.0 → 0.45.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stepzen/graphiql-proxy",
3
- "version": "0.44.0",
3
+ "version": "0.45.0-beta.0",
4
4
  "author": "Darren Waddell <darren@stepzen.com>",
5
5
  "license": "MIT",
6
6
  "homepage": "https://stepzen.com",
@@ -9,26 +9,27 @@
9
9
  "/src/ui/build"
10
10
  ],
11
11
  "engines": {
12
- "node": ">=14.0.1",
13
- "npm": ">=6.14"
12
+ "node": ">=18.0"
14
13
  },
15
- "main": "src/server",
14
+ "type": "module",
15
+ "main": "src/server/index.js",
16
16
  "scripts": {
17
17
  "dev:server": "nodemon src/dev --watch src/dev --watch src/server",
18
18
  "dev:ui": "cd src/ui && REACT_APP_IS_DEVELOPMENT=1 npm start",
19
19
  "prepare": "cd src/ui && npm install --legacy-peer-deps",
20
20
  "build": "cd src/ui && npm run build",
21
21
  "start": "concurrently \"npm run dev:server\" \"npm run dev:ui\"",
22
- "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
22
+ "test": "cross-env TS_NODE_PROJECT='test/tsconfig.json' nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
23
23
  "posttest": "prettier . --check"
24
24
  },
25
25
  "dependencies": {
26
- "@stepzen/fetch": "0.44.0",
26
+ "@stepzen/fetch": "0.45.0-beta.0",
27
27
  "chalk": "^4.1.2",
28
- "cross-spawn": "^7.0.3",
28
+ "cross-spawn": "^7.0.6",
29
29
  "debug": "^4.3.4",
30
30
  "express": "^4.21.1",
31
31
  "express-promise-router": "^4.1.1",
32
+ "helmet": "^8.0.0",
32
33
  "open": "^8.4.0",
33
34
  "prettier": "^2.8.3"
34
35
  },
@@ -39,21 +40,26 @@
39
40
  "@types/express": "^4.17.9",
40
41
  "@types/glob": "^7.2.0",
41
42
  "@types/license-checker": "^25.0.1",
42
- "@types/mocha": "^10.0.1",
43
- "@types/node": "^14.18.36",
43
+ "@types/mocha": "^10.0.9",
44
44
  "@types/sinon-chai": "3.2.8",
45
45
  "chai": "^4.3.10",
46
46
  "concurrently": "^6.0.2",
47
+ "cross-env": "^7.0.3",
47
48
  "dotenv": "^16.0.3",
48
49
  "fancy-test": "^1.4.10",
49
50
  "license-checker": "^25.0.1",
50
- "mocha": "^10.2.0",
51
+ "mocha": "^10.8.2",
51
52
  "nock": "^13.0.4",
52
53
  "nodemon": "^2.0.22",
53
54
  "nyc": "^15.1.0",
54
55
  "sinon": "13.0.1",
55
56
  "sinon-chai": "3.7.0",
56
- "ts-node": "^10.8.2"
57
+ "ts-node": "^10.9.2",
58
+ "typescript": ">=5 <5.4"
57
59
  },
58
- "gitHead": "9afcacbee765998d29795896f8969fd9e4e29926"
60
+ "overrides": {
61
+ "--comment--": "workaround for CVE-2024-21538",
62
+ "cross-spawn": "^7.0.6"
63
+ },
64
+ "gitHead": "d5bc28933e720f1d6a8ee3d5075b50156c717919"
59
65
  }
@@ -16,4 +16,4 @@ const debugging = async (req, res) => {
16
16
  res.json(debugging)
17
17
  }
18
18
 
19
- module.exports = debugging
19
+ export default debugging
@@ -12,4 +12,4 @@ const details = async (req, res) => {
12
12
  })
13
13
  }
14
14
 
15
- module.exports = details
15
+ export default details
@@ -6,4 +6,4 @@ const ping = async (req, res) => {
6
6
  })
7
7
  }
8
8
 
9
- module.exports = ping
9
+ export default ping
@@ -20,4 +20,4 @@ const predicates = async (req, res) => {
20
20
  })
21
21
  }
22
22
 
23
- module.exports = predicates
23
+ export default predicates
@@ -1,9 +1,10 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- const debug = require('debug')
4
- const fetch = require('@stepzen/fetch').default
3
+ import debug from 'debug'
4
+ import fetch from '@stepzen/fetch'
5
+ import {createRequire} from 'node:module'
5
6
 
6
- const {version} = require('../../../package.json')
7
+ const {version} = createRequire(import.meta.url)('../../../package.json')
7
8
 
8
9
  const proxy = async (req, res) => {
9
10
  const {adminkey, debugging, zenservUrl, predicates, workspace} = req.stepzen
@@ -43,4 +44,4 @@ const proxy = async (req, res) => {
43
44
  res.json(json)
44
45
  }
45
46
 
46
- module.exports = proxy
47
+ export default proxy
@@ -1,7 +1,7 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- const fs = require('fs')
4
- const prettier = require('prettier')
3
+ import fs from 'node:fs'
4
+ import prettier from 'prettier'
5
5
 
6
6
  const samples = async (req, res) => {
7
7
  const {workspace} = req.stepzen
@@ -23,4 +23,4 @@ const samples = async (req, res) => {
23
23
  })
24
24
  }
25
25
 
26
- module.exports = samples
26
+ export default samples
@@ -1,20 +1,25 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- const debug = require('debug')
4
- const express = require('express')
5
- const fs = require('fs')
6
- const router = require('express-promise-router')()
7
-
8
- const openBrowser = require('./utils/open-browser')
9
-
10
- const _debugging = require('./api/debugging')
11
- const details = require('./api/details')
12
- const ping = require('./api/ping')
13
- const _predicates = require('./api/predicates')
14
- const proxy = require('./api/proxy')
15
- const samples = require('./api/samples')
16
-
17
- module.exports = async options => {
3
+ import debug from 'debug'
4
+ import express from 'express'
5
+ import fs from 'node:fs'
6
+ import PromiseRouter from 'express-promise-router'
7
+ import path from 'node:path'
8
+ import {fileURLToPath} from 'node:url'
9
+
10
+ import openBrowser from './utils/open-browser.js'
11
+
12
+ import _debugging from './api/debugging.js'
13
+ import details from './api/details.js'
14
+ import ping from './api/ping.js'
15
+ import _predicates from './api/predicates.js'
16
+ import proxy from './api/proxy.js'
17
+ import samples from './api/samples.js'
18
+ import helmet from 'helmet'
19
+
20
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
21
+
22
+ export default async function (options) {
18
23
  const {
19
24
  /** @deprecated use zenservUrl */
20
25
  account,
@@ -52,6 +57,8 @@ module.exports = async options => {
52
57
 
53
58
  app.use(express.json())
54
59
 
60
+ app.use(helmet.frameguard())
61
+
55
62
  app.use(express.static(`${__dirname}/../ui/build`))
56
63
  app.use((req, res, next) => {
57
64
  req.stepzen = {
@@ -67,6 +74,8 @@ module.exports = async options => {
67
74
  next()
68
75
  })
69
76
 
77
+ const router = PromiseRouter()
78
+
70
79
  router.all('/api/predicates', _predicates)
71
80
  router.all('/api/debugging', _debugging)
72
81
  router.get('/api/details', details)
@@ -1,10 +1,10 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
  // Original code from https://github.com/facebook/create-react-app/blob/0f6fc2bc71d78f0dcae67f3f08ce98a42fc0a57c/packages/react-dev-utils/openChrome.applescript
3
3
 
4
- const chalk = require('chalk')
5
- const {execSync} = require('child_process')
6
- const open = require('open')
7
- const spawn = require('cross-spawn')
4
+ import chalk from 'chalk'
5
+ import {execSync} from 'node:child_process'
6
+ import open from 'open'
7
+ import spawn from 'cross-spawn'
8
8
 
9
9
  // https://github.com/sindresorhus/open#app
10
10
  const OSX_CHROME = 'google chrome'
@@ -141,4 +141,4 @@ function openBrowser(url) {
141
141
  }
142
142
  }
143
143
 
144
- module.exports = openBrowser
144
+ export default openBrowser