Skip to content

Commit d814403

Browse files
authored
Merge pull request #2 from tawk/prep-release
Prepare initial release
2 parents 48b1c5c + dd45480 commit d814403

25 files changed

+12296
-15095
lines changed

.eslintrc.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
module.exports = {
2+
root : true,
3+
env : {
4+
node : true,
5+
es2020 : true
6+
},
7+
parserOptions : {
8+
sourceType : 'module',
9+
ecmaVersion : 2022
10+
},
11+
extends : [
12+
'eslint:recommended',
13+
'standard'
14+
],
15+
plugins : [
16+
'newline-destructuring'
17+
],
18+
rules : {
19+
'no-console' : 'error',
20+
semi : ['error', 'always'],
21+
'key-spacing' : [
22+
'error',
23+
{
24+
beforeColon : true
25+
}
26+
],
27+
'space-before-function-paren' : [
28+
'error',
29+
{
30+
anonymous : 'always',
31+
named : 'never',
32+
asyncArrow : 'always'
33+
}
34+
],
35+
'operator-linebreak' : ['error', 'after'],
36+
'no-nested-ternary' : 'error',
37+
quotes : ['error', 'single'],
38+
'arrow-parens' : ['error', 'always'],
39+
'object-property-newline' : ['error', { allowMultiplePropertiesPerLine : false }],
40+
'object-curly-newline' : ['error', {
41+
minProperties : 2,
42+
multiline : true,
43+
consistent : true
44+
}],
45+
'newline-destructuring/newline' : ['error', {
46+
items : 1,
47+
consistent : true
48+
}],
49+
'class-methods-use-this' : 'warn',
50+
strict : ['warn', 'global'],
51+
'padding-line-between-statements' : [
52+
'warn',
53+
{
54+
blankLine : 'always',
55+
prev : 'multiline-expression',
56+
next : 'multiline-expression'
57+
}
58+
]
59+
},
60+
overrides : [
61+
{
62+
files : ['test/**/*.js'],
63+
env : {
64+
jest : true
65+
},
66+
rules : {
67+
'no-new' : 'warn'
68+
}
69+
}
70+
]
71+
};

.eslintrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

.prettierrc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
"@mixmaxhq/prettier-config"
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"jsxBracketSameLine": false,
8+
"jsxSingleQuote": true,
9+
"trailingComma": "es5",
10+
"bracketSpacing": true,
11+
"bracketSameLine": false,
12+
"arrowParens": "always",
13+
"endOfLine": "lf",
14+
"overrides": [
15+
{
16+
"files": "*.ts",
17+
"options": {
18+
"parser": "typescript"
19+
}
20+
}
21+
]
22+
}

CHANGELOG.md

Lines changed: 4 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,174 +1,5 @@
1-
### [8.1.3](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v8.1.2...v8.1.3) (2023-02-14)
1+
### 1.0.0
22

