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

@alipay/faas-db-builder - npm Package Compare versions

Comparing version 1.1.16-alpha.8 to 1.1.16-alpha.9

5

esm/mongo-builder/Collection.d.ts
import type { QueryChainCommand } from '../command/AbstractCommand';
import { Sort } from '../common/constant';
import type { AddDocumentParam, AddManyDocumentParam, MongoDocumentOperation } from '../typing';
import type { AddDocumentParam, AddManyDocumentParam, CollectionBuilderOptions, MongoDocumentOperation } from '../typing';
import { AggregateBuilder } from './Aggregate';

@@ -9,3 +9,4 @@ import { DocumentBuilder } from './Document';

private readonly collectionName;
constructor(collectionName: string);
private readonly options;
constructor(collectionName: string, options?: Partial<CollectionBuilderOptions>);
add(param: AddDocumentParam): MongoDocumentOperation;

@@ -12,0 +13,0 @@ batchAdd(param: AddManyDocumentParam): MongoDocumentOperation;

2

esm/mongo-builder/Collection.js

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

import{DocumentAction as r}from"../common/constant";import{DbBuildError as n}from"../common/error";import{ActionBuilder as c}from"../common/util";import{AggregateBuilder as l}from"./Aggregate";import{DocumentBuilder as u}from"./Document";import{QueryBuilder as e}from"./Query";var d=function(){function o(t){this.collectionName=t}o.prototype.add=function(t){if(!(t===null||t===void 0?void 0:t.data)){throw n.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A")}if(Array.isArray(t.data)){return this.batchAdd(t)}return c.buildDocumentAction(r.create,this.collectionName,t.data)};o.prototype.batchAdd=function(t){if(t.data.length<=0){throw n.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4")}if(t.data.length>200){throw n.invalidParam("data","\u6700\u5927\u957F\u5EA6 200")}var i={$create:t.data};if(typeof t.ordered==="boolean"){i.$ordered=t.ordered}return c.buildDocumentAction(r.batchCreate,this.collectionName,i)};o.prototype.doc=function(t){return new u(this.collectionName,t)};o.prototype.limit=function(t){return new e(this.collectionName).limit(t)};o.prototype.skip=function(t){return new e(this.collectionName).skip(t)};o.prototype.where=function(t){return new e(this.collectionName).where(t)};o.prototype.projection=function(t){return new e(this.collectionName).projection(t)};o.prototype.orderBy=function(t,i){return new e(this.collectionName).orderBy(t,i)};o.prototype.aggregate=function(){return new l(this.collectionName)};o.prototype.get=function(){return new e(this.collectionName).get()};o.prototype.count=function(){return new e(this.collectionName).count()};return o}();export{d as CollectionBuilder};
var i=function(){i=Object.assign||function(o){for(var t,e=1,l=arguments.length;e<l;e++){t=arguments[e];for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))o[r]=t[r]}return o};return i.apply(this,arguments)};import{DocumentAction as u}from"../common/constant";import{DbBuildError as c}from"../common/error";import{ActionBuilder as a}from"../common/util";import{AggregateBuilder as d}from"./Aggregate";import{DocumentBuilder as s}from"./Document";import{QueryBuilder as n}from"./Query";var p=function(){function o(t,e){this.collectionName=t;this.options=i({maxAddCount:200},e)}o.prototype.add=function(t){if(!(t===null||t===void 0?void 0:t.data)){throw c.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A")}if(Array.isArray(t.data)){return this.batchAdd(t)}return a.buildDocumentAction(u.create,this.collectionName,t.data)};o.prototype.batchAdd=function(t){if(t.data.length<=0){throw c.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4")}if(t.data.length>this.options.maxAddCount){throw c.invalidParam("data","\u6700\u5927\u957F\u5EA6 ".concat(this.options.maxAddCount))}var e={$create:t.data};if(typeof t.ordered==="boolean"){e.$ordered=t.ordered}return a.buildDocumentAction(u.batchCreate,this.collectionName,e)};o.prototype.doc=function(t){return new s(this.collectionName,t)};o.prototype.limit=function(t){return new n(this.collectionName).limit(t)};o.prototype.skip=function(t){return new n(this.collectionName).skip(t)};o.prototype.where=function(t){return new n(this.collectionName).where(t)};o.prototype.projection=function(t){return new n(this.collectionName).projection(t)};o.prototype.orderBy=function(t,e){return new n(this.collectionName).orderBy(t,e)};o.prototype.aggregate=function(){return new d(this.collectionName)};o.prototype.get=function(){return new n(this.collectionName).get()};o.prototype.count=function(){return new n(this.collectionName).count()};return o}();export{p as CollectionBuilder};

@@ -15,2 +15,5 @@ import { AggregateCommand } from './command/AbstractCommand';

