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

@imedx/ics-imedx-chromely-plugin-intf-platform

Package Overview
Dependencies
Maintainers
15
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@imedx/ics-imedx-chromely-plugin-intf-platform - npm Package Compare versions

Comparing version 0.0.2-beta.9 to 0.0.2-beta.10

dist/lib/utils/hb-request.js

123

dist/ics-imedx-chromely-plugin-intf-platform.es5.js

@@ -143,6 +143,21 @@ import icsChromelyRequest from '@icreate/ics-chromely-js-sdk';

/**
* 验证授权
* @param intfCode 接口编码
* @returns Promise
*/
IntfPlatform.authorization = function (intfCode) {
return this.hbbasic.api.authorization({
orgId: this.orgId,
apiId: intfCode
}, false);
};
/**
*
* @param orgId 机构编号
* @param hbBasicClient hbBasic接口
* @returns 成功:{code: 200, data, message: 'ok'}
*/
IntfPlatform.init = function () {
IntfPlatform.init = function (orgId, hbBasicClient) {
this.orgId = orgId;
this.hbbasic = hbBasicClient;
return this.OperateEx('Init');

@@ -165,50 +180,68 @@ };

IntfPlatform.bussiness = function (intfCode, code, param) {
// 校验接口是否有权限
var _this = this;
var mode = IntfPlatform.GetInterfaceType(intfCode);
switch (mode) {
case InterfaceType.JS:
var chain_1 = [
{
resolved: function (config) {
// 获取核心接口
var intfCoreInstance = IntfPlatform.getCoreInterface(intfCode);
// 判断核心接口是否存在
if (!intfCoreInstance) {
return Promise.reject({
code: 404,
message: "\u6838\u5FC3\u63A5\u53E3".concat(intfCode, "\u4E0D\u5B58\u5728\uFF01"),
data: null
});
}
else {
try {
return Promise.resolve(intfCoreInstance.business(code, param));
}
catch (error) {
var message = error.message;
return Promise.reject({
code: 404,
message: message || error,
data: null
});
}
}
},
rejected: undefined
// switch (mode) {
// case InterfaceType.JS:
var chain = [
{
resolved: function (config) {
return IntfPlatform.authorization(intfCode);
},
rejected: undefined
}
];
if (mode === InterfaceType.JS) {
chain.push({
resolved: function (config) {
// 获取核心接口
var intfCoreInstance = IntfPlatform.getCoreInterface(intfCode);
// 判断核心接口是否存在
if (!intfCoreInstance) {
return Promise.reject({
code: 404,
message: "\u6838\u5FC3\u63A5\u53E3".concat(intfCode, "\u4E0D\u5B58\u5728\uFF01"),
data: null
});
}
];
icsChromelyRequest.interceptors.response.interceptors.forEach(function (interceptor) {
if (interceptor !== null) {
chain_1.push(interceptor);
else {
try {
return Promise.resolve(intfCoreInstance.business(code, param));
}
catch (error) {
var message = error.message;
return Promise.reject({
code: 404,
message: message || error,
data: null
});
}
}
});
var promise = Promise.resolve(__assign({}, this));
while (chain_1.length) {
var _a = chain_1.shift(), resolved = _a.resolved, rejected = _a.rejected;
promise = promise.then(resolved, rejected);
}
// 返回接口结果
return promise;
default:
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) });
},
rejected: undefined
});
}
else {
chain.push({
resolved: function (config) {
return _this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) });
},
rejected: undefined
});
}
icsChromelyRequest.interceptors.response.interceptors.forEach(function (interceptor) {
if (interceptor !== null) {
chain.push(interceptor);
}
});
var promise = Promise.resolve(__assign({}, this));
while (chain.length) {
var _a = chain.shift(), resolved = _a.resolved, rejected = _a.rejected;
promise = promise.then(resolved, rejected);
}
// 返回接口结果
return promise;
// default:
// return this.OperateEx('Business', { intfCode, code, param: JSON.stringify(param) })
// }
};

