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 implementation of roles and core ownership and projectInfo / projectSettings requires that docId has a specific value, rather than being random.
We don't want this method to be exposed to any public API (e.g. when we expose datatype instances to the public API), since this should only be used internally.
Implementation
Use a non-shared unique symbol to name the method e.g. const kCreateWithDocId = new Symbol('kCreateWithDocId') and export this locally, but do not include in the public exports of @mapeo/core. Then we can use this by dataType[kCreateWithDocId](docId, value). This is how fastify does it.
Tasks
Add method and export symbol
The text was updated successfully, but these errors were encountered:
* feat: Add internal `dataType.createWithDocId()`
Fixes Add `dataType.createWithDocId()` method #190
* Add type def for createWithDocId
* Add tests
* fix typing in unit test
Description
The implementation of roles and core ownership and projectInfo / projectSettings requires that
docId
has a specific value, rather than being random.We don't want this method to be exposed to any public API (e.g. when we expose datatype instances to the public API), since this should only be used internally.
Implementation
Use a non-shared unique symbol to name the method e.g.
const kCreateWithDocId = new Symbol('kCreateWithDocId')
and export this locally, but do not include in the public exports of@mapeo/core
. Then we can use this bydataType[kCreateWithDocId](docId, value)
. This is how fastify does it.Tasks
The text was updated successfully, but these errors were encountered: