@imedx/ics-imedx-chromely-plugin-intf-platform
Advanced tools
Comparing version 0.0.1-beta.2 to 0.0.1-beta.3
import icsChromelyRequest from '@icreate/ics-chromely-js-sdk'; | ||
/** | ||
* 接口响应 | ||
*/ | ||
var IntfResponse = /** @class */ (function () { | ||
function IntfResponse(code, message, data) { | ||
if (code === void 0) { code = 200; } | ||
if (message === void 0) { message = 'ok'; } | ||
if (data === void 0) { data = null; } | ||
this.code = code || 200; | ||
this.message = message || 'ok'; | ||
this.data = data || null; | ||
} | ||
IntfResponse.success = new IntfResponse(); | ||
return IntfResponse; | ||
}()); | ||
/** | ||
* 抽象接口定义 | ||
*/ | ||
var BaseInterfaceCore = /** @class */ (function () { | ||
function BaseInterfaceCore() { | ||
} | ||
/** | ||
* 200成功返回 | ||
* @param data 成功数据 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.success = function (data) { | ||
return new IntfResponse(200, 'ok', data); | ||
}; | ||
/** | ||
* 400错误 | ||
* @param message 错误消息 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.failure = function (message) { | ||
return new IntfResponse(400, message); | ||
}; | ||
/** | ||
* 500错误 | ||
* @param message 错误消息 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.internalError = function (message) { | ||
return new IntfResponse(500, message); | ||
}; | ||
/** | ||
* 404错误 | ||
* @param message 错误消息 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.notFound = function (message) { | ||
return new IntfResponse(404, message); | ||
}; | ||
return BaseInterfaceCore; | ||
}()); | ||
/** | ||
* 接口配置 | ||
*/ | ||
var intfParam = /** @class */ (function () { | ||
function intfParam(name, type, options, defaultValue, remark, deprecated) { | ||
this.name = name; | ||
this.type = type; | ||
this.options = options; | ||
this.default = defaultValue; | ||
this.remark = remark; | ||
this.deprecated = deprecated; | ||
} | ||
return intfParam; | ||
}()); | ||
/** | ||
* 接口参数类型 | ||
*/ | ||
var InterfaceParamType; | ||
(function (InterfaceParamType) { | ||
// 输入框 | ||
InterfaceParamType[InterfaceParamType["input"] = 1] = "input"; | ||
// 选择框 | ||
InterfaceParamType[InterfaceParamType["select"] = 2] = "select"; | ||
})(InterfaceParamType || (InterfaceParamType = {})); | ||
/** | ||
* 接口模式 1表示C#接口 2表示js接口 | ||
*/ | ||
var InterfaceType; | ||
(function (InterfaceType) { | ||
// DLL接口 | ||
InterfaceType[InterfaceType["DLL"] = 1] = "DLL"; | ||
// js接口 | ||
InterfaceType[InterfaceType["JS"] = 2] = "JS"; | ||
})(InterfaceType || (InterfaceType = {})); | ||
var IntfPlatformManage = /** @class */ (function () { | ||
function IntfPlatformManage() { | ||
this.interfaces = new Map(); | ||
this.coreInterfaces = new Map(); | ||
this.configs = new Map(); | ||
this.coreConfigs = new Map(); | ||
} | ||
/** | ||
* 获取核心接口 | ||
* @returns 核心接口管理 | ||
*/ | ||
IntfPlatformManage.getIntfPlatformManage = function () { | ||
if (this.manage == null) { | ||
this.manage = new IntfPlatformManage(); | ||
} | ||
return this.manage; | ||
}; | ||
/** | ||
* 注册核心接口 | ||
* @param name 核心接口名称 | ||
* @param instance 核心接口实例 | ||
*/ | ||
IntfPlatformManage.prototype.registerInterfaceCore = function (name, instance, config) { | ||
this.coreInterfaces.set(name, instance); | ||
this.coreConfigs.set(name, config); | ||
}; | ||
/** | ||
* 注册核心接口 | ||
* @param name 核心接口名称 | ||
* @param instance 核心接口实例 | ||
*/ | ||
IntfPlatformManage.prototype.registerInterface = function (name, instance, config) { | ||
this.interfaces.set(name, instance); | ||
this.configs.set(name, config); | ||
}; | ||
/** | ||
* 获取所有核心接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getAllCoreInterface = function () { | ||
return this.coreInterfaces; | ||
}; | ||
/** | ||
* 获取核心接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getCoreInterface = function (name) { | ||
return this.coreInterfaces.get(name); | ||
}; | ||
/** | ||
* 获取核心接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getCoreInterfaceConfig = function (name) { | ||
return this.configs.get(name); | ||
}; | ||
/** | ||
* 获取所有实现接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getAllInterface = function (name) { | ||
return this.interfaces; | ||
}; | ||
/** | ||
* 获取实现接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getInterface = function (name) { | ||
return this.interfaces.get(name); | ||
}; | ||
/** | ||
* 获取实现接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getInterfaceConfig = function (name) { | ||
return this.configs.get(name); | ||
}; | ||
return IntfPlatformManage; | ||
}()); | ||
/* | ||
@@ -23,2 +199,9 @@ * @Author: 陶慧灵 | ||
/** | ||
* 获取接口模式 | ||
* @returns 接口模式 | ||
*/ | ||
IntfPlatform.GetInterfaceType = function (intfCode) { | ||
return InterfaceType.DLL; | ||
}; | ||
/** | ||
* | ||
@@ -45,3 +228,18 @@ * @returns 成功:{code: 200, data, message: 'ok'} | ||
IntfPlatform.bussiness = function (intfCode, code, param) { | ||
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) }); | ||
var mode = this.GetInterfaceType(intfCode); | ||
switch (mode) { | ||
case InterfaceType.JS: | ||
// 调用js接口实现 | ||
var intfCoreManage = IntfPlatformManage.getIntfPlatformManage(); | ||
// 获取核心接口 | ||
var intfCoreInstance = intfCoreManage.getCoreInterface(intfCode); | ||
// 判断核心接口是否存在 | ||
if (!intfCoreInstance) { | ||
return Promise.reject("\u6838\u5FC3\u63A5\u53E3" + intfCode + "\u4E0D\u5B58\u5728\uFF01"); | ||
} | ||
// 返回接口结果 | ||
return Promise.resolve(intfCoreInstance.business(code, param)); | ||
default: | ||
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) }); | ||
} | ||
}; | ||
@@ -51,12 +249,4 @@ return IntfPlatform; | ||
/* | ||
* @Author: 陶慧灵 | ||
* @Date: 2022-10-21 08:26:57 | ||
* @LastEditors: 陶慧灵 | ||
* @LastEditTime: 2022-10-21 08:32:11 | ||
* @Descripttion: | ||
* @FilePath: \src\ics-imedx-chromely-plugin-intf-platform.ts | ||
*/ | ||
export default IntfPlatform; | ||
export { IntfResponse, BaseInterfaceCore, intfParam, InterfaceParamType, InterfaceType }; | ||
//# sourceMappingURL=ics-imedx-chromely-plugin-intf-platform.es5.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@icreate/ics-chromely-js-sdk')) : | ||
typeof define === 'function' && define.amd ? define(['@icreate/ics-chromely-js-sdk'], factory) : | ||
(global.icsImedxChromelyPluginIntfPlatform = factory(global.icsChromelyRequest)); | ||
}(this, (function (icsChromelyRequest) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@icreate/ics-chromely-js-sdk')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@icreate/ics-chromely-js-sdk'], factory) : | ||
(factory((global.icsImedxChromelyPluginIntfPlatform = {}),global.icsChromelyRequest)); | ||
}(this, (function (exports,icsChromelyRequest) { 'use strict'; | ||
icsChromelyRequest = icsChromelyRequest && icsChromelyRequest.hasOwnProperty('default') ? icsChromelyRequest['default'] : icsChromelyRequest; | ||
/** | ||
* 接口响应 | ||
*/ | ||
var IntfResponse = /** @class */ (function () { | ||
function IntfResponse(code, message, data) { | ||
if (code === void 0) { code = 200; } | ||
if (message === void 0) { message = 'ok'; } | ||
if (data === void 0) { data = null; } | ||
this.code = code || 200; | ||
this.message = message || 'ok'; | ||
this.data = data || null; | ||
} | ||
IntfResponse.success = new IntfResponse(); | ||
return IntfResponse; | ||
}()); | ||
/** | ||
* 抽象接口定义 | ||
*/ | ||
var BaseInterfaceCore = /** @class */ (function () { | ||
function BaseInterfaceCore() { | ||
} | ||
/** | ||
* 200成功返回 | ||
* @param data 成功数据 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.success = function (data) { | ||
return new IntfResponse(200, 'ok', data); | ||
}; | ||
/** | ||
* 400错误 | ||
* @param message 错误消息 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.failure = function (message) { | ||
return new IntfResponse(400, message); | ||
}; | ||
/** | ||
* 500错误 | ||
* @param message 错误消息 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.internalError = function (message) { | ||
return new IntfResponse(500, message); | ||
}; | ||
/** | ||
* 404错误 | ||
* @param message 错误消息 | ||
* @returns 接口响应数据 | ||
*/ | ||
BaseInterfaceCore.prototype.notFound = function (message) { | ||
return new IntfResponse(404, message); | ||
}; | ||
return BaseInterfaceCore; | ||
}()); | ||
/** | ||
* 接口配置 | ||
*/ | ||
var intfParam = /** @class */ (function () { | ||
function intfParam(name, type, options, defaultValue, remark, deprecated) { | ||
this.name = name; | ||
this.type = type; | ||
this.options = options; | ||
this.default = defaultValue; | ||
this.remark = remark; | ||
this.deprecated = deprecated; | ||
} | ||
return intfParam; | ||
}()); | ||
(function (InterfaceParamType) { | ||
// 输入框 | ||
InterfaceParamType[InterfaceParamType["input"] = 1] = "input"; | ||
// 选择框 | ||
InterfaceParamType[InterfaceParamType["select"] = 2] = "select"; | ||
})(exports.InterfaceParamType || (exports.InterfaceParamType = {})); | ||
(function (InterfaceType) { | ||
// DLL接口 | ||
InterfaceType[InterfaceType["DLL"] = 1] = "DLL"; | ||
// js接口 | ||
InterfaceType[InterfaceType["JS"] = 2] = "JS"; | ||
})(exports.InterfaceType || (exports.InterfaceType = {})); | ||
var IntfPlatformManage = /** @class */ (function () { | ||
function IntfPlatformManage() { | ||
this.interfaces = new Map(); | ||
this.coreInterfaces = new Map(); | ||
this.configs = new Map(); | ||
this.coreConfigs = new Map(); | ||
} | ||
/** | ||
* 获取核心接口 | ||
* @returns 核心接口管理 | ||
*/ | ||
IntfPlatformManage.getIntfPlatformManage = function () { | ||
if (this.manage == null) { | ||
this.manage = new IntfPlatformManage(); | ||
} | ||
return this.manage; | ||
}; | ||
/** | ||
* 注册核心接口 | ||
* @param name 核心接口名称 | ||
* @param instance 核心接口实例 | ||
*/ | ||
IntfPlatformManage.prototype.registerInterfaceCore = function (name, instance, config) { | ||
this.coreInterfaces.set(name, instance); | ||
this.coreConfigs.set(name, config); | ||
}; | ||
/** | ||
* 注册核心接口 | ||
* @param name 核心接口名称 | ||
* @param instance 核心接口实例 | ||
*/ | ||
IntfPlatformManage.prototype.registerInterface = function (name, instance, config) { | ||
this.interfaces.set(name, instance); | ||
this.configs.set(name, config); | ||
}; | ||
/** | ||
* 获取所有核心接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getAllCoreInterface = function () { | ||
return this.coreInterfaces; | ||
}; | ||
/** | ||
* 获取核心接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getCoreInterface = function (name) { | ||
return this.coreInterfaces.get(name); | ||
}; | ||
/** | ||
* 获取核心接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getCoreInterfaceConfig = function (name) { | ||
return this.configs.get(name); | ||
}; | ||
/** | ||
* 获取所有实现接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getAllInterface = function (name) { | ||
return this.interfaces; | ||
}; | ||
/** | ||
* 获取实现接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getInterface = function (name) { | ||
return this.interfaces.get(name); | ||
}; | ||
/** | ||
* 获取实现接口 | ||
* @param name 核心接口名称 | ||
* @returns | ||
*/ | ||
IntfPlatformManage.prototype.getInterfaceConfig = function (name) { | ||
return this.configs.get(name); | ||
}; | ||
return IntfPlatformManage; | ||
}()); | ||
/* | ||
@@ -29,2 +197,9 @@ * @Author: 陶慧灵 | ||
/** | ||
* 获取接口模式 | ||
* @returns 接口模式 | ||
*/ | ||
IntfPlatform.GetInterfaceType = function (intfCode) { | ||
return exports.InterfaceType.DLL; | ||
}; | ||
/** | ||
* | ||
@@ -51,3 +226,18 @@ * @returns 成功:{code: 200, data, message: 'ok'} | ||
IntfPlatform.bussiness = function (intfCode, code, param) { | ||
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) }); | ||
var mode = this.GetInterfaceType(intfCode); | ||
switch (mode) { | ||
case exports.InterfaceType.JS: | ||
// 调用js接口实现 | ||
var intfCoreManage = IntfPlatformManage.getIntfPlatformManage(); | ||
// 获取核心接口 | ||
var intfCoreInstance = intfCoreManage.getCoreInterface(intfCode); | ||
// 判断核心接口是否存在 | ||
if (!intfCoreInstance) { | ||
return Promise.reject("\u6838\u5FC3\u63A5\u53E3" + intfCode + "\u4E0D\u5B58\u5728\uFF01"); | ||
} | ||
// 返回接口结果 | ||
return Promise.resolve(intfCoreInstance.business(code, param)); | ||
default: | ||
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) }); | ||
} | ||
}; | ||
@@ -57,14 +247,10 @@ return IntfPlatform; | ||
/* | ||
* @Author: 陶慧灵 | ||
* @Date: 2022-10-21 08:26:57 | ||
* @LastEditors: 陶慧灵 | ||
* @LastEditTime: 2022-10-21 08:32:11 | ||
* @Descripttion: | ||
* @FilePath: \src\ics-imedx-chromely-plugin-intf-platform.ts | ||
*/ | ||
exports.default = IntfPlatform; | ||
exports.IntfResponse = IntfResponse; | ||
exports.BaseInterfaceCore = BaseInterfaceCore; | ||
exports.intfParam = intfParam; | ||
return IntfPlatform; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=ics-imedx-chromely-plugin-intf-platform.umd.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* @Author: 陶慧灵 | ||
* @Date: 2022-10-21 08:26:57 | ||
* @LastEditors: 陶慧灵 | ||
* @LastEditTime: 2022-10-21 08:32:11 | ||
* @Descripttion: | ||
* @FilePath: \src\ics-imedx-chromely-plugin-intf-platform.ts | ||
*/ | ||
var intf_platform_1 = require("./intf-platform"); | ||
exports.default = intf_platform_1.default; | ||
__exportStar(require("./interfaces/InterfaceCore"), exports); | ||
//# sourceMappingURL=ics-imedx-chromely-plugin-intf-platform.js.map |
@@ -12,2 +12,4 @@ "use strict"; | ||
var ics_chromely_js_sdk_1 = require("@icreate/ics-chromely-js-sdk"); | ||
var InterfaceCore_1 = require("./interfaces/InterfaceCore"); | ||
var intf_platform_manage_1 = require("./intf-platform-manage"); | ||
var IntfPlatform = /** @class */ (function () { | ||
@@ -25,2 +27,9 @@ function IntfPlatform() { | ||
/** | ||
* 获取接口模式 | ||
* @returns 接口模式 | ||
*/ | ||
IntfPlatform.GetInterfaceType = function (intfCode) { | ||
return InterfaceCore_1.InterfaceType.DLL; | ||
}; | ||
/** | ||
* | ||
@@ -47,3 +56,18 @@ * @returns 成功:{code: 200, data, message: 'ok'} | ||
IntfPlatform.bussiness = function (intfCode, code, param) { | ||
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) }); | ||
var mode = this.GetInterfaceType(intfCode); | ||
switch (mode) { | ||
case InterfaceCore_1.InterfaceType.JS: | ||
// 调用js接口实现 | ||
var intfCoreManage = intf_platform_manage_1.default.getIntfPlatformManage(); | ||
// 获取核心接口 | ||
var intfCoreInstance = intfCoreManage.getCoreInterface(intfCode); | ||
// 判断核心接口是否存在 | ||
if (!intfCoreInstance) { | ||
return Promise.reject("\u6838\u5FC3\u63A5\u53E3" + intfCode + "\u4E0D\u5B58\u5728\uFF01"); | ||
} | ||
// 返回接口结果 | ||
return Promise.resolve(intfCoreInstance.business(code, param)); | ||
default: | ||
return this.OperateEx('Business', { intfCode: intfCode, code: code, param: JSON.stringify(param) }); | ||
} | ||
}; | ||
@@ -50,0 +74,0 @@ return IntfPlatform; |
import IntfPlatform from './intf-platform'; | ||
export default IntfPlatform; | ||
export * from './interfaces/InterfaceCore'; |
export default class IntfPlatform { | ||
private static OperateEx; | ||
/** | ||
* 获取接口模式 | ||
* @returns 接口模式 | ||
*/ | ||
private static GetInterfaceType; | ||
/** | ||
* | ||
@@ -5,0 +10,0 @@ * @returns 成功:{code: 200, data, message: 'ok'} |
{ | ||
"name": "@imedx/ics-imedx-chromely-plugin-intf-platform", | ||
"version": "0.0.1-beta.2", | ||
"version": "0.0.1-beta.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77473
22
967
1