@@ -215,0 +248,0 @@ /**

@@ -147,6 +147,21 @@ (function (global, factory) {

/**
* 验证授权
* @param intfCode 接口编码
* @returns Promise
*/
IntfPlatform.authorization = function (intfCode) {
return this.hbbasic.api.authorization({
orgId: this.orgId,
apiId: intfCode
}, false);
};
/**
*
* @param orgId 机构编号
* @param hbBasicClient hbBasic接口
* @returns 成功:{code: 200, data, message: 'ok'}
*/
IntfPlatform.init = function () {
IntfPlatform.init = function (orgId, hbBasicClient) {
this.orgId = orgId;
this.hbbasic = hbBasicClient;
return this.OperateEx('Init');

@@ -169,50 +184,68 @@ };

IntfPlatform.bussiness = function (intfCode, code, param) {
// 校验接口是否有权限
var _this = this;
var mode = IntfPlatform.GetInterfaceType(intfCode);
switch (mode) {
case exports.InterfaceType.JS:
var chain_1 = [
{
resolved: function (config) {
// 获取核心接口
var intfCoreInstance = IntfPlatform.getCoreInterface(intfCode);
// 判断核心接口是否存在
if (!intfCoreInstance) {
return Promise.reject({
code: 404,
message: "\u6838\u5FC3\u63A5\u53E3".concat(intfCode, "\u4E0D\u5B58\u5728\uFF01"),
data: null
});
}
else {
try {
return Promise.resolve(intfCoreInstance.business(code, param));
}
catch (error) {
var message = error.message;
return Promise.reject({
code: 404,
message: message || error,
data: null
});
}
}
},
rejected: undefined
// switch (mode) {
// case InterfaceType.JS:
var chain = [
{
resolved: function (config) {
return IntfPlatform.authorization(intfCode);
},
rejected: undefined
}
];
if (mode === exports.InterfaceType.JS) {
chain.push({
resolved: function (config) {
// 获取核心接口
var intfCoreInstance = IntfPlatform.getCoreInterface(intfCode);
// 判断核心接口是否存在
if (!intfCoreInstance) {
return Promise.reject({
code: 404,
message: "\u6838\u5FC3\u63A5\u53E3".concat(intfCode, "\u4E0D\u5B58\u5728\uFF01"),
data: null
});
}
];
icsChromelyRequest.interceptors.response.interceptors.forEach(function (interceptor) {
if (interceptor !== null) {
chain_1.push(interceptor);
else {
try {
return Promise.resolve(intfCoreInstance.business(code, param));
}
catch (error) {
var message = error.message;
return Promise.reject({
code: 404,
message: message || error,
data: null
});
}
}
});
var promise = Promise.resolve(__assign({}, this));
while (chain_1.length) {
var _a = chain_1.shift(), resolved = _a.resolved, rejected = _a.rejected;
promise = promise.then(resolved, rejected);
}
// 返回接口结果
return promise;
default:
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) });
},
rejected: undefined
});
}
else {
chain.push({
resolved: function (config) {
return _this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) });
},
rejected: undefined
});
}
icsChromelyRequest.interceptors.response.interceptors.forEach(function (interceptor) {
if (interceptor !== null) {
chain.push(interceptor);
}
});
var promise = Promise.resolve(__assign({}, this));
while (chain.length) {
var _a = chain.shift(), resolved = _a.resolved, rejected = _a.rejected;
promise = promise.then(resolved, rejected);
}
// 返回接口结果
return promise;
// default:
// return this.OperateEx('Business', { intfCode, code, param: JSON.stringify(param) })
// }
};

