You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2020/02/27 13:32:30 UTC
[couchdb-nano] branch master updated: improve TypeScript
definitions for Mango selectors - fixes issue #202 (#205)
This is an automated email from the ASF dual-hosted git repository.
glynnbird pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
The following commit(s) were added to refs/heads/master by this push:
new ee50585 improve TypeScript definitions for Mango selectors - fixes issue #202 (#205)
ee50585 is described below
commit ee50585db97b0dc851ee939ba13ebf404cc78ff7
Author: Glynn Bird <gl...@gmail.com>
AuthorDate: Thu Feb 27 13:32:21 2020 +0000
improve TypeScript definitions for Mango selectors - fixes issue #202 (#205)
---
lib/nano.d.ts | 34 +++++++---------------------------
1 file changed, 7 insertions(+), 27 deletions(-)
diff --git a/lib/nano.d.ts b/lib/nano.d.ts
index 9f5d29f..1a5eb35 100644
--- a/lib/nano.d.ts
+++ b/lib/nano.d.ts
@@ -1274,36 +1274,16 @@ declare namespace nano {
update_seq: any;
}
- type MangoValue = number | string | Date | boolean | null;
-
// http://docs.couchdb.org/en/latest/api/database/find.html#selector-syntax
-
- enum ConditionOperands {
- $lt = '$lt',
- $lte = '$lte',
- $eq = '$eq',
- $ne = '$ne',
- $gte = '$gte',
- $gt = '$gt'
- }
-
- enum ArrayFieldOperands {
- $in = '$in',
- $nin = '$nin'
+ type MangoValue = number | string | Date | boolean | object | null;
+ type MangoOperator = '$lt' | '$lte' | '$eq' | '$ne' | '$gte' | '$gt' |
+ '$exists' | '$type' |
+ '$in' | '$nin' | '$size' | '$mod' | '$regex' |
+ '$or' | '$and' | '$nor' | '$not' | '$all' | '$allMatch' | '$elemMatch';
+ type MangoSelector = {
+ [K in MangoOperator]: MangoSelector | MangoValue | MangoValue[];
}
- enum CombinationOperands {
- $or = '$or',
- $and = '$and',
- $nor = '$nor',
- $all = '$all'
- }
-
- type MangoSelector = { [key: string]: MangoSelector | MangoValue | MangoValue[]; }
- | Partial<{ [key in ConditionOperands]: MangoValue; }>
- | Partial<{ [key in ArrayFieldOperands]: MangoValue[] }>
- | Partial<{ [key in CombinationOperands]: MangoSelector[] }>
-
// http://docs.couchdb.org/en/latest/api/database/find.html#sort-syntax
type SortOrder = string | string[] | { [key: string]: 'asc' | 'desc' };