@alipay/faas-biz-server-sdk
Advanced tools
Comparing version 1.1.0 to 1.1.1-alpha.0
@@ -44,4 +44,7 @@ "use strict"; | ||
cloudbaseClient; | ||
constructor() { | ||
this.cloudbaseClient = new CloudbaseClientGen_1.CloudbaseClient(); | ||
constructor(config) { | ||
const cloudbaseConfig = { | ||
environment: config && config.environment ? config.environment : 'hz' | ||
}; | ||
this.cloudbaseClient = new CloudbaseClientGen_1.CloudbaseClient(cloudbaseConfig); | ||
} | ||
@@ -48,0 +51,0 @@ async getCurrentUser() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RUNTIME_AUTH_SERVER_ENDPOINT = void 0; | ||
exports.AUTH_USER_POOL_UID_OFFLINE = exports.AUTH_ENV_ID_OFFLINE = exports.RUNTIME_AUTH_SERVER_ENDPOINT_OFFLINE = exports.RUNTIME_AUTH_SERVER_ENDPOINT = void 0; | ||
exports.RUNTIME_AUTH_SERVER_ENDPOINT = process.env.RUNTIME_BIZ_GATEWAY_ENDPOINT || process.env.RUNTIME_AUTH_SERVER_ENDPOINT || ""; | ||
exports.RUNTIME_AUTH_SERVER_ENDPOINT_OFFLINE = 'http://localhost:8080' || ""; | ||
exports.AUTH_ENV_ID_OFFLINE = 'env-00jx4sn02vbh'; | ||
exports.AUTH_USER_POOL_UID_OFFLINE = '01HFR6MESSEG1P13PWWWCSHT83'; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UploadurlGetResponse = exports.DownloadurlGetResponse = exports.TaskResultResponse = exports.Image2ImageResponse = exports.Image2ImageInput = exports.CloudAI = exports.PermissionQueryResponse = exports.Permission = exports.RoleQueryResponse = exports.Role = exports.UserQueryResponse = exports.User = exports.CloudbaseClient = exports.Auth = void 0; | ||
exports.FaasWebSocket = exports.FaasWebSocketIO = exports.UploadurlGetResponse = exports.DownloadurlGetResponse = exports.TaskResultResponse = exports.Image2ImageResponse = exports.Image2ImageInput = exports.CloudAI = exports.PermissionQueryResponse = exports.Permission = exports.RoleQueryResponse = exports.Role = exports.UserQueryResponse = exports.User = exports.CloudbaseClient = exports.Auth = void 0; | ||
const Auth_1 = require("./apis/auth/Auth"); | ||
@@ -32,1 +35,5 @@ Object.defineProperty(exports, "Auth", { enumerable: true, get: function () { return Auth_1.Auth; } }); | ||
Object.defineProperty(exports, "UploadurlGetResponse", { enumerable: true, get: function () { return UploadUrlGetResponse_1.UploadurlGetResponse; } }); | ||
const FaasWebsocketIO_1 = __importDefault(require("./models/websocket/FaasWebsocketIO")); | ||
exports.FaasWebSocketIO = FaasWebsocketIO_1.default; | ||
const Websocket_1 = __importDefault(require("./models/websocket/Websocket")); | ||
exports.FaasWebSocket = Websocket_1.default; |
@@ -81,6 +81,15 @@ "use strict"; | ||
class CloudbaseClient { | ||
constructor(config) { } | ||
environment; | ||
constructor(config) { | ||
this.environment = config && config.environment ? config.environment : 'hz'; | ||
} | ||
async execute(request) { | ||
try { | ||
const url = configuration_1.RUNTIME_AUTH_SERVER_ENDPOINT + "/openapi/execute"; | ||
let url; | ||
if (this.environment === 'offline') { | ||
url = configuration_1.RUNTIME_AUTH_SERVER_ENDPOINT_OFFLINE + "/openapi/execute"; | ||
} | ||
else { | ||
url = configuration_1.RUNTIME_AUTH_SERVER_ENDPOINT + "/openapi/execute"; | ||
} | ||
const options = { | ||
@@ -87,0 +96,0 @@ api: this.getRequestUri(request), |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Sign = void 0; | ||
const enc_hex_1 = __importDefault(require("crypto-js/enc-hex")); | ||
const hmac_sha256_1 = __importDefault(require("crypto-js/hmac-sha256")); | ||
const sha256_1 = __importDefault(require("crypto-js/sha256")); | ||
const uuid_1 = require("uuid"); | ||
const crypto_js_1 = require("crypto-js"); | ||
const configuration_1 = require("./configuration"); | ||
class Sign { | ||
static sign(config) { | ||
let secretId = 'null'; | ||
let secretKey = 'null'; | ||
let envId = configuration_1.AUTH_ENV_ID_OFFLINE; | ||
if (process.env.RUNTIME_ACCESS_KEY && process.env.RUNTIME_SECRET_KEY && process.env.RUNTIME_ENV_ID) { | ||
secretId = process.env.RUNTIME_ACCESS_KEY; | ||
secretKey = process.env.RUNTIME_SECRET_KEY; | ||
envId = process.env.RUNTIME_ENV_ID; | ||
} | ||
const signOptions = { | ||
...config, | ||
secretId: process.env.RUNTIME_ACCESS_KEY || '', | ||
secretKey: process.env.RUNTIME_SECRET_KEY || '', | ||
envId: process.env.RUNTIME_ENV_ID || '', | ||
secretId: secretId, | ||
secretKey: secretKey, | ||
envId: envId, | ||
timestamp: Math.floor(Date.now() / 1000), | ||
@@ -34,10 +38,10 @@ }; | ||
static createSha256(message, secret = '') { | ||
const hmac = (0, hmac_sha256_1.default)(message, secret); | ||
return hmac.toString(enc_hex_1.default); | ||
const hmac = (0, crypto_js_1.HmacSHA256)(message, secret); | ||
return hmac.toString(); | ||
} | ||
static createHash(message) { | ||
const hash = (0, sha256_1.default)(message); | ||
return hash.toString(enc_hex_1.default); | ||
const hash = (0, crypto_js_1.SHA256)(message); | ||
return hash.toString(); | ||
} | ||
} | ||
exports.Sign = Sign; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const index_1 = require("../index"); | ||
const index_2 = require("../index"); | ||
const cloudai = new index_1.CloudAI(); | ||
const service = "mangai"; | ||
const input = new index_2.Image2ImageInput(); | ||
input.imageUrl = "https://mdn.alipayobjects.com/cto_doraemon/afts/img/sZFHS60_UhcAAAAAAAAAAAAAKqq5AQBr/original"; | ||
cloudai.image2image(service, input) | ||
.then((result) => { | ||
console.log(`image2image:${JSON.stringify(result)}`); | ||
}).catch((error) => { | ||
console.error(error.message); | ||
describe('CloudAI-test', () => { | ||
let cloudai; | ||
const service = "mangai"; | ||
beforeEach(() => { | ||
const cloudai = new index_1.CloudAI(); | ||
}); | ||
test('test1', async () => { | ||
console.log('test 1 success'); | ||
}); | ||
}); | ||
cloudai.getTaskResult("mangai:01HQQF60FMEX3CY3GZ207ED52Q") | ||
.then((result) => { | ||
console.log(`image2image:${JSON.stringify(result)}`); | ||
}).catch((error) => { | ||
console.error(error.message); | ||
}); |
{ | ||
"name": "@alipay/faas-biz-server-sdk", | ||
"version": "1.1.0", | ||
"version": "1.1.1-alpha.0", | ||
"description": "支付宝云开发业务 SDK(函数端)", | ||
@@ -12,3 +12,4 @@ "main": "dist/index.js", | ||
"gen": "sh resources/openapi-auto-generate/tool/generate-openapi.sh", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run build", | ||
"test": "jest" | ||
}, | ||
@@ -23,3 +24,4 @@ "keywords": [], | ||
"@alipay/faas-server-utils": "^1.1.19", | ||
"@alipay/faas-server-sdk": "^1.1.19", | ||
"@alipay/faas-server-sdk": "^1.1.21-alpha.2", | ||
"@alipay/faas-runtime": "^1.1.21-alpha.2", | ||
"@types/axios": "^0.14.0", | ||
@@ -29,3 +31,10 @@ "axios": "^1.6.2", | ||
"uuid": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.12", | ||
"jest": "^29.7.0", | ||
"jest-html-reporters": "^3.1.7", | ||
"ts-jest": "^29.1.2", | ||
"typescript": "^5.4.3" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
132693
113
2822
7
5
2
7