Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

fix: do not strip prefixes for MountDatastores #82

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Jan 19, 2022

If you have a mount datastore:

const d = new MountDatastore([{
  datastore: foo,
  prefix: new Key('/bar')
}])

d.put(new Key('/bar/baz'), val) results in foo.put(new Key('/baz'), val).

This PR changes the default behaviour to foo.put(new Key('/bar/baz'), val).

If you need the old behaviour, use a KeyTransformDatastore to strip the prefix - see stripPrefixDatastore in the MountDatastore tests for an example.

BREAKING CHANGE: key prefixes are no longer stripped by MountDatastore

If you have a mount datastore:

```js
const d = new MountDatastore([{
  datastore: foo,
  prefix: new Key('/bar')
}])
```

`d.put(new Key('/bar/baz'), val)` results in `foo.put(new Key('/baz'), val)`.

This PR changes the default behaviour to `foo.put(new Key('/bar/baz'), val)`.

If you need the old behaviour, use a `KeyTransformDatastore` to strip the prefix
- see [stripPrefixDatastore](./test/mount.spec.js#17) for an example.

BREAKING CHANGE: key prefixes are no longer stripped by MountDatastore
@achingbrain achingbrain merged commit 73bae74 into master Jan 19, 2022
@achingbrain achingbrain deleted the fix/do-not-strip-prefixes-for-mount-datastores branch January 19, 2022 11:41
github-actions bot pushed a commit that referenced this pull request Jan 19, 2022
## [7.0.0](v6.0.7...v7.0.0) (2022-01-19)

### ⚠ BREAKING CHANGES

* key prefixes are no longer stripped by MountDatastore

### Bug Fixes

* do not strip prefixes for MountDatastores ([#82](#82)) ([73bae74](73bae74))

### Trivial Changes

* switch to unified ci ([#83](#83)) ([b3f79e6](b3f79e6))
@github-actions
Copy link

🎉 This PR is included in version 7.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant