Skip to content

Commit

Permalink
1.1.1 fix typescript interface definitions & update copyright
Browse files Browse the repository at this point in the history
* replace Observable with Subscribable in arguments
* subdivide read/write signatures
  • Loading branch information
smcatala committed Feb 12, 2017
1 parent b5c36b6 commit 25360a8
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 47 deletions.
15 changes: 9 additions & 6 deletions README.md
Expand Up @@ -8,7 +8,7 @@ thin RXJS abstraction layer for pouchDB with
`read` and `write` RXJS operators.

## example
a live version of this example can be viewed [here](https://cdn.rawgit.com/ZenyWay/rx-pouchdb/v1.1.0-experimental/spec/example/index.html)
a live version of this example can be viewed [here](https://cdn.rawgit.com/ZenyWay/rx-pouchdb/v1.1.1-experimental/spec/example/index.html)
in the browser console,
or by cloning this repository and running the following commands from a terminal:
```bash
Expand All @@ -18,7 +18,7 @@ npm run example
the files of this example are available [in this repository](./spec/example).

```ts
import newRxPouchDb from 'rx-pouchdb/dist'
import newRxPouchDb, { DocId, VersionedDoc } from 'rx-pouchdb/dist'
import debug = require('debug')
const PouchDB = require('pouchdb-browser') // no valid type definitions for TS2
debug.enable('example:*,rx-pouchdb:*') // rx-pouchdb uses `debug`
Expand Down Expand Up @@ -46,9 +46,12 @@ const docs = [{
release: '1987'
}]]

const refs = docs.map(function getId (doc: any): any {
return Array.isArray(doc) ? doc.map(getId) : { _id: doc._id }
})
function getId <D extends VersionedDoc>(doc: D): DocId
function getId <D extends VersionedDoc>(doc: D[]|D) {
return Array.isArray(doc) ? doc.map(getId) : <DocId>{ _id: doc._id }
}

const refs = docs.map(getId)

// write docs to vault
const write$ = sids.write(docs)
Expand Down Expand Up @@ -77,7 +80,7 @@ write$.forEach(debug('example:write:'))
`ES5` and [`Typescript`](http://www.typescriptlang.org/) compatible.
Coded in `Typescript 2`.

run the [unit tests](https://cdn.rawgit.com/ZenyWay/rx-pouchdb/v1.1.0-experimental/spec/web/index.html)
run the [unit tests](https://cdn.rawgit.com/ZenyWay/rx-pouchdb/v1.1.1-experimental/spec/web/index.html)
in your browser.

# <a name="contributing"></a> CONTRIBUTING
Expand Down
28 changes: 14 additions & 14 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "rx-pouchdb",
"version": "1.1.0",
"version": "1.1.1",
"description": "thin RXJS abstraction layer for pouchDB: read and write RXJS operators",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -50,26 +50,26 @@
},
"homepage": "https://github.com/zenyway/rx-pouchdb#readme",
"dependencies": {
"@types/bluebird": "^3.0.37",
"@types/debug": "0.0.29",
"bluebird": "^3.4.7",
"debug": "^2.6.0",
"rxjs": "^5.0.3",
"debug": "^2.6.1",
"rxjs": "^5.1.0",
"tslib": "^1.5.0"
},
"devDependencies": {
"@types/jasmine": "^2.5.41",
"@types/node": "^7.0.4",
"@types/bluebird": "^3.0.37",
"@types/debug": "0.0.29",
"@types/jasmine": "^2.5.42",
"@types/node": "^7.0.5",
"browserify": "^14.0.0",
"browserify-istanbul": "^2.0.0",
"concurrently": "^3.1.0",
"coveralls": "^2.11.15",
"concurrently": "^3.2.0",
"coveralls": "^2.11.16",
"cpx": "^1.5.0",
"eslint": "^3.14.1",
"eslint": "^3.15.0",
"http-server": "^0.9.0",
"istanbul": "^0.4.5",
"jasmine-core": "^2.5.2",
"karma": "^1.4.0",
"karma": "^1.4.1",
"karma-browserify": "^5.1.1",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
Expand All @@ -80,12 +80,12 @@
"karma-safari-launcher": "^1.0.0",
"karma-spec-reporter": "0.0.26",
"mkdirp": "^0.5.1",
"pouchdb-browser": "^6.1.1",
"remap-istanbul": "^0.8.4",
"pouchdb-browser": "^6.1.2",
"remap-istanbul": "^0.9.1",
"rimraf": "^2.5.4",
"standard": "^8.6.0",
"tsify": "^3.0.1",
"typescript": "^2.1.5",
"typescript": "^2.1.6",
"uglifyify": "^3.0.4",
"watchify": "^3.9.0"
}
Expand Down
13 changes: 13 additions & 0 deletions spec/example/index.html
@@ -1,3 +1,16 @@
<!--
Copyright 2017 Stephane M. Catala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
Limitations under the License.
-->
<head>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion spec/example/index.js

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

13 changes: 8 additions & 5 deletions spec/example/index.ts
@@ -1,5 +1,5 @@
/**
* Copyright 2016 Stephane M. Catala
* Copyright 2017 Stephane M. Catala
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,7 @@
* Limitations under the License.
*/
;
import newRxPouchDb from '../../src'
import newRxPouchDb, { DocId, VersionedDoc } from '../../src'
import debug = require('debug')
const PouchDB = require('pouchdb-browser') // no valid type definitions for TS2
debug.enable('example:*,rx-pouchdb:*') // rx-pouchdb uses `debug`
Expand Down Expand Up @@ -40,9 +40,12 @@ const docs = [{
release: '1987'
}]]

const refs = docs.map(function getId (doc: any): any {
return Array.isArray(doc) ? doc.map(getId) : { _id: doc._id }
})
function getId <D extends VersionedDoc>(doc: D): DocId
function getId <D extends VersionedDoc>(doc: D[]|D) {
return Array.isArray(doc) ? doc.map(getId) : <DocId>{ _id: doc._id }
}

const refs = docs.map(getId)

// write docs to vault
const write$ = sids.write(docs)
Expand Down
2 changes: 1 addition & 1 deletion spec/index.spec.ts
@@ -1,5 +1,5 @@
/**
* Copyright 2016 Stephane M. Catala
* Copyright 2017 Stephane M. Catala
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion spec/karma-coverage.conf.js
@@ -1,5 +1,5 @@
/**
* Copyright 2016 Stephane M. Catala
* Copyright 2017 Stephane M. Catala
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion spec/karma.conf.js
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Stephane M. Catala
* Copyright 2017 Stephane M. Catala
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion spec/web/index.html
@@ -1,5 +1,5 @@
<!--
Copyright 2016 Stephane M. Catala
Copyright 2017 Stephane M. Catala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions spec/web/index.spec.js

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

2 changes: 1 addition & 1 deletion src/core-db-io.ts
@@ -1,5 +1,5 @@
/**
* Copyright 2016 Stephane M. Catala
* Copyright 2017 Stephane M. Catala
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/db-io.ts
@@ -1,5 +1,5 @@
/**
* Copyright 2016 Stephane M. Catala
* Copyright 2017 Stephane M. Catala
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 25360a8

Please sign in to comment.