WS API: done ; HTTP API: add secret path '$'

This commit is contained in:
Leonid Kaganov
2025-08-12 18:53:28 +03:00
parent 4844f295c0
commit aaefc1385b
8 changed files with 500 additions and 88 deletions
+1
View File
@@ -46,6 +46,7 @@
border-radius: 6px;
min-height: 100px;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
</style>
</head>
+123 -11
View File
@@ -6,6 +6,129 @@ source ./pulse_lib.sh
TOKEN=$(./token.sh claims.json)
ZP="00000000-0000-0000-0000-000000000001/TESTS"
echo "--------- if-match ----------"
put "00000000-0000-0000-0000-000000000001/TESTS" "Value_1" "HULY-TTL: 2"
put "00000000-0000-0000-0000-000000000001/TESTS/1" "Value_1" "HULY-TTL: 2"
put "00000000-0000-0000-0000-000000000001/TESTS/2" "Value_1" "HULY-TTL: 2"
put "00000000-0000-0000-0000-000000000001/TESTS/3$" "Value_1" "HULY-TTL: 2"
put "00000000-0000-0000-0000-000000000001/TESTS/3/secret$/4" "Value_1" "HULY-TTL: 2"
get "00000000-0000-0000-0000-000000000001/TESTS"
get "00000000-0000-0000-0000-000000000001/TESTS/"
get "00000000-0000-0000-0000-000000000001/TESTS/3/secret$/"
exit
Key
Key is a string that consists of one or multiple segments separated by ‘/’. Example: foo/bar/baz.
Segment may not contain special characters (‘$’, ‘*’, ‘?’)
Key may not end with ‘/’
Segment may not be empty
Key segment may be private (prefixed with ‘$’)
Query
May not contain special characters (‘*’, ‘?’)
It is possible to use prefix, for listings / subscriptions (prefix ends with segment separator ‘/’)
GET/SUBSCRIBE/.. a/b → single key
GET/SUBSCRIBE/.. a/b/c/ → multiple
If multiple
select all keys starting with prefix
skip keys, containing private segments to the right from the prefix
example
1. /a/b/$c/$d, 2. /a/b/c, 3. /a/b/$c, 4. /a/b/$c/$d/e
/ → [2]
/a/b/ → [2]
/a/b/$c/ → [3]
/a/b/$c/$d/ → [4]
/a/b/$c/$d → (1)
exit
echo "--------- Deprecated symbols ----------"
put "00000000-0000-0000-0000-000000000001/'TESTS" "Value_1" "HULY-TTL: 2"
put "00000000-0000-0000-0000-000000000001/TES?TS" "Value_1" "HULY-TTL: 2"
put "00000000-0000-0000-0000-000000000001/TESTS*" "Value_1" "HULY-TTL: 2"
put "00000000-0000-0000-0000-000000000001/TESTS/" "Value_1" "HULY-TTL: 2"
echo "--------- if-match ----------"
delete ${ZP}
@@ -42,17 +165,6 @@ echo "================> UPDATE PUT If-Match"
put "00000000-0000-0000-0000-000000000001/TESTS" "Value_1" "HULY-TTL: 3"
echo "sleep 1 sec"
sleep 1
+3
View File
@@ -32,6 +32,9 @@ api() {
*) echo -en "${GRAY}${status}${N}" ;;
esac
if [ -n "$etag" ]; then echo -n -e " ${F}${etag}${N}" ; fi
body=$(echo "$body" | sed 's/{/\\n{/g')
if [ -n "$body" ]; then echo -e "\n ${GRAY}[${body}]${N}" ; else echo -e " ${L}(no body)${N}" ; fi
rm -f "$tmpfile"
}