export type AggregateExpressionRecord = Record<string, AggregateExpression>;
export interface CollectionBuilderOptions {
maxAddCount: number;
}
export interface SortOption {

@@ -17,0 +20,0 @@ field: string;

import type { QueryChainCommand } from '../command/AbstractCommand';
import { Sort } from '../common/constant';
import type { AddDocumentParam, AddManyDocumentParam, MongoDocumentOperation } from '../typing';
import type { AddDocumentParam, AddManyDocumentParam, CollectionBuilderOptions, MongoDocumentOperation } from '../typing';
import { AggregateBuilder } from './Aggregate';

@@ -9,3 +9,4 @@ import { DocumentBuilder } from './Document';

private readonly collectionName;
constructor(collectionName: string);
private readonly options;
constructor(collectionName: string, options?: Partial<CollectionBuilderOptions>);
add(param: AddDocumentParam): MongoDocumentOperation;

@@ -12,0 +13,0 @@ batchAdd(param: AddManyDocumentParam): MongoDocumentOperation;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CollectionBuilder=void 0;var constant_1=require("../common/constant");var error_1=require("../common/error");var util_1=require("../common/util");var Aggregate_1=require("./Aggregate");var Document_1=require("./Document");var Query_1=require("./Query");var CollectionBuilder=function(){function t(e){this.collectionName=e}t.prototype.add=function(e){if(!(e===null||e===void 0?void 0:e.data)){throw error_1.DbBuildError.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A")}if(Array.isArray(e.data)){return this.batchAdd(e)}return util_1.ActionBuilder.buildDocumentAction(constant_1.DocumentAction.create,this.collectionName,e.data)};t.prototype.batchAdd=function(e){if(e.data.length<=0){throw error_1.DbBuildError.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4")}if(e.data.length>200){throw error_1.DbBuildError.invalidParam("data","\u6700\u5927\u957F\u5EA6 200")}var r={$create:e.data};if(typeof e.ordered==="boolean"){r.$ordered=e.ordered}return util_1.ActionBuilder.buildDocumentAction(constant_1.DocumentAction.batchCreate,this.collectionName,r)};t.prototype.doc=function(e){return new Document_1.DocumentBuilder(this.collectionName,e)};t.prototype.limit=function(e){return new Query_1.QueryBuilder(this.collectionName).limit(e)};t.prototype.skip=function(e){return new Query_1.QueryBuilder(this.collectionName).skip(e)};t.prototype.where=function(e){return new Query_1.QueryBuilder(this.collectionName).where(e)};t.prototype.projection=function(e){return new Query_1.QueryBuilder(this.collectionName).projection(e)};t.prototype.orderBy=function(e,r){return new Query_1.QueryBuilder(this.collectionName).orderBy(e,r)};t.prototype.aggregate=function(){return new Aggregate_1.AggregateBuilder(this.collectionName)};t.prototype.get=function(){return new Query_1.QueryBuilder(this.collectionName).get()};t.prototype.count=function(){return new Query_1.QueryBuilder(this.collectionName).count()};return t}();exports.CollectionBuilder=CollectionBuilder;
"use strict";var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});exports.CollectionBuilder=void 0;var constant_1=require("../common/constant");var error_1=require("../common/error");var util_1=require("../common/util");var Aggregate_1=require("./Aggregate");var Document_1=require("./Document");var Query_1=require("./Query");var CollectionBuilder=function(){function e(t,r){this.collectionName=t;this.options=__assign({maxAddCount:200},r)}e.prototype.add=function(t){if(!(t===null||t===void 0?void 0:t.data)){throw error_1.DbBuildError.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A")}if(Array.isArray(t.data)){return this.batchAdd(t)}return util_1.ActionBuilder.buildDocumentAction(constant_1.DocumentAction.create,this.collectionName,t.data)};e.prototype.batchAdd=function(t){if(t.data.length<=0){throw error_1.DbBuildError.invalidParam("data","\u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4")}if(t.data.length>this.options.maxAddCount){throw error_1.DbBuildError.invalidParam("data","\u6700\u5927\u957F\u5EA6 ".concat(this.options.maxAddCount))}var r={$create:t.data};if(typeof t.ordered==="boolean"){r.$ordered=t.ordered}return util_1.ActionBuilder.buildDocumentAction(constant_1.DocumentAction.batchCreate,this.collectionName,r)};e.prototype.doc=function(t){return new Document_1.DocumentBuilder(this.collectionName,t)};e.prototype.limit=function(t){return new Query_1.QueryBuilder(this.collectionName).limit(t)};e.prototype.skip=function(t){return new Query_1.QueryBuilder(this.collectionName).skip(t)};e.prototype.where=function(t){return new Query_1.QueryBuilder(this.collectionName).where(t)};e.prototype.projection=function(t){return new Query_1.QueryBuilder(this.collectionName).projection(t)};e.prototype.orderBy=function(t,r){return new Query_1.QueryBuilder(this.collectionName).orderBy(t,r)};e.prototype.aggregate=function(){return new Aggregate_1.AggregateBuilder(this.collectionName)};e.prototype.get=function(){return new Query_1.QueryBuilder(this.collectionName).get()};e.prototype.count=function(){return new Query_1.QueryBuilder(this.collectionName).count()};return e}();exports.CollectionBuilder=CollectionBuilder;

@@ -15,2 +15,5 @@ import { AggregateCommand } from './command/AbstractCommand';

export type AggregateExpressionRecord = Record<string, AggregateExpression>;
export interface CollectionBuilderOptions {
maxAddCount: number;
}
export interface SortOption {

@@ -17,0 +20,0 @@ field: string;

{
"name": "@alipay/faas-db-builder",
"version": "1.1.16-alpha.8",
"version": "1.1.16-alpha.9",
"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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc