@testsmith/api-spector-agent 0.9.14 → 0.9.16
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/dist/index.cjs +13 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -73422,8 +73422,7 @@ var StreamFramer = class {
|
|
|
73422
73422
|
this.carry += text.replaceAll(/\r\n?/g, "\n");
|
|
73423
73423
|
return this.mode === "sse" ? this.drainSse() : this.drainNdjson();
|
|
73424
73424
|
}
|
|
73425
|
-
/** Emit
|
|
73426
|
-
* trailing delimiter). */
|
|
73425
|
+
/** Emit a last line/block that had no trailing delimiter when the stream closed. */
|
|
73427
73426
|
flush() {
|
|
73428
73427
|
const rest = this.carry;
|
|
73429
73428
|
this.carry = "";
|
|
@@ -73746,7 +73745,7 @@ async function vaultFetch(conn, path, init = {}) {
|
|
|
73746
73745
|
const res = await fetch(`${conn.address}/v1/${path}`, {
|
|
73747
73746
|
...init,
|
|
73748
73747
|
headers,
|
|
73749
|
-
// undici honours `dispatcher`;
|
|
73748
|
+
// undici honours `dispatcher`; not in the DOM RequestInit type.
|
|
73750
73749
|
...dispatcher ? { dispatcher } : {}
|
|
73751
73750
|
});
|
|
73752
73751
|
if (!res.ok) {
|
|
@@ -76375,9 +76374,8 @@ function buildAt(ctx, testResults, consoleOutput) {
|
|
|
76375
76374
|
const sp = {
|
|
76376
76375
|
// Variable scopes
|
|
76377
76376
|
variables: makeVarScope(localVars, "variables"),
|
|
76378
|
-
// Request-scoped set/get. Request
|
|
76379
|
-
//
|
|
76380
|
-
// the in-memory session) but are never written back to the saved collection.
|
|
76377
|
+
// Request-scoped set/get. Request vars share the local store at run time: they
|
|
76378
|
+
// apply for the current run but are never written back to the saved collection.
|
|
76381
76379
|
request: makeVarScope(localVars, "request"),
|
|
76382
76380
|
environment: makeVarScope(envVars, "environment"),
|
|
76383
76381
|
collectionVariables: makeVarScope(collectionVars, "collectionVariables"),
|
|
@@ -76406,18 +76404,8 @@ function buildAt(ctx, testResults, consoleOutput) {
|
|
|
76406
76404
|
expect: (value2) => makeAsserter(value2, false),
|
|
76407
76405
|
// JSONPath query: sp.jsonPath(data, '$.store.book[?(@.price < 10)].title')
|
|
76408
76406
|
jsonPath: (data, expr) => JSONPath({ path: expr, json: data }),
|
|
76409
|
-
/**
|
|
76410
|
-
*
|
|
76411
|
-
*
|
|
76412
|
-
* Usage in scripts:
|
|
76413
|
-
* const code = sp.totp("JBSWY3DPEHPK3PXP");
|
|
76414
|
-
* sp.environment.set("otp", code);
|
|
76415
|
-
*
|
|
76416
|
-
* Options (all optional):
|
|
76417
|
-
* digits — code length (default 6)
|
|
76418
|
-
* period — time step in seconds (default 30)
|
|
76419
|
-
* algorithm — "sha1" | "sha256" | "sha512" (default "sha1")
|
|
76420
|
-
*/
|
|
76407
|
+
/** TOTP code from a base32 secret. Options: digits (6), period secs (30),
|
|
76408
|
+
* algorithm "sha1"|"sha256"|"sha512" ("sha1"). */
|
|
76421
76409
|
totp: (secret, options) => {
|
|
76422
76410
|
const digits = options?.digits ?? 6;
|
|
76423
76411
|
const period = options?.period ?? 30;
|
|
@@ -80663,7 +80651,8 @@ async function fetchOAuth2Token(auth, vars) {
|
|
|
80663
80651
|
params.set("grant_type", flow === "password" ? "password" : "client_credentials");
|
|
80664
80652
|
params.set("client_id", clientId);
|
|
80665
80653
|
params.set("client_secret", clientSecret);
|
|
80666
|
-
|
|
80654
|
+
const scope = interpolate(auth.oauth2Scopes ?? "", vars).trim();
|
|
80655
|
+
if (scope) params.set("scope", scope);
|
|
80667
80656
|
if (flow === "password") {
|
|
80668
80657
|
let password = auth.password ?? "";
|
|
80669
80658
|
if (!password && auth.passwordSecretRef) password = await getSecret(auth.passwordSecretRef) ?? "";
|
|
@@ -81474,7 +81463,7 @@ var BLOCK_SPECS = {
|
|
|
81474
81463
|
inputs: IN,
|
|
81475
81464
|
outputs: () => []
|
|
81476
81465
|
},
|
|
81477
|
-
//
|
|
81466
|
+
// Action
|
|
81478
81467
|
request: {
|
|
81479
81468
|
type: "request",
|
|
81480
81469
|
category: "action",
|
|
@@ -81491,7 +81480,7 @@ var BLOCK_SPECS = {
|
|
|
81491
81480
|
inputs: IN,
|
|
81492
81481
|
outputs: OUT
|
|
81493
81482
|
},
|
|
81494
|
-
//
|
|
81483
|
+
// Logic
|
|
81495
81484
|
if: {
|
|
81496
81485
|
type: "if",
|
|
81497
81486
|
category: "logic",
|
|
@@ -81572,7 +81561,7 @@ var BLOCK_SPECS = {
|
|
|
81572
81561
|
outputs: () => [{ id: "branch", label: "branch" }, { id: "done", label: "done" }],
|
|
81573
81562
|
defaultConfig: { copies: 1 }
|
|
81574
81563
|
},
|
|
81575
|
-
//
|
|
81564
|
+
// Looping
|
|
81576
81565
|
forEach: {
|
|
81577
81566
|
type: "forEach",
|
|
81578
81567
|
category: "looping",
|
|
@@ -81600,7 +81589,7 @@ var BLOCK_SPECS = {
|
|
|
81600
81589
|
outputs: OUT,
|
|
81601
81590
|
defaultConfig: { intoVar: "results" }
|
|
81602
81591
|
},
|
|
81603
|
-
//
|
|
81592
|
+
// Visualize
|
|
81604
81593
|
display: {
|
|
81605
81594
|
type: "display",
|
|
81606
81595
|
category: "visualize",
|
|
@@ -81632,7 +81621,7 @@ var APP_URL = (process.env.APP_URL || "").replace(/\/+$/, "");
|
|
|
81632
81621
|
var AGENT_TOKEN = process.env.AGENT_TOKEN || "";
|
|
81633
81622
|
var RUNTIME_TOKEN = process.env.RUNTIME_TOKEN || "";
|
|
81634
81623
|
var POLL_MS = Number(process.env.POLL_INTERVAL_MS || 5e3);
|
|
81635
|
-
var VERSION = true ? "0.9.
|
|
81624
|
+
var VERSION = true ? "0.9.16" : "";
|
|
81636
81625
|
var authHeaders = AGENT_TOKEN ? { Authorization: `Bearer ${AGENT_TOKEN}` } : RUNTIME_TOKEN ? { "X-Runtime-Token": RUNTIME_TOKEN } : {};
|
|
81637
81626
|
async function postResult(m6, fields) {
|
|
81638
81627
|
await fetch(`${APP_URL}/api/monitor-runtime/${m6.id}/result`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testsmith/api-spector-agent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.16",
|
|
4
4
|
"description": "API Spector private runner: monitor internal/local APIs the cloud cannot reach, with no inbound connections.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://api-spector.dev",
|