diff --git a/docs/examples/index.md b/docs/examples/index.md index 97ed13ac..534e430a 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -13,3 +13,10 @@ SPDX-License-Identifier: CC-BY-NC-SA-4.0 + + + + + + + diff --git a/docs/examples/oauth/add_data.data b/docs/examples/oauth/add_data.data new file mode 100644 index 00000000..0aea93ad --- /dev/null +++ b/docs/examples/oauth/add_data.data @@ -0,0 +1,6 @@ +{ + "request_uri": "urn:ietf:params:oauth:request_uri:1719239545ed9f269e652d207b90dec394b87225c92346023b", + "data": { + "email": "email@example.com" + } +} diff --git a/docs/examples/oauth/add_data.keys b/docs/examples/oauth/add_data.keys new file mode 100644 index 00000000..7d382aaf --- /dev/null +++ b/docs/examples/oauth/add_data.keys @@ -0,0 +1,14 @@ +{ + "server_data": { + "jwk": { + "kty": "EC", + "crv": "P-256", + "alg": "ES256", + "x": "SVqB4JcUD6lsfvqMr-OKUNUphdNn64Eay60978ZlL74", + "y": "lf0u0pMj4lGAzZix5u4Cm5CMQIgMNpkwy163wtKYVKI", + "d": "0g5vAEKzugrXaRbgKG0Tj2qJ5lMP4Bezds1_sTybkfk" + }, + "url": "https://valid.issuer.url", + "authentication_url": "https://did.dyne.org/dids/" + } +} diff --git a/docs/examples/oauth/add_data.zen b/docs/examples/oauth/add_data.zen new file mode 100644 index 00000000..a162e54f --- /dev/null +++ b/docs/examples/oauth/add_data.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I send request_uri 'request_uri' and send data 'data' and send server_data 'server' and add data to authorization details and output into 'result' + +Given I have a 'string array' named 'result' +Then print the 'result' diff --git a/docs/examples/oauth/gen_access_token.data b/docs/examples/oauth/gen_access_token.data new file mode 100644 index 00000000..5d588406 --- /dev/null +++ b/docs/examples/oauth/gen_access_token.data @@ -0,0 +1,16 @@ +{ + "json_body": { + "grant_type": "authorization_code", + "client_id": "did:dyne:sandbox.genericissuer:6Cp8mPUvJmQaMxQPSnNyhb74f9Ga4WqfXCkBneFgikm5", + "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", + "redirect_uri": "https://Wallet.example.org/cb", + "code": "eyJhbGciOiJFUzI1NiIsImp3ayI6eyJrdHkiOiJFQyIsIngiOiJ0R3hhcWJYR3JsNm92VC11NXNWMU1vUFRESG5ZTEtZbkNpZzM0NW5zSmc4IiwieSI6IlFOT3RBRzd4Sm52cHlGS2lGdmJJdFBxaVBiN2VZSVMtQlRvU0YwaHM3NTgiLCJjcnYiOiJQLTI1NiJ9fQ.eyJzdWIiOiI1NDJiYWNjODAyMDUxZTdhYjBjMWZhNDAxZjAwYzhjNWJjN2Y0NzVhIiwiaWF0IjoxNzE5MjQxMTYzLCJpc3MiOiJodHRwczovL2Rldi5hdXRoei1zZXJ2ZXIxLmZvcmtib21iLmV1L2F1dGh6X3NlcnZlciIsImF1ZCI6ImRpZDpkeW5lOnNhbmRib3guc2lnbnJvb206NEtFeW1XZ0xEVWYxTE5ja2V4WTk2ZGZLejV2SDc5ZGlEZWtnTE1SOUZXcEgiLCJleHAiOjE3MTkyNDQ3NjJ9.1OhQ5FKXuh_QWxm4XMufNqFS2Zkql7bmBzfMuT8GzVEil3HzYM7dAwUo5Zl9shu-w7bEGlKkOIhXssVrMeMlXg" + }, + "request": { + "headers": { + "content-length": 42, + "Content-Type": "application/x-www-form-urlencoded", + "DPoP": "eyJhbGciOiJFUzI1NiIsImp3ayI6eyJjcnYiOiJQLTI1NiIsImt0eSI6IkVDIiwieCI6InpKLTR1d0VWVlYxQW9GcW1yZVlzUlh1SjhGbzVHRVVUeTZ0aklBdjdUcFkiLCJ5IjoiVm9YdmEzVEpHc0o5bjlZVzV3MGplMHp6U2hmYnN3QWd6SHI1TEZCSDNsZyJ9LCJ0eXAiOiJkcG9wK2p3dCJ9.eyJodG0iOiJQT1NUIiwiaHR1IjoiaHR0cHM6Ly9kZXYuYXV0aHotc2VydmVyMS5mb3JrYm9tYi5ldS9hdXRoel9zZXJ2ZXIvdG9rZW4iLCJpYXQiOjE3MTkyNDEzMjYsImp0aSI6IkFad0VwZ2tOTlhrbllWT1JZbjNYNW9HVW1iTVp3V3d1UF9xSDNnOFRjbHcifQ.X2sO6h3GUcTu0h_qNyOsXEB2Z3qzPUd1azOJIeMmfH4zIk-Hd8sHm1RG2RaxZ3n22qSDbKjBap2G9U3Kjw5gLA" + } + } +} diff --git a/docs/examples/oauth/gen_access_token.keys b/docs/examples/oauth/gen_access_token.keys new file mode 100644 index 00000000..7d382aaf --- /dev/null +++ b/docs/examples/oauth/gen_access_token.keys @@ -0,0 +1,14 @@ +{ + "server_data": { + "jwk": { + "kty": "EC", + "crv": "P-256", + "alg": "ES256", + "x": "SVqB4JcUD6lsfvqMr-OKUNUphdNn64Eay60978ZlL74", + "y": "lf0u0pMj4lGAzZix5u4Cm5CMQIgMNpkwy163wtKYVKI", + "d": "0g5vAEKzugrXaRbgKG0Tj2qJ5lMP4Bezds1_sTybkfk" + }, + "url": "https://valid.issuer.url", + "authentication_url": "https://did.dyne.org/dids/" + } +} diff --git a/docs/examples/oauth/gen_access_token.zen b/docs/examples/oauth/gen_access_token.zen new file mode 100644 index 00000000..b70640cc --- /dev/null +++ b/docs/examples/oauth/gen_access_token.zen @@ -0,0 +1,12 @@ +Rule unknown ignore +Scenario 'http': url encode + +Given I have a 'string dictionary' named 'json_body' +Given I have a 'string dictionary' named 'request' + +When I create the http get parameters from 'json_body' using percent encoding +When I move 'json_body' to 'body' in 'request' + +Then print the 'request' + +Then I send request 'request' and send server_data 'server_data' and generate access token and output into 'result' diff --git a/docs/examples/oauth/gen_auth_code.data b/docs/examples/oauth/gen_auth_code.data new file mode 100644 index 00000000..d0059add --- /dev/null +++ b/docs/examples/oauth/gen_auth_code.data @@ -0,0 +1,8 @@ +{ + "request": { + "body": "client_id=did%3Adyne%3Asandbox%2Egenericissuer%3A6Cp8mPUvJmQaMxQPSnNyhb74f9Ga4WqfXCkBneFgikm5&request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3A1719239545ed9f269e652d207b90dec394b87225c92346023b", + "headers": { + "Authorization": "" + } + } +} diff --git a/docs/examples/oauth/gen_auth_code.keys b/docs/examples/oauth/gen_auth_code.keys new file mode 100644 index 00000000..7d382aaf --- /dev/null +++ b/docs/examples/oauth/gen_auth_code.keys @@ -0,0 +1,14 @@ +{ + "server_data": { + "jwk": { + "kty": "EC", + "crv": "P-256", + "alg": "ES256", + "x": "SVqB4JcUD6lsfvqMr-OKUNUphdNn64Eay60978ZlL74", + "y": "lf0u0pMj4lGAzZix5u4Cm5CMQIgMNpkwy163wtKYVKI", + "d": "0g5vAEKzugrXaRbgKG0Tj2qJ5lMP4Bezds1_sTybkfk" + }, + "url": "https://valid.issuer.url", + "authentication_url": "https://did.dyne.org/dids/" + } +} diff --git a/docs/examples/oauth/gen_auth_code.zen b/docs/examples/oauth/gen_auth_code.zen new file mode 100644 index 00000000..e272d9a3 --- /dev/null +++ b/docs/examples/oauth/gen_auth_code.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I send request 'request' and send server_data 'server' and generate authorization code and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/oauth/gen_request_uri.data b/docs/examples/oauth/gen_request_uri.data new file mode 100644 index 00000000..3e454383 --- /dev/null +++ b/docs/examples/oauth/gen_request_uri.data @@ -0,0 +1,10 @@ +{ + "client": { + "id": "did:dyne:sandbox.genericissuer:6Cp8mPUvJmQaMxQPSnNyhb74f9Ga4WqfXCkBneFgikm5", + "clientSecret": "eyJhbGciOiJFUzI1NiJ9.eyJzdWIiOiJwaXBwbyJ9.hiVPL2JTdmcZY7Vcso95KUBEzcTGvmvQ7wlwkCo0G74Unpzny2drvLsu-HzHWyckKbRjwWox-V5gqqKeka8kEQ", + "grants": ["authorization_code"], + "redirectUris": ["https://Wallet.example.org/cb"], + "scope": ["Auth1"], + "resource": "http://issuer1.zenswarm.forkbomb.eu/credential_issuer" + } +} diff --git a/docs/examples/oauth/gen_request_uri.keys b/docs/examples/oauth/gen_request_uri.keys new file mode 100644 index 00000000..a4a08f2b --- /dev/null +++ b/docs/examples/oauth/gen_request_uri.keys @@ -0,0 +1,22 @@ +{ + "server_data": { + "jwk": { + "kty": "EC", + "crv": "P-256", + "alg": "ES256", + "x": "SVqB4JcUD6lsfvqMr-OKUNUphdNn64Eay60978ZlL74", + "y": "lf0u0pMj4lGAzZix5u4Cm5CMQIgMNpkwy163wtKYVKI", + "d": "0g5vAEKzugrXaRbgKG0Tj2qJ5lMP4Bezds1_sTybkfk" + }, + "url": "https://valid.issuer.url", + "authentication_url": "https://did.dyne.org/dids/" + }, + "expires_in": 500, + "request": { + "body": "response_type=code&client_id=did:dyne:sandbox.genericissuer:6Cp8mPUvJmQaMxQPSnNyhb74f9Ga4WqfXCkBneFgikm5&state=xyz&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256&redirect_uri=https%3A%2F%2FWallet.example.org%2Fcb&authorization_details=%5B%7B%22type%22%3A%20%22openid_credential%22%2C%20%22credential_configuration_id%22%3A%20%22Auth1%22%2C%22locations%22%3A%20%5B%22http%3A%2F%2Fissuer1.zenswarm.forkbomb.eu%3A3100%2Fcredential_issuer%2F%22%5D%7D%5D", + "headers": { + "Authorization": "" + } + } +} + diff --git a/docs/examples/oauth/gen_request_uri.zen b/docs/examples/oauth/gen_request_uri.zen new file mode 100644 index 00000000..9b05d1ca --- /dev/null +++ b/docs/examples/oauth/gen_request_uri.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I send request 'request' and send client 'client' and send server_data 'server_data' and send expires_in 'expires_in' and generate request uri and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/oauth/get_auth_details.data b/docs/examples/oauth/get_auth_details.data new file mode 100644 index 00000000..3ab49984 --- /dev/null +++ b/docs/examples/oauth/get_auth_details.data @@ -0,0 +1,3 @@ +{ + "token": "eyJhbGciOiJFUzI1NiIsImp3ayI6eyJrdHkiOiJFQyIsIngiOiJ0R3hhcWJYR3JsNm92VC11NXNWMU1vUFRESG5ZTEtZbkNpZzM0NW5zSmc4IiwieSI6IlFOT3RBRzd4Sm52cHlGS2lGdmJJdFBxaVBiN2VZSVMtQlRvU0YwaHM3NTgiLCJjcnYiOiJQLTI1NiJ9fQ.eyJzdWIiOiJjYzA3N2Y4MTcwMWU3NDIxNTQ5ZmU0MjBiNDFiNTUxMjVlZDljNmZlIiwiaWF0IjoxNzE5MjQxMzI3LCJpc3MiOiJodHRwczovL2Rldi5hdXRoei1zZXJ2ZXIxLmZvcmtib21iLmV1L2F1dGh6X3NlcnZlciIsImF1ZCI6ImRpZDpkeW5lOnNhbmRib3guc2lnbnJvb206NEtFeW1XZ0xEVWYxTE5ja2V4WTk2ZGZLejV2SDc5ZGlEZWtnTE1SOUZXcEgiLCJleHAiOjE3MTkyNDQ5Mjd9.xLWyO9DkLnSU-9w_4kzmI-znQAwlYJnBbZXpKqmHNpwnFwJUdK26hmVgIQSy2HcHujKyaXX6unjmFe1P5HyK9A" +} diff --git a/docs/examples/oauth/get_auth_details.keys b/docs/examples/oauth/get_auth_details.keys new file mode 100644 index 00000000..39d1d8c7 --- /dev/null +++ b/docs/examples/oauth/get_auth_details.keys @@ -0,0 +1,5 @@ +{ + "server": { + "url": "https://valid.issuer.url" + } +} diff --git a/docs/examples/oauth/get_auth_details.zen b/docs/examples/oauth/get_auth_details.zen new file mode 100644 index 00000000..f9132dfe --- /dev/null +++ b/docs/examples/oauth/get_auth_details.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I send token 'token' and send server_data 'server' and get authorization details from token and output into 'result' + +Given I have a 'string array' named 'result' +Then print data diff --git a/docs/examples/oauth/index.md b/docs/examples/oauth/index.md new file mode 100644 index 00000000..d50e9912 --- /dev/null +++ b/docs/examples/oauth/index.md @@ -0,0 +1,49 @@ + + +## oauth plugin examples + +### generate request uri +::: code-group +<<< @/examples/oauth/gen_request_uri.zen{3 gherkin:line-numbers} +<<< @/examples/oauth/gen_request_uri.data{json} +<<< @/examples/oauth/gen_request_uri.keys{json} +::: + +### verify request parameters +::: code-group +<<< @/examples/oauth/ver_request_params.zen{15 gherkin:line-numbers} +<<< @/examples/oauth/ver_request_params.data{json} +<<< @/examples/oauth/ver_request_params.keys{json} +::: + +### add data to authorization details +::: code-group +<<< @/examples/oauth/add_data.zen{3 gherkin:line-numbers} +<<< @/examples/oauth/add_data.data{json} +<<< @/examples/oauth/add_data.keys{json} +::: + +### generate authorization code +::: code-group +<<< @/examples/oauth/gen_auth_code.zen{3 gherkin:line-numbers} +<<< @/examples/oauth/gen_auth_code.data{json} +<<< @/examples/oauth/gen_auth_code.keys{json} +::: + +### generate access token +::: code-group +<<< @/examples/oauth/gen_access_token.zen{12 gherkin:line-numbers} +<<< @/examples/oauth/gen_access_token.data{json} +<<< @/examples/oauth/gen_access_token.keys{json} +::: + +### get authorization details +::: code-group +<<< @/examples/oauth/get_auth_details.zen{3 gherkin:line-numbers} +<<< @/examples/oauth/get_auth_details.data{json} +<<< @/examples/oauth/get_auth_details.keys{json} +::: diff --git a/docs/examples/oauth/ver_request_params.data b/docs/examples/oauth/ver_request_params.data new file mode 100644 index 00000000..65f6ce51 --- /dev/null +++ b/docs/examples/oauth/ver_request_params.data @@ -0,0 +1,9 @@ +{ + "client_id": "did:dyne:sandbox.genericissuer:6Cp8mPUvJmQaMxQPSnNyhb74f9Ga4WqfXCkBneFgikm5", + "request_uri": "urn:ietf:params:oauth:request_uri:1719239545ed9f269e652d207b90dec394b87225c92346023b", + "request": { + "headers": { + "Authorization": "" + } + } +} diff --git a/docs/examples/oauth/ver_request_params.keys b/docs/examples/oauth/ver_request_params.keys new file mode 100644 index 00000000..7d382aaf --- /dev/null +++ b/docs/examples/oauth/ver_request_params.keys @@ -0,0 +1,14 @@ +{ + "server_data": { + "jwk": { + "kty": "EC", + "crv": "P-256", + "alg": "ES256", + "x": "SVqB4JcUD6lsfvqMr-OKUNUphdNn64Eay60978ZlL74", + "y": "lf0u0pMj4lGAzZix5u4Cm5CMQIgMNpkwy163wtKYVKI", + "d": "0g5vAEKzugrXaRbgKG0Tj2qJ5lMP4Bezds1_sTybkfk" + }, + "url": "https://valid.issuer.url", + "authentication_url": "https://did.dyne.org/dids/" + } +} diff --git a/docs/examples/oauth/ver_request_params.zen b/docs/examples/oauth/ver_request_params.zen new file mode 100644 index 00000000..daf9c851 --- /dev/null +++ b/docs/examples/oauth/ver_request_params.zen @@ -0,0 +1,15 @@ +Rule unknown ignore + +Given I have a 'string' named 'client_id' +Given I have a 'string' named 'request_uri' +Given I have a 'string dictionary' named 'request' + +When I set 'body' to 'client_id=' as 'string' +When I append the 'client_id' to 'body' +When I append the string '&request_uri=' to 'body' +When I append the 'request_uri' to 'body' +When I move 'body' in 'request' + +Then print the 'request' + +Then I send request 'request' and send server_data 'server_data' and verify request parameters diff --git a/docs/examples/pocketbase/create_record.data b/docs/examples/pocketbase/create_record.data new file mode 100644 index 00000000..a97013dc --- /dev/null +++ b/docs/examples/pocketbase/create_record.data @@ -0,0 +1,11 @@ +{ + "create_parameters": { + "collection": "organizations", + "record": { + "name": "Jhon org" + } + }, + "record_parameters": { + "requestKey": "testCreate" + } +} diff --git a/docs/examples/pocketbase/create_record.keys b/docs/examples/pocketbase/create_record.keys new file mode 100644 index 00000000..8182adf4 --- /dev/null +++ b/docs/examples/pocketbase/create_record.keys @@ -0,0 +1,7 @@ +{ + "pb_address": "http://127.0.0.1:8090", + "my_credentials": { + "email": "test@test.eu", + "password": "testtest" + } +} diff --git a/docs/examples/pocketbase/create_record.zen b/docs/examples/pocketbase/create_record.zen new file mode 100644 index 00000000..764220e8 --- /dev/null +++ b/docs/examples/pocketbase/create_record.zen @@ -0,0 +1,9 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client +Given I send my_credentials 'my_credentials' and login + +Given I send create_parameters 'create_parameters' and send record_parameters 'record_parameters' and create record and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/delete_record.data b/docs/examples/pocketbase/delete_record.data new file mode 100644 index 00000000..7d5ba137 --- /dev/null +++ b/docs/examples/pocketbase/delete_record.data @@ -0,0 +1,6 @@ +{ + "delete_parameters": { + "collection": "organizations", + "id": "q3vijjsacrn32tk" + } +} diff --git a/docs/examples/pocketbase/delete_record.keys b/docs/examples/pocketbase/delete_record.keys new file mode 100644 index 00000000..8182adf4 --- /dev/null +++ b/docs/examples/pocketbase/delete_record.keys @@ -0,0 +1,7 @@ +{ + "pb_address": "http://127.0.0.1:8090", + "my_credentials": { + "email": "test@test.eu", + "password": "testtest" + } +} diff --git a/docs/examples/pocketbase/delete_record.zen b/docs/examples/pocketbase/delete_record.zen new file mode 100644 index 00000000..e640de87 --- /dev/null +++ b/docs/examples/pocketbase/delete_record.zen @@ -0,0 +1,9 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client +Given I send my_credentials 'my_credentials' and login + +Given I send delete_parameters 'delete_parameters' and delete record and output into 'result' + +Given I have a 'string' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/get_one_record.data b/docs/examples/pocketbase/get_one_record.data new file mode 100644 index 00000000..1e5aeba9 --- /dev/null +++ b/docs/examples/pocketbase/get_one_record.data @@ -0,0 +1,7 @@ +{ + "show_parameters": { + "collection": "organizations", + "id": "p7viyzsihrn52uj", + "fields": "name" + } +} diff --git a/docs/examples/pocketbase/get_one_record.keys b/docs/examples/pocketbase/get_one_record.keys new file mode 100644 index 00000000..95669c91 --- /dev/null +++ b/docs/examples/pocketbase/get_one_record.keys @@ -0,0 +1,3 @@ +{ + "pb_address": "http://127.0.0.1:8090" +} diff --git a/docs/examples/pocketbase/get_one_record.zen b/docs/examples/pocketbase/get_one_record.zen new file mode 100644 index 00000000..312cab10 --- /dev/null +++ b/docs/examples/pocketbase/get_one_record.zen @@ -0,0 +1,8 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client + +Given I send show_parameters 'show_parameters' and get one record and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/get_some_records.data b/docs/examples/pocketbase/get_some_records.data new file mode 100644 index 00000000..7a53624f --- /dev/null +++ b/docs/examples/pocketbase/get_some_records.data @@ -0,0 +1,10 @@ +{ + "list_parameters": { + "type": "list", + "pagination": { + "page": 2, + "perPage": 20 + }, + "collection": "organizations" + } +} diff --git a/docs/examples/pocketbase/get_some_records.keys b/docs/examples/pocketbase/get_some_records.keys new file mode 100644 index 00000000..95669c91 --- /dev/null +++ b/docs/examples/pocketbase/get_some_records.keys @@ -0,0 +1,3 @@ +{ + "pb_address": "http://127.0.0.1:8090" +} diff --git a/docs/examples/pocketbase/get_some_records.zen b/docs/examples/pocketbase/get_some_records.zen new file mode 100644 index 00000000..cba8ba9b --- /dev/null +++ b/docs/examples/pocketbase/get_some_records.zen @@ -0,0 +1,8 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client + +Given I send list_parameters 'list_parameters' and get some records and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/index.md b/docs/examples/pocketbase/index.md new file mode 100644 index 00000000..28c92a50 --- /dev/null +++ b/docs/examples/pocketbase/index.md @@ -0,0 +1,70 @@ + + +## pocketbase plugin examples + +### start pb client +::: code-group +<<< @/examples/pocketbase/start_pb.zen{3 gherkin:line-numbers} +<<< @/examples/pocketbase/start_pb.data{json} +<<< @/examples/pocketbase/start_pb.keys{json} +::: + +### login +::: code-group +<<< @/examples/pocketbase/login.zen{5 gherkin:line-numbers} +<<< @/examples/pocketbase/login.data{json} +<<< @/examples/pocketbase/login.keys{json} +::: + +### password reset +::: code-group +<<< @/examples/pocketbase/pw_reset.zen{6 gherkin:line-numbers} +<<< @/examples/pocketbase/pw_reset.data{json} +<<< @/examples/pocketbase/pw_reset.keys{json} +::: + +### get some records +::: code-group +<<< @/examples/pocketbase/get_some_records.zen{5 gherkin:line-numbers} +<<< @/examples/pocketbase/get_some_records.data{json} +<<< @/examples/pocketbase/get_some_records.keys{json} +::: + +### get one record +::: code-group +<<< @/examples/pocketbase/get_one_record.zen{5 gherkin:line-numbers} +<<< @/examples/pocketbase/get_one_record.data{json} +<<< @/examples/pocketbase/get_one_record.keys{json} +::: + +### create a record +::: code-group +<<< @/examples/pocketbase/create_record.zen{6 gherkin:line-numbers} +<<< @/examples/pocketbase/create_record.data{json} +<<< @/examples/pocketbase/create_record.keys{json} +::: + +### update a record +::: code-group +<<< @/examples/pocketbase/update_record.zen{6 gherkin:line-numbers} +<<< @/examples/pocketbase/update_record.data{json} +<<< @/examples/pocketbase/update_record.keys{json} +::: + +### delete a record +::: code-group +<<< @/examples/pocketbase/delete_record.zen{6 gherkin:line-numbers} +<<< @/examples/pocketbase/delete_record.data{json} +<<< @/examples/pocketbase/delete_record.keys{json} +::: + +### send request +::: code-group +<<< @/examples/pocketbase/send_request.zen{5 gherkin:line-numbers} +<<< @/examples/pocketbase/send_request.data{json} +<<< @/examples/pocketbase/send_request.keys{json} +::: diff --git a/docs/examples/pocketbase/login.data b/docs/examples/pocketbase/login.data new file mode 100644 index 00000000..3bbabe0d --- /dev/null +++ b/docs/examples/pocketbase/login.data @@ -0,0 +1,6 @@ +{ + "my_credentials": { + "email": "test@test.eu", + "password": "testtest" + } +} diff --git a/docs/examples/pocketbase/login.keys b/docs/examples/pocketbase/login.keys new file mode 100644 index 00000000..95669c91 --- /dev/null +++ b/docs/examples/pocketbase/login.keys @@ -0,0 +1,3 @@ +{ + "pb_address": "http://127.0.0.1:8090" +} diff --git a/docs/examples/pocketbase/login.zen b/docs/examples/pocketbase/login.zen new file mode 100644 index 00000000..fa091b40 --- /dev/null +++ b/docs/examples/pocketbase/login.zen @@ -0,0 +1,8 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client + +Given I send my_credentials 'my_credentials' and login and output into 'result' + +Given I have a 'string' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/pw_reset.data b/docs/examples/pocketbase/pw_reset.data new file mode 100644 index 00000000..38591a40 --- /dev/null +++ b/docs/examples/pocketbase/pw_reset.data @@ -0,0 +1,3 @@ +{ + "email": "test@test.eu" +} diff --git a/docs/examples/pocketbase/pw_reset.keys b/docs/examples/pocketbase/pw_reset.keys new file mode 100644 index 00000000..8182adf4 --- /dev/null +++ b/docs/examples/pocketbase/pw_reset.keys @@ -0,0 +1,7 @@ +{ + "pb_address": "http://127.0.0.1:8090", + "my_credentials": { + "email": "test@test.eu", + "password": "testtest" + } +} diff --git a/docs/examples/pocketbase/pw_reset.zen b/docs/examples/pocketbase/pw_reset.zen new file mode 100644 index 00000000..2af6c0fe --- /dev/null +++ b/docs/examples/pocketbase/pw_reset.zen @@ -0,0 +1,9 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client +Given I send my_credentials 'my_credentials' and login + +Given I send email 'email' and ask password reset and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/send_request.data b/docs/examples/pocketbase/send_request.data new file mode 100644 index 00000000..ed8f476f --- /dev/null +++ b/docs/examples/pocketbase/send_request.data @@ -0,0 +1,4 @@ +{ + "url": "/api/hello/user", + "send_parameters": {} +} diff --git a/docs/examples/pocketbase/send_request.keys b/docs/examples/pocketbase/send_request.keys new file mode 100644 index 00000000..95669c91 --- /dev/null +++ b/docs/examples/pocketbase/send_request.keys @@ -0,0 +1,3 @@ +{ + "pb_address": "http://127.0.0.1:8090" +} diff --git a/docs/examples/pocketbase/send_request.zen b/docs/examples/pocketbase/send_request.zen new file mode 100644 index 00000000..2b84e1af --- /dev/null +++ b/docs/examples/pocketbase/send_request.zen @@ -0,0 +1,8 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client + +Given I send url 'url' and send send_parameters 'send_parameters' and send request and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/start_pb.data b/docs/examples/pocketbase/start_pb.data new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/docs/examples/pocketbase/start_pb.data @@ -0,0 +1 @@ +{} diff --git a/docs/examples/pocketbase/start_pb.keys b/docs/examples/pocketbase/start_pb.keys new file mode 100644 index 00000000..95669c91 --- /dev/null +++ b/docs/examples/pocketbase/start_pb.keys @@ -0,0 +1,3 @@ +{ + "pb_address": "http://127.0.0.1:8090" +} diff --git a/docs/examples/pocketbase/start_pb.zen b/docs/examples/pocketbase/start_pb.zen new file mode 100644 index 00000000..385c2831 --- /dev/null +++ b/docs/examples/pocketbase/start_pb.zen @@ -0,0 +1,8 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client and output into 'result' +# for mobile contracts use instead +# Given I connect to 'pb_address' and start capacitor pb client and output into 'result' + +Given I have a 'string' named 'result' +Then print the 'result' diff --git a/docs/examples/pocketbase/update_record.data b/docs/examples/pocketbase/update_record.data new file mode 100644 index 00000000..2ec9def3 --- /dev/null +++ b/docs/examples/pocketbase/update_record.data @@ -0,0 +1,12 @@ +{ + "update_parameters": { + "id": "q3vijjsacrn32tk", + "collection": "organizations", + "record": { + "name": "new value for name" + } + }, + "record_parameters": { + "fields": "id, name" + } +} diff --git a/docs/examples/pocketbase/update_record.keys b/docs/examples/pocketbase/update_record.keys new file mode 100644 index 00000000..8182adf4 --- /dev/null +++ b/docs/examples/pocketbase/update_record.keys @@ -0,0 +1,7 @@ +{ + "pb_address": "http://127.0.0.1:8090", + "my_credentials": { + "email": "test@test.eu", + "password": "testtest" + } +} diff --git a/docs/examples/pocketbase/update_record.zen b/docs/examples/pocketbase/update_record.zen new file mode 100644 index 00000000..2a165b55 --- /dev/null +++ b/docs/examples/pocketbase/update_record.zen @@ -0,0 +1,9 @@ +Rule unknown ignore + +Given I connect to 'pb_address' and start pb client +Given I send my_credentials 'my_credentials' and login + +Given I send update_parameters 'update_parameters' and send record_parameters 'record_parameters' and update record and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/qrcode/index.md b/docs/examples/qrcode/index.md new file mode 100644 index 00000000..8638b6d9 --- /dev/null +++ b/docs/examples/qrcode/index.md @@ -0,0 +1,14 @@ + + +## qrcode plugin examples + +### create qr code +::: code-group +<<< @/examples/qrcode/qr_code.zen{3 gherkin:line-numbers} +<<< @/examples/qrcode/qr_code.data{json} +<<< @/examples/qrcode/qr_code.keys{json} +::: diff --git a/docs/examples/qrcode/qr_code.data b/docs/examples/qrcode/qr_code.data new file mode 100644 index 00000000..47bf399a --- /dev/null +++ b/docs/examples/qrcode/qr_code.data @@ -0,0 +1,3 @@ +{ + "text": "Hello World!" +} diff --git a/docs/examples/qrcode/qr_code.keys b/docs/examples/qrcode/qr_code.keys new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/docs/examples/qrcode/qr_code.keys @@ -0,0 +1 @@ +{} diff --git a/docs/examples/qrcode/qr_code.zen b/docs/examples/qrcode/qr_code.zen new file mode 100644 index 00000000..c8e40f0a --- /dev/null +++ b/docs/examples/qrcode/qr_code.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I send text 'text' and create qr code and output into 'result' + +Given I have a 'string' named 'result' +Then print the 'result' diff --git a/docs/examples/redis/delete.data b/docs/examples/redis/delete.data new file mode 100644 index 00000000..4869bf8d --- /dev/null +++ b/docs/examples/redis/delete.data @@ -0,0 +1,3 @@ +{ + "key": "some key" +} diff --git a/docs/examples/redis/delete.keys b/docs/examples/redis/delete.keys new file mode 100644 index 00000000..fe8ff570 --- /dev/null +++ b/docs/examples/redis/delete.keys @@ -0,0 +1,3 @@ +{ + "redis": "redis://localhost:6379" +} diff --git a/docs/examples/redis/delete.zen b/docs/examples/redis/delete.zen new file mode 100644 index 00000000..528037cd --- /dev/null +++ b/docs/examples/redis/delete.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I connect to 'redis' and send key 'key' and delete key from redis and output into 'result' + +Given I have a 'number' named 'result' +Then print the 'result' diff --git a/docs/examples/redis/index.md b/docs/examples/redis/index.md new file mode 100644 index 00000000..1645095a --- /dev/null +++ b/docs/examples/redis/index.md @@ -0,0 +1,28 @@ + + +## redis plugin examples + +### write object into key in redis +::: code-group +<<< @/examples/redis/write.zen{3 gherkin:line-numbers} +<<< @/examples/redis/write.data{json} +<<< @/examples/redis/write.keys{json} +::: + +### read key from redis +::: code-group +<<< @/examples/redis/read.zen{3 gherkin:line-numbers} +<<< @/examples/redis/read.data{json} +<<< @/examples/redis/read.keys{json} +::: + +### delete key from redis +::: code-group +<<< @/examples/redis/delete.zen{3 gherkin:line-numbers} +<<< @/examples/redis/delete.data{json} +<<< @/examples/redis/delete.keys{json} +::: diff --git a/docs/examples/redis/read.data b/docs/examples/redis/read.data new file mode 100644 index 00000000..4869bf8d --- /dev/null +++ b/docs/examples/redis/read.data @@ -0,0 +1,3 @@ +{ + "key": "some key" +} diff --git a/docs/examples/redis/read.keys b/docs/examples/redis/read.keys new file mode 100644 index 00000000..fe8ff570 --- /dev/null +++ b/docs/examples/redis/read.keys @@ -0,0 +1,3 @@ +{ + "redis": "redis://localhost:6379" +} diff --git a/docs/examples/redis/read.zen b/docs/examples/redis/read.zen new file mode 100644 index 00000000..e846ccad --- /dev/null +++ b/docs/examples/redis/read.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I connect to 'redis' and send key 'key' and read key from redis and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/redis/write.data b/docs/examples/redis/write.data new file mode 100644 index 00000000..9752d330 --- /dev/null +++ b/docs/examples/redis/write.data @@ -0,0 +1,7 @@ +{ + "key": "some key", + "object": { + "foo": "bar", + "baz": "qux" + } +} diff --git a/docs/examples/redis/write.keys b/docs/examples/redis/write.keys new file mode 100644 index 00000000..fe8ff570 --- /dev/null +++ b/docs/examples/redis/write.keys @@ -0,0 +1,3 @@ +{ + "redis": "redis://localhost:6379" +} diff --git a/docs/examples/redis/write.zen b/docs/examples/redis/write.zen new file mode 100644 index 00000000..b8634f25 --- /dev/null +++ b/docs/examples/redis/write.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I connect to 'redis' and send key 'key' and send object 'object' and write object into key in redis and outpuit into 'result' + +Given I have a 'string' named 'result' +Then print the 'result' diff --git a/docs/examples/shell/execute.data b/docs/examples/shell/execute.data new file mode 100644 index 00000000..351fb7fc --- /dev/null +++ b/docs/examples/shell/execute.data @@ -0,0 +1,3 @@ +{ + "command": "ls -a" +} diff --git a/docs/examples/shell/execute.keys b/docs/examples/shell/execute.keys new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/docs/examples/shell/execute.keys @@ -0,0 +1 @@ +{} diff --git a/docs/examples/shell/execute.zen b/docs/examples/shell/execute.zen new file mode 100644 index 00000000..88e1ff9b --- /dev/null +++ b/docs/examples/shell/execute.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I send command 'command' and execute in shell and output into 'result' + +Given I have a 'string' named 'result' +Then print the 'result' diff --git a/docs/examples/shell/index.md b/docs/examples/shell/index.md new file mode 100644 index 00000000..f0de7071 --- /dev/null +++ b/docs/examples/shell/index.md @@ -0,0 +1,14 @@ + + +## shell plugin examples + +### execute in shell +::: code-group +<<< @/examples/shell/execute.zen{3 gherkin:line-numbers} +<<< @/examples/shell/execute.data{json} +<<< @/examples/shell/execute.keys{json} +::: diff --git a/docs/examples/timestamp/fetch_timestamp.data b/docs/examples/timestamp/fetch_timestamp.data new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/docs/examples/timestamp/fetch_timestamp.data @@ -0,0 +1 @@ +{} diff --git a/docs/examples/timestamp/fetch_timestamp.keys b/docs/examples/timestamp/fetch_timestamp.keys new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/docs/examples/timestamp/fetch_timestamp.keys @@ -0,0 +1 @@ +{} diff --git a/docs/examples/timestamp/fetch_timestamp.zen b/docs/examples/timestamp/fetch_timestamp.zen new file mode 100644 index 00000000..7c046277 --- /dev/null +++ b/docs/examples/timestamp/fetch_timestamp.zen @@ -0,0 +1,9 @@ +Rule unknown ignore + +Given I fetch the local timestamp in seconds and output into 'result_in_seconds' +Given I fetch the local timestamp in milliseconds and output into 'result_in_milliseconds' + +Given I have a 'string' named 'result_in_seconds' +Given I have a 'string' named 'result_in_milliseconds' +Then print the 'result_in_seconds' +Then print the 'result_in_milliseconds' diff --git a/docs/examples/timestamp/index.md b/docs/examples/timestamp/index.md new file mode 100644 index 00000000..b0f48ecb --- /dev/null +++ b/docs/examples/timestamp/index.md @@ -0,0 +1,14 @@ + + +## timestamp plugin examples + +### fetch the local timestamp +::: code-group +<<< @/examples/timestamp/fetch_timestamp.zen{3-4 gherkin:line-numbers} +<<< @/examples/timestamp/fetch_timestamp.data{json} +<<< @/examples/timestamp/fetch_timestamp.keys{json} +::: diff --git a/docs/examples/zencode/execute_zencode.data b/docs/examples/zencode/execute_zencode.data new file mode 100644 index 00000000..0effb01c --- /dev/null +++ b/docs/examples/zencode/execute_zencode.data @@ -0,0 +1,7 @@ +{ + "keys": { + "keyring": { + "ecdh": "FJ5Esc1koLSH+9pKSdI65tcyH2HowzXMe0UdsqktmZU=" + } + } +} diff --git a/docs/examples/zencode/execute_zencode.keys b/docs/examples/zencode/execute_zencode.keys new file mode 100644 index 00000000..bef82baa --- /dev/null +++ b/docs/examples/zencode/execute_zencode.keys @@ -0,0 +1,4 @@ +{ + "zencode": "Scenario 'ecdh': Create the public key\nGiven I have the 'keyring'\nWhen I create the ecdh public key\nThen print the 'ecdh public key'\n", + "data": {} +} diff --git a/docs/examples/zencode/execute_zencode.zen b/docs/examples/zencode/execute_zencode.zen new file mode 100644 index 00000000..cea7aa5e --- /dev/null +++ b/docs/examples/zencode/execute_zencode.zen @@ -0,0 +1,6 @@ +Rule unknown ignore + +Given I send keys 'keys' and send data 'data' and send script 'script' and execute zencode and output into 'result' + +Given I have a 'string dictionary' named 'result' +Then print the 'result' diff --git a/docs/examples/zencode/index.md b/docs/examples/zencode/index.md new file mode 100644 index 00000000..54a51435 --- /dev/null +++ b/docs/examples/zencode/index.md @@ -0,0 +1,14 @@ + + +## zencode plugin examples + +### execute zencode +::: code-group +<<< @/examples/zencode/execute_zencode.zen{3 gherkin:line-numbers} +<<< @/examples/zencode/execute_zencode.data{json} +<<< @/examples/zencode/execute_zencode.keys{json} +::: diff --git a/lerna.json b/lerna.json index 22974c41..c2c125af 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json", - "version": "1.33.10", + "version": "1.33.13", "command": { "publish": { "conventionalCommits": true diff --git a/pkg/browser/package.json b/pkg/browser/package.json index 65c83c95..02850ee2 100644 --- a/pkg/browser/package.json +++ b/pkg/browser/package.json @@ -8,7 +8,7 @@ "@slangroom/pocketbase": "workspace:*", "@slangroom/qrcode": "workspace:*" }, - "version": "1.33.10", + "version": "1.33.13", "repository": "https://github.com/dyne/slangroom", "license": "AGPL-3.0-only", "type": "module", diff --git a/pkg/core/package.json b/pkg/core/package.json index de856a6e..0258e36a 100644 --- a/pkg/core/package.json +++ b/pkg/core/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/core", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/deps": "workspace:*", "@slangroom/ignored": "workspace:*", diff --git a/pkg/db/package.json b/pkg/db/package.json index 23b5a86b..aff2a588 100644 --- a/pkg/db/package.json +++ b/pkg/db/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/db", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "sequelize": "^6.16.0", diff --git a/pkg/deps/package.json b/pkg/deps/package.json index 5d5019de..cc15cb89 100644 --- a/pkg/deps/package.json +++ b/pkg/deps/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/deps", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "chalk": "^5.3.0", "chevrotain": "^10.5.0" diff --git a/pkg/ethereum/package.json b/pkg/ethereum/package.json index fe7af4c6..92932a3c 100644 --- a/pkg/ethereum/package.json +++ b/pkg/ethereum/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/ethereum", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/shared": "workspace:*", diff --git a/pkg/fs/package.json b/pkg/fs/package.json index 8d99b277..39de0edd 100644 --- a/pkg/fs/package.json +++ b/pkg/fs/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/fs", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/shared": "workspace:*", diff --git a/pkg/git/package.json b/pkg/git/package.json index 867e213c..39f8e60c 100644 --- a/pkg/git/package.json +++ b/pkg/git/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/git", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "isomorphic-git": "^1.25.10" diff --git a/pkg/helpers/package.json b/pkg/helpers/package.json index f8fdd470..8a64adcd 100644 --- a/pkg/helpers/package.json +++ b/pkg/helpers/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/helpers", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/shared": "workspace:*", diff --git a/pkg/http/package.json b/pkg/http/package.json index 7aa3c09a..c7bf0f02 100644 --- a/pkg/http/package.json +++ b/pkg/http/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/http", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/shared": "workspace:*", diff --git a/pkg/ignored/package.json b/pkg/ignored/package.json index 9efcb489..386b8ae5 100644 --- a/pkg/ignored/package.json +++ b/pkg/ignored/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/ignored", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/deps": "workspace:*", "@slangroom/shared": "workspace:*" diff --git a/pkg/json-schema/package.json b/pkg/json-schema/package.json index 111ace47..909c9fe8 100644 --- a/pkg/json-schema/package.json +++ b/pkg/json-schema/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/json-schema", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/shared": "workspace:*", diff --git a/pkg/oauth/package.json b/pkg/oauth/package.json index 22392b99..47d097ab 100644 --- a/pkg/oauth/package.json +++ b/pkg/oauth/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/oauth", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@node-oauth/oauth2-server": "^5.1.0", "@slangroom/core": "workspace:*", diff --git a/pkg/oauth/test/e2e.ts b/pkg/oauth/test/e2e.ts index e6ad8718..4df0f823 100644 --- a/pkg/oauth/test/e2e.ts +++ b/pkg/oauth/test/e2e.ts @@ -75,7 +75,7 @@ Then print data }, request: { //&scope=Auth1&resource=http%3A%2F%2Fissuer1.zenswarm.forkbomb.eu%3A3100%2Fcredential_issuer%2F - body: 'response_type=code&client_id=did:dyne:sandbox.genericissuer:6Cp8mPUvJmQaMxQPSnNyhb74f9Ga4WqfXCkBneFgikm5&state=xyz&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256&redirect_uri=https%3A%2F%2FWallet.example.org%2Fcb&authorization_details=%5B%7B%22type%22%3A+%22openid_credential%22%2C+%22credential_configuration_id%22%3A+%22Auth1%22%2C%22locations%22%3A+%5B%22http%3A%2F%2Fissuer1.zenswarm.forkbomb.eu%3A3100%2Fcredential_issuer%2F%22%5D%7D%5D', + body: 'response_type=code&client_id=did:dyne:sandbox.genericissuer:6Cp8mPUvJmQaMxQPSnNyhb74f9Ga4WqfXCkBneFgikm5&state=xyz&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256&redirect_uri=https%3A%2F%2FWallet.example.org%2Fcb&authorization_details=%5B%7B%22type%22%3A+%22openid_credential%22%2C+%22credential_configuration_id%22%3A+%22Auth1%22%2C%22locations%22%3A+%5B%22https%3A%2F%2Fissuer1.zenswarm.forkbomb.eu%2Fcredential_issuer%2F%22%5D%7D%5D', headers: { Authorization: '', }, @@ -88,7 +88,7 @@ Then print data grants: ['authorization_code'], redirectUris: ['https://Wallet.example.org/cb'], scope: ['Auth1'], - resource: "http://issuer1.zenswarm.forkbomb.eu/credential_issuer/" + resource: "https://issuer1.zenswarm.forkbomb.eu/credential_issuer/" }, }, }); diff --git a/pkg/pocketbase/package.json b/pkg/pocketbase/package.json index a0ed56dc..33865f5e 100644 --- a/pkg/pocketbase/package.json +++ b/pkg/pocketbase/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/pocketbase", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@capacitor/preferences": "^6.0.0", "@slangroom/core": "workspace:*", diff --git a/pkg/qrcode/package.json b/pkg/qrcode/package.json index e4f85653..6e18f57a 100644 --- a/pkg/qrcode/package.json +++ b/pkg/qrcode/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/qrcode", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "qrcode": "^1.5.3" diff --git a/pkg/redis/package.json b/pkg/redis/package.json index c0379380..80f165af 100644 --- a/pkg/redis/package.json +++ b/pkg/redis/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/redis", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@redis/client": "^1.5.12", "@slangroom/core": "workspace:*", diff --git a/pkg/redis/src/plugin.ts b/pkg/redis/src/plugin.ts index edf29e5b..13e8f5dd 100644 --- a/pkg/redis/src/plugin.ts +++ b/pkg/redis/src/plugin.ts @@ -26,7 +26,11 @@ export const write = p.new('connect', async (ctx: PluginContext) => { const redisUrl = ctx.fetchConnect()[0]; const client = redisClient.createClient({ url: redisUrl }); - await client.connect(); + try { + await client.connect(); + } catch (e) { + return ctx.fail(new RedisError(e.message)); + } const key = ctx.fetch("key") as string; if (typeof key !== 'string') return ctx.fail(new RedisError('key must be string')); const data = ctx.fetch("object") as JsonableObject; @@ -43,7 +47,11 @@ export const read = p.new('connect', const client = redisClient.createClient({ url: redisUrl }); const key = ctx.fetch("key") as string; if (typeof key !== 'string') return ctx.fail(new RedisError('key must be string')); - await client.connect(); + try { + await client.connect(); + } catch (e) { + return ctx.fail(new RedisError(e.message)); + } await client.sendCommand(["SETNX", key, "{}"]); return ctx.pass(JSON.parse((await client.get(key)) || "{}")); @@ -57,7 +65,11 @@ export const deleteRedis = p.new('connect', const client = redisClient.createClient({ url: redisUrl }); const key = ctx.fetch("key") as string; if (typeof key !== 'string') return ctx.fail(new RedisError('key must be string')); - await client.connect(); + try { + await client.connect(); + } catch (e) { + return ctx.fail(new RedisError(e.message)); + } return ctx.pass(await client.del(key)) }, diff --git a/pkg/redis/test/e2e.ts b/pkg/redis/test/e2e.ts index 90dc1467..01b6e754 100644 --- a/pkg/redis/test/e2e.ts +++ b/pkg/redis/test/e2e.ts @@ -6,12 +6,16 @@ import test, { registerCompletionHandler } from 'ava'; import { Slangroom } from '@slangroom/core'; import { redis } from '@slangroom/redis'; import process from 'node:process'; +// read the version from the package.json +import packageJson from '@slangroom/redis/package.json' with { type: 'json' }; // https://github.com/avajs/ava/blob/main/docs/08-common-pitfalls.md#timeouts-because-a-file-failed-to-exit registerCompletionHandler(() => { process.exit(); }); +const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, ''); + test('Redis write and read back', async (t) => { const obj = { name: 'test person', @@ -38,3 +42,49 @@ Then I connect to 'redis' and send key 'key1' and read key from redis and output t.deepEqual(res['result']['read1'], obj); t.deepEqual(res['result']['read2'], {}); }); + +test('Redis wrong url', async (t) => { + const readRedis = `Rule unknown ignore +Given I connect to 'redis' and send key 'key' and read key from redis and output into 'read' +Given I have a 'string dictionary' named 'read' +Then print data +`; + const slangroom = new Slangroom(redis); + const fn = slangroom.execute(readRedis, { + keys: { + redis: 'redis://wrong_url:6379', + key: 'some_random_key', + }, + }); + const error = await t.throwsAsync(fn); + t.true(stripAnsiCodes((error as Error).message).startsWith( +`0 | Rule unknown ignore +1 | Given I connect to 'redis' and send key 'key' and read key from redis and output into 'read' + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 | Given I have a 'string dictionary' named 'read' +3 | Then print data + +Error colors: + - error + - suggested words + - missing words + - extra words + +Slangroom @slangroom/redis@${packageJson.version} Error:`)); +}); + +test('Redis read not set key', async (t) => { + const readRedis = `Rule unknown ignore +Given I connect to 'redis' and send key 'key' and read key from redis and output into 'read' +Given I have a 'string dictionary' named 'read' +Then print data +`; + const slangroom = new Slangroom(redis); + const res = await slangroom.execute(readRedis, { + keys: { + redis: 'redis://localhost:6379', + key: 'some_random_key', + }, + }); + t.deepEqual(res['result']['read'], []); +}); diff --git a/pkg/shared/package.json b/pkg/shared/package.json index 93c64a88..49b8acea 100644 --- a/pkg/shared/package.json +++ b/pkg/shared/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/shared", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/deps": "workspace:*" }, diff --git a/pkg/shell/package.json b/pkg/shell/package.json index 1f4c3387..6991e780 100644 --- a/pkg/shell/package.json +++ b/pkg/shell/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/shell", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "execa": "^8.0.1" diff --git a/pkg/timestamp/package.json b/pkg/timestamp/package.json index 602bed24..de88de00 100644 --- a/pkg/timestamp/package.json +++ b/pkg/timestamp/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/timestamp", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/shared": "workspace:*" diff --git a/pkg/wallet/package.json b/pkg/wallet/package.json index 259ebf4b..b2f10ac3 100644 --- a/pkg/wallet/package.json +++ b/pkg/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/wallet", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@meeco/sd-jwt": "^0.0.3", "@meeco/sd-jwt-vc": "^0.0.4", diff --git a/pkg/zencode/package.json b/pkg/zencode/package.json index 46136208..4e845fea 100644 --- a/pkg/zencode/package.json +++ b/pkg/zencode/package.json @@ -1,6 +1,6 @@ { "name": "@slangroom/zencode", - "version": "1.33.10", + "version": "1.33.13", "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/shared": "workspace:*"