@testsmith/api-spector 0.7.7 → 0.7.9
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/bin/cli.js +4 -0
- package/out/main/chunks/{broker-client-Df4PpJqB.js → broker-client-CJBfpvbd.js} +4 -1
- package/out/main/chunks/{flow-engine-BVzjz4lJ.js → flow-engine-BxwjEy37.js} +66 -1
- package/out/main/chunks/{handle-Bz0C56Eq.js → handle-Crv1i9hb.js} +60 -0
- package/out/main/chunks/{import-BhGBiW7j.js → import-DTcZMRNu.js} +2 -2
- package/out/main/chunks/perf-report-ChaO3K0w.js +124 -0
- package/out/main/chunks/perf-run-Co_5unBR.js +578 -0
- package/out/main/chunks/{request-collection-KGPuvN7o.js → request-collection-gkOYlWml.js} +68 -11
- package/out/main/chunks/{request-exec-B-F0K-pN.js → request-exec-CgyqbNWk.js} +445 -13
- package/out/main/chunks/run-concurrent-468tH0AX.js +26 -0
- package/out/main/chunks/{soap-handler-DqIPcIQL.js → soap-handler-Brr7BPWO.js} +2 -2
- package/out/main/contract.js +6 -3
- package/out/main/flow.js +8 -5
- package/out/main/index.js +1352 -185
- package/out/main/lib.js +6 -3
- package/out/main/perf-worker.js +45 -0
- package/out/main/perf.js +253 -0
- package/out/main/runner.js +181 -7
- package/out/main/socketio.js +172 -0
- package/out/main/wsdl.js +3 -3
- package/out/preload/index.js +127 -2
- package/out/renderer/assets/{GraphQLEditor-BXpdmpn6.js → GraphQLEditor-CXvLKrnv.js} +59 -14
- package/out/renderer/assets/{SoapEditor-De6WlP6E.js → SoapEditor-7hxhISPZ.js} +3 -3
- package/out/renderer/assets/ajv-CJPwFjiP.js +6718 -0
- package/out/renderer/assets/{codemirror-F6m3Hm1M.js → codemirror-CdIFBPs2.js} +1214 -1207
- package/out/renderer/assets/{index-Gcd_t6pX.js → index-BUFSn_qD.js} +15344 -12285
- package/out/renderer/assets/index-DkhdKzQJ.css +627 -0
- package/out/renderer/index.html +4 -4
- package/package.json +12 -6
- package/out/renderer/assets/ajv-2MAg6kGF.js +0 -6153
- package/out/renderer/assets/index-CYArpqm5.css +0 -627
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const socket_ioClient = require("socket.io-client");
|
|
4
|
+
const cliCommon = require("./chunks/cli-common-GnihVSjU.js");
|
|
5
|
+
require("node:fs/promises");
|
|
6
|
+
require("node:path");
|
|
7
|
+
require("./chunks/data-files-BYqhsoPe.js");
|
|
8
|
+
require("node:crypto");
|
|
9
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
10
|
+
function printHelp() {
|
|
11
|
+
console.log(`
|
|
12
|
+
API Spector - Socket.IO
|
|
13
|
+
|
|
14
|
+
api-spector socketio --url <url> [--namespace /ns] [--auth '{"token":"x"}']
|
|
15
|
+
[--header K:V] [--emit 'event:[args]'] [--ack]
|
|
16
|
+
[--listen <seconds>] [--json]
|
|
17
|
+
api-spector socketio --workspace <path> --request <name> [same options]
|
|
18
|
+
`);
|
|
19
|
+
}
|
|
20
|
+
function jsonText(value) {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.stringify(value);
|
|
23
|
+
} catch {
|
|
24
|
+
return String(value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function targetUrl(url, namespace) {
|
|
28
|
+
const ns = (namespace ?? "").trim();
|
|
29
|
+
if (!ns || ns === "/") return url;
|
|
30
|
+
return url.replace(/\/+$/, "") + (ns.startsWith("/") ? ns : `/${ns}`);
|
|
31
|
+
}
|
|
32
|
+
function parseEmit(spec) {
|
|
33
|
+
const i = spec.indexOf(":");
|
|
34
|
+
if (i === -1) return { event: spec, args: [] };
|
|
35
|
+
const event = spec.slice(0, i);
|
|
36
|
+
const rest = spec.slice(i + 1).trim();
|
|
37
|
+
if (!rest) return { event, args: [] };
|
|
38
|
+
let parsed;
|
|
39
|
+
try {
|
|
40
|
+
parsed = JSON.parse(rest);
|
|
41
|
+
} catch {
|
|
42
|
+
throw new Error(`--emit "${spec}": arguments after ':' must be JSON`);
|
|
43
|
+
}
|
|
44
|
+
return { event, args: Array.isArray(parsed) ? parsed : [parsed] };
|
|
45
|
+
}
|
|
46
|
+
async function sourceFromWorkspace(wsPath, name) {
|
|
47
|
+
const { workspace, dir } = await cliCommon.loadWorkspace(wsPath);
|
|
48
|
+
const collections = await cliCommon.loadCollections(workspace, dir);
|
|
49
|
+
let found;
|
|
50
|
+
for (const col of collections) {
|
|
51
|
+
for (const req of Object.values(col.requests)) {
|
|
52
|
+
if (req.name === name) {
|
|
53
|
+
found = req;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (found) break;
|
|
58
|
+
}
|
|
59
|
+
if (!found) throw new Error(`Request "${name}" not found in the workspace`);
|
|
60
|
+
const headers = {};
|
|
61
|
+
for (const h of found.headers ?? []) if (h.enabled && h.key) headers[h.key] = h.value;
|
|
62
|
+
return { url: found.url, headers, namespace: found.socketio?.namespace, auth: found.socketio?.auth };
|
|
63
|
+
}
|
|
64
|
+
async function main() {
|
|
65
|
+
const args = cliCommon.parseArgs(process.argv.slice(2), ["emit", "header"]);
|
|
66
|
+
if (args.help || args.h) {
|
|
67
|
+
printHelp();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let url = typeof args.url === "string" ? args.url : "";
|
|
71
|
+
let headers = {};
|
|
72
|
+
let namespace = typeof args.namespace === "string" ? args.namespace : void 0;
|
|
73
|
+
let auth = typeof args.auth === "string" ? args.auth : void 0;
|
|
74
|
+
if (typeof args.workspace === "string" && typeof args.request === "string") {
|
|
75
|
+
const src = await sourceFromWorkspace(args.workspace, args.request);
|
|
76
|
+
url = url || src.url;
|
|
77
|
+
headers = { ...src.headers };
|
|
78
|
+
namespace = namespace ?? src.namespace;
|
|
79
|
+
auth = auth ?? src.auth;
|
|
80
|
+
}
|
|
81
|
+
const headerList = Array.isArray(args.header) ? args.header : typeof args.header === "string" ? [args.header] : [];
|
|
82
|
+
for (const h of headerList) {
|
|
83
|
+
const idx = h.indexOf(":");
|
|
84
|
+
if (idx > 0) headers[h.slice(0, idx).trim()] = h.slice(idx + 1).trim();
|
|
85
|
+
}
|
|
86
|
+
if (!url) {
|
|
87
|
+
console.error(cliCommon.color(" [error] Provide --url, or --workspace with --request.", cliCommon.C.red));
|
|
88
|
+
printHelp();
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
let authObj;
|
|
92
|
+
if (auth && auth.trim()) {
|
|
93
|
+
try {
|
|
94
|
+
authObj = JSON.parse(auth);
|
|
95
|
+
} catch {
|
|
96
|
+
console.error(cliCommon.color(" [error] --auth is not valid JSON", cliCommon.C.red));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const emits = (Array.isArray(args.emit) ? args.emit : typeof args.emit === "string" ? [args.emit] : []).map(parseEmit);
|
|
101
|
+
const listenMs = Math.round((typeof args.listen === "string" ? Number(args.listen) : 5) * 1e3) || 5e3;
|
|
102
|
+
const asJson = Boolean(args.json);
|
|
103
|
+
const ack = Boolean(args.ack);
|
|
104
|
+
const received = [];
|
|
105
|
+
const log = (s) => {
|
|
106
|
+
if (!asJson) console.log(s);
|
|
107
|
+
};
|
|
108
|
+
if (!asJson) {
|
|
109
|
+
console.log("");
|
|
110
|
+
console.log(` ${cliCommon.color("Socket.IO", cliCommon.C.bold)} ${cliCommon.color(targetUrl(url, namespace), cliCommon.C.dim)}`);
|
|
111
|
+
}
|
|
112
|
+
const socket = socket_ioClient.io(targetUrl(url, namespace), {
|
|
113
|
+
path: typeof args.path === "string" ? args.path : "/socket.io",
|
|
114
|
+
transports: ["websocket", "polling"],
|
|
115
|
+
extraHeaders: headers,
|
|
116
|
+
auth: authObj,
|
|
117
|
+
forceNew: true,
|
|
118
|
+
reconnection: false
|
|
119
|
+
});
|
|
120
|
+
socket.onAny((event, ...a) => {
|
|
121
|
+
received.push({ at: Date.now(), event, args: a });
|
|
122
|
+
log(` ${cliCommon.color("←", cliCommon.C.green)} ${cliCommon.color(event, cliCommon.C.bold)} ${cliCommon.color(jsonText(a), cliCommon.C.dim)}`);
|
|
123
|
+
});
|
|
124
|
+
await new Promise((resolve, reject) => {
|
|
125
|
+
socket.on("connect_error", (err) => reject(err));
|
|
126
|
+
socket.on("connect", async () => {
|
|
127
|
+
log(` ${cliCommon.color("connected", cliCommon.C.green)} ${cliCommon.color(`(id ${socket.id})`, cliCommon.C.dim)}`);
|
|
128
|
+
for (const { event, args: emitArgs } of emits) {
|
|
129
|
+
if (ack) {
|
|
130
|
+
try {
|
|
131
|
+
const resp = await socket.timeout(5e3).emitWithAck(event, ...emitArgs);
|
|
132
|
+
log(` ${cliCommon.color("→", cliCommon.C.cyan)} ${cliCommon.color(event, cliCommon.C.bold)} ${cliCommon.color(jsonText(emitArgs), cliCommon.C.dim)} ${cliCommon.color("ack", cliCommon.C.green)} ${cliCommon.color(jsonText(resp), cliCommon.C.dim)}`);
|
|
133
|
+
} catch {
|
|
134
|
+
log(` ${cliCommon.color("→", cliCommon.C.cyan)} ${cliCommon.color(event, cliCommon.C.bold)} ${cliCommon.color(jsonText(emitArgs), cliCommon.C.dim)} ${cliCommon.color("(no ack)", cliCommon.C.yellow)}`);
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
socket.emit(event, ...emitArgs);
|
|
138
|
+
log(` ${cliCommon.color("→", cliCommon.C.cyan)} ${cliCommon.color(event, cliCommon.C.bold)} ${cliCommon.color(jsonText(emitArgs), cliCommon.C.dim)}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (listenMs > 0) {
|
|
142
|
+
log(cliCommon.color(` listening for ${listenMs / 1e3}s…`, cliCommon.C.dim));
|
|
143
|
+
await sleep(listenMs);
|
|
144
|
+
}
|
|
145
|
+
resolve();
|
|
146
|
+
});
|
|
147
|
+
}).catch((err) => {
|
|
148
|
+
socket.close();
|
|
149
|
+
if (asJson) console.log(JSON.stringify({ url, namespace: namespace ?? "/", connected: false, error: err.message }, null, 2));
|
|
150
|
+
else console.error(cliCommon.color(` [error] Connection failed: ${err.message}`, cliCommon.C.red));
|
|
151
|
+
process.exit(1);
|
|
152
|
+
});
|
|
153
|
+
socket.disconnect();
|
|
154
|
+
if (asJson) {
|
|
155
|
+
console.log(JSON.stringify({
|
|
156
|
+
url,
|
|
157
|
+
namespace: namespace ?? "/",
|
|
158
|
+
connected: true,
|
|
159
|
+
emitted: emits.map((e) => ({ event: e.event, args: e.args })),
|
|
160
|
+
received: received.map((r) => ({ event: r.event, args: r.args }))
|
|
161
|
+
}, null, 2));
|
|
162
|
+
} else {
|
|
163
|
+
console.log("");
|
|
164
|
+
console.log(` ${cliCommon.color(String(received.length), cliCommon.C.bold)} event(s) received, ${emits.length} emitted.`);
|
|
165
|
+
console.log("");
|
|
166
|
+
}
|
|
167
|
+
process.exit(0);
|
|
168
|
+
}
|
|
169
|
+
main().catch((err) => {
|
|
170
|
+
console.error(cliCommon.color(` [error] ${err instanceof Error ? err.message : String(err)}`, cliCommon.C.red));
|
|
171
|
+
process.exit(1);
|
|
172
|
+
});
|
package/out/main/wsdl.js
CHANGED
|
@@ -4,10 +4,10 @@ const promises = require("node:fs/promises");
|
|
|
4
4
|
const path = require("node:path");
|
|
5
5
|
const https = require("node:https");
|
|
6
6
|
const http = require("node:http");
|
|
7
|
-
const soapHandler = require("./chunks/soap-handler-
|
|
8
|
-
const _import = require("./chunks/import-
|
|
7
|
+
const soapHandler = require("./chunks/soap-handler-Brr7BPWO.js");
|
|
8
|
+
const _import = require("./chunks/import-DTcZMRNu.js");
|
|
9
9
|
const cliCommon = require("./chunks/cli-common-GnihVSjU.js");
|
|
10
|
-
require("./chunks/handle-
|
|
10
|
+
require("./chunks/handle-Crv1i9hb.js");
|
|
11
11
|
require("@xmldom/xmldom");
|
|
12
12
|
require("uuid");
|
|
13
13
|
require("./chunks/data-files-BYqhsoPe.js");
|
package/out/preload/index.js
CHANGED
|
@@ -81,6 +81,8 @@ const IPC = {
|
|
|
81
81
|
insomnia: "import:insomnia",
|
|
82
82
|
bruno: "import:bruno",
|
|
83
83
|
http: "import:http",
|
|
84
|
+
har: "import:har",
|
|
85
|
+
arazzo: "import:arazzo",
|
|
84
86
|
spector: "import:spector",
|
|
85
87
|
openapiSchemas: "import:openapi-schemas",
|
|
86
88
|
openapiSchemasUrl: "import:openapi-schemas-url"
|
|
@@ -115,11 +117,69 @@ const IPC = {
|
|
|
115
117
|
connect: "ws:connect",
|
|
116
118
|
send: "ws:send",
|
|
117
119
|
disconnect: "ws:disconnect",
|
|
120
|
+
/** Run a WebSocket request as a test: connect, optionally send, collect for
|
|
121
|
+
* a window, then assert over the received frames. */
|
|
122
|
+
test: "ws:test",
|
|
118
123
|
/** Event: inbound/outbound WS message. */
|
|
119
124
|
message: "ws:message",
|
|
120
125
|
/** Event: connection status change. */
|
|
121
126
|
status: "ws:status"
|
|
122
127
|
},
|
|
128
|
+
// ─── jq (JSON response filtering) ───────────────────────────────────────────
|
|
129
|
+
jq: {
|
|
130
|
+
filter: "jq:filter"
|
|
131
|
+
},
|
|
132
|
+
// ─── GraphQL subscriptions (graphql-ws) ─────────────────────────────────────
|
|
133
|
+
graphqlws: {
|
|
134
|
+
subscribe: "graphqlws:subscribe",
|
|
135
|
+
stop: "graphqlws:stop",
|
|
136
|
+
/** Run a GraphQL subscription as a test: subscribe, collect the emitted
|
|
137
|
+
* payloads for a window, then assert over them. */
|
|
138
|
+
test: "graphqlws:test",
|
|
139
|
+
/** Event: a next / error / complete / system message. */
|
|
140
|
+
message: "graphqlws:message",
|
|
141
|
+
/** Event: connection status change. */
|
|
142
|
+
status: "graphqlws:status"
|
|
143
|
+
},
|
|
144
|
+
// ─── Socket.IO ─────────────────────────────────────────────────────────────
|
|
145
|
+
socketio: {
|
|
146
|
+
connect: "socketio:connect",
|
|
147
|
+
emit: "socketio:emit",
|
|
148
|
+
disconnect: "socketio:disconnect",
|
|
149
|
+
/** Run a Socket.IO request as a test: connect, optionally emit, collect the
|
|
150
|
+
* received events for a window, then assert over them. */
|
|
151
|
+
test: "socketio:test",
|
|
152
|
+
/** Event: inbound/outbound Socket.IO event, ack, or system note. */
|
|
153
|
+
message: "socketio:message",
|
|
154
|
+
/** Event: connection status change. */
|
|
155
|
+
status: "socketio:status"
|
|
156
|
+
},
|
|
157
|
+
// ─── MQTT ──────────────────────────────────────────────────────────────────
|
|
158
|
+
mqtt: {
|
|
159
|
+
connect: "mqtt:connect",
|
|
160
|
+
publish: "mqtt:publish",
|
|
161
|
+
subscribe: "mqtt:subscribe",
|
|
162
|
+
unsubscribe: "mqtt:unsubscribe",
|
|
163
|
+
disconnect: "mqtt:disconnect",
|
|
164
|
+
/** Run an MQTT request as a test: connect, subscribe, optionally publish,
|
|
165
|
+
* collect for a window, then assert over the messages. */
|
|
166
|
+
test: "mqtt:test",
|
|
167
|
+
/** Event: a published / received message, or a system note. */
|
|
168
|
+
message: "mqtt:message",
|
|
169
|
+
/** Event: connection status change. */
|
|
170
|
+
status: "mqtt:status"
|
|
171
|
+
},
|
|
172
|
+
// ─── Performance (load) testing ─────────────────────────────────────────────
|
|
173
|
+
perf: {
|
|
174
|
+
/** Run a load test for a request; resolves with the aggregate result. */
|
|
175
|
+
run: "perf:run",
|
|
176
|
+
/** Abort the active run early. */
|
|
177
|
+
stop: "perf:stop",
|
|
178
|
+
/** Export a finished run as a self-contained HTML report (save dialog). */
|
|
179
|
+
exportHtml: "perf:exportHtml",
|
|
180
|
+
/** Event: live progress while a run is in flight. */
|
|
181
|
+
progress: "perf:progress"
|
|
182
|
+
},
|
|
123
183
|
// ─── SOAP / WSDL ───────────────────────────────────────────────────────────
|
|
124
184
|
wsdl: {
|
|
125
185
|
fetch: "wsdl:fetch",
|
|
@@ -319,6 +379,10 @@ const api = {
|
|
|
319
379
|
importInsomnia: () => electron.ipcRenderer.invoke(IPC.import.insomnia),
|
|
320
380
|
importBruno: () => electron.ipcRenderer.invoke(IPC.import.bruno),
|
|
321
381
|
importHttpFile: () => electron.ipcRenderer.invoke(IPC.import.http),
|
|
382
|
+
importHar: () => electron.ipcRenderer.invoke(IPC.import.har),
|
|
383
|
+
/** Import an Arazzo workflow doc: builds a collection (from its OpenAPI
|
|
384
|
+
* sources) plus one Flow per workflow, with any translation warnings. */
|
|
385
|
+
importArazzo: () => electron.ipcRenderer.invoke(IPC.import.arazzo),
|
|
322
386
|
importSpectorCollection: () => electron.ipcRenderer.invoke(IPC.import.spector),
|
|
323
387
|
/** Extract response-body schemas from an OpenAPI spec file (no full import). */
|
|
324
388
|
extractOpenApiSchemas: () => electron.ipcRenderer.invoke(IPC.import.openapiSchemas),
|
|
@@ -332,8 +396,10 @@ const api = {
|
|
|
332
396
|
// ─── HashiCorp Vault (interactive OIDC login) ─────────────────────────────
|
|
333
397
|
vaultOidcLogin: (opts) => electron.ipcRenderer.invoke(IPC.vault.oidcLogin, opts),
|
|
334
398
|
// ─── OAuth 2.0 ────────────────────────────────────────────────────────────
|
|
335
|
-
|
|
336
|
-
|
|
399
|
+
// `ctx` is the active scope; main resolves the full {{var}} map from it
|
|
400
|
+
// (environment incl. secret-manager refs, collection vars, globals).
|
|
401
|
+
oauth2StartFlow: (auth, ctx) => electron.ipcRenderer.invoke(IPC.oauth2.startFlow, auth, ctx),
|
|
402
|
+
oauth2RefreshToken: (auth, ctx, refreshToken) => electron.ipcRenderer.invoke(IPC.oauth2.refreshToken, auth, ctx, refreshToken),
|
|
337
403
|
// ─── Cloud integration ────────────────────────────────────────────────────────
|
|
338
404
|
cloudTest: () => electron.ipcRenderer.invoke(IPC.cloud.test),
|
|
339
405
|
cloudPushMock: (server) => electron.ipcRenderer.invoke(IPC.cloud.pushMock, server),
|
|
@@ -377,6 +443,65 @@ const api = {
|
|
|
377
443
|
electron.ipcRenderer.removeAllListeners(IPC.ws.message);
|
|
378
444
|
electron.ipcRenderer.removeAllListeners(IPC.ws.status);
|
|
379
445
|
},
|
|
446
|
+
wsTest: (cfg) => electron.ipcRenderer.invoke(IPC.ws.test, cfg),
|
|
447
|
+
// ─── Socket.IO ────────────────────────────────────────────────────────────
|
|
448
|
+
socketIoConnect: (requestId, opts) => electron.ipcRenderer.invoke(IPC.socketio.connect, requestId, opts),
|
|
449
|
+
socketIoEmit: (requestId, opts) => electron.ipcRenderer.invoke(IPC.socketio.emit, requestId, opts),
|
|
450
|
+
socketIoDisconnect: (requestId) => electron.ipcRenderer.invoke(IPC.socketio.disconnect, requestId),
|
|
451
|
+
onSocketIoMessage: (cb) => {
|
|
452
|
+
electron.ipcRenderer.on(IPC.socketio.message, (_e, payload) => cb(payload));
|
|
453
|
+
},
|
|
454
|
+
onSocketIoStatus: (cb) => {
|
|
455
|
+
electron.ipcRenderer.on(IPC.socketio.status, (_e, payload) => cb(payload));
|
|
456
|
+
},
|
|
457
|
+
offSocketIoEvents: () => {
|
|
458
|
+
electron.ipcRenderer.removeAllListeners(IPC.socketio.message);
|
|
459
|
+
electron.ipcRenderer.removeAllListeners(IPC.socketio.status);
|
|
460
|
+
},
|
|
461
|
+
socketIoTest: (cfg) => electron.ipcRenderer.invoke(IPC.socketio.test, cfg),
|
|
462
|
+
// ─── jq (JSON response filtering) ─────────────────────────────────────────
|
|
463
|
+
jqFilter: (json, filter) => electron.ipcRenderer.invoke(IPC.jq.filter, json, filter),
|
|
464
|
+
// ─── GraphQL subscriptions (graphql-ws) ───────────────────────────────────
|
|
465
|
+
graphqlWsSubscribe: (requestId, opts) => electron.ipcRenderer.invoke(IPC.graphqlws.subscribe, requestId, opts),
|
|
466
|
+
graphqlWsStop: (requestId) => electron.ipcRenderer.invoke(IPC.graphqlws.stop, requestId),
|
|
467
|
+
onGraphqlWsMessage: (cb) => {
|
|
468
|
+
electron.ipcRenderer.on(IPC.graphqlws.message, (_e, payload) => cb(payload));
|
|
469
|
+
},
|
|
470
|
+
onGraphqlWsStatus: (cb) => {
|
|
471
|
+
electron.ipcRenderer.on(IPC.graphqlws.status, (_e, payload) => cb(payload));
|
|
472
|
+
},
|
|
473
|
+
offGraphqlWsEvents: () => {
|
|
474
|
+
electron.ipcRenderer.removeAllListeners(IPC.graphqlws.message);
|
|
475
|
+
electron.ipcRenderer.removeAllListeners(IPC.graphqlws.status);
|
|
476
|
+
},
|
|
477
|
+
graphqlWsTest: (cfg) => electron.ipcRenderer.invoke(IPC.graphqlws.test, cfg),
|
|
478
|
+
// ─── MQTT ──────────────────────────────────────────────────────────────────
|
|
479
|
+
mqttConnect: (requestId, opts) => electron.ipcRenderer.invoke(IPC.mqtt.connect, requestId, opts),
|
|
480
|
+
mqttPublish: (requestId, opts) => electron.ipcRenderer.invoke(IPC.mqtt.publish, requestId, opts),
|
|
481
|
+
mqttSubscribe: (requestId, opts) => electron.ipcRenderer.invoke(IPC.mqtt.subscribe, requestId, opts),
|
|
482
|
+
mqttUnsubscribe: (requestId, opts) => electron.ipcRenderer.invoke(IPC.mqtt.unsubscribe, requestId, opts),
|
|
483
|
+
mqttDisconnect: (requestId) => electron.ipcRenderer.invoke(IPC.mqtt.disconnect, requestId),
|
|
484
|
+
mqttTest: (cfg) => electron.ipcRenderer.invoke(IPC.mqtt.test, cfg),
|
|
485
|
+
onMqttMessage: (cb) => {
|
|
486
|
+
electron.ipcRenderer.on(IPC.mqtt.message, (_e, payload) => cb(payload));
|
|
487
|
+
},
|
|
488
|
+
onMqttStatus: (cb) => {
|
|
489
|
+
electron.ipcRenderer.on(IPC.mqtt.status, (_e, payload) => cb(payload));
|
|
490
|
+
},
|
|
491
|
+
offMqttEvents: () => {
|
|
492
|
+
electron.ipcRenderer.removeAllListeners(IPC.mqtt.message);
|
|
493
|
+
electron.ipcRenderer.removeAllListeners(IPC.mqtt.status);
|
|
494
|
+
},
|
|
495
|
+
// ─── Performance (load) testing ─────────────────────────────────────────────
|
|
496
|
+
perfRun: (payload) => electron.ipcRenderer.invoke(IPC.perf.run, payload),
|
|
497
|
+
perfStop: () => electron.ipcRenderer.invoke(IPC.perf.stop),
|
|
498
|
+
perfExportHtml: (result, meta) => electron.ipcRenderer.invoke(IPC.perf.exportHtml, result, meta),
|
|
499
|
+
onPerfProgress: (cb) => {
|
|
500
|
+
electron.ipcRenderer.on(IPC.perf.progress, (_e, payload) => cb(payload));
|
|
501
|
+
},
|
|
502
|
+
offPerfEvents: () => {
|
|
503
|
+
electron.ipcRenderer.removeAllListeners(IPC.perf.progress);
|
|
504
|
+
},
|
|
380
505
|
// ─── gRPC ─────────────────────────────────────────────────────────────────
|
|
381
506
|
grpcLoadProto: (src) => electron.ipcRenderer.invoke(IPC.grpc.loadProto, src),
|
|
382
507
|
grpcInvoke: (requestId, opts) => electron.ipcRenderer.invoke(IPC.grpc.invoke, requestId, opts),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as linter, E as EditorView, L as LanguageSupport,
|
|
2
|
-
import { u as useT, a as useStore, b as useActiveEnvironment } from "./index-
|
|
3
|
-
import "./ajv-
|
|
1
|
+
import { l as linter, E as EditorView, L as LanguageSupport, f as LRLanguage, s as styleTags, i as indentNodeProp, m as delimitedIndent, n as foldNodeProp, p as foldInside, S as StateField, q as LRParser, u as StateEffect, v as tags, a as reactExports, j as jsxRuntimeExports, d as ReactCodeMirror, o as oneDark, c as json } from "./codemirror-CdIFBPs2.js";
|
|
2
|
+
import { u as useT, a as useStore, b as useActiveEnvironment, i as isSubscriptionQuery } from "./index-BUFSn_qD.js";
|
|
3
|
+
import "./ajv-CJPwFjiP.js";
|
|
4
4
|
function devAssert(condition, message) {
|
|
5
5
|
const booleanCondition = Boolean(condition);
|
|
6
6
|
if (!booleanCondition) {
|
|
@@ -673,12 +673,33 @@ function readNextToken(lexer, start) {
|
|
|
673
673
|
while (position < bodyLength) {
|
|
674
674
|
const code = body.charCodeAt(position);
|
|
675
675
|
switch (code) {
|
|
676
|
+
// Ignored ::
|
|
677
|
+
// - UnicodeBOM
|
|
678
|
+
// - WhiteSpace
|
|
679
|
+
// - LineTerminator
|
|
680
|
+
// - Comment
|
|
681
|
+
// - Comma
|
|
682
|
+
//
|
|
683
|
+
// UnicodeBOM :: "Byte Order Mark (U+FEFF)"
|
|
684
|
+
//
|
|
685
|
+
// WhiteSpace ::
|
|
686
|
+
// - "Horizontal Tab (U+0009)"
|
|
687
|
+
// - "Space (U+0020)"
|
|
688
|
+
//
|
|
689
|
+
// Comma :: ,
|
|
676
690
|
case 65279:
|
|
691
|
+
// <BOM>
|
|
677
692
|
case 9:
|
|
693
|
+
// \t
|
|
678
694
|
case 32:
|
|
695
|
+
// <space>
|
|
679
696
|
case 44:
|
|
680
697
|
++position;
|
|
681
698
|
continue;
|
|
699
|
+
// LineTerminator ::
|
|
700
|
+
// - "New Line (U+000A)"
|
|
701
|
+
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
702
|
+
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
682
703
|
case 10:
|
|
683
704
|
++position;
|
|
684
705
|
++lexer.line;
|
|
@@ -693,8 +714,17 @@ function readNextToken(lexer, start) {
|
|
|
693
714
|
++lexer.line;
|
|
694
715
|
lexer.lineStart = position;
|
|
695
716
|
continue;
|
|
717
|
+
// Comment
|
|
696
718
|
case 35:
|
|
697
719
|
return readComment(lexer, position);
|
|
720
|
+
// Token ::
|
|
721
|
+
// - Punctuator
|
|
722
|
+
// - Name
|
|
723
|
+
// - IntValue
|
|
724
|
+
// - FloatValue
|
|
725
|
+
// - StringValue
|
|
726
|
+
//
|
|
727
|
+
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
698
728
|
case 33:
|
|
699
729
|
return createToken(lexer, TokenKind.BANG, position, position + 1);
|
|
700
730
|
case 36:
|
|
@@ -726,6 +756,7 @@ function readNextToken(lexer, start) {
|
|
|
726
756
|
return createToken(lexer, TokenKind.PIPE, position, position + 1);
|
|
727
757
|
case 125:
|
|
728
758
|
return createToken(lexer, TokenKind.BRACE_R, position, position + 1);
|
|
759
|
+
// StringValue
|
|
729
760
|
case 34:
|
|
730
761
|
if (body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {
|
|
731
762
|
return readBlockString(lexer, position);
|
|
@@ -6221,6 +6252,8 @@ function getDirectiveLocationForASTPath(ancestors) {
|
|
|
6221
6252
|
"kind" in parentNode || invariant$1(false);
|
|
6222
6253
|
return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? DirectiveLocation.INPUT_FIELD_DEFINITION : DirectiveLocation.ARGUMENT_DEFINITION;
|
|
6223
6254
|
}
|
|
6255
|
+
// Not reachable, all possible types have been considered.
|
|
6256
|
+
/* c8 ignore next */
|
|
6224
6257
|
default:
|
|
6225
6258
|
invariant$1(false, "Unexpected kind: " + inspect(appliedTo.kind));
|
|
6226
6259
|
}
|
|
@@ -11340,18 +11373,25 @@ function unwrapType(state) {
|
|
|
11340
11373
|
}
|
|
11341
11374
|
return state;
|
|
11342
11375
|
}
|
|
11343
|
-
var nullthrows
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11376
|
+
var nullthrows = { exports: {} };
|
|
11377
|
+
var hasRequiredNullthrows;
|
|
11378
|
+
function requireNullthrows() {
|
|
11379
|
+
if (hasRequiredNullthrows) return nullthrows.exports;
|
|
11380
|
+
hasRequiredNullthrows = 1;
|
|
11381
|
+
function nullthrows$1(x, message) {
|
|
11382
|
+
if (x != null) {
|
|
11383
|
+
return x;
|
|
11384
|
+
}
|
|
11385
|
+
var error = new Error(message !== void 0 ? message : "Got unexpected " + x);
|
|
11386
|
+
error.framesToPop = 1;
|
|
11387
|
+
throw error;
|
|
11347
11388
|
}
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11389
|
+
nullthrows.exports = nullthrows$1;
|
|
11390
|
+
nullthrows.exports.default = nullthrows$1;
|
|
11391
|
+
Object.defineProperty(nullthrows.exports, "__esModule", { value: true });
|
|
11392
|
+
return nullthrows.exports;
|
|
11351
11393
|
}
|
|
11352
|
-
|
|
11353
|
-
nullthrows$1.exports.default = nullthrows;
|
|
11354
|
-
Object.defineProperty(nullthrows$1.exports, "__esModule", { value: true });
|
|
11394
|
+
requireNullthrows();
|
|
11355
11395
|
class Range {
|
|
11356
11396
|
constructor(start, end) {
|
|
11357
11397
|
this.containsPosition = (position) => {
|
|
@@ -12397,7 +12437,12 @@ function GraphQLEditor({ request, onChange }) {
|
|
|
12397
12437
|
basicSetup: { lineNumbers: false, foldGutter: false }
|
|
12398
12438
|
}
|
|
12399
12439
|
) })
|
|
12400
|
-
] })
|
|
12440
|
+
] }),
|
|
12441
|
+
isSubscriptionQuery(gql.query) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 border-t border-surface-800 pt-2 mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-[10px] text-surface-600", children: [
|
|
12442
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-fuchsia-300 uppercase tracking-wider font-medium", children: t2("Subscription") }),
|
|
12443
|
+
" — ",
|
|
12444
|
+
t2("run it to stream the results and tests in the Response pane.")
|
|
12445
|
+
] }) })
|
|
12401
12446
|
] })
|
|
12402
12447
|
] })
|
|
12403
12448
|
] });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { u as useT, c as btnPrimaryCls, d as commentKeymap } from "./index-
|
|
3
|
-
import "./ajv-
|
|
1
|
+
import { a as reactExports, j as jsxRuntimeExports, d as ReactCodeMirror, o as oneDark, x as xml } from "./codemirror-CdIFBPs2.js";
|
|
2
|
+
import { u as useT, c as btnPrimaryCls, d as commentKeymap } from "./index-BUFSn_qD.js";
|
|
3
|
+
import "./ajv-CJPwFjiP.js";
|
|
4
4
|
const SOAP_11_CONTENT_TYPE = "text/xml; charset=utf-8";
|
|
5
5
|
const SOAP_12_CONTENT_TYPE = "application/soap+xml; charset=utf-8";
|
|
6
6
|
function contentTypeForSoap(version) {
|