@stepzen/graphiql-proxy 0.21.0-beta.1 → 0.21.0-beta.2
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 +2 -2
- package/src/server/api/details.js +2 -2
- package/src/server/api/proxy.js +14 -7
- package/src/server/index.js +39 -20
- package/src/ui/build/asset-manifest.json +3 -3
- package/src/ui/build/index.html +1 -1
- package/src/ui/build/static/js/{main.58ea6b6f.js → main.6e3668a7.js} +3 -3
- package/src/ui/build/static/js/{main.58ea6b6f.js.LICENSE.txt → main.6e3668a7.js.LICENSE.txt} +0 -0
- package/src/ui/build/static/js/{main.58ea6b6f.js.map → main.6e3668a7.js.map} +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stepzen/graphiql-proxy",
|
|
3
|
-
"version": "0.21.0-beta.
|
|
3
|
+
"version": "0.21.0-beta.2",
|
|
4
4
|
"author": "Darren Waddell <darren@stepzen.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://stepzen.com",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"sinon-chai": "3.7.0",
|
|
58
58
|
"ts-node": "^10.8.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "58b85cc37fa990639bf7170d4224cf51cc1f7ad1"
|
|
61
61
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
2
2
|
|
|
3
3
|
const details = async (req, res) => {
|
|
4
|
-
const {
|
|
4
|
+
const {zenservUrl, predicates, workspace} = req.stepzen
|
|
5
5
|
|
|
6
|
-
const endpoint =
|
|
6
|
+
const endpoint = `${zenservUrl}/${workspace.endpoint}/__graphql`
|
|
7
7
|
|
|
8
8
|
res.json({
|
|
9
9
|
endpoint,
|
package/src/server/api/proxy.js
CHANGED
|
@@ -6,22 +6,32 @@ const fetch = require('node-fetch')
|
|
|
6
6
|
const {version} = require('../../../package.json')
|
|
7
7
|
|
|
8
8
|
const proxy = async (req, res) => {
|
|
9
|
-
const {
|
|
10
|
-
|
|
9
|
+
const {
|
|
10
|
+
adminkey,
|
|
11
|
+
debugging,
|
|
12
|
+
zenservDomain,
|
|
13
|
+
zenservUrl,
|
|
14
|
+
predicates,
|
|
15
|
+
workspace,
|
|
16
|
+
} = req.stepzen
|
|
11
17
|
|
|
12
18
|
let endpoint = workspace.endpoint
|
|
13
19
|
|
|
14
|
-
let headers = {
|
|
20
|
+
let headers = {
|
|
21
|
+
host: zenservDomain,
|
|
22
|
+
}
|
|
15
23
|
|
|
16
24
|
if (predicates.available && predicates.enabled) {
|
|
17
25
|
try {
|
|
18
26
|
const others = JSON.parse(JSON.stringify(predicates.headers))
|
|
19
27
|
headers = {
|
|
28
|
+
...headers,
|
|
20
29
|
...others,
|
|
21
30
|
}
|
|
22
31
|
} catch {}
|
|
23
32
|
} else {
|
|
24
33
|
headers = {
|
|
34
|
+
...headers,
|
|
25
35
|
Authorization: `Apikey ${adminkey}`,
|
|
26
36
|
}
|
|
27
37
|
}
|
|
@@ -33,10 +43,7 @@ const proxy = async (req, res) => {
|
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
45
|
|
|
36
|
-
const url =
|
|
37
|
-
'.io',
|
|
38
|
-
'.net',
|
|
39
|
-
)}/${endpoint}/__graphql`
|
|
46
|
+
const url = `${zenservUrl}/${endpoint}/__graphql`
|
|
40
47
|
|
|
41
48
|
debug('stepzen:dashboard')(`proxy headers: ${JSON.stringify(headers)}`)
|
|
42
49
|
debug('stepzen:dashboard')(`proxy url: ${url}`)
|
package/src/server/index.js
CHANGED
|
@@ -15,24 +15,41 @@ const _predicates = require('./api/predicates')
|
|
|
15
15
|
const proxy = require('./api/proxy')
|
|
16
16
|
const samples = require('./api/samples')
|
|
17
17
|
|
|
18
|
-
module.exports = async
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
module.exports = async options => {
|
|
19
|
+
const {
|
|
20
|
+
/** @deprecated use zenservDomain and zenservUrl */
|
|
21
|
+
account,
|
|
22
|
+
adminkey,
|
|
23
|
+
apikey,
|
|
24
|
+
cli = {version: ''},
|
|
25
|
+
/** @deprecated use zenservDomain and zenservUrl */
|
|
26
|
+
domain = 'stepzen.io',
|
|
27
|
+
port = 5000,
|
|
28
|
+
predicates = {
|
|
29
|
+
available: false,
|
|
30
|
+
enabled: false,
|
|
31
|
+
onTogglePredicates: async () => {},
|
|
32
|
+
},
|
|
33
|
+
debugging = {
|
|
34
|
+
enabled: false,
|
|
35
|
+
onToggleDebugging: async () => {},
|
|
36
|
+
},
|
|
37
|
+
workspace,
|
|
38
|
+
zenservDomain,
|
|
39
|
+
zenservUrl,
|
|
40
|
+
} = options
|
|
41
|
+
|
|
42
|
+
const warnIfUsingDeprecatedOption = option => {
|
|
43
|
+
if (options[option]) {
|
|
44
|
+
debug('stepzen:dashboard')(
|
|
45
|
+
`The account ${option} is deprecated.` +
|
|
46
|
+
` Please use zenservDomain and zenservUrl instead.`,
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
warnIfUsingDeprecatedOption('account')
|
|
51
|
+
warnIfUsingDeprecatedOption('domain')
|
|
52
|
+
|
|
36
53
|
const app = express()
|
|
37
54
|
|
|
38
55
|
app.use(express.json())
|
|
@@ -41,14 +58,16 @@ module.exports = async ({
|
|
|
41
58
|
app.use(express.static(`${__dirname}/../ui/build`))
|
|
42
59
|
app.use((req, res, next) => {
|
|
43
60
|
req.stepzen = {
|
|
44
|
-
account,
|
|
45
61
|
adminkey,
|
|
46
62
|
apikey,
|
|
47
63
|
cli,
|
|
48
64
|
debugging,
|
|
49
|
-
domain,
|
|
50
65
|
predicates,
|
|
51
66
|
workspace,
|
|
67
|
+
zenservDomain:
|
|
68
|
+
zenservDomain || `${account}.${domain.replace('.io', '.net')}`,
|
|
69
|
+
zenservUrl:
|
|
70
|
+
zenservUrl || `https://${account}.${domain.replace('.io', '.net')}`,
|
|
52
71
|
}
|
|
53
72
|
next()
|
|
54
73
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/static/css/main.4fb42d49.css",
|
|
4
|
-
"main.js": "/static/js/main.
|
|
4
|
+
"main.js": "/static/js/main.6e3668a7.js",
|
|
5
5
|
"static/js/503.a3ba392a.chunk.js": "/static/js/503.a3ba392a.chunk.js",
|
|
6
6
|
"static/js/136.7849911c.chunk.js": "/static/js/136.7849911c.chunk.js",
|
|
7
7
|
"static/js/190.e088a175.chunk.js": "/static/js/190.e088a175.chunk.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"static/media/logo.svg": "/static/media/logo.2fa5e016c31f1c335b07ff477d91ee9a.svg",
|
|
28
28
|
"index.html": "/index.html",
|
|
29
29
|
"main.4fb42d49.css.map": "/static/css/main.4fb42d49.css.map",
|
|
30
|
-
"main.
|
|
30
|
+
"main.6e3668a7.js.map": "/static/js/main.6e3668a7.js.map",
|
|
31
31
|
"503.a3ba392a.chunk.js.map": "/static/js/503.a3ba392a.chunk.js.map",
|
|
32
32
|
"136.7849911c.chunk.js.map": "/static/js/136.7849911c.chunk.js.map",
|
|
33
33
|
"190.e088a175.chunk.js.map": "/static/js/190.e088a175.chunk.js.map",
|
|
@@ -53,6 +53,6 @@
|
|
|
53
53
|
},
|
|
54
54
|
"entrypoints": [
|
|
55
55
|
"static/css/main.4fb42d49.css",
|
|
56
|
-
"static/js/main.
|
|
56
|
+
"static/js/main.6e3668a7.js"
|
|
57
57
|
]
|
|
58
58
|
}
|
package/src/ui/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>StepZen</title><script defer="defer" src="/static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>StepZen</title><script defer="defer" src="/static/js/main.6e3668a7.js"></script><link href="/static/css/main.4fb42d49.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
|