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

@icreate/ics-chromely-js-sdk

Package Overview
Dependencies
Maintainers
8
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@icreate/ics-chromely-js-sdk - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5-beta.1

84

dist/ics-chromely-js-sdk.es5.js

@@ -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;

@@ -97,6 +97,5 @@ this._baseCommandUrl = 'http://command.com/';

request: new InterceptorManage(),
response: new InterceptorManage()
response: new InterceptorManage(),
};
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);

@@ -132,3 +131,2 @@ link.click();

return __generator(this, function (_b) {
this.headers['Content-Type'] = this.headers['Content-Type'] || 'application/json';
chain = [

@@ -138,3 +136,9 @@ {

var _a, _b;
var options = __assign(__assign({}, opts), config);
var options = __assign(__assign({}, config), opts);
if (options.headers) {
options.headers['Content-Type'] = options.headers['Content-Type'] || 'application/json';
}
else {
options.headers = { 'Content-Type': 'application/json' };
}
if (((_a = opts === null || opts === void 0 ? void 0 : opts.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'GET' || ((_b = opts === null || opts === void 0 ? void 0 : opts.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'HEAD') {

@@ -145,3 +149,3 @@ var params = [];

}
opts.url = opts.url + (params.length > 0 ? "?" + params.join('&') : '');
opts.url = opts.url + (params.length > 0 ? "?".concat(params.join('&')) : '');
}

@@ -153,28 +157,34 @@ 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 () {
var data, _a, _b, error, body;
return __generator(this, function (_c) {
switch (_c.label) {
var _a, _b, error, body;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
if (!res.ok) return [3 /*break*/, 2];
if (!res.ok) return [3 /*break*/, 5];
if (!(res.headers.get('Content-Type') === 'application/json')) return [3 /*break*/, 2];
_b = (_a = JSON).parse;
return [4 /*yield*/, res.text()];
case 1:
data = _b.apply(_a, [_c.sent()]);
return [2 /*return*/, data];
case 1: return [2 /*return*/, _b.apply(_a, [_d.sent()])];
case 2:
_c = { code: 200, message: 'ok' };
return [4 /*yield*/, res.blob()];
case 3: return [2 /*return*/, (_c.data = _d.sent(), _c)];
case 4: return [3 /*break*/, 7];
case 5:
error = null;
return [4 /*yield*/, res.text()];
case 3:
body = _c.sent();
case 6:
body = _d.sent();
try {
error = JSON.parse(body);
}
catch (_d) {
catch (_e) {
error = {
message: body
message: body,
};
}
return [2 /*return*/, Promise.reject(error)];
case 7: return [2 /*return*/];
}

@@ -185,4 +195,4 @@ });

},
rejected: undefined
}
rejected: undefined,
},
];

@@ -213,3 +223,3 @@ // 拦截器加入执行链

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;

@@ -103,6 +103,5 @@ this._baseCommandUrl = 'http://command.com/';

request: new InterceptorManage(),
response: new InterceptorManage()
response: new InterceptorManage(),
};
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);

@@ -138,3 +137,2 @@ link.click();

return __generator(this, function (_b) {
this.headers['Content-Type'] = this.headers['Content-Type'] || 'application/json';
chain = [

@@ -144,3 +142,9 @@ {

var _a, _b;
var options = __assign(__assign({}, opts), config);
var options = __assign(__assign({}, config), opts);
if (options.headers) {
options.headers['Content-Type'] = options.headers['Content-Type'] || 'application/json';
}
else {
options.headers = { 'Content-Type': 'application/json' };
}
if (((_a = opts === null || opts === void 0 ? void 0 : opts.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'GET' || ((_b = opts === null || opts === void 0 ? void 0 : opts.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'HEAD') {

@@ -151,3 +155,3 @@ var params = [];

}
opts.url = opts.url + (params.length > 0 ? "?" + params.join('&') : '');
opts.url = opts.url + (params.length > 0 ? "?".concat(params.join('&')) : '');
}

@@ -159,28 +163,34 @@ 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 () {
var data, _a, _b, error, body;
return __generator(this, function (_c) {
switch (_c.label) {
var _a, _b, error, body;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
if (!res.ok) return [3 /*break*/, 2];
if (!res.ok) return [3 /*break*/, 5];
if (!(res.headers.get('Content-Type') === 'application/json')) return [3 /*break*/, 2];
_b = (_a = JSON).parse;
return [4 /*yield*/, res.text()];
case 1:
data = _b.apply(_a, [_c.sent()]);
return [2 /*return*/, data];
case 1: return [2 /*return*/, _b.apply(_a, [_d.sent()])];
case 2:
_c = { code: 200, message: 'ok' };
return [4 /*yield*/, res.blob()];
case 3: return [2 /*return*/, (_c.data = _d.sent(), _c)];
case 4: return [3 /*break*/, 7];
case 5:
error = null;
return [4 /*yield*/, res.text()];
case 3:
body = _c.sent();
case 6:
body = _d.sent();
try {
error = JSON.parse(body);
}
catch (_d) {
catch (_e) {
error = {
message: body
message: body,
};
}
return [2 /*return*/, Promise.reject(error)];
case 7: return [2 /*return*/];
}

@@ -191,4 +201,4 @@ });

},
rejected: undefined
}
rejected: undefined,
},
];

@@ -221,3 +231,3 @@ // 拦截器加入执行链

})));
}));
//# sourceMappingURL=ics-chromely-js-sdk.umd.js.map

@@ -53,4 +53,4 @@ "use strict";

* @Date: 2022-05-05 11:55:32
* @LastEditors: 文贝
* @LastEditTime: 2022-06-06 18:20:08
* @LastEditors: 陶慧灵
* @LastEditTime: 2022-12-13 09:53:32
* @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;

@@ -71,6 +70,5 @@ this._baseCommandUrl = 'http://command.com/';

request: new Interceptor_manage_1.default(),
response: new Interceptor_manage_1.default()
response: new Interceptor_manage_1.default(),
};
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);

