Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alipay/faas-server-sdk

Package Overview
Dependencies
Maintainers
3
Versions
141
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.21-alpha.0 to 1.1.21-alpha.1

1

lib/errors.d.ts

@@ -8,3 +8,4 @@ import { FaasError } from '@alipay/faas-common-sdk';

INVALID_OPENAPI_RESPONSE_ERR(requestId: string, res: any): FaasError;
WEBSOCKET_ERR(message: string, errorCode: string, detail?: string, requestID?: string): FaasError;
NOT_FOUND_ERR(message: string): FaasError;
};

2

lib/errors.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.errors=void 0;const faas_common_sdk_1=require("@alipay/faas-common-sdk");exports.errors={INVALID_PARAM(r,s){return faas_common_sdk_1.FaasError.INVALID_PARAM_ERR(r,s)},NETWORK_ERR(r,s){const e=new faas_common_sdk_1.FaasError(-1,r.toString());return e.requestID=s,e},STORAGE_DOWNLOAD_FILE_ERR(r,s){const e=new faas_common_sdk_1.FaasError(-1,`\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25, ${r}`);return e.requestID=s,e},STORAGE_UPLOAD_FILE_ERR(r,s){const e=new faas_common_sdk_1.FaasError(-1,`\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25, ${r}`);return e.requestID=s,e},INVALID_OPENAPI_RESPONSE_ERR(r,s){const e=new faas_common_sdk_1.FaasError(-1,`\u8FD4\u56DE\u503C ${JSON.stringify(s)} \u683C\u5F0F\u4E0D\u6B63\u786E`);return e.requestID=r,e},NOT_FOUND_ERR(r){return faas_common_sdk_1.FaasError.NOT_FOUND_ERR(r)}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.errors=void 0;const faas_common_sdk_1=require("@alipay/faas-common-sdk");exports.errors={INVALID_PARAM(e,s){return faas_common_sdk_1.FaasError.INVALID_PARAM_ERR(e,s)},NETWORK_ERR(e,s){const r=new faas_common_sdk_1.FaasError(-1,e.toString());return r.requestID=s,r},STORAGE_DOWNLOAD_FILE_ERR(e,s){const r=new faas_common_sdk_1.FaasError(-1,`\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25, ${e}`);return r.requestID=s,r},STORAGE_UPLOAD_FILE_ERR(e,s){const r=new faas_common_sdk_1.FaasError(-1,`\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25, ${e}`);return r.requestID=s,r},INVALID_OPENAPI_RESPONSE_ERR(e,s){const r=new faas_common_sdk_1.FaasError(-1,`\u8FD4\u56DE\u503C ${JSON.stringify(s)} \u683C\u5F0F\u4E0D\u6B63\u786E`);return r.requestID=e,r},WEBSOCKET_ERR(e,s,r,o){const E=r?`: ${r}`:"",t=new faas_common_sdk_1.FaasError(-1,`${e}(${s||"-"})${E}`);return t.requestID=o||"",t},NOT_FOUND_ERR(e){return faas_common_sdk_1.FaasError.NOT_FOUND_ERR(e)}};

@@ -17,2 +17,3 @@ import { Cloud } from './Cloud';

export declare const getTempFileURL: (param: import("@alipay/faas-common-sdk").GetTempFileURLParam) => Promise<import("@alipay/faas-common-sdk").GetTempFileURLResult>;
export declare const ws: () => import("./Websocket").WebsocketSDK;
export { Cloud, initRuntimeEnv } from './Cloud';

@@ -19,0 +20,0 @@ export { DYNAMIC_CURRENT_ENV } from './constant';

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

"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(t,r,e,o){o===void 0&&(o=e);var i=Object.getOwnPropertyDescriptor(r,e);(!i||("get"in i?!r.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return r[e]}}),Object.defineProperty(t,o,i)}:function(t,r,e,o){o===void 0&&(o=e),t[o]=r[e]}),__exportStar=this&&this.__exportStar||function(t,r){for(var e in t)e!=="default"&&!Object.prototype.hasOwnProperty.call(r,e)&&__createBinding(r,t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sort=exports.DYNAMIC_CURRENT_ENV=exports.initRuntimeEnv=exports.Cloud=exports.getTempFileURL=exports.deleteFile=exports.downloadFile=exports.uploadFile=exports.getUploadFileURL=exports.openapi=exports.redis=exports.mysql=exports.database=exports.callFunction=exports.getAlipayContext=exports.init=exports.refreshConfig=void 0;const Cloud_1=require("./Cloud"),cloud=new Cloud_1.Cloud,exportApi=t=>cloud[t].bind(cloud);exports.default=cloud,exports.refreshConfig=exportApi("refreshConfig"),exports.init=exportApi("init"),exports.getAlipayContext=exportApi("getAlipayContext"),exports.callFunction=exportApi("callFunction"),exports.database=exportApi("database"),exports.mysql=exportApi("mysql"),exports.redis=exportApi("redis"),exports.openapi=cloud.openapi,exports.getUploadFileURL=exportApi("getUploadFileURL"),exports.uploadFile=exportApi("uploadFile"),exports.downloadFile=exportApi("downloadFile"),exports.deleteFile=exportApi("deleteFile"),exports.getTempFileURL=exportApi("getTempFileURL");var Cloud_2=require("./Cloud");Object.defineProperty(exports,"Cloud",{enumerable:!0,get:function(){return Cloud_2.Cloud}}),Object.defineProperty(exports,"initRuntimeEnv",{enumerable:!0,get:function(){return Cloud_2.initRuntimeEnv}});var constant_1=require("./constant");Object.defineProperty(exports,"DYNAMIC_CURRENT_ENV",{enumerable:!0,get:function(){return constant_1.DYNAMIC_CURRENT_ENV}});var faas_db_builder_1=require("@alipay/faas-db-builder");Object.defineProperty(exports,"Sort",{enumerable:!0,get:function(){return faas_db_builder_1.Sort}}),__exportStar(require("./types"),exports),__exportStar(require("./types/openapi"),exports);
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(t,r,e,o){o===void 0&&(o=e);var i=Object.getOwnPropertyDescriptor(r,e);(!i||("get"in i?!r.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return r[e]}}),Object.defineProperty(t,o,i)}:function(t,r,e,o){o===void 0&&(o=e),t[o]=r[e]}),__exportStar=this&&this.__exportStar||function(t,r){for(var e in t)e!=="default"&&!Object.prototype.hasOwnProperty.call(r,e)&&__createBinding(r,t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sort=exports.DYNAMIC_CURRENT_ENV=exports.initRuntimeEnv=exports.Cloud=exports.ws=exports.getTempFileURL=exports.deleteFile=exports.downloadFile=exports.uploadFile=exports.getUploadFileURL=exports.openapi=exports.redis=exports.mysql=exports.database=exports.callFunction=exports.getAlipayContext=exports.init=exports.refreshConfig=void 0;const Cloud_1=require("./Cloud"),cloud=new Cloud_1.Cloud,exportApi=t=>cloud[t].bind(cloud);exports.default=cloud,exports.refreshConfig=exportApi("refreshConfig"),exports.init=exportApi("init"),exports.getAlipayContext=exportApi("getAlipayContext"),exports.callFunction=exportApi("callFunction"),exports.database=exportApi("database"),exports.mysql=exportApi("mysql"),exports.redis=exportApi("redis"),exports.openapi=cloud.openapi,exports.getUploadFileURL=exportApi("getUploadFileURL"),exports.uploadFile=exportApi("uploadFile"),exports.downloadFile=exportApi("downloadFile"),exports.deleteFile=exportApi("deleteFile"),exports.getTempFileURL=exportApi("getTempFileURL"),exports.ws=exportApi("ws");var Cloud_2=require("./Cloud");Object.defineProperty(exports,"Cloud",{enumerable:!0,get:function(){return Cloud_2.Cloud}}),Object.defineProperty(exports,"initRuntimeEnv",{enumerable:!0,get:function(){return Cloud_2.initRuntimeEnv}});var constant_1=require("./constant");Object.defineProperty(exports,"DYNAMIC_CURRENT_ENV",{enumerable:!0,get:function(){return constant_1.DYNAMIC_CURRENT_ENV}});var faas_db_builder_1=require("@alipay/faas-db-builder");Object.defineProperty(exports,"Sort",{enumerable:!0,get:function(){return faas_db_builder_1.Sort}}),__exportStar(require("./types"),exports),__exportStar(require("./types/openapi"),exports);

@@ -6,25 +6,19 @@ import { CloudConfig } from '@alipay/faas-server-utils';

}
export interface SendToOneResponse {
export interface ToOneResponse {
success: boolean;
requestID: string;
}
export interface SendToManyResponse {
export interface ToManyResponse {
successCount: number;
allCount: number;
failedConnIds: string[];
requestID: string;
}
export interface CloseOneResponse {
success: boolean;
}
export interface CloseManyResponse {
successCount: number;
allCount: number;
failedConnIds: string[];
}
export declare class WebsocketSDK {
#private;
constructor(config: CloudConfig);
send(connectionId: string, data: string): Promise<SendToManyResponse>;
send(connectionId: string, data: any): Promise<SendToOneResponse>;
close(connectionId: string[]): Promise<CloseManyResponse>;
close(connectionId: string): Promise<CloseOneResponse>;
send(connectionId: string[], data: any): Promise<ToManyResponse>;
send(connectionId: string, data: any): Promise<ToOneResponse>;
close(connectionId: string[]): Promise<ToManyResponse>;
close(connectionId: string): Promise<ToOneResponse>;
}

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebsocketSDK=void 0;const faas_common_sdk_1=require("@alipay/faas-common-sdk"),requester_1=require("./requester");class WebsocketSDK{#t;constructor(t){this.#t=requester_1.Httpclient.createWebsocketHttpclient(t)}async send(t,e){let s="TEXT",r;typeof e=="string"?r=e:Buffer.isBuffer(e)?(r=e.toString("base64"),s="BINARY"):r=JSON.stringify(e);const a=Array.isArray(t)?t:[t],n=a.length===1?await this.#s(a[0],{type:s,payload:r}):await this.#r(a,{type:s,payload:r});return this.#e(n)}async close(t){const e=Array.isArray(t)?t:[t],s=e.length===1?await this.#a(e[0]):await this.#n(e);return this.#e(s)}async#s(t,e){return await this.#t.request({method:"POST",path:`/connection/send/${t}`,data:e})}async#r(t,e){return await this.#t.request({method:"POST",path:"/connection/batch/send",data:{connIds:t,data:e}})}async#a(t){return await this.#t.request({method:"POST",path:`/connection/close/${t}`})}async#n(t){return await this.#t.request({method:"POST",path:"/connection/batch/close",data:{connIds:t}})}#e(t){if(t.status===200)return t.data;const{code:e,message:s,errCode:r,errMsg:a}=t.data;throw faas_common_sdk_1.FaasError.SERVER_ERR(e||r,s||a,t.requestID,t.status)}}exports.WebsocketSDK=WebsocketSDK;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebsocketSDK=void 0;const errors_1=require("./errors"),requester_1=require("./requester");class WebsocketSDK{#t;constructor(e){this.#t=requester_1.Httpclient.createWebsocketHttpclient(e)}async send(e,t){let s="TEXT",r;typeof t=="string"?r=t:Buffer.isBuffer(t)?(r=t.toString("base64"),s="BINARY"):r=JSON.stringify(t);const a=Array.isArray(e)?e:[e];return a.length===1?await this.#a(a[0],{type:s,payload:r}):await this.#n(a,{type:s,payload:r})}async close(e){const t=Array.isArray(e)?e:[e];return t.length===1?await this.#o(t[0]):await this.#c(t)}async#a(e,t){const s=await this.#t.request({method:"POST",path:`/connection/send/${e}`,data:t});return this.#s(s)}async#n(e,t){const s=await this.#t.request({method:"POST",path:"/connection/batch/send",data:{connIds:e,message:t}});return this.#r(s)}async#o(e){const t=await this.#t.request({method:"POST",path:`/connection/close/${e}`});return this.#s(t)}async#c(e){const t=await this.#t.request({method:"POST",path:"/connection/batch/close",data:{connIds:e}});return this.#r(t)}#e(e){if(e.status!==200){const{errorCode:t,resultMsg:s,detailMsg:r,traceId:a,requestId:n}=e.data||{},o=s??"\u7F51\u7EDC\u5F02\u5E38";throw errors_1.errors.WEBSOCKET_ERR(o,t?`${t}(${e.status})`:`${e.status}`,r,a||n)}if(!e.data.success){const{errorCode:t,resultMsg:s,detailMsg:r,traceId:a,requestId:n}=e.data;throw errors_1.errors.WEBSOCKET_ERR(s,t,r,a||n)}return e.data}#s(e){const t=this.#e(e);return{success:t.data,requestID:t.requestId||t.traceId}}#r(e){const t=this.#e(e);return{requestID:t.requestId||t.traceId,...t.data}}}exports.WebsocketSDK=WebsocketSDK;
{
"name": "@alipay/faas-server-sdk",
"version": "1.1.21-alpha.0",
"version": "1.1.21-alpha.1",
"description": "云函数服务 SDK",

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

"dependencies": {
"@alipay/faas-common-sdk": "^1.1.21-alpha.0",
"@alipay/faas-db-builder": "^1.1.21-alpha.0",
"@alipay/faas-server-utils": "^1.1.21-alpha.0",
"@alipay/faas-common-sdk": "^1.1.21-alpha.1",
"@alipay/faas-db-builder": "^1.1.21-alpha.1",
"@alipay/faas-server-utils": "^1.1.21-alpha.1",
"ali-rds": "^6.2.0",

@@ -42,0 +42,0 @@ "bson": "^4.7.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