Socket
Socket
Sign inDemoInstall

@alipay/faas-server-sdk

Package Overview
Dependencies
Maintainers
3
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alipay/faas-server-sdk - npm Package Compare versions

Comparing version 1.1.16-alpha.2 to 1.1.16-alpha.3

1

lib/Database/index.d.ts

@@ -13,2 +13,3 @@ import { Command, RegExpParam, RegExp } from '@alipay/faas-db-builder';

regexp(param: RegExpParam): RegExp;
regex(param: RegExpParam): RegExp;
collection(collectionName: string): Collection;

@@ -15,0 +16,0 @@ requestRaw(method: HttpMethod, path: string, data?: object, headers?: Record<string, string>): Promise<import("urllib").HttpClientResponse<unknown>>;

2

lib/Database/index.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Database=void 0;const faas_db_builder_1=require("@alipay/faas-db-builder"),faas_common_sdk_1=require("@alipay/faas-common-sdk"),requester_1=require("../requester"),Collection_1=require("./Collection"),Transaction_1=require("./Transaction");class Database{#t;command;#r;#e;constructor(t){this.#t=t,this.command=new faas_db_builder_1.Command,this.#r=new faas_db_builder_1.MongoBuilder,this.#e=requester_1.Httpclient.createDatabaseHttpclient(t)}RegExp(t){return new faas_db_builder_1.RegExp(t)}regexp(t){return new faas_db_builder_1.RegExp(t)}collection(t){if(!t)throw faas_common_sdk_1.FaasError.INVALID_PARAM_ERR("collectionName","\u4E0D\u80FD\u4E3A\u7A7A");return new Collection_1.Collection(this.#t,t,this.#e)}#n(){return`/${this.#t.functionDatabaseName||"faas"}`}#a(t){return`${this.#n()}/${t}`}async requestRaw(t,e,s,a){const{res:r}=await this.#e.requestRaw({method:t,path:e,data:s,headers:a});return r}async createCollection(t){if(this.#t.ignoreCollectionExists){const a=await this.#i(t);if(a)return a}const e="PUT",s=this.#a(t);return await this.#s(e,s)}async getCollection(t){const e="GET",s=this.#a(t);return await this.#s(e,s)}async listCollection(t,e){const s="POST",a=`${this.#n()}?list`,{options:r}=this.#r.listCollection(t,e);return await this.#s(s,a,r)}async deleteCollection(t){const e="DELETE",s=this.#a(t);return await this.#s(e,s)}async startTransaction(){return await Transaction_1.Transaction.create(this.#t,this.#e)}async runTransaction(t){const e=await this.startTransaction();try{const s=await t(e);if(e.isRollback())throw e.reason;return e.isProcessing()&&await e.commit(),s}catch(s){if(e.isProcessing())try{await e.rollback(s)}catch(a){throw a.cause=s,a}throw e.isRollback()?e.reason:s}}async#i(t){try{return await this.getCollection(t)}catch(e){if(e.httpStatus===404)return null;throw e}}async#s(t,e,s){const a=await this.#e.request({method:t,path:e,data:s});return faas_common_sdk_1.ResponseUtil.handleResponse(a)}}exports.Database=Database;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Database=void 0;const faas_db_builder_1=require("@alipay/faas-db-builder"),faas_common_sdk_1=require("@alipay/faas-common-sdk"),requester_1=require("../requester"),Collection_1=require("./Collection"),Transaction_1=require("./Transaction");class Database{#t;command;#r;#e;constructor(t){this.#t=t,this.command=new faas_db_builder_1.Command,this.#r=new faas_db_builder_1.MongoBuilder,this.#e=requester_1.Httpclient.createDatabaseHttpclient(t)}RegExp(t){return new faas_db_builder_1.RegExp(t)}regexp(t){return new faas_db_builder_1.RegExp(t)}regex(t){return new faas_db_builder_1.RegExp(t)}collection(t){if(!t)throw faas_common_sdk_1.FaasError.INVALID_PARAM_ERR("collectionName","\u4E0D\u80FD\u4E3A\u7A7A");return new Collection_1.Collection(this.#t,t,this.#e)}#n(){return`/${this.#t.functionDatabaseName||"faas"}`}#a(t){return`${this.#n()}/${t}`}async requestRaw(t,e,s,a){const{res:r}=await this.#e.requestRaw({method:t,path:e,data:s,headers:a});return r}async createCollection(t){if(this.#t.ignoreCollectionExists){const a=await this.#i(t);if(a)return a}const e="PUT",s=this.#a(t);return await this.#s(e,s)}async getCollection(t){const e="GET",s=this.#a(t);return await this.#s(e,s)}async listCollection(t,e){const s="POST",a=`${this.#n()}?list`,{options:r}=this.#r.listCollection(t,e);return await this.#s(s,a,r)}async deleteCollection(t){const e="DELETE",s=this.#a(t);return await this.#s(e,s)}async startTransaction(){return await Transaction_1.Transaction.create(this.#t,this.#e)}async runTransaction(t){const e=await this.startTransaction();try{const s=await t(e);if(e.isRollback())throw e.reason;return e.isProcessing()&&await e.commit(),s}catch(s){if(e.isProcessing())try{await e.rollback(s)}catch(a){throw a.cause=s,a}throw e.isRollback()?e.reason:s}}async#i(t){try{return await this.getCollection(t)}catch(e){if(e.httpStatus===404)return null;throw e}}async#s(t,e,s){const a=await this.#e.request({method:t,path:e,data:s});return faas_common_sdk_1.ResponseUtil.handleResponse(a)}}exports.Database=Database;
{
"name": "@alipay/faas-server-sdk",
"version": "1.1.16-alpha.2",
"version": "1.1.16-alpha.3",
"description": "云函数服务 SDK",

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

"dependencies": {
"@alipay/faas-common-sdk": "^1.1.16-alpha.2",
"@alipay/faas-db-builder": "^1.1.16-alpha.2",
"@alipay/faas-server-utils": "^1.1.16-alpha.2",
"@alipay/faas-common-sdk": "^1.1.16-alpha.3",
"@alipay/faas-db-builder": "^1.1.16-alpha.3",
"@alipay/faas-server-utils": "^1.1.16-alpha.3",
"ali-rds": "^6.2.0",

@@ -42,0 +42,0 @@ "ioredis": "^5.3.2",

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