-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(migrations)!: connections 0.3.0 migration script and tests #1177
chore(migrations)!: connections 0.3.0 migration script and tests #1177
Conversation
…be sued in hooks extension Signed-off-by: Akiff Manji <[email protected]>
Signed-off-by: Akiff Manji <[email protected]>
Signed-off-by: Akiff Manji <[email protected]>
Signed-off-by: Akiff Manji <[email protected]>
…ype, to be sued in hooks extension" This reverts commit 3b5fd0c. Signed-off-by: Akiff Manji <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1177 +/- ##
==========================================
+ Coverage 87.40% 88.71% +1.30%
==========================================
Files 706 707 +1
Lines 16535 16562 +27
Branches 2804 2806 +2
==========================================
+ Hits 14453 14693 +240
+ Misses 1940 1755 -185
+ Partials 142 114 -28
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that I noticed during this PR review, and maybe as we are already writing a migration script we could update is that a) the property is connectionType
and not connectionTypes
. It was first singular and I think we forgot to update the naming to plural. Second is that it is only stored as tag. As tags are not always nice to work with, my preference always goes to adding it as either a value to the connection record itself (and add it as a tag in the getTags()
method in the connection record). or setting it in the metadata, where we can still include it as a tag for the record.
Would you be willing to include those changes in this PR? So:
- Add an
_internal/connectionTypes
value to the record metadata with theconnectionTypes
property - rename the
connectionType
toconnectionTypes
in theDefaultConnectionTags
- Update all methods that were using the connectionType tags to rather set the value on the record (connection service, mediator module, etc..)
And update the migration script to (i think the way you retrieve all connections, is already set up to do this):
- set the
connectionTypes
value on the connection record based on theconnectionType
tag - remove the
connectionType
tag from the record (connectionRecord.setTag('connectionType', undefined)
)
Otherwise I can look at making that additional PR, but I think it would make it easier to work with the connection types
packages/core/src/storage/migration/updates/0.2-0.3/connection.ts
Outdated
Show resolved
Hide resolved
packages/core/src/storage/migration/updates/0.2-0.3/connection.ts
Outdated
Show resolved
Hide resolved
While I'm fine with current naming, I think it makes sense to rename it to Adding connectionTypes as a direct ConnectionRecord property could make it easier to work with, mostly when we are in the need of updating several ConnectionRecord properties at once (I don't see a common use case yet but it might be). For current use case I think it's not needed because usually, as an an end user, for setter we always need to call ConnectionRepository.update() afterwards so that's why the addConnectionTypes / removeConnectionTypes API/Service methods are convenient to deal with it even if the internals are not so straightforward. The getter, as you said in another comment is not so complicated anyway (just record.getTags().connectionType or the Api method getConnectionTypes(record). |
@genaris @TimoGlastra What if we employ the "crawl, walk, run" strategy here as it seems that this next release is time sensitive? How about I at least rename the metadata correctly and in a subsequent release we can discuss moving the data directly into the record? |
Yes makes sense. I was overly complicating things... |
@genaris you're right. This comment from me was a lot of thoughts going in all directions. Let's rename to plural naming now and maybe add it to the record in a later release. I'm fine with adding it to the record directly, and can understand the complexity of the record metadata. I think I'm not a fan of using the tags as a way to store data. I see it as away to query data, and we should call |
Signed-off-by: Akiff Manji <[email protected]>
Signed-off-by: Akiff Manji <[email protected]>
Signed-off-by: Akiff Manji <[email protected]>
I think this is a very good point, as maybe we were too implementation-specific when deciding to use tags, as the original need solved by |
…tly on records Signed-off-by: Akiff Manji <[email protected]>
…, update tests Signed-off-by: Akiff Manji <[email protected]>
So I didn't see these additional comments before proceeding, but I've gone ahead and added the connectionTypes directly to the record and updated the methods accordingly. I have added a metadata type (which is not being used at this point) so I can remove that change to keep the PR clean. Let me know your thoughts |
packages/core/src/modules/connections/repository/ConnectionMetadataTypes.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Akiff Manji <[email protected]>
…idishdev/aries-framework-javascript into connections-0.3.0-migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @amanji. Left some small final remarks
packages/core/src/modules/connections/repository/ConnectionRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/connections/services/ConnectionService.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/connections/services/ConnectionService.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/connections/repository/ConnectionRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/storage/migration/updates/0.2-0.3/connection.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Akiff Manji <[email protected]>
…ord.ts Co-authored-by: Timo Glastra <[email protected]> Signed-off-by: Akiff Manji <[email protected]>
…ce.ts Co-authored-by: Timo Glastra <[email protected]> Signed-off-by: Akiff Manji <[email protected]>
Signed-off-by: Akiff Manji <[email protected]>
…idishdev/aries-framework-javascript into connections-0.3.0-migration
Signed-off-by: Akiff Manji <[email protected]>
Signed-off-by: Akiff Manji <[email protected]>
This PR introduces changes to how connection types are handled in connection records:
connectionType
label. Connection types are now directly part of the record.connectionType
property is now pluralized toconnectionTypes
to reflect the fact that the property accepts anArray
of connection types.Related Issues
#1155