@@ -219,0 +252,0 @@ /**

@@ -40,6 +40,21 @@ "use strict";

/**
* 验证授权
* @param intfCode 接口编码
* @returns Promise
*/
IntfPlatform.authorization = function (intfCode) {
return this.hbbasic.api.authorization({
orgId: this.orgId,
apiId: intfCode
}, false);
};
/**
*
* @param orgId 机构编号
* @param hbBasicClient hbBasic接口
* @returns 成功:{code: 200, data, message: 'ok'}
*/
IntfPlatform.init = function () {
IntfPlatform.init = function (orgId, hbBasicClient) {
this.orgId = orgId;
this.hbbasic = hbBasicClient;
return this.OperateEx('Init');

@@ -62,50 +77,68 @@ };

IntfPlatform.bussiness = function (intfCode, code, param) {
// 校验接口是否有权限
var _this = this;
var mode = IntfPlatform.GetInterfaceType(intfCode);
switch (mode) {
case InterfaceCore_1.InterfaceType.JS:
var chain_1 = [
{
resolved: function (config) {
// 获取核心接口
var intfCoreInstance = IntfPlatform.getCoreInterface(intfCode);
// 判断核心接口是否存在
if (!intfCoreInstance) {
return Promise.reject({
code: 404,
message: "\u6838\u5FC3\u63A5\u53E3".concat(intfCode, "\u4E0D\u5B58\u5728\uFF01"),
data: null
});
}
else {
try {
return Promise.resolve(intfCoreInstance.business(code, param));
}
catch (error) {
var message = error.message;
return Promise.reject({
code: 404,
message: message || error,
data: null
});
}
}
},
rejected: undefined
// switch (mode) {
// case InterfaceType.JS:
var chain = [
{
resolved: function (config) {
return IntfPlatform.authorization(intfCode);
},
rejected: undefined
}
];
if (mode === InterfaceCore_1.InterfaceType.JS) {
chain.push({
resolved: function (config) {
// 获取核心接口
var intfCoreInstance = IntfPlatform.getCoreInterface(intfCode);
// 判断核心接口是否存在
if (!intfCoreInstance) {
return Promise.reject({
code: 404,
message: "\u6838\u5FC3\u63A5\u53E3".concat(intfCode, "\u4E0D\u5B58\u5728\uFF01"),
data: null
});
}
];
ics_chromely_js_sdk_1.default.interceptors.response.interceptors.forEach(function (interceptor) {
if (interceptor !== null) {
chain_1.push(interceptor);
else {
try {
return Promise.resolve(intfCoreInstance.business(code, param));
}
catch (error) {
var message = error.message;
return Promise.reject({
code: 404,
message: message || error,
data: null
});
}
}
});
var promise = Promise.resolve(__assign({}, this));
while (chain_1.length) {
var _a = chain_1.shift(), resolved = _a.resolved, rejected = _a.rejected;
promise = promise.then(resolved, rejected);
}
// 返回接口结果
return promise;
default:
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) });
},
rejected: undefined
});
}
else {
chain.push({
resolved: function (config) {
return _this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) });
},
rejected: undefined
});
}
ics_chromely_js_sdk_1.default.interceptors.response.interceptors.forEach(function (interceptor) {
if (interceptor !== null) {
chain.push(interceptor);
}
});
var promise = Promise.resolve(__assign({}, this));
while (chain.length) {
var _a = chain.shift(), resolved = _a.resolved, rejected = _a.rejected;
promise = promise.then(resolved, rejected);
}
// 返回接口结果
return promise;
// default:
// return this.OperateEx('Business', { intfCode, code, param: JSON.stringify(param) })
// }
};

@@ -112,0 +145,0 @@ /**

@@ -0,4 +1,13 @@

import HBBasicClient from '@icreate/hb-basic-js-sdk';
import { ConfigRecord, IInterfaceCore } from './interfaces/InterfaceCore';
export default class IntfPlatform {
/**
* 机构ID
*/
private static orgId;
/**
* hbbasic接口
*/
private static hbbasic;
/**
* 实现接口列表

@@ -32,6 +41,14 @@ */

/**
* 验证授权
* @param intfCode 接口编码
* @returns Promise
*/
static authorization(intfCode: string): Promise<any>;
/**
*
* @param orgId 机构编号
* @param hbBasicClient hbBasic接口
* @returns 成功:{code: 200, data, message: 'ok'}
*/
static init(): Promise<any>;
static init(orgId: string, hbBasicClient: HBBasicClient): Promise<any>;
/**

@@ -38,0 +55,0 @@ *

{
"name": "@imedx/ics-imedx-chromely-plugin-intf-platform",
"version": "0.0.2-beta.9",
"version": "0.0.2-beta.10",
"description": "",

@@ -131,4 +131,6 @@ "keywords": [],

"dependencies": {
"@icreate/ics-chromely-js-sdk": "^0.0.6"
"@icreate/hb-basic-js-sdk": "^0.0.17-beta.14",
"@icreate/ics-chromely-js-sdk": "^0.0.6-beta.1",
"@icreate/ics-chromely-plugin-core": "^0.0.20-beta.5"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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