You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@alipay/faas-db-builder

Package Overview
Dependencies
Maintainers
3
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.18-alpha.5 to 1.1.18-alpha.6

esm/command/update/shift.d.ts

13

esm/command/AggregatePipeline.d.ts
import { Sort } from '../common/constant';
import type { LookupAggregateParam, ReplaceRootParam, SampleAggregateParam, UnwindParam } from '../typing';
import type { AggregateGeoNearParam, LookupAggregateParam, ReplaceRootParam, SampleAggregateParam, UnwindParam, bucketAutoParam, bucketParam } from '../typing';
import type { AggregateCommand, QueryChainCommand } from './AbstractCommand';

@@ -19,7 +19,17 @@ export declare class AggregatePipeline {

unwind(unwind: string | UnwindParam): this;
geoNear(near: AggregateGeoNearParam): this;
bucket(bucket: bucketParam): this;
bucketAuto(bucketAuto: bucketAutoParam): this;
sortByCount(sortByCount: string | object): this;
done(): ({
$geoNear: any;
$match?: undefined;
$sort?: undefined;
} | {
$match: any;
$geoNear?: undefined;
$sort?: undefined;
} | {
[x: string]: any;
$geoNear?: undefined;
$match?: undefined;

@@ -29,2 +39,3 @@ $sort?: undefined;

$sort: {};
$geoNear?: undefined;
$match?: undefined;

@@ -31,0 +42,0 @@ })[];

2

esm/command/AggregatePipeline.js

@@ -1,1 +0,1 @@

import{PipelineStageName as e,Sort as u}from"../common/constant";import{DbBuildError as c}from"../common/error";import{AggregateRequest as h}from"./AggregateRequest";import{QueryRequest as m}from"./QueryRequest";var l=function(){function r(){this.pipeline=[]}r.prototype.addFields=function(t){this.pushStage(e.addFields,t);return this};r.prototype.count=function(t){this.pushStage(e.count,t);return this};r.prototype.match=function(t){this.pushStage(e.match,t);return this};r.prototype.group=function(t){this.pushStage(e.group,t);return this};r.prototype.project=function(t){this.pushStage(e.project,t);return this};r.prototype.replaceRoot=function(t){this.pushStage(e.replaceRoot,t);return this};r.prototype.sample=function(t){this.pushStage(e.sample,t);return this};r.prototype.lookup=function(t){this.pushStage(e.lookup,t);return this};r.prototype.sort=function(t){this.pushStage(e.sort,t);return this};r.prototype.limit=function(t){this.pushStage(e.limit,t);return this};r.prototype.skip=function(t){this.pushStage(e.skip,t);return this};r.prototype.unwind=function(t){this.pushStage(e.unwind,t);return this};r.prototype.done=function(){return this.pipeline.map(function(t){var i,p;switch(t.name){case e.match:return{$match:new m(t.param).toJSON()};case e.count:case e.sample:case e.lookup:case e.limit:case e.skip:case e.unwind:return i={},i[t.name]=t.param,i;case e.addFields:case e.group:case e.project:case e.replaceRoot:return p={},p[t.name]=new h(t.param).toJSON(),p;case e.sort:return{$sort:Object.keys(t.param).reduce(function(n,a){var o;switch(t.param[a]){case u.DESC:o=-1;break;case u.ASC:o=1;break;case 1:o=1;break;case-1:o=-1;break;default:o=1}n[a]=o;return n},{})};default:{var s=t.name;throw c.invalidParam(s,"\u4E0D\u652F\u6301\u7684 aggregate \u64CD\u4F5C")}}})};r.prototype.pushStage=function(t,i){this.pipeline.push({name:t,param:i})};return r}();export{l as AggregatePipeline};
var a=function(){a=Object.assign||function(r){for(var t,o=1,u=arguments.length;o<u;o++){t=arguments[o];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))r[n]=t[n]}return r};return a.apply(this,arguments)};import{PipelineStageName as e,Sort as c}from"../common/constant";import{DbBuildError as f}from"../common/error";import{GeoPoint as l}from"../mongo-builder/Geo";import{AggregateRequest as g}from"./AggregateRequest";import{QueryRequest as h}from"./QueryRequest";var y=function(){function r(){this.pipeline=[]}r.prototype.addFields=function(t){this.pushStage(e.addFields,t);return this};r.prototype.count=function(t){this.pushStage(e.count,t);return this};r.prototype.match=function(t){this.pushStage(e.match,t);return this};r.prototype.group=function(t){this.pushStage(e.group,t);return this};r.prototype.project=function(t){this.pushStage(e.project,t);return this};r.prototype.replaceRoot=function(t){this.pushStage(e.replaceRoot,t);return this};r.prototype.sample=function(t){this.pushStage(e.sample,t);return this};r.prototype.lookup=function(t){this.pushStage(e.lookup,t);return this};r.prototype.sort=function(t){this.pushStage(e.sort,t);return this};r.prototype.limit=function(t){this.pushStage(e.limit,t);return this};r.prototype.skip=function(t){this.pushStage(e.skip,t);return this};r.prototype.unwind=function(t){this.pushStage(e.unwind,t);return this};r.prototype.geoNear=function(t){this.pushStage(e.geoNear,t);return this};r.prototype.bucket=function(t){this.pushStage(e.bucket,t);return this};r.prototype.bucketAuto=function(t){this.pushStage(e.bucketAuto,t);return this};r.prototype.sortByCount=function(t){this.pushStage(e.sortByCount,t);return this};r.prototype.done=function(){return this.pipeline.map(function(t){var o,u;switch(t.name){case e.geoNear:{var n=a({},t.param);if(t.param.query){n.query=new h(t.param.query).toJSON()}if(t.param.near instanceof l){n.near=t.param.near.toJSON()}return{$geoNear:n}}case e.match:return{$match:new h(t.param).toJSON()};case e.count:case e.sample:case e.lookup:case e.limit:case e.skip:case e.unwind:return o={},o[t.name]=t.param,o;case e.addFields:case e.group:case e.sortByCount:case e.project:case e.bucket:case e.bucketAuto:case e.replaceRoot:return u={},u[t.name]=new g(t.param).toJSON(),u;case e.sort:return{$sort:Object.keys(t.param).reduce(function(p,s){var i;switch(t.param[s]){case c.DESC:i=-1;break;case c.ASC:i=1;break;case 1:i=1;break;case-1:i=-1;break;default:i=1}p[s]=i;return p},{})};default:{var m=t.name;throw f.invalidParam(m,"\u4E0D\u652F\u6301\u7684 aggregate \u64CD\u4F5C")}}})};r.prototype.pushStage=function(t,o){this.pipeline.push({name:t,param:o})};return r}();export{y as AggregatePipeline};

@@ -21,2 +21,4 @@ import { Sort } from '../common/constant';

import { GeoIntersectsCommand, GeoNearCommand, GeoWithinCommand } from './query/geo';
import { UnShiftCommand } from './update/unshift';
import { ShiftCommand } from './update/shift';
export declare class AggregateCommandFactory {

@@ -130,2 +132,4 @@ pipeline(): AggregatePipeline;

geoIntersects(val: GeoIntersectsParam): GeoIntersectsCommand;
unshift(val: any[]): UnShiftCommand;
shift(): ShiftCommand;
and(cmd: Array<object | QueryCommand | QueryChain>): QueryChain;

@@ -132,0 +136,0 @@ and(...cmd: Array<object | QueryCommand | QueryChain>): QueryChain;

@@ -1,1 +0,1 @@

var p=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,m;n<a;n++){if(m||!(n in r)){if(!m)m=Array.prototype.slice.call(r,0,n);m[n]=r[n]}}return t.concat(m||Array.prototype.slice.call(r))};import{Sort as y}from"../common/constant";import{AbsAggregateCommand as f,AddAggregateCommand as A,AddToSetAggregateCommand as d,AndAggregateCommand as c,ArrayElemAtAggregateCommand as w,AvgAggregateCommand as C,CeilAggregateCommand as s,CMPAggregateCommand as l,ConcatAggregateCommand as v,CondAggregateCommand as h,CountAggregateCommand as S,DateToStringAggregateCommand as x,DivideAggregateCommand as M,EqAggregateCommand as b,ExpAggregateCommand as L,FirstAggregateCommand as q,FloorAggregateCommand as N,GtAggregateCommand as I,GteAggregateCommand as T,IfNullAggregateCommand as E,InAggregateCommand as P,IndexOfArrayAggregateCommand as G,IsArrayAggregateCommand as O,ISOWeekAggregateCommand as W,LastAggregateCommand as k,LetAggregateCommand as z,LnAggregateCommand as F,Log10AggregateCommand as j,LogAggregateCommand as B,LtAggregateCommand as D,LteAggregateCommand as R,MapAggregateCommand as U,MaxAggregateCommand as Q,MergeObjectsAggregateCommand as Y,MinAggregateCommand as H,ModAggregateCommand as J,MonthAggregateCommand as K,MultiplyAggregateCommand as V,NeqAggregateCommand as X,NotAggregateCommand as Z,OrAggregateCommand as $,PowAggregateCommand as _,PushAggregateCommand as rr,SizeAggregateCommand as tr,SliceAggregateCommand as nr,SplitAggregateCommand as er,SqrtAggregateCommand as or,SubstrAggregateCommand as ar,SubstrBytesAggregateCommand as mr,SubtractAggregateCommand as pr,SumAggregateCommand as ur,SwitchAggregateCommand as gr,ToLowerAggregateCommand as ir,ToUpperAggregateCommand as yr,TruncAggregateCommand as fr,WeekAggregateCommand as Ar,YearAggregateCommand as dr}from"./aggregate";import{AggregatePipeline as cr}from"./AggregatePipeline";import{AllCommand as wr}from"./query/all";import{AndCommand as Cr,NorCommand as sr,NotCommand as lr,OrCommand as vr}from"./query/logic";import{ElemMatchCommand as hr}from"./query/elemMatch";import{EqCommand as Sr}from"./query/eq";import{ExistsCommand as xr}from"./query/exists";import{ExprCommand as Mr}from"./query/expr";import{GtCommand as br}from"./query/gt";import{GteCommand as Lr}from"./query/gte";import{InCommand as qr}from"./query/in";import{LtCommand as Nr}from"./query/lt";import{LteCommand as Ir}from"./query/lte";import{ModCommand as Tr}from"./query/mod";import{NeqCommand as Er}from"./query/neq";import{NinCommand as Pr}from"./query/nin";import{QueryChain as o}from"./query/QueryChain";import{SizeCommand as Gr}from"./query/size";import{AddToSetCommand as Or}from"./update/addToSet";import{IncCommand as Wr}from"./update/inc";import{MaxCommand as kr}from"./update/max";import{MinCommand as zr}from"./update/min";import{MulCommand as Fr}from"./update/mul";import{PopCommand as jr}from"./update/pop";import{PullCommand as Br}from"./update/pull";import{PullAllCommand as Dr}from"./update/pullAll";import{PushCommand as u}from"./update/push";import{RemoveCommand as Rr}from"./update/remove";import{RenameCommand as Ur}from"./update/rename";import{SetCommand as Qr}from"./update/set";import{GeoIntersectsCommand as Yr,GeoNearCommand as Hr,GeoWithinCommand as Jr}from"./query/geo";var g=function(){function t(){}t.prototype.pipeline=function(){return new cr};t.prototype.avg=function(r){return new C(r)};t.prototype.count=function(){return new S};t.prototype.max=function(r){return new Q(r)};t.prototype.min=function(r){return new H(r)};t.prototype.sum=function(r){return new ur(r)};t.prototype.and=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new c(a)};t.prototype.or=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new $(a)};t.prototype.not=function(r){return new Z(r)};t.prototype.cmp=function(r,e){var n=Array.isArray(r)?r:[r,e];return new l(n)};t.prototype.eq=function(r,e){var n=Array.isArray(r)?r:[r,e];return new b(n)};t.prototype.neq=function(r,e){var n=Array.isArray(r)?r:[r,e];return new X(n)};t.prototype.lt=function(r,e){var n=Array.isArray(r)?r:[r,e];return new D(n)};t.prototype.lte=function(r,e){var n=Array.isArray(r)?r:[r,e];return new R(n)};t.prototype.gt=function(r,e){var n=Array.isArray(r)?r:[r,e];return new I(n)};t.prototype.gte=function(r,e){var n=Array.isArray(r)?r:[r,e];return new T(n)};t.prototype.addToSet=function(r){return new d(r)};t.prototype.arrayElemAt=function(r,e){var n=Array.isArray(r)?r:[r,e];return new w(n)};t.prototype.indexOfArray=function(r,e,n,a){var m=Array.isArray(r)?r:[r,e,n,a].filter(function(i){return i!==void 0});return new G(m)};t.prototype.isArray=function(r){return new O(r)};t.prototype.size=function(r){return new tr(r)};t.prototype.in=function(r,e){var n=Array.isArray(r)?r:[r,e];return new P(n)};t.prototype.slice=function(r,e,n){var a=Array.isArray(r)?r:[r,e,n].filter(function(m){return m!==void 0});return new nr(a)};t.prototype.map=function(r){return new U(r)};t.prototype.ifNull=function(r,e){var n=Array.isArray(r)?r:[r,e];return new E(n)};t.prototype.cond=function(r){return new h(r)};t.prototype.switch=function(r){return new gr(r)};t.prototype.concat=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new v(a)};t.prototype.dateToString=function(r){return new x(r)};t.prototype.toLower=function(r){return new ir(r)};t.prototype.toUpper=function(r){return new yr(r)};t.prototype.split=function(r,e){var n=Array.isArray(r)?r:[r,e];return new er(n)};t.prototype.substr=function(r,e,n){var a=Array.isArray(r)?r:[r,e,n];return new ar(a)};t.prototype.substrBytes=function(r,e,n){var a=Array.isArray(r)?r:[r,e,n];return new mr(a)};t.prototype.first=function(r){return new q(r)};t.prototype.last=function(r){return new k(r)};t.prototype.push=function(r){return new rr(r)};t.prototype.let=function(r){return new z(r)};t.prototype.add=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new A(a)};t.prototype.subtract=function(r,e){var n=Array.isArray(r)?r:[r,e];return new pr(n)};t.prototype.multiply=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new V(a)};t.prototype.divide=function(r,e){var n=Array.isArray(r)?r:[r,e];return new M(n)};t.prototype.abs=function(r){return new f(r)};t.prototype.ceil=function(r){return new s(r)};t.prototype.exp=function(r){return new L(r)};t.prototype.floor=function(r){return new N(r)};t.prototype.ln=function(r){return new F(r)};t.prototype.log=function(r,e){var n=Array.isArray(r)?r:[r,e];return new B(n)};t.prototype.log10=function(r){return new j(r)};t.prototype.mod=function(r,e){var n=Array.isArray(r)?r:[r,e];return new J(n)};t.prototype.pow=function(r,e){var n=Array.isArray(r)?r:[r,e];return new _(n)};t.prototype.sqrt=function(r){return new or(r)};t.prototype.trunc=function(r){return new fr(r)};t.prototype.mergeObjects=function(r){return new Y(r)};t.prototype.month=function(r){return new K(r)};t.prototype.year=function(r){return new dr(r)};t.prototype.week=function(r){return new Ar(r)};t.prototype.isoWeek=function(r){return new W(r)};return t}();export{g as AggregateCommandFactory};var Kr=function(){function t(){this.aggregate=new g;this.Sort=y}t.prototype.addToSet=function(r){return new Or(r)};t.prototype.inc=function(r){return new Wr(r)};t.prototype.max=function(r){return new kr(r)};t.prototype.min=function(r){return new zr(r)};t.prototype.mul=function(r){return new Fr(r)};t.prototype.pop=function(r){return new jr(r)};t.prototype.pull=function(r){return new Br(r)};t.prototype.pullAll=function(r){return new Dr(r)};t.prototype.push=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}return new(u.bind.apply(u,p([void 0,r],e,false)))};t.prototype.remove=function(){return new Rr};t.prototype.rename=function(r){return new Ur(r)};t.prototype.set=function(r){return new Qr(r)};t.prototype.expr=function(r){return new Mr(r)};t.prototype.geoWithin=function(r){return new Jr(r)};t.prototype.geoNear=function(r){return new Hr(r)};t.prototype.geoIntersects=function(r){return new Yr(r)};t.prototype.and=function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}r=Array.isArray(r[0])?r[0]:r;var n=new Cr(r.map(o.unchain));return new o(n)};t.prototype.or=function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}r=Array.isArray(r[0])?r[0]:r;var n=new vr(r.map(o.unchain));return new o(n)};t.prototype.not=function(r){var e=new lr(o.unchain(r));return new o(e)};t.prototype.nor=function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}r=Array.isArray(r[0])?r[0]:r;var n=new sr(r.map(o.unchain));return new o(n)};t.prototype.eq=function(r){return new o(new Sr(r))};t.prototype.neq=function(r){return new o(new Er(r))};t.prototype.lt=function(r){return new o(new Nr(r))};t.prototype.lte=function(r){return new o(new Ir(r))};t.prototype.gt=function(r){return new o(new br(r))};t.prototype.gte=function(r){return new o(new Lr(r))};t.prototype.in=function(r){return new o(new qr(r))};t.prototype.nin=function(r){return new o(new Pr(r))};t.prototype.exists=function(r){return new o(new xr(r))};t.prototype.mod=function(r,e){return new o(new Tr(r,e))};t.prototype.all=function(r){return new o(new wr(r))};t.prototype.elemMatch=function(r){return new o(new hr(o.unchain(r)))};t.prototype.size=function(r){return new o(new Gr(r))};return t}();export{Kr as Command};
var p=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,m;n<a;n++){if(m||!(n in r)){if(!m)m=Array.prototype.slice.call(r,0,n);m[n]=r[n]}}return t.concat(m||Array.prototype.slice.call(r))};import{Sort as y}from"../common/constant";import{AbsAggregateCommand as f,AddAggregateCommand as A,AddToSetAggregateCommand as d,AndAggregateCommand as c,ArrayElemAtAggregateCommand as w,AvgAggregateCommand as C,CeilAggregateCommand as s,CMPAggregateCommand as l,ConcatAggregateCommand as v,CondAggregateCommand as h,CountAggregateCommand as S,DateToStringAggregateCommand as x,DivideAggregateCommand as M,EqAggregateCommand as b,ExpAggregateCommand as L,FirstAggregateCommand as q,FloorAggregateCommand as N,GtAggregateCommand as I,GteAggregateCommand as T,IfNullAggregateCommand as E,InAggregateCommand as P,IndexOfArrayAggregateCommand as G,IsArrayAggregateCommand as O,ISOWeekAggregateCommand as W,LastAggregateCommand as k,LetAggregateCommand as z,LnAggregateCommand as F,Log10AggregateCommand as U,LogAggregateCommand as j,LtAggregateCommand as B,LteAggregateCommand as D,MapAggregateCommand as R,MaxAggregateCommand as Q,MergeObjectsAggregateCommand as Y,MinAggregateCommand as H,ModAggregateCommand as J,MonthAggregateCommand as K,MultiplyAggregateCommand as V,NeqAggregateCommand as X,NotAggregateCommand as Z,OrAggregateCommand as $,PowAggregateCommand as _,PushAggregateCommand as rr,SizeAggregateCommand as tr,SliceAggregateCommand as nr,SplitAggregateCommand as er,SqrtAggregateCommand as or,SubstrAggregateCommand as ar,SubstrBytesAggregateCommand as mr,SubtractAggregateCommand as pr,SumAggregateCommand as ur,SwitchAggregateCommand as gr,ToLowerAggregateCommand as ir,ToUpperAggregateCommand as yr,TruncAggregateCommand as fr,WeekAggregateCommand as Ar,YearAggregateCommand as dr}from"./aggregate";import{AggregatePipeline as cr}from"./AggregatePipeline";import{AllCommand as wr}from"./query/all";import{AndCommand as Cr,NorCommand as sr,NotCommand as lr,OrCommand as vr}from"./query/logic";import{ElemMatchCommand as hr}from"./query/elemMatch";import{EqCommand as Sr}from"./query/eq";import{ExistsCommand as xr}from"./query/exists";import{ExprCommand as Mr}from"./query/expr";import{GtCommand as br}from"./query/gt";import{GteCommand as Lr}from"./query/gte";import{InCommand as qr}from"./query/in";import{LtCommand as Nr}from"./query/lt";import{LteCommand as Ir}from"./query/lte";import{ModCommand as Tr}from"./query/mod";import{NeqCommand as Er}from"./query/neq";import{NinCommand as Pr}from"./query/nin";import{QueryChain as o}from"./query/QueryChain";import{SizeCommand as Gr}from"./query/size";import{AddToSetCommand as Or}from"./update/addToSet";import{IncCommand as Wr}from"./update/inc";import{MaxCommand as kr}from"./update/max";import{MinCommand as zr}from"./update/min";import{MulCommand as Fr}from"./update/mul";import{PopCommand as Ur}from"./update/pop";import{PullCommand as jr}from"./update/pull";import{PullAllCommand as Br}from"./update/pullAll";import{PushCommand as u}from"./update/push";import{RemoveCommand as Dr}from"./update/remove";import{RenameCommand as Rr}from"./update/rename";import{SetCommand as Qr}from"./update/set";import{GeoIntersectsCommand as Yr,GeoNearCommand as Hr,GeoWithinCommand as Jr}from"./query/geo";import{UnShiftCommand as Kr}from"./update/unshift";import{ShiftCommand as Vr}from"./update/shift";var g=function(){function t(){}t.prototype.pipeline=function(){return new cr};t.prototype.avg=function(r){return new C(r)};t.prototype.count=function(){return new S};t.prototype.max=function(r){return new Q(r)};t.prototype.min=function(r){return new H(r)};t.prototype.sum=function(r){return new ur(r)};t.prototype.and=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new c(a)};t.prototype.or=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new $(a)};t.prototype.not=function(r){return new Z(r)};t.prototype.cmp=function(r,e){var n=Array.isArray(r)?r:[r,e];return new l(n)};t.prototype.eq=function(r,e){var n=Array.isArray(r)?r:[r,e];return new b(n)};t.prototype.neq=function(r,e){var n=Array.isArray(r)?r:[r,e];return new X(n)};t.prototype.lt=function(r,e){var n=Array.isArray(r)?r:[r,e];return new B(n)};t.prototype.lte=function(r,e){var n=Array.isArray(r)?r:[r,e];return new D(n)};t.prototype.gt=function(r,e){var n=Array.isArray(r)?r:[r,e];return new I(n)};t.prototype.gte=function(r,e){var n=Array.isArray(r)?r:[r,e];return new T(n)};t.prototype.addToSet=function(r){return new d(r)};t.prototype.arrayElemAt=function(r,e){var n=Array.isArray(r)?r:[r,e];return new w(n)};t.prototype.indexOfArray=function(r,e,n,a){var m=Array.isArray(r)?r:[r,e,n,a].filter(function(i){return i!==void 0});return new G(m)};t.prototype.isArray=function(r){return new O(r)};t.prototype.size=function(r){return new tr(r)};t.prototype.in=function(r,e){var n=Array.isArray(r)?r:[r,e];return new P(n)};t.prototype.slice=function(r,e,n){var a=Array.isArray(r)?r:[r,e,n].filter(function(m){return m!==void 0});return new nr(a)};t.prototype.map=function(r){return new R(r)};t.prototype.ifNull=function(r,e){var n=Array.isArray(r)?r:[r,e];return new E(n)};t.prototype.cond=function(r){return new h(r)};t.prototype.switch=function(r){return new gr(r)};t.prototype.concat=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new v(a)};t.prototype.dateToString=function(r){return new x(r)};t.prototype.toLower=function(r){return new ir(r)};t.prototype.toUpper=function(r){return new yr(r)};t.prototype.split=function(r,e){var n=Array.isArray(r)?r:[r,e];return new er(n)};t.prototype.substr=function(r,e,n){var a=Array.isArray(r)?r:[r,e,n];return new ar(a)};t.prototype.substrBytes=function(r,e,n){var a=Array.isArray(r)?r:[r,e,n];return new mr(a)};t.prototype.first=function(r){return new q(r)};t.prototype.last=function(r){return new k(r)};t.prototype.push=function(r){return new rr(r)};t.prototype.let=function(r){return new z(r)};t.prototype.add=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new A(a)};t.prototype.subtract=function(r,e){var n=Array.isArray(r)?r:[r,e];return new pr(n)};t.prototype.multiply=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var a=Array.isArray(r)?r:p([r],e,true);return new V(a)};t.prototype.divide=function(r,e){var n=Array.isArray(r)?r:[r,e];return new M(n)};t.prototype.abs=function(r){return new f(r)};t.prototype.ceil=function(r){return new s(r)};t.prototype.exp=function(r){return new L(r)};t.prototype.floor=function(r){return new N(r)};t.prototype.ln=function(r){return new F(r)};t.prototype.log=function(r,e){var n=Array.isArray(r)?r:[r,e];return new j(n)};t.prototype.log10=function(r){return new U(r)};t.prototype.mod=function(r,e){var n=Array.isArray(r)?r:[r,e];return new J(n)};t.prototype.pow=function(r,e){var n=Array.isArray(r)?r:[r,e];return new _(n)};t.prototype.sqrt=function(r){return new or(r)};t.prototype.trunc=function(r){return new fr(r)};t.prototype.mergeObjects=function(r){return new Y(r)};t.prototype.month=function(r){return new K(r)};t.prototype.year=function(r){return new dr(r)};t.prototype.week=function(r){return new Ar(r)};t.prototype.isoWeek=function(r){return new W(r)};return t}();export{g as AggregateCommandFactory};var Xr=function(){function t(){this.aggregate=new g;this.Sort=y}t.prototype.addToSet=function(r){return new Or(r)};t.prototype.inc=function(r){return new Wr(r)};t.prototype.max=function(r){return new kr(r)};t.prototype.min=function(r){return new zr(r)};t.prototype.mul=function(r){return new Fr(r)};t.prototype.pop=function(r){return new Ur(r)};t.prototype.pull=function(r){return new jr(r)};t.prototype.pullAll=function(r){return new Br(r)};t.prototype.push=function(r){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}return new(u.bind.apply(u,p([void 0,r],e,false)))};t.prototype.remove=function(){return new Dr};t.prototype.rename=function(r){return new Rr(r)};t.prototype.set=function(r){return new Qr(r)};t.prototype.expr=function(r){return new Mr(r)};t.prototype.geoWithin=function(r){return new Jr(r)};t.prototype.geoNear=function(r){return new Hr(r)};t.prototype.geoIntersects=function(r){return new Yr(r)};t.prototype.unshift=function(r){return new Kr(r)};t.prototype.shift=function(){return new Vr};t.prototype.and=function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}r=Array.isArray(r[0])?r[0]:r;var n=new Cr(r.map(o.unchain));return new o(n)};t.prototype.or=function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}r=Array.isArray(r[0])?r[0]:r;var n=new vr(r.map(o.unchain));return new o(n)};t.prototype.not=function(r){var e=new lr(o.unchain(r));return new o(e)};t.prototype.nor=function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}r=Array.isArray(r[0])?r[0]:r;var n=new sr(r.map(o.unchain));return new o(n)};t.prototype.eq=function(r){return new o(new Sr(r))};t.prototype.neq=function(r){return new o(new Er(r))};t.prototype.lt=function(r){return new o(new Nr(r))};t.prototype.lte=function(r){return new o(new Ir(r))};t.prototype.gt=function(r){return new o(new br(r))};t.prototype.gte=function(r){return new o(new Lr(r))};t.prototype.in=function(r){return new o(new qr(r))};t.prototype.nin=function(r){return new o(new Pr(r))};t.prototype.exists=function(r){return new o(new xr(r))};t.prototype.mod=function(r,e){return new o(new Tr(r,e))};t.prototype.all=function(r){return new o(new wr(r))};t.prototype.elemMatch=function(r){return new o(new hr(o.unchain(r)))};t.prototype.size=function(r){return new o(new Gr(r))};return t}();export{Xr as Command};

@@ -40,3 +40,7 @@ export declare enum Sort {

skip = "$skip",
unwind = "$unwind"
unwind = "$unwind",
geoNear = "$geoNear",
bucket = "$bucket",
bucketAuto = "$bucketAuto",
sortByCount = "$sortByCount"
}

@@ -1,1 +0,1 @@

export var Sort;(function(r){r["DESC"]="desc";r["ASC"]="asc"})(Sort||(Sort={}));export var CollectionAction;(function(r){r["update"]="update";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create"})(CollectionAction||(CollectionAction={}));export var DocumentAction;(function(r){r["update"]="update";r["findOneAndUpdate"]="findOneAndUpdate";r["replace"]="replace";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create";r["batchCreate"]="batchCreate";r["count"]="count";r["aggregate"]="aggregate"})(DocumentAction||(DocumentAction={}));export var Target;(function(r){r["collection"]="collection";r["document"]="document"})(Target||(Target={}));export var PipelineStageName;(function(r){r["addFields"]="$addFields";r["count"]="$count";r["match"]="$match";r["group"]="$group";r["project"]="$project";r["replaceRoot"]="$replaceRoot";r["sample"]="$sample";r["lookup"]="$lookup";r["sort"]="$sort";r["limit"]="$limit";r["skip"]="$skip";r["unwind"]="$unwind"})(PipelineStageName||(PipelineStageName={}));
export var Sort;(function(r){r["DESC"]="desc";r["ASC"]="asc"})(Sort||(Sort={}));export var CollectionAction;(function(r){r["update"]="update";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create"})(CollectionAction||(CollectionAction={}));export var DocumentAction;(function(r){r["update"]="update";r["findOneAndUpdate"]="findOneAndUpdate";r["replace"]="replace";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create";r["batchCreate"]="batchCreate";r["count"]="count";r["aggregate"]="aggregate"})(DocumentAction||(DocumentAction={}));export var Target;(function(r){r["collection"]="collection";r["document"]="document"})(Target||(Target={}));export var PipelineStageName;(function(r){r["addFields"]="$addFields";r["count"]="$count";r["match"]="$match";r["group"]="$group";r["project"]="$project";r["replaceRoot"]="$replaceRoot";r["sample"]="$sample";r["lookup"]="$lookup";r["sort"]="$sort";r["limit"]="$limit";r["skip"]="$skip";r["unwind"]="$unwind";r["geoNear"]="$geoNear";r["bucket"]="$bucket";r["bucketAuto"]="$bucketAuto";r["sortByCount"]="$sortByCount"})(PipelineStageName||(PipelineStageName={}));

@@ -154,1 +154,24 @@ import { AggregateCommand } from './command/AbstractCommand';

}
export interface AggregateGeoNearParam {
near: GeoPoint;
spherical?: boolean;
maxDistance?: number;
minDistance?: number;
query?: object;
distanceMultiplier?: number;
distanceField: string;
includeLocs?: string;
key?: string;
}
export interface bucketParam {
groupBy: AggregateExpression;
boundaries: Array<number>;
default?: string;
output?: object;
}
export interface bucketAutoParam {
groupBy: AggregateExpression;
buckets: number;
granularity?: string;
output?: object;
}
import { Sort } from '../common/constant';
import type { LookupAggregateParam, ReplaceRootParam, SampleAggregateParam, UnwindParam } from '../typing';
import type { AggregateGeoNearParam, LookupAggregateParam, ReplaceRootParam, SampleAggregateParam, UnwindParam, bucketAutoParam, bucketParam } from '../typing';
import type { AggregateCommand, QueryChainCommand } from './AbstractCommand';

@@ -19,7 +19,17 @@ export declare class AggregatePipeline {

unwind(unwind: string | UnwindParam): this;
geoNear(near: AggregateGeoNearParam): this;
bucket(bucket: bucketParam): this;
bucketAuto(bucketAuto: bucketAutoParam): this;
sortByCount(sortByCount: string | object): this;
done(): ({
$geoNear: any;
$match?: undefined;
$sort?: undefined;
} | {
$match: any;
$geoNear?: undefined;
$sort?: undefined;
} | {
[x: string]: any;
$geoNear?: undefined;
$match?: undefined;

@@ -29,2 +39,3 @@ $sort?: undefined;

$sort: {};
$geoNear?: undefined;
$match?: undefined;

@@ -31,0 +42,0 @@ })[];

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AggregatePipeline=void 0;var constant_1=require("../common/constant");var error_1=require("../common/error");var AggregateRequest_1=require("./AggregateRequest");var QueryRequest_1=require("./QueryRequest");var AggregatePipeline=function(){function t(){this.pipeline=[]}t.prototype.addFields=function(e){this.pushStage(constant_1.PipelineStageName.addFields,e);return this};t.prototype.count=function(e){this.pushStage(constant_1.PipelineStageName.count,e);return this};t.prototype.match=function(e){this.pushStage(constant_1.PipelineStageName.match,e);return this};t.prototype.group=function(e){this.pushStage(constant_1.PipelineStageName.group,e);return this};t.prototype.project=function(e){this.pushStage(constant_1.PipelineStageName.project,e);return this};t.prototype.replaceRoot=function(e){this.pushStage(constant_1.PipelineStageName.replaceRoot,e);return this};t.prototype.sample=function(e){this.pushStage(constant_1.PipelineStageName.sample,e);return this};t.prototype.lookup=function(e){this.pushStage(constant_1.PipelineStageName.lookup,e);return this};t.prototype.sort=function(e){this.pushStage(constant_1.PipelineStageName.sort,e);return this};t.prototype.limit=function(e){this.pushStage(constant_1.PipelineStageName.limit,e);return this};t.prototype.skip=function(e){this.pushStage(constant_1.PipelineStageName.skip,e);return this};t.prototype.unwind=function(e){this.pushStage(constant_1.PipelineStageName.unwind,e);return this};t.prototype.done=function(){return this.pipeline.map(function(e){var a,r;switch(e.name){case constant_1.PipelineStageName.match:return{$match:new QueryRequest_1.QueryRequest(e.param).toJSON()};case constant_1.PipelineStageName.count:case constant_1.PipelineStageName.sample:case constant_1.PipelineStageName.lookup:case constant_1.PipelineStageName.limit:case constant_1.PipelineStageName.skip:case constant_1.PipelineStageName.unwind:return a={},a[e.name]=e.param,a;case constant_1.PipelineStageName.addFields:case constant_1.PipelineStageName.group:case constant_1.PipelineStageName.project:case constant_1.PipelineStageName.replaceRoot:return r={},r[e.name]=new AggregateRequest_1.AggregateRequest(e.param).toJSON(),r;case constant_1.PipelineStageName.sort:return{$sort:Object.keys(e.param).reduce(function(n,p){var i;switch(e.param[p]){case constant_1.Sort.DESC:i=-1;break;case constant_1.Sort.ASC:i=1;break;case 1:i=1;break;case-1:i=-1;break;default:i=1}n[p]=i;return n},{})};default:{var o=e.name;throw error_1.DbBuildError.invalidParam(o,"\u4E0D\u652F\u6301\u7684 aggregate \u64CD\u4F5C")}}})};t.prototype.pushStage=function(e,a){this.pipeline.push({name:e,param:a})};return t}();exports.AggregatePipeline=AggregatePipeline;
"use strict";var __assign=this&&this.__assign||function(){__assign=Object.assign||function(t){for(var e,a=1,n=arguments.length;a<n;a++){e=arguments[a];for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i))t[i]=e[i]}return t};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});exports.AggregatePipeline=void 0;var constant_1=require("../common/constant");var error_1=require("../common/error");var Geo_1=require("../mongo-builder/Geo");var AggregateRequest_1=require("./AggregateRequest");var QueryRequest_1=require("./QueryRequest");var AggregatePipeline=function(){function t(){this.pipeline=[]}t.prototype.addFields=function(e){this.pushStage(constant_1.PipelineStageName.addFields,e);return this};t.prototype.count=function(e){this.pushStage(constant_1.PipelineStageName.count,e);return this};t.prototype.match=function(e){this.pushStage(constant_1.PipelineStageName.match,e);return this};t.prototype.group=function(e){this.pushStage(constant_1.PipelineStageName.group,e);return this};t.prototype.project=function(e){this.pushStage(constant_1.PipelineStageName.project,e);return this};t.prototype.replaceRoot=function(e){this.pushStage(constant_1.PipelineStageName.replaceRoot,e);return this};t.prototype.sample=function(e){this.pushStage(constant_1.PipelineStageName.sample,e);return this};t.prototype.lookup=function(e){this.pushStage(constant_1.PipelineStageName.lookup,e);return this};t.prototype.sort=function(e){this.pushStage(constant_1.PipelineStageName.sort,e);return this};t.prototype.limit=function(e){this.pushStage(constant_1.PipelineStageName.limit,e);return this};t.prototype.skip=function(e){this.pushStage(constant_1.PipelineStageName.skip,e);return this};t.prototype.unwind=function(e){this.pushStage(constant_1.PipelineStageName.unwind,e);return this};t.prototype.geoNear=function(e){this.pushStage(constant_1.PipelineStageName.geoNear,e);return this};t.prototype.bucket=function(e){this.pushStage(constant_1.PipelineStageName.bucket,e);return this};t.prototype.bucketAuto=function(e){this.pushStage(constant_1.PipelineStageName.bucketAuto,e);return this};t.prototype.sortByCount=function(e){this.pushStage(constant_1.PipelineStageName.sortByCount,e);return this};t.prototype.done=function(){return this.pipeline.map(function(e){var a,n;switch(e.name){case constant_1.PipelineStageName.geoNear:{var i=__assign({},e.param);if(e.param.query){i.query=new QueryRequest_1.QueryRequest(e.param.query).toJSON()}if(e.param.near instanceof Geo_1.GeoPoint){i.near=e.param.near.toJSON()}return{$geoNear:i}}case constant_1.PipelineStageName.match:return{$match:new QueryRequest_1.QueryRequest(e.param).toJSON()};case constant_1.PipelineStageName.count:case constant_1.PipelineStageName.sample:case constant_1.PipelineStageName.lookup:case constant_1.PipelineStageName.limit:case constant_1.PipelineStageName.skip:case constant_1.PipelineStageName.unwind:return a={},a[e.name]=e.param,a;case constant_1.PipelineStageName.addFields:case constant_1.PipelineStageName.group:case constant_1.PipelineStageName.sortByCount:case constant_1.PipelineStageName.project:case constant_1.PipelineStageName.bucket:case constant_1.PipelineStageName.bucketAuto:case constant_1.PipelineStageName.replaceRoot:return n={},n[e.name]=new AggregateRequest_1.AggregateRequest(e.param).toJSON(),n;case constant_1.PipelineStageName.sort:return{$sort:Object.keys(e.param).reduce(function(o,p){var r;switch(e.param[p]){case constant_1.Sort.DESC:r=-1;break;case constant_1.Sort.ASC:r=1;break;case 1:r=1;break;case-1:r=-1;break;default:r=1}o[p]=r;return o},{})};default:{var u=e.name;throw error_1.DbBuildError.invalidParam(u,"\u4E0D\u652F\u6301\u7684 aggregate \u64CD\u4F5C")}}})};t.prototype.pushStage=function(e,a){this.pipeline.push({name:e,param:a})};return t}();exports.AggregatePipeline=AggregatePipeline;

@@ -21,2 +21,4 @@ import { Sort } from '../common/constant';

import { GeoIntersectsCommand, GeoNearCommand, GeoWithinCommand } from './query/geo';
import { UnShiftCommand } from './update/unshift';
import { ShiftCommand } from './update/shift';
export declare class AggregateCommandFactory {

@@ -130,2 +132,4 @@ pipeline(): AggregatePipeline;

geoIntersects(val: GeoIntersectsParam): GeoIntersectsCommand;
unshift(val: any[]): UnShiftCommand;
shift(): ShiftCommand;
and(cmd: Array<object | QueryCommand | QueryChain>): QueryChain;

@@ -132,0 +136,0 @@ and(...cmd: Array<object | QueryCommand | QueryChain>): QueryChain;

@@ -1,1 +0,1 @@

"use strict";var __spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||arguments.length===2)for(var n=0,o=r.length,a;n<o;n++){if(a||!(n in r)){if(!a)a=Array.prototype.slice.call(r,0,n);a[n]=r[n]}}return e.concat(a||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:true});exports.Command=exports.AggregateCommandFactory=void 0;var constant_1=require("../common/constant");var aggregate_1=require("./aggregate");var AggregatePipeline_1=require("./AggregatePipeline");var all_1=require("./query/all");var logic_1=require("./query/logic");var elemMatch_1=require("./query/elemMatch");var eq_1=require("./query/eq");var exists_1=require("./query/exists");var expr_1=require("./query/expr");var gt_1=require("./query/gt");var gte_1=require("./query/gte");var in_1=require("./query/in");var lt_1=require("./query/lt");var lte_1=require("./query/lte");var mod_1=require("./query/mod");var neq_1=require("./query/neq");var nin_1=require("./query/nin");var QueryChain_1=require("./query/QueryChain");var size_1=require("./query/size");var addToSet_1=require("./update/addToSet");var inc_1=require("./update/inc");var max_1=require("./update/max");var min_1=require("./update/min");var mul_1=require("./update/mul");var pop_1=require("./update/pop");var pull_1=require("./update/pull");var pullAll_1=require("./update/pullAll");var push_1=require("./update/push");var remove_1=require("./update/remove");var rename_1=require("./update/rename");var set_1=require("./update/set");var geo_1=require("./query/geo");var AggregateCommandFactory=function(){function e(){}e.prototype.pipeline=function(){return new AggregatePipeline_1.AggregatePipeline};e.prototype.avg=function(r){return new aggregate_1.AvgAggregateCommand(r)};e.prototype.count=function(){return new aggregate_1.CountAggregateCommand};e.prototype.max=function(r){return new aggregate_1.MaxAggregateCommand(r)};e.prototype.min=function(r){return new aggregate_1.MinAggregateCommand(r)};e.prototype.sum=function(r){return new aggregate_1.SumAggregateCommand(r)};e.prototype.and=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.AndAggregateCommand(o)};e.prototype.or=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.OrAggregateCommand(o)};e.prototype.not=function(r){return new aggregate_1.NotAggregateCommand(r)};e.prototype.cmp=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.CMPAggregateCommand(n)};e.prototype.eq=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.EqAggregateCommand(n)};e.prototype.neq=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.NeqAggregateCommand(n)};e.prototype.lt=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.LtAggregateCommand(n)};e.prototype.lte=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.LteAggregateCommand(n)};e.prototype.gt=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.GtAggregateCommand(n)};e.prototype.gte=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.GteAggregateCommand(n)};e.prototype.addToSet=function(r){return new aggregate_1.AddToSetAggregateCommand(r)};e.prototype.arrayElemAt=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.ArrayElemAtAggregateCommand(n)};e.prototype.indexOfArray=function(r,t,n,o){var a=Array.isArray(r)?r:[r,t,n,o].filter(function(u){return u!==void 0});return new aggregate_1.IndexOfArrayAggregateCommand(a)};e.prototype.isArray=function(r){return new aggregate_1.IsArrayAggregateCommand(r)};e.prototype.size=function(r){return new aggregate_1.SizeAggregateCommand(r)};e.prototype.in=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.InAggregateCommand(n)};e.prototype.slice=function(r,t,n){var o=Array.isArray(r)?r:[r,t,n].filter(function(a){return a!==void 0});return new aggregate_1.SliceAggregateCommand(o)};e.prototype.map=function(r){return new aggregate_1.MapAggregateCommand(r)};e.prototype.ifNull=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.IfNullAggregateCommand(n)};e.prototype.cond=function(r){return new aggregate_1.CondAggregateCommand(r)};e.prototype.switch=function(r){return new aggregate_1.SwitchAggregateCommand(r)};e.prototype.concat=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.ConcatAggregateCommand(o)};e.prototype.dateToString=function(r){return new aggregate_1.DateToStringAggregateCommand(r)};e.prototype.toLower=function(r){return new aggregate_1.ToLowerAggregateCommand(r)};e.prototype.toUpper=function(r){return new aggregate_1.ToUpperAggregateCommand(r)};e.prototype.split=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.SplitAggregateCommand(n)};e.prototype.substr=function(r,t,n){var o=Array.isArray(r)?r:[r,t,n];return new aggregate_1.SubstrAggregateCommand(o)};e.prototype.substrBytes=function(r,t,n){var o=Array.isArray(r)?r:[r,t,n];return new aggregate_1.SubstrBytesAggregateCommand(o)};e.prototype.first=function(r){return new aggregate_1.FirstAggregateCommand(r)};e.prototype.last=function(r){return new aggregate_1.LastAggregateCommand(r)};e.prototype.push=function(r){return new aggregate_1.PushAggregateCommand(r)};e.prototype.let=function(r){return new aggregate_1.LetAggregateCommand(r)};e.prototype.add=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.AddAggregateCommand(o)};e.prototype.subtract=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.SubtractAggregateCommand(n)};e.prototype.multiply=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.MultiplyAggregateCommand(o)};e.prototype.divide=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.DivideAggregateCommand(n)};e.prototype.abs=function(r){return new aggregate_1.AbsAggregateCommand(r)};e.prototype.ceil=function(r){return new aggregate_1.CeilAggregateCommand(r)};e.prototype.exp=function(r){return new aggregate_1.ExpAggregateCommand(r)};e.prototype.floor=function(r){return new aggregate_1.FloorAggregateCommand(r)};e.prototype.ln=function(r){return new aggregate_1.LnAggregateCommand(r)};e.prototype.log=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.LogAggregateCommand(n)};e.prototype.log10=function(r){return new aggregate_1.Log10AggregateCommand(r)};e.prototype.mod=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.ModAggregateCommand(n)};e.prototype.pow=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.PowAggregateCommand(n)};e.prototype.sqrt=function(r){return new aggregate_1.SqrtAggregateCommand(r)};e.prototype.trunc=function(r){return new aggregate_1.TruncAggregateCommand(r)};e.prototype.mergeObjects=function(r){return new aggregate_1.MergeObjectsAggregateCommand(r)};e.prototype.month=function(r){return new aggregate_1.MonthAggregateCommand(r)};e.prototype.year=function(r){return new aggregate_1.YearAggregateCommand(r)};e.prototype.week=function(r){return new aggregate_1.WeekAggregateCommand(r)};e.prototype.isoWeek=function(r){return new aggregate_1.ISOWeekAggregateCommand(r)};return e}();exports.AggregateCommandFactory=AggregateCommandFactory;var Command=function(){function e(){this.aggregate=new AggregateCommandFactory;this.Sort=constant_1.Sort}e.prototype.addToSet=function(r){return new addToSet_1.AddToSetCommand(r)};e.prototype.inc=function(r){return new inc_1.IncCommand(r)};e.prototype.max=function(r){return new max_1.MaxCommand(r)};e.prototype.min=function(r){return new min_1.MinCommand(r)};e.prototype.mul=function(r){return new mul_1.MulCommand(r)};e.prototype.pop=function(r){return new pop_1.PopCommand(r)};e.prototype.pull=function(r){return new pull_1.PullCommand(r)};e.prototype.pullAll=function(r){return new pullAll_1.PullAllCommand(r)};e.prototype.push=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}return new(push_1.PushCommand.bind.apply(push_1.PushCommand,__spreadArray([void 0,r],t,false)))};e.prototype.remove=function(){return new remove_1.RemoveCommand};e.prototype.rename=function(r){return new rename_1.RenameCommand(r)};e.prototype.set=function(r){return new set_1.SetCommand(r)};e.prototype.expr=function(r){return new expr_1.ExprCommand(r)};e.prototype.geoWithin=function(r){return new geo_1.GeoWithinCommand(r)};e.prototype.geoNear=function(r){return new geo_1.GeoNearCommand(r)};e.prototype.geoIntersects=function(r){return new geo_1.GeoIntersectsCommand(r)};e.prototype.and=function(){var r=[];for(var t=0;t<arguments.length;t++){r[t]=arguments[t]}r=Array.isArray(r[0])?r[0]:r;var n=new logic_1.AndCommand(r.map(QueryChain_1.QueryChain.unchain));return new QueryChain_1.QueryChain(n)};e.prototype.or=function(){var r=[];for(var t=0;t<arguments.length;t++){r[t]=arguments[t]}r=Array.isArray(r[0])?r[0]:r;var n=new logic_1.OrCommand(r.map(QueryChain_1.QueryChain.unchain));return new QueryChain_1.QueryChain(n)};e.prototype.not=function(r){var t=new logic_1.NotCommand(QueryChain_1.QueryChain.unchain(r));return new QueryChain_1.QueryChain(t)};e.prototype.nor=function(){var r=[];for(var t=0;t<arguments.length;t++){r[t]=arguments[t]}r=Array.isArray(r[0])?r[0]:r;var n=new logic_1.NorCommand(r.map(QueryChain_1.QueryChain.unchain));return new QueryChain_1.QueryChain(n)};e.prototype.eq=function(r){return new QueryChain_1.QueryChain(new eq_1.EqCommand(r))};e.prototype.neq=function(r){return new QueryChain_1.QueryChain(new neq_1.NeqCommand(r))};e.prototype.lt=function(r){return new QueryChain_1.QueryChain(new lt_1.LtCommand(r))};e.prototype.lte=function(r){return new QueryChain_1.QueryChain(new lte_1.LteCommand(r))};e.prototype.gt=function(r){return new QueryChain_1.QueryChain(new gt_1.GtCommand(r))};e.prototype.gte=function(r){return new QueryChain_1.QueryChain(new gte_1.GteCommand(r))};e.prototype.in=function(r){return new QueryChain_1.QueryChain(new in_1.InCommand(r))};e.prototype.nin=function(r){return new QueryChain_1.QueryChain(new nin_1.NinCommand(r))};e.prototype.exists=function(r){return new QueryChain_1.QueryChain(new exists_1.ExistsCommand(r))};e.prototype.mod=function(r,t){return new QueryChain_1.QueryChain(new mod_1.ModCommand(r,t))};e.prototype.all=function(r){return new QueryChain_1.QueryChain(new all_1.AllCommand(r))};e.prototype.elemMatch=function(r){return new QueryChain_1.QueryChain(new elemMatch_1.ElemMatchCommand(QueryChain_1.QueryChain.unchain(r)))};e.prototype.size=function(r){return new QueryChain_1.QueryChain(new size_1.SizeCommand(r))};return e}();exports.Command=Command;
"use strict";var __spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||arguments.length===2)for(var n=0,o=r.length,a;n<o;n++){if(a||!(n in r)){if(!a)a=Array.prototype.slice.call(r,0,n);a[n]=r[n]}}return e.concat(a||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:true});exports.Command=exports.AggregateCommandFactory=void 0;var constant_1=require("../common/constant");var aggregate_1=require("./aggregate");var AggregatePipeline_1=require("./AggregatePipeline");var all_1=require("./query/all");var logic_1=require("./query/logic");var elemMatch_1=require("./query/elemMatch");var eq_1=require("./query/eq");var exists_1=require("./query/exists");var expr_1=require("./query/expr");var gt_1=require("./query/gt");var gte_1=require("./query/gte");var in_1=require("./query/in");var lt_1=require("./query/lt");var lte_1=require("./query/lte");var mod_1=require("./query/mod");var neq_1=require("./query/neq");var nin_1=require("./query/nin");var QueryChain_1=require("./query/QueryChain");var size_1=require("./query/size");var addToSet_1=require("./update/addToSet");var inc_1=require("./update/inc");var max_1=require("./update/max");var min_1=require("./update/min");var mul_1=require("./update/mul");var pop_1=require("./update/pop");var pull_1=require("./update/pull");var pullAll_1=require("./update/pullAll");var push_1=require("./update/push");var remove_1=require("./update/remove");var rename_1=require("./update/rename");var set_1=require("./update/set");var geo_1=require("./query/geo");var unshift_1=require("./update/unshift");var shift_1=require("./update/shift");var AggregateCommandFactory=function(){function e(){}e.prototype.pipeline=function(){return new AggregatePipeline_1.AggregatePipeline};e.prototype.avg=function(r){return new aggregate_1.AvgAggregateCommand(r)};e.prototype.count=function(){return new aggregate_1.CountAggregateCommand};e.prototype.max=function(r){return new aggregate_1.MaxAggregateCommand(r)};e.prototype.min=function(r){return new aggregate_1.MinAggregateCommand(r)};e.prototype.sum=function(r){return new aggregate_1.SumAggregateCommand(r)};e.prototype.and=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.AndAggregateCommand(o)};e.prototype.or=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.OrAggregateCommand(o)};e.prototype.not=function(r){return new aggregate_1.NotAggregateCommand(r)};e.prototype.cmp=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.CMPAggregateCommand(n)};e.prototype.eq=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.EqAggregateCommand(n)};e.prototype.neq=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.NeqAggregateCommand(n)};e.prototype.lt=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.LtAggregateCommand(n)};e.prototype.lte=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.LteAggregateCommand(n)};e.prototype.gt=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.GtAggregateCommand(n)};e.prototype.gte=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.GteAggregateCommand(n)};e.prototype.addToSet=function(r){return new aggregate_1.AddToSetAggregateCommand(r)};e.prototype.arrayElemAt=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.ArrayElemAtAggregateCommand(n)};e.prototype.indexOfArray=function(r,t,n,o){var a=Array.isArray(r)?r:[r,t,n,o].filter(function(u){return u!==void 0});return new aggregate_1.IndexOfArrayAggregateCommand(a)};e.prototype.isArray=function(r){return new aggregate_1.IsArrayAggregateCommand(r)};e.prototype.size=function(r){return new aggregate_1.SizeAggregateCommand(r)};e.prototype.in=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.InAggregateCommand(n)};e.prototype.slice=function(r,t,n){var o=Array.isArray(r)?r:[r,t,n].filter(function(a){return a!==void 0});return new aggregate_1.SliceAggregateCommand(o)};e.prototype.map=function(r){return new aggregate_1.MapAggregateCommand(r)};e.prototype.ifNull=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.IfNullAggregateCommand(n)};e.prototype.cond=function(r){return new aggregate_1.CondAggregateCommand(r)};e.prototype.switch=function(r){return new aggregate_1.SwitchAggregateCommand(r)};e.prototype.concat=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.ConcatAggregateCommand(o)};e.prototype.dateToString=function(r){return new aggregate_1.DateToStringAggregateCommand(r)};e.prototype.toLower=function(r){return new aggregate_1.ToLowerAggregateCommand(r)};e.prototype.toUpper=function(r){return new aggregate_1.ToUpperAggregateCommand(r)};e.prototype.split=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.SplitAggregateCommand(n)};e.prototype.substr=function(r,t,n){var o=Array.isArray(r)?r:[r,t,n];return new aggregate_1.SubstrAggregateCommand(o)};e.prototype.substrBytes=function(r,t,n){var o=Array.isArray(r)?r:[r,t,n];return new aggregate_1.SubstrBytesAggregateCommand(o)};e.prototype.first=function(r){return new aggregate_1.FirstAggregateCommand(r)};e.prototype.last=function(r){return new aggregate_1.LastAggregateCommand(r)};e.prototype.push=function(r){return new aggregate_1.PushAggregateCommand(r)};e.prototype.let=function(r){return new aggregate_1.LetAggregateCommand(r)};e.prototype.add=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.AddAggregateCommand(o)};e.prototype.subtract=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.SubtractAggregateCommand(n)};e.prototype.multiply=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}var o=Array.isArray(r)?r:__spreadArray([r],t,true);return new aggregate_1.MultiplyAggregateCommand(o)};e.prototype.divide=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.DivideAggregateCommand(n)};e.prototype.abs=function(r){return new aggregate_1.AbsAggregateCommand(r)};e.prototype.ceil=function(r){return new aggregate_1.CeilAggregateCommand(r)};e.prototype.exp=function(r){return new aggregate_1.ExpAggregateCommand(r)};e.prototype.floor=function(r){return new aggregate_1.FloorAggregateCommand(r)};e.prototype.ln=function(r){return new aggregate_1.LnAggregateCommand(r)};e.prototype.log=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.LogAggregateCommand(n)};e.prototype.log10=function(r){return new aggregate_1.Log10AggregateCommand(r)};e.prototype.mod=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.ModAggregateCommand(n)};e.prototype.pow=function(r,t){var n=Array.isArray(r)?r:[r,t];return new aggregate_1.PowAggregateCommand(n)};e.prototype.sqrt=function(r){return new aggregate_1.SqrtAggregateCommand(r)};e.prototype.trunc=function(r){return new aggregate_1.TruncAggregateCommand(r)};e.prototype.mergeObjects=function(r){return new aggregate_1.MergeObjectsAggregateCommand(r)};e.prototype.month=function(r){return new aggregate_1.MonthAggregateCommand(r)};e.prototype.year=function(r){return new aggregate_1.YearAggregateCommand(r)};e.prototype.week=function(r){return new aggregate_1.WeekAggregateCommand(r)};e.prototype.isoWeek=function(r){return new aggregate_1.ISOWeekAggregateCommand(r)};return e}();exports.AggregateCommandFactory=AggregateCommandFactory;var Command=function(){function e(){this.aggregate=new AggregateCommandFactory;this.Sort=constant_1.Sort}e.prototype.addToSet=function(r){return new addToSet_1.AddToSetCommand(r)};e.prototype.inc=function(r){return new inc_1.IncCommand(r)};e.prototype.max=function(r){return new max_1.MaxCommand(r)};e.prototype.min=function(r){return new min_1.MinCommand(r)};e.prototype.mul=function(r){return new mul_1.MulCommand(r)};e.prototype.pop=function(r){return new pop_1.PopCommand(r)};e.prototype.pull=function(r){return new pull_1.PullCommand(r)};e.prototype.pullAll=function(r){return new pullAll_1.PullAllCommand(r)};e.prototype.push=function(r){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}return new(push_1.PushCommand.bind.apply(push_1.PushCommand,__spreadArray([void 0,r],t,false)))};e.prototype.remove=function(){return new remove_1.RemoveCommand};e.prototype.rename=function(r){return new rename_1.RenameCommand(r)};e.prototype.set=function(r){return new set_1.SetCommand(r)};e.prototype.expr=function(r){return new expr_1.ExprCommand(r)};e.prototype.geoWithin=function(r){return new geo_1.GeoWithinCommand(r)};e.prototype.geoNear=function(r){return new geo_1.GeoNearCommand(r)};e.prototype.geoIntersects=function(r){return new geo_1.GeoIntersectsCommand(r)};e.prototype.unshift=function(r){return new unshift_1.UnShiftCommand(r)};e.prototype.shift=function(){return new shift_1.ShiftCommand};e.prototype.and=function(){var r=[];for(var t=0;t<arguments.length;t++){r[t]=arguments[t]}r=Array.isArray(r[0])?r[0]:r;var n=new logic_1.AndCommand(r.map(QueryChain_1.QueryChain.unchain));return new QueryChain_1.QueryChain(n)};e.prototype.or=function(){var r=[];for(var t=0;t<arguments.length;t++){r[t]=arguments[t]}r=Array.isArray(r[0])?r[0]:r;var n=new logic_1.OrCommand(r.map(QueryChain_1.QueryChain.unchain));return new QueryChain_1.QueryChain(n)};e.prototype.not=function(r){var t=new logic_1.NotCommand(QueryChain_1.QueryChain.unchain(r));return new QueryChain_1.QueryChain(t)};e.prototype.nor=function(){var r=[];for(var t=0;t<arguments.length;t++){r[t]=arguments[t]}r=Array.isArray(r[0])?r[0]:r;var n=new logic_1.NorCommand(r.map(QueryChain_1.QueryChain.unchain));return new QueryChain_1.QueryChain(n)};e.prototype.eq=function(r){return new QueryChain_1.QueryChain(new eq_1.EqCommand(r))};e.prototype.neq=function(r){return new QueryChain_1.QueryChain(new neq_1.NeqCommand(r))};e.prototype.lt=function(r){return new QueryChain_1.QueryChain(new lt_1.LtCommand(r))};e.prototype.lte=function(r){return new QueryChain_1.QueryChain(new lte_1.LteCommand(r))};e.prototype.gt=function(r){return new QueryChain_1.QueryChain(new gt_1.GtCommand(r))};e.prototype.gte=function(r){return new QueryChain_1.QueryChain(new gte_1.GteCommand(r))};e.prototype.in=function(r){return new QueryChain_1.QueryChain(new in_1.InCommand(r))};e.prototype.nin=function(r){return new QueryChain_1.QueryChain(new nin_1.NinCommand(r))};e.prototype.exists=function(r){return new QueryChain_1.QueryChain(new exists_1.ExistsCommand(r))};e.prototype.mod=function(r,t){return new QueryChain_1.QueryChain(new mod_1.ModCommand(r,t))};e.prototype.all=function(r){return new QueryChain_1.QueryChain(new all_1.AllCommand(r))};e.prototype.elemMatch=function(r){return new QueryChain_1.QueryChain(new elemMatch_1.ElemMatchCommand(QueryChain_1.QueryChain.unchain(r)))};e.prototype.size=function(r){return new QueryChain_1.QueryChain(new size_1.SizeCommand(r))};return e}();exports.Command=Command;

@@ -40,3 +40,7 @@ export declare enum Sort {

skip = "$skip",
unwind = "$unwind"
unwind = "$unwind",
geoNear = "$geoNear",
bucket = "$bucket",
bucketAuto = "$bucketAuto",
sortByCount = "$sortByCount"
}

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PipelineStageName=exports.Target=exports.DocumentAction=exports.CollectionAction=exports.Sort=void 0;var Sort;(function(r){r["DESC"]="desc";r["ASC"]="asc"})(Sort||(exports.Sort=Sort={}));var CollectionAction;(function(r){r["update"]="update";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create"})(CollectionAction||(exports.CollectionAction=CollectionAction={}));var DocumentAction;(function(r){r["update"]="update";r["findOneAndUpdate"]="findOneAndUpdate";r["replace"]="replace";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create";r["batchCreate"]="batchCreate";r["count"]="count";r["aggregate"]="aggregate"})(DocumentAction||(exports.DocumentAction=DocumentAction={}));var Target;(function(r){r["collection"]="collection";r["document"]="document"})(Target||(exports.Target=Target={}));var PipelineStageName;(function(r){r["addFields"]="$addFields";r["count"]="$count";r["match"]="$match";r["group"]="$group";r["project"]="$project";r["replaceRoot"]="$replaceRoot";r["sample"]="$sample";r["lookup"]="$lookup";r["sort"]="$sort";r["limit"]="$limit";r["skip"]="$skip";r["unwind"]="$unwind"})(PipelineStageName||(exports.PipelineStageName=PipelineStageName={}));
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PipelineStageName=exports.Target=exports.DocumentAction=exports.CollectionAction=exports.Sort=void 0;var Sort;(function(r){r["DESC"]="desc";r["ASC"]="asc"})(Sort||(exports.Sort=Sort={}));var CollectionAction;(function(r){r["update"]="update";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create"})(CollectionAction||(exports.CollectionAction=CollectionAction={}));var DocumentAction;(function(r){r["update"]="update";r["findOneAndUpdate"]="findOneAndUpdate";r["replace"]="replace";r["delete"]="delete";r["query"]="query";r["queryList"]="queryList";r["create"]="create";r["batchCreate"]="batchCreate";r["count"]="count";r["aggregate"]="aggregate"})(DocumentAction||(exports.DocumentAction=DocumentAction={}));var Target;(function(r){r["collection"]="collection";r["document"]="document"})(Target||(exports.Target=Target={}));var PipelineStageName;(function(r){r["addFields"]="$addFields";r["count"]="$count";r["match"]="$match";r["group"]="$group";r["project"]="$project";r["replaceRoot"]="$replaceRoot";r["sample"]="$sample";r["lookup"]="$lookup";r["sort"]="$sort";r["limit"]="$limit";r["skip"]="$skip";r["unwind"]="$unwind";r["geoNear"]="$geoNear";r["bucket"]="$bucket";r["bucketAuto"]="$bucketAuto";r["sortByCount"]="$sortByCount"})(PipelineStageName||(exports.PipelineStageName=PipelineStageName={}));

@@ -154,1 +154,24 @@ import { AggregateCommand } from './command/AbstractCommand';

}
export interface AggregateGeoNearParam {
near: GeoPoint;
spherical?: boolean;
maxDistance?: number;
minDistance?: number;
query?: object;
distanceMultiplier?: number;
distanceField: string;
includeLocs?: string;
key?: string;
}
export interface bucketParam {
groupBy: AggregateExpression;
boundaries: Array<number>;
default?: string;
output?: object;
}
export interface bucketAutoParam {
groupBy: AggregateExpression;
buckets: number;
granularity?: string;
output?: object;
}
{
"name": "@alipay/faas-db-builder",
"version": "1.1.18-alpha.5",
"version": "1.1.18-alpha.6",
"description": "db builder",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc