diff --git a/README.md b/README.md index fd28e7ce..1bd8362d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ - - -### Now for a little internet optimism + [![Build Status](https://github.com/atsign-foundation/at_tools/actions/workflows/at_tools.yaml/badge.svg)](https://github.com/atsign-foundation/at_tools/actions/workflows/at_tools.yaml) [![GitHub License](https://img.shields.io/badge/license-BSD3-blue.svg)](./LICENSE) ## at_tools -This repository contains @protocol tools and libraries for developers +This repository contains @protocol tools and libraries for developers building @platform applications who wish to utilize the authentication methods and commonly used components of the @protocol: diff --git a/at_cli/README.md b/at_cli/README.md index bcbf3df4..0a9b5be0 100644 --- a/at_cli/README.md +++ b/at_cli/README.md @@ -1,6 +1,4 @@ - - -### Now for a little internet optimism + # at_cli diff --git a/at_commons/CHANGELOG.md b/at_commons/CHANGELOG.md index 82c566f8..5a587a77 100644 --- a/at_commons/CHANGELOG.md +++ b/at_commons/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.16 +- Hide at_client_exceptions.dart to prevent at_client_exception being referred from at_commons +## 3.0.15 +- FEAT: support to bypass cache in lookup and plookup verbs ## 3.0.14 - Remove unnecessary print statements ## 3.0.13 diff --git a/at_commons/README.md b/at_commons/README.md index 71b0dc09..9da20946 100644 --- a/at_commons/README.md +++ b/at_commons/README.md @@ -1,6 +1,4 @@ - - -### Now for a little internet optimism + [![Pub Package](https://img.shields.io/pub/v/at_commons)](https://pub.dev/packages/at_commons) diff --git a/at_commons/lib/src/at_constants.dart b/at_commons/lib/src/at_constants.dart index cdc72e14..d03a1694 100644 --- a/at_commons/lib/src/at_constants.dart +++ b/at_commons/lib/src/at_constants.dart @@ -63,3 +63,4 @@ const String commitLogCompactionKey = 'privatekey:commitLogCompactionStats'; const String accessLogCompactionKey = 'privatekey:accessLogCompactionStats'; const String notificationCompactionKey = 'privatekey:notificationCompactionStats'; +const String byPassCache = 'bypassCache'; diff --git a/at_commons/lib/src/verb/lookup_verb_builder.dart b/at_commons/lib/src/verb/lookup_verb_builder.dart index 7d639aa9..538e0762 100644 --- a/at_commons/lib/src/verb/lookup_verb_builder.dart +++ b/at_commons/lib/src/verb/lookup_verb_builder.dart @@ -26,15 +26,20 @@ class LookupVerbBuilder implements VerbBuilder { String? operation; + // if set to true, returns the value of key on the remote server instead of the cached copy + bool byPassCache = false; + @override String buildCommand() { - String command; + String command = 'lookup:'; + if (byPassCache == true) { + command += 'bypassCache:$byPassCache:'; + } if (operation != null) { - command = 'lookup:$operation:$atKey${VerbUtil.formatAtSign(sharedBy)}\n'; - } else { - command = 'lookup:$atKey${VerbUtil.formatAtSign(sharedBy)}\n'; + command += '$operation:'; } - return command; + command += atKey!; + return '$command${VerbUtil.formatAtSign(sharedBy)}\n'; } @override diff --git a/at_commons/lib/src/verb/plookup_verb_builder.dart b/at_commons/lib/src/verb/plookup_verb_builder.dart index f7c59b10..aee9f4d2 100644 --- a/at_commons/lib/src/verb/plookup_verb_builder.dart +++ b/at_commons/lib/src/verb/plookup_verb_builder.dart @@ -17,15 +17,20 @@ class PLookupVerbBuilder implements VerbBuilder { String? operation; + // if set to true, returns the value of key on the remote server instead of the cached copy + bool byPassCache = false; + @override String buildCommand() { - String command; + String command = 'plookup:'; + if (byPassCache == true) { + command += 'bypassCache:$byPassCache:'; + } if (operation != null) { - command = 'plookup:$operation:$atKey${VerbUtil.formatAtSign(sharedBy)}\n'; - } else { - command = 'plookup:$atKey${VerbUtil.formatAtSign(sharedBy)}\n'; + command += '$operation:'; } - return command; + command += atKey!; + return '$command${VerbUtil.formatAtSign(sharedBy)}\n'; } @override diff --git a/at_commons/lib/src/verb/syntax.dart b/at_commons/lib/src/verb/syntax.dart index a6ec6216..4632bcba 100644 --- a/at_commons/lib/src/verb/syntax.dart +++ b/at_commons/lib/src/verb/syntax.dart @@ -6,9 +6,9 @@ class VerbSyntax { static const llookup = r'^llookup:((?meta|all):)?(?:cached:)?((?:public:)|(@(?[^@:\s]*):))?(?[^:]((?!:{2})[^@])+)@(?[^@\s]+)$'; static const plookup = - r'^plookup:((?meta|all):)?(?[^@\s]+)@(?[^@\s]+)$'; + r'^plookup:(bypassCache:(?true|false):)?((?meta|all):)?(?[^@\s]+)@(?[^@\s]+)$'; static const lookup = - r'^lookup:((?meta|all):)?(?(?:[^:]).+)@(?[^@\s]+)$'; + r'^lookup:(bypassCache:(?true|false):)?((?meta|all):)?(?(?:[^:]).+)@(?[^@\s]+)$'; static const scan = r'^scan$|scan(:(?@[^:@\s]+))?(:page:(?\d+))?( (?\S+))?$'; static const config = diff --git a/at_commons/pubspec.yaml b/at_commons/pubspec.yaml index fdfd0938..d66d305e 100644 --- a/at_commons/pubspec.yaml +++ b/at_commons/pubspec.yaml @@ -1,6 +1,6 @@ name: at_commons description: A library of Dart and Flutter utility classes that are used across other components of the @‎platform. -version: 3.0.14 +version: 3.0.16 repository: https://github.com/atsign-foundation/at_tools homepage: https://atsign.dev diff --git a/at_commons/test/lookup_verb_builder_test.dart b/at_commons/test/lookup_verb_builder_test.dart new file mode 100644 index 00000000..b85576dc --- /dev/null +++ b/at_commons/test/lookup_verb_builder_test.dart @@ -0,0 +1,37 @@ +import 'package:at_commons/at_builders.dart'; +import 'package:test/test.dart'; + +void main() { + group('A group of lookup verb builder tests', () { + test('verify simple lookup command', () { + var lookupVerbBuilder = LookupVerbBuilder() + ..atKey = 'phone' + ..sharedBy = 'alice'; + expect(lookupVerbBuilder.buildCommand(), 'lookup:phone@alice\n'); + }); + test('verify lookup meta command', () { + var lookupVerbBuilder = LookupVerbBuilder() + ..operation = 'meta' + ..atKey = 'email' + ..sharedBy = 'alice'; + expect(lookupVerbBuilder.buildCommand(), 'lookup:meta:email@alice\n'); + }); + + test('verify lookup all command', () { + var lookupVerbBuilder = LookupVerbBuilder() + ..operation = 'all' + ..atKey = 'email' + ..sharedBy = 'alice'; + expect(lookupVerbBuilder.buildCommand(), 'lookup:all:email@alice\n'); + }); + + test('verify lookup bypass cache command', () { + var lookupVerbBuilder = LookupVerbBuilder() + ..byPassCache = true + ..atKey = 'email' + ..sharedBy = 'alice'; + expect(lookupVerbBuilder.buildCommand(), + 'lookup:bypassCache:true:email@alice\n'); + }); + }); +} diff --git a/at_commons/test/plookup_verb_builder_test.dart b/at_commons/test/plookup_verb_builder_test.dart new file mode 100644 index 00000000..6d78e193 --- /dev/null +++ b/at_commons/test/plookup_verb_builder_test.dart @@ -0,0 +1,37 @@ +import 'package:at_commons/at_builders.dart'; +import 'package:test/test.dart'; + +void main() { + group('A group of lookup verb builder tests', () { + test('verify simple plookup command', () { + var plookupVerbBuilder = PLookupVerbBuilder() + ..atKey = 'phone' + ..sharedBy = 'alice'; + expect(plookupVerbBuilder.buildCommand(), 'plookup:phone@alice\n'); + }); + test('verify plookup meta command', () { + var plookupVerbBuilder = PLookupVerbBuilder() + ..operation = 'meta' + ..atKey = 'email' + ..sharedBy = 'alice'; + expect(plookupVerbBuilder.buildCommand(), 'plookup:meta:email@alice\n'); + }); + + test('verify plookup all command', () { + var plookupVerbBuilder = PLookupVerbBuilder() + ..operation = 'all' + ..atKey = 'email' + ..sharedBy = 'alice'; + expect(plookupVerbBuilder.buildCommand(), 'plookup:all:email@alice\n'); + }); + + test('verify plookup bypass cache command', () { + var plookupVerbBuilder = PLookupVerbBuilder() + ..byPassCache = true + ..atKey = 'email' + ..sharedBy = 'alice'; + expect(plookupVerbBuilder.buildCommand(), + 'plookup:bypassCache:true:email@alice\n'); + }); + }); +} diff --git a/at_cram/README.md b/at_cram/README.md index 77f8b9e0..8291a485 100644 --- a/at_cram/README.md +++ b/at_cram/README.md @@ -1,6 +1,4 @@ - - -### Now for a little internet optimism + ## at_cram diff --git a/at_dump_atKeys/README.md b/at_dump_atKeys/README.md index b5d5ecf4..b4087c4e 100644 --- a/at_dump_atKeys/README.md +++ b/at_dump_atKeys/README.md @@ -1,6 +1,4 @@ - - -### Now for a little internet optimism + ## at_dump_atKeys diff --git a/at_hive_recovery/README.md b/at_hive_recovery/README.md index b39ec71b..6a2ddbe7 100644 --- a/at_hive_recovery/README.md +++ b/at_hive_recovery/README.md @@ -1,11 +1,17 @@ -# at_hive_recovery # + + +# at_hive_recovery **at_hive_recovery** tool for recovering corrupted hive boxes. Usage: +``` dart bin/main.dart +``` e.g -dart bin/main.dart @alice /home/alice/storage/hive \ No newline at end of file +``` +dart bin/main.dart @alice /home/alice/storage/hive +``` \ No newline at end of file diff --git a/at_pkam/README.md b/at_pkam/README.md index 990e1de7..3b3e2f84 100644 --- a/at_pkam/README.md +++ b/at_pkam/README.md @@ -1,6 +1,4 @@ - - -### Now for a little internet optimism + ## at_pkam diff --git a/at_utils/README.md b/at_utils/README.md index 968a47de..e4090bd3 100644 --- a/at_utils/README.md +++ b/at_utils/README.md @@ -1,6 +1,4 @@ - - -### Now for a little internet optimism + [![Pub Package](https://img.shields.io/pub/v/at_utils)](https://pub.dev/packages/at_utils) diff --git a/at_ve_doctor/README.md b/at_ve_doctor/README.md index bc3b1939..156fc20f 100644 --- a/at_ve_doctor/README.md +++ b/at_ve_doctor/README.md @@ -1,6 +1,4 @@ - - -### Now for a little internet optimism + ## at_ve_doctor