You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The UX will eventually need a way to show who created and updated any record in the database. Naming chosen to match the createdAt and updatedAt fields.
Both of these could be derived without being stored in the cores:
To derive updatedBy: get the key of the hypercore where the document is stored. If we want a deviceId, then lookup ownership of that core.
To derive createdBy: follow history of any document until you reach the original (empty links[]), and get the updatedBy for that document.
We could just store these on each document which would simplify the code, but that would mean that this information is untrusted / unverified (someone writing directly to the database could write what they want for these fields).
@mapeo/schema does not feel like the right place to derive this information: it would require information about core ownership. Also, versionId before the @ is already the key of the hypercore where the document is stored.
@mapeo/sqlite-indexer could index the creatorCoreId, by writing it to the sqlite index when it encounters the root document (e.g. the document with no links[] record).
mapeo-core is probably the best place to convert the coreId from versionId to a device ID for updatedBy, and it can also convert the creatorCoreId into a device ID for createdBy.
The UX will eventually need a way to show who created and updated any record in the database. Naming chosen to match the
createdAt
andupdatedAt
fields.Both of these could be derived without being stored in the cores:
updatedBy
: get the key of the hypercore where the document is stored. If we want a deviceId, then lookup ownership of that core.createdBy
: follow history of any document until you reach the original (empty links[]), and get theupdatedBy
for that document.We could just store these on each document which would simplify the code, but that would mean that this information is untrusted / unverified (someone writing directly to the database could write what they want for these fields).
@mapeo/schema
does not feel like the right place to derive this information: it would require information about core ownership. Also,versionId
before the@
is already the key of the hypercore where the document is stored.@mapeo/sqlite-indexer
could index thecreatorCoreId
, by writing it to the sqlite index when it encounters the root document (e.g. the document with nolinks[]
record).mapeo-core
is probably the best place to convert the coreId fromversionId
to a device ID forupdatedBy
, and it can also convert thecreatorCoreId
into a device ID forcreatedBy
.creatorCoreId
mapeo-sqlite-indexer#7createdBy
andupdatedBy
fields for data returned to client comapeo-core#136The text was updated successfully, but these errors were encountered: