@alipay/faas-common-sdk 1.1.14 → 1.1.15-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LookupAggregateParam, QueryChainCommand, SampleAggregateParam } from '@alipay/faas-db-builder';
|
|
1
|
+
import { AggregateCommand, LookupAggregateParam, QueryChainCommand, SampleAggregateParam, Sort } from '@alipay/faas-db-builder';
|
|
2
2
|
import { CallbackParam, CreateDatabaseOptions } from '../types';
|
|
3
3
|
export declare class Aggregate {
|
|
4
4
|
private readonly options;
|
|
@@ -9,6 +9,10 @@ export declare class Aggregate {
|
|
|
9
9
|
group(group: object): Aggregate;
|
|
10
10
|
sample(sample: SampleAggregateParam): Aggregate;
|
|
11
11
|
lookup(lookup: LookupAggregateParam): Aggregate;
|
|
12
|
+
project(project: Record<string, boolean | 0 | 1 | object | AggregateCommand>): Aggregate;
|
|
13
|
+
sort(sort: Record<string, Sort | 1 | -1>): Aggregate;
|
|
14
|
+
limit(limit: number): Aggregate;
|
|
15
|
+
skip(skip: number): Aggregate;
|
|
12
16
|
end<T = any>(): Promise<T[]>;
|
|
13
17
|
end<T = any>(param: CallbackParam<T[]>): void;
|
|
14
18
|
private getCollectionPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var p=function(
|
|
1
|
+
var p=function(i,e,n,u){var o=arguments.length,t=o<3?e:u===null?u=Object.getOwnPropertyDescriptor(e,n):u,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")t=Reflect.decorate(i,e,n,u);else for(var s=i.length-1;s>=0;s--)if(a=i[s])t=(o<3?a(t):o>3?a(e,n,t):a(e,n))||t;return o>3&&t&&Object.defineProperty(e,n,t),t};var h=function(i,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(i,e)};var d=function(i,e,n,u){function o(t){return t instanceof n?t:new n(function(a){a(t)})}return new(n||(n=Promise))(function(t,a){function s(c){try{r(u.next(c))}catch(f){a(f)}}function l(c){try{r(u["throw"](c))}catch(f){a(f)}}function r(c){c.done?t(c.value):o(c.value).then(s,l)}r((u=u.apply(i,e||[])).next())})};var b=function(i,e){var n={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},u,o,t,a;return a={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(r){return function(c){return l([r,c])}}function l(r){if(u)throw new TypeError("Generator is already executing.");while(a&&(a=0,r[0]&&(n=0)),n)try{if(u=1,o&&(t=r[0]&2?o["return"]:r[0]?o["throw"]||((t=o["return"])&&t.call(o),0):o.next)&&!(t=t.call(o,r[1])).done)return t;if(o=0,t)r=[r[0]&2,t.value];switch(r[0]){case 0:case 1:t=r;break;case 4:n.label++;return{value:r[1],done:false};case 5:n.label++;o=r[1];r=[0];continue;case 7:r=n.ops.pop();n.trys.pop();continue;default:if(!(t=n.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){n=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){n.label=r[1];break}if(r[0]===6&&n.label<t[1]){n.label=t[1];t=r;break}if(t&&n.label<t[2]){n.label=t[2];n.ops.push(r);break}if(t[2])n.ops.pop();n.trys.pop();continue}r=e.call(i,n)}catch(c){r=[6,c];o=0}finally{u=t=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{AggregateBuilder as y}from"@alipay/faas-db-builder";import{WrapCallback as m}from"../decorator";import{ResponseUtil as g}from"../utils";var v=function(){function i(e,n){this.collectionName=e;this.options=n;this.builder=new y(e)}i.prototype.match=function(e){this.builder.match(e);return this};i.prototype.group=function(e){this.builder.group(e);return this};i.prototype.sample=function(e){this.builder.sample(e);return this};i.prototype.lookup=function(e){this.builder.lookup(e);return this};i.prototype.project=function(e){this.builder.project(e);return this};i.prototype.sort=function(e){this.builder.sort(e);return this};i.prototype.limit=function(e){this.builder.limit(e);return this};i.prototype.skip=function(e){this.builder.skip(e);return this};i.prototype.end=function(){return d(this,void 0,void 0,function(){var e,n,u,o;return b(this,function(t){switch(t.label){case 0:e=this.builder.end().options;n="POST";u="".concat(this.getCollectionPath(),"?aggregate");return[4,this.options.httpclient.request({method:n,path:u,data:e})];case 1:o=t.sent();return[2,g.handleResponse(o)]}})})};i.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)};p([m(),h("design:type",Function),h("design:paramtypes",[]),h("design:returntype",Promise)],i.prototype,"end",null);return i}();export{v as Aggregate};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LookupAggregateParam, QueryChainCommand, SampleAggregateParam } from '@alipay/faas-db-builder';
|
|
1
|
+
import { AggregateCommand, LookupAggregateParam, QueryChainCommand, SampleAggregateParam, Sort } from '@alipay/faas-db-builder';
|
|
2
2
|
import { CallbackParam, CreateDatabaseOptions } from '../types';
|
|
3
3
|
export declare class Aggregate {
|
|
4
4
|
private readonly options;
|
|
@@ -9,6 +9,10 @@ export declare class Aggregate {
|
|
|
9
9
|
group(group: object): Aggregate;
|
|
10
10
|
sample(sample: SampleAggregateParam): Aggregate;
|
|
11
11
|
lookup(lookup: LookupAggregateParam): Aggregate;
|
|
12
|
+
project(project: Record<string, boolean | 0 | 1 | object | AggregateCommand>): Aggregate;
|
|
13
|
+
sort(sort: Record<string, Sort | 1 | -1>): Aggregate;
|
|
14
|
+
limit(limit: number): Aggregate;
|
|
15
|
+
skip(skip: number): Aggregate;
|
|
12
16
|
end<T = any>(): Promise<T[]>;
|
|
13
17
|
end<T = any>(param: CallbackParam<T[]>): void;
|
|
14
18
|
private getCollectionPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __decorate=this&&this.__decorate||function(
|
|
1
|
+
"use strict";var __decorate=this&&this.__decorate||function(i,e,r,a){var o=arguments.length,t=o<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,r):a,u;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")t=Reflect.decorate(i,e,r,a);else for(var c=i.length-1;c>=0;c--)if(u=i[c])t=(o<3?u(t):o>3?u(e,r,t):u(e,r))||t;return o>3&&t&&Object.defineProperty(e,r,t),t};var __metadata=this&&this.__metadata||function(i,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(i,e)};var __awaiter=this&&this.__awaiter||function(i,e,r,a){function o(t){return t instanceof r?t:new r(function(u){u(t)})}return new(r||(r=Promise))(function(t,u){function c(s){try{n(a.next(s))}catch(f){u(f)}}function l(s){try{n(a["throw"](s))}catch(f){u(f)}}function n(s){s.done?t(s.value):o(s.value).then(c,l)}n((a=a.apply(i,e||[])).next())})};var __generator=this&&this.__generator||function(i,e){var r={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,o,t,u;return u={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(n){return function(s){return l([n,s])}}function l(n){if(a)throw new TypeError("Generator is already executing.");while(u&&(u=0,n[0]&&(r=0)),r)try{if(a=1,o&&(t=n[0]&2?o["return"]:n[0]?o["throw"]||((t=o["return"])&&t.call(o),0):o.next)&&!(t=t.call(o,n[1])).done)return t;if(o=0,t)n=[n[0]&2,t.value];switch(n[0]){case 0:case 1:t=n;break;case 4:r.label++;return{value:n[1],done:false};case 5:r.label++;o=n[1];n=[0];continue;case 7:n=r.ops.pop();r.trys.pop();continue;default:if(!(t=r.trys,t=t.length>0&&t[t.length-1])&&(n[0]===6||n[0]===2)){r=0;continue}if(n[0]===3&&(!t||n[1]>t[0]&&n[1]<t[3])){r.label=n[1];break}if(n[0]===6&&r.label<t[1]){r.label=t[1];t=n;break}if(t&&r.label<t[2]){r.label=t[2];r.ops.push(n);break}if(t[2])r.ops.pop();r.trys.pop();continue}n=e.call(i,r)}catch(s){n=[6,s];o=0}finally{a=t=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});exports.Aggregate=void 0;var faas_db_builder_1=require("@alipay/faas-db-builder");var decorator_1=require("../decorator");var utils_1=require("../utils");var Aggregate=function(){function i(e,r){this.collectionName=e;this.options=r;this.builder=new faas_db_builder_1.AggregateBuilder(e)}i.prototype.match=function(e){this.builder.match(e);return this};i.prototype.group=function(e){this.builder.group(e);return this};i.prototype.sample=function(e){this.builder.sample(e);return this};i.prototype.lookup=function(e){this.builder.lookup(e);return this};i.prototype.project=function(e){this.builder.project(e);return this};i.prototype.sort=function(e){this.builder.sort(e);return this};i.prototype.limit=function(e){this.builder.limit(e);return this};i.prototype.skip=function(e){this.builder.skip(e);return this};i.prototype.end=function(){return __awaiter(this,void 0,void 0,function(){var e,r,a,o;return __generator(this,function(t){switch(t.label){case 0:e=this.builder.end().options;r="POST";a="".concat(this.getCollectionPath(),"?aggregate");return[4,this.options.httpclient.request({method:r,path:a,data:e})];case 1:o=t.sent();return[2,utils_1.ResponseUtil.handleResponse(o)]}})})};i.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)};__decorate([(0,decorator_1.WrapCallback)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],i.prototype,"end",null);return i}();exports.Aggregate=Aggregate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/faas-common-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15-alpha.1",
|
|
4
4
|
"description": "云函数服务通用 SDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typescript": "^5.0.4"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@alipay/faas-db-builder": "^1.1.
|
|
33
|
+
"@alipay/faas-db-builder": "^1.1.15-alpha.1"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">= 14.0.0"
|