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
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request
Current behavior
Cannot pass PartitioningAdapter as an adapter to initializePersistence
Error:
Type 'PartitioningAdapter' is not assignable to type 'StorageAdapter'.
Types of property 'exportDatabase' are incompatible.
Type '(dbname: string, dbref: import("/xxx/angular-pwa/node_modules/@lokidb/partitioning-adapter/types/loki/src/loki").Loki) => Promise<void>'
is not assignable to type
'(dbname: string, dbref: import("/xxx/angular-pwa/node_modules/@lokidb/loki/types/loki/src/loki").Loki) => Promise<void>'.
Expected behavior
Can pass PartitioningAdapter as an adapter to initializePersistence
Minimal reproduction of the problem with instructions
IndexedStorage.register();
PartitioningAdapter.register();
let idbAdapter = new IndexedStorage('test.db');
let paAdapter = new PartitioningAdapter(
idbAdapter,
{
paging: true,
pageSize:5*1024*1024
}
);
let options: Loki.Options = {
env: 'BROWSER',
serializationMethod: 'normal'
};
let db = new Loki('test.db', options);
let persistenceOptions: Loki.PersistenceOptions = {
adapter: paAdapter, <-- Issue is here
autosave: false,
autosaveInterval: 1000,
autoload: false,
throttledSaves: false,
persistenceMethod: 'indexed-storage'
};
this.db.initializePersistence(persistenceOptions).then(err => {
console.log('initializePersistence complete');
});
What is the motivation / use case for changing the behavior?
The issue is that there are two Loki type definitions one in Loki & one in PartitioningAdapter. PartitioningAdapter extends the StorageAdapter which references its own copy of Loki and not the root copy here @lokidb/loki
If I try to use the reference to @lokidb/partitioning-adapter/types/loki/src/loki instead of @lokidb/loki I can pass the paAdapter to the PersistenceOptions but i get another error
Module not found: Error: Can't resolve '@lokidb/partitioning-adapter/types/loki/src/loki'
The text was updated successfully, but these errors were encountered:
I also received that error, but with the fsAdapter:
Type 'PartitioningAdapter' is not assignable to type 'StorageAdapter'.
Types of property 'exportDatabase' are incompatible.
Type '(dbname: string, dbref: import("/…/node_modules/@lokidb/partitioning-adapter/types/loki/src/loki").Loki) => Promise<void>' is not assignable to type '(dbname: string, dbref: import("/…/node_modules/@lokidb/loki/types/loki/src/loki").Loki) => Promise<void>'.
Types of parameters 'dbref' and 'dbref' are incompatible.
Type 'import("/…/node_modules/@lokidb/loki/types/loki/src/loki").Loki' is not assignable to type 'import("/…/node_modules/@lokidb/partitioning-adapter/types/loki/src/loki").Loki'.
Types have separate declarations of a private property 'databaseVersion'.
The expected type comes from property 'adapter' which is declared here on type 'PersistenceOptions'
Thanks for the workaround! Changing adapter: paAdapter to adapter: paAdapter as any, lets it run.
I'm submitting a
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request
Current behavior
Cannot pass PartitioningAdapter as an adapter to initializePersistence
Error:
Expected behavior
Can pass PartitioningAdapter as an adapter to initializePersistence
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Be able to use PartitioningAdapter
Environment
The issue is that there are two Loki type definitions one in Loki & one in PartitioningAdapter. PartitioningAdapter extends the StorageAdapter which references its own copy of Loki and not the root copy here @lokidb/loki
@lokidb/partitioning-adapter/types/loki/src/loki
@lokidb/loki
If I try to use the reference to @lokidb/partitioning-adapter/types/loki/src/loki instead of @lokidb/loki I can pass the paAdapter to the PersistenceOptions but i get another error
The text was updated successfully, but these errors were encountered: