api-tuner 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -6,6 +6,14 @@
6
6
 
7
7
  - [SWI Prolog](https://www.swi-prolog.org/Download.html)
8
8
 
9
+ Follow platform-specific instructions to install locally oor in a docker image.
10
+
11
+ To run `api-tuner` in GitHub workflow, you add this action to your jobs:
12
+
13
+ ```yaml
14
+ - uses: fabasoad/setup-prolog-action@v1
15
+ ```
16
+
9
17
  ## Installation
10
18
 
11
19
  `npm i api-tuner`
package/bin/tuner.sh CHANGED
@@ -88,4 +88,5 @@ for path in "${PATHS[@]}"; do
88
88
  cat "$path" >> "$MERGED"
89
89
  done
90
90
 
91
+ set -o pipefail
91
92
  $eye $ARGS "${SCRIPT_PATH}"/../rules/*.n3 "${MERGED}" | $SUMMARY
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-tuner",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -2,6 +2,23 @@ PREFIX tuner: <https://api-tuner.described.at/>
2
2
  prefix string: <http://www.w3.org/2000/10/swap/string#>
3
3
  prefix log: <http://www.w3.org/2000/10/swap/log#>
4
4
 
5
+ {
6
+ ?expr tuner:assertThat ?msg .
7
+ } <= {
8
+ (
9
+ ?expr
10
+ true
11
+ {
12
+ (
13
+ { ?msg log:rawType log:ForAll }
14
+ { ?expr^tuner:logFailedAssertion }
15
+ { ?msg^tuner:logFailedAssertion }
16
+ ) log:ifThenElseIn [].
17
+ true log:equalTo false .
18
+ }
19
+ ) log:ifThenElseIn [] .
20
+ } .
21
+
5
22
  {
6
23
  ?res tuner:http_code ?value .
7
24
  } <= {
package/rules/logging.n3 CHANGED
@@ -22,3 +22,13 @@ prefix string: <http://www.w3.org/2000/10/swap/string#>
22
22
  true
23
23
  ) log:ifThenElseIn ?SCOPE .
24
24
  } .
25
+
26
+ {
27
+ ?left tuner:logFailedAssertion ?right .
28
+ } <= {
29
+ (
30
+ { [] tuner:logLevel 'info' }
31
+ { 'Failed assertion' log:trace ?right . }
32
+ true
33
+ ) log:ifThenElseIn ?SCOPE .
34
+ } .
package/rules/requests.n3 CHANGED
@@ -61,7 +61,13 @@ prefix earl: <http://www.w3.org/ns/earl#>
61
61
  ) string:concatenation ?command .
62
62
 
63
63
  ?command^tuner:trace .
64
- ?command!e:exec .
64
+ {
65
+ ?command!e:exec .
66
+ } log:callWithCleanup {
67
+ {
68
+ ( { ?requestBodyFile log:rawType log:Literal } { ?requestBodyFile!file:rm } true ) log:ifThenElseIn [] .
69
+ } log:callWithCleanup true .
70
+ } .
65
71
 
66
72
  (
67
73
  "node " "lib/merge-curl-output.js"!file:libPath " "
@@ -72,9 +78,6 @@ prefix earl: <http://www.w3.org/ns/earl#>
72
78
  ("file://" ?responseFile)!string:concatenation^log:uri log:semantics ?res .
73
79
  ?res^tuner:trace .
74
80
  } log:callWithCleanup {
75
- {
76
- ( { ?requestBodyFile log:rawType log:Literal } { ?requestBodyFile!file:rm } true ) log:ifThenElseIn [] .
77
- } log:callWithCleanup true .
78
81
  { ?responseHeadersFile!file:rm } log:callWithCleanup true .
79
82
  { ?responseBodyFile!file:rm } log:callWithCleanup true .
80
83
  { ?responseFile!file:rm } log:callWithCleanup true .