Skip to content

Commit

Permalink
FIX #4722 (#4729)
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed May 2, 2023
1 parent 1db2584 commit 408c2cd
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 43 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# RxDB Changelog

<!-- CHANGELOG NEWEST -->

- FIX remove `pouchdb-selector-core` dependency [#4722](https://github.com/pubkey/rxdb/issues/4722)
<!-- ADD new changes here! -->

<!-- /CHANGELOG NEWEST -->
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@
"oblivious-set": "1.1.1",
"ohash": "1.1.2",
"pako": "2.1.0",
"pouchdb-selector-core": "8.0.1",
"reconnecting-websocket": "4.4.0",
"simple-peer": "9.11.1",
"socket.io-client": "4.6.1",
Expand Down Expand Up @@ -520,4 +519,4 @@
"webpack-cli": "5.0.2",
"webpack-dev-server": "4.13.3"
}
}
}
5 changes: 1 addition & 4 deletions src/plugins/dev-mode/check-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import type {
DefaultPreparedQuery
} from '../../types';
import { newRxError, newRxTypeError } from '../../rx-error';
import {
massageSelector
} from 'pouchdb-selector-core';
import { RxStorageDexieStatics } from '../storage-dexie';
import { deepEqual } from '../utils';

Expand Down Expand Up @@ -77,7 +74,7 @@ export function checkMangoQuery(args: RxPluginPrePrepareQueryArgs) {
* Ensure that all top level fields are included in the schema.
* TODO this check can be augmented to also check sub-fields.
*/
const massagedSelector: MangoQuerySelector<any> = massageSelector(args.mangoQuery.selector);
const massagedSelector: MangoQuerySelector<any> = args.mangoQuery.selector;
const schemaTopLevelFields = Object.keys(schema.properties);
Object.keys(massagedSelector)
// do not check operators
Expand Down
1 change: 0 additions & 1 deletion src/types/modules/pouchdb-selector-core.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions test/unit/attachments-compression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ modes.forEach(mode => {
it('should insert one attachment', async () => {
const c = await createCompressedAttachmentsCollection();
const doc = await c.findOne().exec(true);
console.log('meow START');
const attachment = await doc.putAttachment({
id: 'cat.txt',
data: createBlob('meow', 'text/plain'),
type: 'text/plain'
});
console.log('meow END');
assert.ok(attachment);
assert.strictEqual(attachment.id, 'cat.txt');
assert.strictEqual(attachment.type, 'text/plain');
Expand Down
33 changes: 0 additions & 33 deletions test/unit/rx-query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,39 +358,6 @@ describe('rx-query.test.ts', () => {
});
});
config.parallel('.exec()', () => {
it('should throw if top level field is not known to the schema', async () => {
const col = await humansCollection.create(0);

await AsyncTestUtil.assertThrows(
() => col.find({
selector: {
asdfasdfasdf: 'asdf'
} as any
}).exec(),
'RxError',
'QU13'
);

// should also detect wrong fields inside of $and
await AsyncTestUtil.assertThrows(
() => col.find({
selector: {
$and: [
{
asdfasdfasdf: 'asdf'
} as any,
{
asdfasdfasdf: 'asdf'
} as any
]
}
}).exec(),
'RxError',
'QU13'
);

col.database.destroy();
});
it('reusing exec should not make a execOverDatabase', async () => {
const col = await humansCollection.create(2);
const q = col.find().where('passportId').ne('Alice');
Expand Down

0 comments on commit 408c2cd

Please sign in to comment.