@@ -106,3 +104,2 @@ link.click();

return __generator(this, function (_b) {
this.headers['Content-Type'] = this.headers['Content-Type'] || 'application/json';
chain = [

@@ -112,3 +109,9 @@ {

var _a, _b;
var options = __assign(__assign({}, opts), config);
var options = __assign(__assign({}, config), opts);
if (options.headers) {
options.headers['Content-Type'] = options.headers['Content-Type'] || 'application/json';
}
else {
options.headers = { 'Content-Type': 'application/json' };
}
if (((_a = opts === null || opts === void 0 ? void 0 : opts.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'GET' || ((_b = opts === null || opts === void 0 ? void 0 : opts.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'HEAD') {

@@ -119,3 +122,3 @@ var params = [];

}
opts.url = opts.url + (params.length > 0 ? "?" + params.join('&') : '');
opts.url = opts.url + (params.length > 0 ? "?".concat(params.join('&')) : '');
}

@@ -127,28 +130,34 @@ 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 () {
var data, _a, _b, error, body;
return __generator(this, function (_c) {
switch (_c.label) {
var _a, _b, error, body;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
if (!res.ok) return [3 /*break*/, 2];
if (!res.ok) return [3 /*break*/, 5];
if (!(res.headers.get('Content-Type') === 'application/json')) return [3 /*break*/, 2];
_b = (_a = JSON).parse;
return [4 /*yield*/, res.text()];
case 1:
data = _b.apply(_a, [_c.sent()]);
return [2 /*return*/, data];
case 1: return [2 /*return*/, _b.apply(_a, [_d.sent()])];
case 2:
_c = { code: 200, message: 'ok' };
return [4 /*yield*/, res.blob()];
case 3: return [2 /*return*/, (_c.data = _d.sent(), _c)];
case 4: return [3 /*break*/, 7];
case 5:
error = null;
return [4 /*yield*/, res.text()];
case 3:
body = _c.sent();
case 6:
body = _d.sent();
try {
error = JSON.parse(body);
}
catch (_d) {
catch (_e) {
error = {
message: body
message: body,
};
}
return [2 /*return*/, Promise.reject(error)];
case 7: return [2 /*return*/];
}

@@ -159,4 +168,4 @@ });

},
rejected: undefined
}
rejected: undefined,
},
];

@@ -163,0 +172,0 @@ // 拦截器加入执行链

@@ -6,3 +6,3 @@ "use strict";

* @LastEditors: 文贝
* @LastEditTime: 2022-05-20 14:01:07
* @LastEditTime: 2022-06-22 17:54:30
* @Description:

@@ -9,0 +9,0 @@ * @FilePath: \ics-chromely\src\interfaces\interfaces.ts

@@ -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,2 +30,5 @@ url: string;

data?: any;
headers?: {
[key: string]: string;
};
}): Promise<any>;

@@ -29,0 +35,0 @@ }

@@ -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.4",
"version": "0.0.5-beta.1",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -0,0 +0,0 @@ ## 引入

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

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