3-
4-
### Bug Fixes
5-
6-
* bump mongodb-memory-server dependency ([0bb0e3d](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/0bb0e3d5624cdc2a4420f885a00538a88ca86635))
7-
* regenerate package-lock.json ([659ec34](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/659ec34f4c9f2f58b8024f8507d7cf73f06a8854))
8-
9-
### [8.1.2](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v8.1.1...v8.1.2) (2022-08-26)
10-
11-
12-
### Bug Fixes
13-
14-
* use the transpiled version in node 12 ([a705377](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/a705377f0a191dd2f27482a8cd09f46ce5825829))
15-
16-
### [8.1.1](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v8.1.0...v8.1.1) (2022-08-26)
17-
18-
19-
### Bug Fixes
20-
21-
* properly page through undefs and nulls ([0eb28e7](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/0eb28e7f573511ef7fc8790e9c0fc84e5a997cef))
22-
23-
## [8.1.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v8.0.1...v8.1.0) (2022-08-25)
24-
25-
26-
### Features
27-
28-
* update babel to v7 ([6a86084](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/6a86084253a5b950e2549df3cb537e8c5eaef7c5))
29-
30-
### [8.0.1](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v8.0.0...v8.0.1) (2022-08-24)
31-
32-
33-
### Bug Fixes
34-
35-
* remove uses of the spread operator ([7e8a8c9](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/7e8a8c948a501e4a7aaff0896ac558ffe73971de))
36-
37-
## [8.0.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.8.0...v8.0.0) (2022-08-24)
38-
39-
40-
### ⚠ BREAKING CHANGES
41-
42-
* functional fixes and possible performance changes in `aggregate`.
43-
44-
### Features
45-
46-
* force a major release ([9c73e07](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/9c73e07f71176433e0ca3279996b3b9d5e39a175))
47-
48-
## [7.8.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.7.0...v7.8.0) (2022-08-23)
49-
50-
51-
### Features
52-
53-
* add a `sortCaseInsensitive` option to `find` and `aggregate` ([#323](https://github.com/mixmaxhq/mongo-cursor-pagination/issues/323)) ([f4543f6](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/f4543f643bac890c627d538e6200c5f5a1d45ebc))
54-
55-
56-
### Bug Fixes
57-
58-
* improve documentation and skip commit ([e33a493](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/e33a493f98712dbbdac2ea3ed6a9a5c731dea448))
59-
60-
## [7.7.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.6.1...v7.7.0) (2022-08-16)
61-
62-
63-
### Features
64-
65-
* allow collation as arg on find and aggregate ([cdfcfcb](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/cdfcfcbf355f177d0589341f603b0458e4fc5c64))
66-
* turn global collation off for single query ([c2ff6da](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/c2ff6dae5824820414d5286f91d0cd7eedf0ba90))
67-
68-
69-
### Bug Fixes
70-
71-
* skip commit with wrong scope ([#322](https://github.com/mixmaxhq/mongo-cursor-pagination/issues/322)) ([e2729ac](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/e2729ac584a483f28e1275f70eb7ebd8ec44556b))
72-
73-
### [7.6.1](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.6.0...v7.6.1) (2021-11-18)
74-
75-
76-
### Bug Fixes
77-
78-
* return _id when paginatedField is not set ([1a056d7](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/1a056d7ed291760c0734a22375d8c049b14b4aaf)), closes [#309](https://github.com/mixmaxhq/mongo-cursor-pagination/issues/309)
79-
80-
## [7.6.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.5.0...v7.6.0) (2021-08-26)
81-
82-
83-
### Features
84-
85-
* add support for aggregation `hint`s ([b90acd4](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/b90acd46c0d70c664ef5270e64a584f124558264))
86-
87-
## [7.5.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.4.0...v7.5.0) (2021-08-26)
88-
89-
90-
### Features
91-
92-
* extract/expose a function to encode pagination tokens ([04dc7fa](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/04dc7fafc0038393302442df8b472b1ad74b5d28))
93-
94-
95-
### Bug Fixes
96-
97-
* only export the function we need ([8f80382](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/8f8038275607f03b67966d0d116dab8b5c6ee9fa))
98-
99-
## [7.4.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.3.1...v7.4.0) (2021-03-08)
100-
101-
102-
### Features
103-
104-
* **mongoose-plugin:** add search function ([0efd73c](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/0efd73c9a5e53887226a4a1d2b61605a0e168514))
105-
106-
107-
### Bug Fixes
108-
109-
* skip bad commit message ([4c85357](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/4c85357f1079c6f73877ba6775b2eb6ad962c422))
110-
111-
### [7.3.1](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.3.0...v7.3.1) (2020-08-10)
112-
113-
114-
### Bug Fixes
115-
116-
* **bson:** fixes regression where string _ids were no longer supported ([1487195](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/1487195444fb1b6f151014522e498000d1dd452d))
117-
118-
## [7.3.0](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.2.1...v7.3.0) (2020-05-06)
119-
120-
121-
### Features
122-
123-
* **find:** add optional hint parameter for the cursor ([17616da](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/17616da43641ff2d455e70d96368e839afb216ae))
124-
125-
### [7.2.1](https://github.com/mixmaxhq/mongo-cursor-pagination/compare/v7.2.0...v7.2.1) (2020-05-06)
126-
127-
128-
### Bug Fixes
129-
130-
* apply no-var rule changes ([8cf0620](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/8cf0620b023ac460a62788b9d11763211d5a5f88))
131-
* comply with new eslint rules ([e5851bd](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/e5851bde1a86ab322aa6eac4c56995d98f80e74b))
132-
* eslint cleanup ([3c3c913](https://github.com/mixmaxhq/mongo-cursor-pagination/commit/3c3c91311cab97d51896f16c8463d73bdb7d9225))
133-
134-
## Changelog
135-
136-
* 7.2.0 Add support for `COLLATION` configuration parameter.
137-
138-
* 7.1.0 Add support for `aggregate`.
139-
140-
* 7.0.1 Update base64-url to fix security issue (https://github.com/mixmaxhq/mongo-cursor-pagination/pull/41 - thanks @pwiebe).
141-
142-
* 7.0.0 Add findWithReq overrideFields support. Breaking: now throws errors on unusable `fields`/`overrideFields`, so check your inputs. Also changes our intersection mechanism, so it _could_ cause backwards-incompatible changes to fields resolution. If causes unexpected backwards-incompatible changes, please file an issue!
143-
144-
* 6.3.0 Can be used as a Mongoose plugin
145-
146-
* 6.2.0 Added support for 'after' and 'before' parameters - thanks @lirbank
147-
148-
* 6.1.0 Added support for native mongodb driver (https://github.com/mixmaxhq/mongo-cursor-pagination/pull/24 - thanks @lirbank)
149-
150-
* 6.0.1 Fix issue where calling `find` with a paginated field that has dot notation e.g. `start.dateTime` produces an invalid `next` token.
151-
152-
* 6.0.0 Breaking API change: `mongo-cursor-pagination` requires a Promise enabled mongodb instance from `mongoist` and returns Promises from `find`, `findWithReq`, and `search` rather than handling callbacks. *Note: Although the library now uses `async/await`, it is still useable in node >= 6.9.0.*
153-
154-
* 5.0.0 Now `50` results are returned by default, and up to `300` results can be returned if the `limit` parameter is used. These can be overridden by setting `mongoPaging.config.DEFAULT_LIMIT` and `mongoPaging.config.MAX_LIMIT` respectively.
155-
156-
* 4.1.1 Fixed bug that would overwrite `$or` in queries passed in.
157-
158-
* 4.1.0 Adds `sortAscending` option to sort by the `paginatedField` ascending. Defaults to false (existing behavior).
159-
160-
* 4.0.0 Breaking API change: `next` and `previous` attributes are now always returned with every response (in case the client wants to poll for new changes). New attributes `hasPrevious` and `hasNext` should now be used know if there are more results in the previous or next page. Before the change, `next` and `previously` could not be replied upon to know if there were more pages.
161-
162-
* 3.1.1 Don't use `let` for backwards compatibility.
163-
164-
* 3.1.0 `findInReq()` now accepts dot notation for fields. So you can pass `?fields=users.userId` to only turn the `userId` property for `users` in the response.
165-
166-
* 3.0.1 Fixed bug where the \_id field was always returned when a paginatedField was used.
167-
168-
* 3.0.0 Breaking API change: `find()` no longer accepts a string for `limit`. Added `findWithReq`.
169-
170-
* 2.0.0 Changed API to so you now set global config on the config object instead of the root export itself (e.g. `require('mongo-cursor-pagination').config.MAX_LIMIT = 100`). The default `MAX_LIMIT` is now a more reasonable 25 instead of 100. Added `search()`. Fixed edge case where pages will be incorrect if paginatedField has duplicate values.
171-
172-
* 1.1.0 Add `MAX_LIMIT` global setting to clamp
173-
174-
* 1.0.0 Initial release
3+
- Initial port from [mixmaxhq/mongo-cursor-pagination@8.1.13](https://github.com/mixmaxhq/mongo-cursor-pagination)
4+
- Removed support for express and mongoose and mongoist in favor of supporting native client only
5+
- Updated development tooling to be self-contained

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
# mongo-cursor-pagination
1+
# @tawk.to/mongo-cursor-pagination
22

3-
[![Build Status](https://travis-ci.org/mixmaxhq/mongo-cursor-pagination.svg?branch=master)](https://travis-ci.org/mixmaxhq/mongo-cursor-pagination)
4-
5-
This module aids in implementing "cursor-based" pagination using Mongo range queries or relevancy-based search results. **This module is currently used in production for the [Mixmax API](https://developer.mixmax.com) to return millions of results a day**.
6-
7-
### New
8-
9-
- [Now Supports Mongoose](https://github.com/mixmaxhq/mongo-cursor-pagination#with-mongoose)
3+
This module aids in implementing "cursor-based" pagination using Mongo range queries or relevancy-based search results.
104

115
## Background
126

@@ -28,7 +22,7 @@ Here are some examples of cursor-based APIs:
2822

2923
## Install
3024

31-
`npm install mongo-cursor-pagination --save`
25+
`npm install @tawk.to/mongo-cursor-pagination --save`
3226

3327
## Usage
3428

@@ -389,12 +383,6 @@ db.people.createIndex({
389383
390384
To run tests, you first must [start a Mongo server on port 27017](https://mongodb.github.io/node-mongodb-native/2.2/quick-start/) and then run `npm test`.
391385
392-
## Future ideas
393-
394-
- Add support to `search()` to query previous pages.
386+
## TODOs
395387
396-
## Publishing a new version
397-
398-
```
399-
GH_TOKEN=xxx npx semantic-release --no-ci
400-
```
388+
- Convert to typescript and add proper typing

jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
clearMocks: true,
3-
collectCoverageFrom: ['src/**/*.js'],
4-
testEnvironment: 'node',
2+
clearMocks : true,
3+
collectCoverageFrom : ['src/**/*.js'],
4+
testEnvironment : 'node'
55
};

0 commit comments

Comments
 (0)