Skip to content

Commit

Permalink
build: upgrade to ottoman 2.0 (GA)
Browse files Browse the repository at this point in the history
feathers-ottoman is now upgraded to support ottoman 2.0 (GA release)
  • Loading branch information
bwgjoseph committed Oct 10, 2021
1 parent 258a77e commit c6cc0dd
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

__IMPORTANT__: This is still in early development stage, please report any issue found

This library is written against [ottoman-2.0.0-beta.3](https://github.com/couchbaselabs/node-ottoman). It is tested against [Couchbase 7.0 BETA](https://docs.couchbase.com/server/7.0/introduction/intro.html) which supports [scope and collection](https://docs.couchbase.com/server/7.0/learn/data/scopes-and-collections.html) and it should work with current version, [Couchbase 6.6](https://docs.couchbase.com/server/current/introduction/intro.html)
This library is written against [ottoman-2.0.0](https://github.com/couchbaselabs/node-ottoman). It is tested against [Couchbase 7.0.1](https://docs.couchbase.com/server/7.0/introduction/intro.html) which supports [scope and collection](https://docs.couchbase.com/server/7.0/learn/data/scopes-and-collections.html)

---

Expand Down
82 changes: 45 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@feathersjs/adapter-commons": "^4.5.11",
"@feathersjs/errors": "^4.5.11",
"@feathersjs/feathers": "^4.5.11",
"ottoman": "2.0.0-beta.3"
"ottoman": "2.0.0"
},
"devDependencies": {
"@feathersjs/adapter-tests": "^4.5.11",
Expand Down
19 changes: 16 additions & 3 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import errors from '@feathersjs/errors';
import feathers from '@feathersjs/feathers';
import assert from 'assert';
import {
getDefaultInstance, getModel, Ottoman, Schema, SearchConsistency, ModelOptions,
getDefaultInstance, QueryScanConsistency, getModel, Ottoman, Schema, SearchConsistency, ModelOptions,
} from 'ottoman';
import { OttomanServiceOptions, Service } from '../src/index';
import customTestSuite from './methods.test';
Expand Down Expand Up @@ -83,7 +83,7 @@ const initOttoman = async () => {
ottoman = new Ottoman({ collectionName: '_default' });
}

ottoman.connect({
await ottoman.connect({
connectionString: 'couchbase://localhost',
bucketName: 'testBucket',
username: 'user',
Expand All @@ -109,12 +109,24 @@ const initOttoman = async () => {
return ottoman;
};

const initIndexes = async () => {
const createIndexQuery = `
CREATE PRIMARY INDEX ON \`testBucket\`.\`testpostscope\`.\`testpostcollection\`
`;

try {
await getDefaultInstance().cluster.query(createIndexQuery, { scanConsistency: QueryScanConsistency.RequestPlus });
} catch (err) {
console.error(err);
}
};

const removeDocuments = async () => {
const query = `
DELETE FROM \`testBucket\`.testpostscope.testpostcollection
`;
try {
await getDefaultInstance().cluster.query(query, { scanConsistency: 'request_plus' });
await getDefaultInstance().cluster.query(query, { scanConsistency: QueryScanConsistency.RequestPlus });
} catch (err) {
console.error(err);
throw err;
Expand All @@ -126,6 +138,7 @@ describe('Feathers Ottoman Service', () => {

before(async () => {
await initOttoman();
await initIndexes();
await removeDocuments();

const options: OttomanServiceOptions = {
Expand Down

0 comments on commit c6cc0dd

Please sign in to comment.