@icreate/ics-chromely-js-sdk
Advanced tools
Comparing version 0.0.2 to 0.0.4-beta.1
@@ -1,14 +0,14 @@ | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -28,6 +28,7 @@ | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -77,3 +78,3 @@ }); | ||
}; | ||
InterceptorManage.prototype.eject = function (id) { | ||
InterceptorManage.prototype.reject = function (id) { | ||
if (this.interceptors[id]) { | ||
@@ -88,3 +89,2 @@ this.interceptors[id] = null; | ||
function IcsChromelyClient(_a) { | ||
var _this = this; | ||
var _b = _a === void 0 ? {} : _a, _c = _b.headers, headers = _c === void 0 ? {} : _c, fetch = _b.fetch; | ||
@@ -100,3 +100,2 @@ this._baseCommandUrl = 'http://command.com/'; | ||
this.interceptors.response.use(function (response) { | ||
var _a; | ||
// console.log(response) | ||
@@ -107,3 +106,3 @@ if (response.code === 200) { | ||
else { | ||
(_a = _this.errorFn) === null || _a === void 0 ? void 0 : _a.call(_this, response); | ||
// this.errorFn?.(response) | ||
return Promise.reject(response); | ||
@@ -113,3 +112,3 @@ } | ||
} | ||
IcsChromelyClient.prototype.errorFn = function (response) { }; | ||
// public errorFn(response: IMedxResponse<IMedxResponse<any>>) {} | ||
IcsChromelyClient.prototype.command = function (opts) { | ||
@@ -121,3 +120,3 @@ var link = document.createElement('a'); | ||
} | ||
link.href = "" + this._baseCommandUrl + opts.url + (params.length > 0 ? "?" + params.join('&') : ''); | ||
link.href = "".concat(this._baseCommandUrl).concat(opts.url).concat(params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
document.body.appendChild(link); | ||
@@ -143,3 +142,3 @@ link.click(); | ||
} | ||
opts.url = opts.url + (params.length > 0 ? "?" + params.join('&') : ''); | ||
opts.url = opts.url + (params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
} | ||
@@ -151,3 +150,3 @@ else { | ||
var res = config | ||
.fetch("" + config._baseAjaxUrl + opts.url, options) | ||
.fetch("".concat(config._baseAjaxUrl).concat(opts.url), options) | ||
.then(function (res) { return __awaiter(_this, void 0, void 0, function () { | ||
@@ -210,3 +209,3 @@ var data, _a, _b, error, body; | ||
export default icsChromelyRequest; | ||
export { icsChromelyRequest as default }; | ||
//# sourceMappingURL=ics-chromely-js-sdk.es5.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.icsChromelyJsSdk = factory()); | ||
}(this, (function () { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.icsChromelyJsSdk = factory()); | ||
})(this, (function () { 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -34,6 +34,7 @@ | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -83,3 +84,3 @@ }); | ||
}; | ||
InterceptorManage.prototype.eject = function (id) { | ||
InterceptorManage.prototype.reject = function (id) { | ||
if (this.interceptors[id]) { | ||
@@ -94,3 +95,2 @@ this.interceptors[id] = null; | ||
function IcsChromelyClient(_a) { | ||
var _this = this; | ||
var _b = _a === void 0 ? {} : _a, _c = _b.headers, headers = _c === void 0 ? {} : _c, fetch = _b.fetch; | ||
@@ -106,3 +106,2 @@ this._baseCommandUrl = 'http://command.com/'; | ||
this.interceptors.response.use(function (response) { | ||
var _a; | ||
// console.log(response) | ||
@@ -113,3 +112,3 @@ if (response.code === 200) { | ||
else { | ||
(_a = _this.errorFn) === null || _a === void 0 ? void 0 : _a.call(_this, response); | ||
// this.errorFn?.(response) | ||
return Promise.reject(response); | ||
@@ -119,3 +118,3 @@ } | ||
} | ||
IcsChromelyClient.prototype.errorFn = function (response) { }; | ||
// public errorFn(response: IMedxResponse<IMedxResponse<any>>) {} | ||
IcsChromelyClient.prototype.command = function (opts) { | ||
@@ -127,3 +126,3 @@ var link = document.createElement('a'); | ||
} | ||
link.href = "" + this._baseCommandUrl + opts.url + (params.length > 0 ? "?" + params.join('&') : ''); | ||
link.href = "".concat(this._baseCommandUrl).concat(opts.url).concat(params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
document.body.appendChild(link); | ||
@@ -149,3 +148,3 @@ link.click(); | ||
} | ||
opts.url = opts.url + (params.length > 0 ? "?" + params.join('&') : ''); | ||
opts.url = opts.url + (params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
} | ||
@@ -157,3 +156,3 @@ else { | ||
var res = config | ||
.fetch("" + config._baseAjaxUrl + opts.url, options) | ||
.fetch("".concat(config._baseAjaxUrl).concat(opts.url), options) | ||
.then(function (res) { return __awaiter(_this, void 0, void 0, function () { | ||
@@ -218,3 +217,3 @@ var data, _a, _b, error, body; | ||
}))); | ||
})); | ||
//# sourceMappingURL=ics-chromely-js-sdk.umd.js.map |
@@ -54,3 +54,3 @@ "use strict"; | ||
* @LastEditors: 文贝 | ||
* @LastEditTime: 2022-05-16 09:29:28 | ||
* @LastEditTime: 2022-10-25 09:19:17 | ||
* @Description: | ||
@@ -62,3 +62,2 @@ * @FilePath: \ics-chromely\src\ics-chromely-js-sdk.ts | ||
function IcsChromelyClient(_a) { | ||
var _this = this; | ||
var _b = _a === void 0 ? {} : _a, _c = _b.headers, headers = _c === void 0 ? {} : _c, fetch = _b.fetch; | ||
@@ -74,3 +73,2 @@ this._baseCommandUrl = 'http://command.com/'; | ||
this.interceptors.response.use(function (response) { | ||
var _a; | ||
// console.log(response) | ||
@@ -81,3 +79,3 @@ if (response.code === 200) { | ||
else { | ||
(_a = _this.errorFn) === null || _a === void 0 ? void 0 : _a.call(_this, response); | ||
// this.errorFn?.(response) | ||
return Promise.reject(response); | ||
@@ -87,3 +85,3 @@ } | ||
} | ||
IcsChromelyClient.prototype.errorFn = function (response) { }; | ||
// public errorFn(response: IMedxResponse<IMedxResponse<any>>) {} | ||
IcsChromelyClient.prototype.command = function (opts) { | ||
@@ -95,3 +93,3 @@ var link = document.createElement('a'); | ||
} | ||
link.href = "" + this._baseCommandUrl + opts.url + (params.length > 0 ? "?" + params.join('&') : ''); | ||
link.href = "".concat(this._baseCommandUrl).concat(opts.url).concat(params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
document.body.appendChild(link); | ||
@@ -117,3 +115,3 @@ link.click(); | ||
} | ||
opts.url = opts.url + (params.length > 0 ? "?" + params.join('&') : ''); | ||
opts.url = opts.url + (params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
} | ||
@@ -125,3 +123,3 @@ else { | ||
var res = config | ||
.fetch("" + config._baseAjaxUrl + opts.url, options) | ||
.fetch("".concat(config._baseAjaxUrl).concat(opts.url), options) | ||
.then(function (res) { return __awaiter(_this, void 0, void 0, function () { | ||
@@ -128,0 +126,0 @@ var data, _a, _b, error, body; |
@@ -5,6 +5,6 @@ "use strict"; | ||
* @Date: 2022-05-05 14:16:04 | ||
* @LastEditors: 刘邓 | ||
* @LastEditTime: 2022-05-06 17:10:49 | ||
* @LastEditors: 文贝 | ||
* @LastEditTime: 2022-06-22 17:54:30 | ||
* @Description: | ||
* @FilePath: \src\interfaces\interfaces.ts | ||
* @FilePath: \ics-chromely\src\interfaces\interfaces.ts | ||
*/ | ||
@@ -11,0 +11,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -15,3 +15,3 @@ "use strict"; | ||
}; | ||
InterceptorManage.prototype.eject = function (id) { | ||
InterceptorManage.prototype.reject = function (id) { | ||
if (this.interceptors[id]) { | ||
@@ -18,0 +18,0 @@ this.interceptors[id] = null; |
@@ -0,1 +1,2 @@ | ||
import InterceptorManager from './lib/Interceptor-manage'; | ||
import { IMedxResponse } from './interfaces/interfaces'; | ||
@@ -9,3 +10,6 @@ declare class IcsChromelyClient { | ||
fetch: any; | ||
private interceptors; | ||
interceptors: { | ||
request: InterceptorManager<IcsChromelyClient>; | ||
response: InterceptorManager<IMedxResponse<any>>; | ||
}; | ||
constructor({ headers, fetch }?: { | ||
@@ -17,3 +21,2 @@ headers?: { | ||
}); | ||
errorFn(response: IMedxResponse<IMedxResponse<any>>): void; | ||
command(opts: { | ||
@@ -27,5 +30,5 @@ url: string; | ||
data?: any; | ||
}): Promise<this>; | ||
}): Promise<any>; | ||
} | ||
declare const icsChromelyRequest: IcsChromelyClient; | ||
export default icsChromelyRequest; |
@@ -14,3 +14,3 @@ interface IMedxResponseBase { | ||
use(resolved: ResolvedFn<T>, rejected?: RejectedFn): number; | ||
eject(id: number): void; | ||
reject(id: number): void; | ||
} | ||
@@ -17,0 +17,0 @@ export interface ResolvedFn<T = any> { |
@@ -5,3 +5,3 @@ import { IInterceptorManage, Interceptor, RejectedFn, ResolvedFn } from '../interfaces/interfaces'; | ||
use(resolved: ResolvedFn<T>, rejected?: RejectedFn): number; | ||
eject(id: number): void; | ||
reject(id: number): void; | ||
} |
{ | ||
"name": "@icreate/ics-chromely-js-sdk", | ||
"version": "0.0.2", | ||
"version": "0.0.4-beta.1", | ||
"description": "", | ||
@@ -123,2 +123,2 @@ "keywords": [], | ||
} | ||
} | ||
} |
@@ -22,3 +22,3 @@ ## 引入 | ||
icsChromelyRequest.function(opts: { url: string; method?: 'POST' | 'GET'; data?: any }) | ||
##### 注意:参数需要根据C#文件来定义,以下面的C#文件为例, url为RouteKey关键字对应值;`request.Parameters["key"]`对应的则为GET方法,且参数为key;`_jsonSerializer.Deserialize<CacheModel>(request.RawJson)`对应的则为POST方法,参数为CacheModel对应的数据类型。 | ||
##### 注意:参数需要根据C#文件来定义,以下面的C#文件为例, url为RouteKey关键字对应值;`request.Parameters["key"]`对应的则为GET方法,且参数为key;`_jsonSerializer.Deserialize<CacheModel>(request.PostData.ToString())`对应的则为POST方法,参数为CacheModel对应的数据类型。 | ||
@@ -54,3 +54,3 @@ { | ||
Check.NotNull(request.PostData, "缓存对象"); | ||
var cacheModel = _jsonSerializer.Deserialize<CacheModel>(request.RawJson); | ||
var cacheModel = _jsonSerializer.Deserialize<CacheModel>(request.PostData.ToString()); | ||
_memoryCache.Set(cacheModel.Key, cacheModel.Value); | ||
@@ -57,0 +57,0 @@ return Success("Ok"); |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
68018
0
675