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

pcapi

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pcapi - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

bower.json
{
"name": "pcapi",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "https://github.com/edina/pcapi.js",

@@ -5,0 +5,0 @@ "authors": [

@@ -290,4 +290,7 @@ /*

this.baseUrl = options.url;
this.version = options.version;
this.cloudProviderUrl = options.url + "/" + options.version + "/pcapi";
this.version = options.version || "";
this.cloudProviderUrl = options.url;
if(this.version !== ""){
this.cloudProviderUrl += "/" + this.version + "/pcapi";
}
},

@@ -294,0 +297,0 @@

@@ -1,1 +0,1 @@

"use strict";var pcapi=function(){var reservedDirs=["editors","records","features"];var clearCloudLogin=function(){localStorage.setItem("cloud-user",JSON.stringify({id:undefined}))};var doLogin=function(provider,callback,cbrowser){var loginUrl=_this.getCloudProviderUrl()+"/auth/"+provider;if(provider==="local"){doLoginLocal(callback,cbrowser,loginUrl)}else{doLoginDropBox(callback,cbrowser,loginUrl)}};var doLoginLocal=function(callback,cbrowser,loginUrl){var pollTimer,pollTimerCount=0,pollInterval=3e3,pollForMax=5*60*1e3;var pollUrl=loginUrl;console.debug("Login with: "+pollUrl);var cb=window.open(pollUrl,"_blank","location=no");var closeCb=function(userId){clearInterval(pollTimer);callback(userId)};console.debug("Poll: "+pollUrl);pollTimer=setInterval(function(){$.ajax({url:pollUrl,timeout:3e3,success:function(pollData){pollTimerCount+=pollInterval;if(typeof pollData==="object"){if(pollData.state===1||pollTimerCount>pollForMax){var cloudUserId;if(pollData.state===1){cloudUserId=pollData.userid;_this.setCloudLogin(cloudUserId)}cb.close();closeCb(cloudUserId)}}},error:function(error){console.error("Problem polling api: "+error.statusText);closeCb()}})},pollInterval);if(cbrowser){cbrowser(cb)}};var doLoginDropBox=function(callback,cbrowser,loginUrl){var pollTimer,pollTimerCount=0,pollInterval=3e3,pollForMax=5*60*1e3;var userId=getCloudLoginId();if(userId!==undefined){console.debug("got a user id: "+userId);loginUrl+="/"+userId}clearCloudLogin();console.debug("Login with: "+loginUrl+"?async=true");$.ajax({url:loginUrl+"?async=true",timeout:3e3,cache:false,success:function(data){console.debug("Redirect to: "+data.url);var cloudUserId=data.userid;var closeCb=function(userId){clearInterval(pollTimer);callback(userId)};var cb=window.open(data.url,"_blank","location=no");var pollUrl=loginUrl+"/"+cloudUserId+"?async=true";console.debug("Poll: "+pollUrl);pollTimer=setInterval(function(){$.ajax({url:pollUrl,success:function(pollData){pollTimerCount+=pollInterval;if(pollData.state===1||pollTimerCount>pollForMax){if(pollData.state===1){_this.setCloudLogin(cloudUserId)}cb.close();closeCb(cloudUserId)}},error:function(error){console.error("Problem polling api: "+error.statusText);closeCb({status:-1,msg:"Problem polling api"})},cache:false})},pollInterval);if(cbrowser){cbrowser(cb)}},error:function(jqXHR,textStatus){var msg;if(textStatus===undefined){textStatus=" Unspecified Error."}else if(textStatus==="timeout"){msg="Unable to login, please enable data connection."}else{msg="Problem with login: "+textStatus}callback({status:-1,msg:msg});console.error(msg)}})};var doRequest=function(options){var deferred=new $.Deferred;options.cache=false;$.ajax(options).then(function(data){if(typeof data==="string"&&options.contentType==="html"||typeof data==="object"){deferred.resolve(data)}else{try{deferred.resolve(JSON.parse(data))}catch(e){console.error(e);deferred.reject(e)}}}).fail(function(error){console.error("Problem with "+options.url+" : status="+status+" : "+error);deferred.reject(error)});return deferred.promise()};var getCloudLogin=function(){var login=null;var user=localStorage.getItem("cloud-user");if(user){login=JSON.parse(user)}return login};var getCloudLoginId=function(){var id;var login=getCloudLogin();if(typeof login==="object"){id=login.id}return id};var objectToURL=function(obj){var params=[];if(typeof obj==="object"){for(var key in obj){if(obj.hasOwnProperty(key)){params.push(encodeURIComponent(key)+"="+encodeURIComponent(obj[key]))}}}return params.join("&")};var endsWith=function(str,suffix){return str.indexOf(suffix,str.length-suffix.length)!==-1};var _this={init:function(options){this.baseUrl=options.url;this.version=options.version;this.cloudProviderUrl=options.url+"/"+options.version+"/pcapi"},buildUrl:function(remoteDir,path,urlParams){var userId=getCloudLoginId();return this.buildUserUrl(userId,remoteDir,path,urlParams)},buildUserUrl:function(userId,remoteDir,path,urlParams){path=path||"";var params=objectToURL(urlParams);if(params.length>0){params="?"+params}return this.getCloudProviderUrl()+"/"+remoteDir+"/"+this.getProvider()+"/"+userId+"/"+path+params},buildFSUrl:function(remoteDir,path){var userId=getCloudLoginId();return this.buildFSUserUrl(userId,remoteDir,path)},buildFSUserUrl:function(userId,remoteDir,path){path=path||"";if(userId!==""){userId="/"+userId}return this.getCloudProviderUrl()+"/fs/"+this.getProvider()+userId+"/"+remoteDir+"/"+path},checkLogin:function(callback){if(!this.userId){var user=getCloudLogin();if(user!==null&&user.id){var url=this.getCloudProviderUrl()+"/auth/"+this.getProvider();if(user.id!=="local"){url+="/"+user.id}console.debug("Check user with: "+url);$.ajax({url:url,type:"GET",dataType:"json",cache:false,success:$.proxy(function(data){if(data.state===1){this.setCloudLogin(user.id,user.cursor)}callback(true,data)},this),error:function(jqXHR,status,error){callback(false,error)}})}else{console.debug("No user session saved");this.logoutCloud()}}else{callback(this.userId)}},deleteItem:function(remoteDir,path,userId){userId=userId||getCloudLoginId();var options={};options.url=this.buildFSUserUrl(userId,remoteDir,path);options.type="DELETE";console.debug("Delete item from "+remoteDir+" with "+options.url);return doRequest(options)},doRequest:doRequest,exportRecord:function(userId,recordName){var url=this.buildUserUrl(userId,"records",recordName);var options={type:"GET",dataType:"json",url:url+"?ogc_sync=true",cache:false};return this.doRequest(options)},getAssets:function(){var options={remoteDir:"records",extras:"assets/images/",filters:{frmt:"url"}};return this.getItems(options)},getBaseUrl:function(){return this.baseUrl},getCloudProviderUrl:function(){return this.cloudProviderUrl},getEditor:function(options){options.contentType="html";return this.getItem(options)},getFSItems:function(remoteDir,userId){userId=userId||getCloudLoginId();var options={};options.url=this.buildFSUserUrl(userId,remoteDir);options.type="GET";console.debug("Get items of "+remoteDir+" with "+options.url);return doRequest(options)},getFSItem:function(options){var userId=options.userId||getCloudLoginId();var requestOptions={};requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,options.item);requestOptions.type="GET";console.debug("Get item "+options.item+" of "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},getItem:function(options){var userId=options.userId||getCloudLoginId();var requestOptions={};requestOptions.contentType=options.contentType||"json";requestOptions.url=this.buildUserUrl(userId,options.remoteDir,options.item);requestOptions.data=options.data;requestOptions.type="GET";console.debug("Get item "+options.item+" of "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},getItems:function(options){var userId=options.userId||getCloudLoginId();var requestOptions={};requestOptions.type="GET";requestOptions.url=this.buildUserUrl(userId,options.remoteDir,options.extras);requestOptions.data=options.filters||{};console.debug("Get items of "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},getParameters:function(){var query=window.location.search.substring(1);var queryString={};var params=query.split("&");for(var i=0;i<params.length;i++){var pair=params[i].split("=");if(typeof queryString[pair[0]]==="undefined"){queryString[pair[0]]=pair[1]}else if(typeof queryString[pair[0]]==="string"){var arr=[queryString[pair[0]],pair[1]];queryString[pair[0]]=arr}else{queryString[pair[0]].push(pair[1])}}return queryString},getProviders:function(){var options={type:"GET",url:this.getCloudProviderUrl()+"/auth/providers"};return doRequest(options)},getProvider:function(){return localStorage.getItem("cloud-provider")||"local"},getUser:function(){return this.user},getUserId:function(){return getCloudLoginId()},loginAsyncCloud:function(provider,cb,cbrowser){doLogin(provider,cb,cbrowser)},loginCloud:function(){if(!("uid"in this.getParameters())){var loginUrl=this.getCloudProviderUrl()+"/auth/"+this.getProvider()+"?callback="+$(location).attr("href");$.getJSON(loginUrl,function(data){$(location).attr("href",data.url)})}},logoutCloud:function(){var cb;var provider=this.getProvider();var loginUrl=_this.getCloudProviderUrl()+"/auth/"+provider;if(provider==="local"){cb=window.open(loginUrl,"_blank","location=no,clearsessioncache=yes");cb.addEventListener("loadstop",function(){cb.close()})}clearCloudLogin()},objectToURL:function(obj){var params=[];if(typeof obj==="object"){for(var key in obj){if(obj.hasOwnProperty(key)){params.push(encodeURIComponent(key)+"="+encodeURIComponent(obj[key]))}}}return params.join("&")},saveItem:function(options){var path,requestOptions={};var userId=options.userId||getCloudLoginId();requestOptions.type="POST";if(options.remoteDir==="records"){requestOptions.data=JSON.stringify(options.data,undefined,2);path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else if(options.remoteDir==="editors"){requestOptions.data=options.data;path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else{requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,path,options.urlParams)}console.debug("Post item to "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},setBaseUrl:function(url){this.baseUrl=url},setCloudLogin:function(userId,cursor){this.user={id:userId,cursor:cursor};localStorage.setItem("cloud-user",JSON.stringify(this.user))},setCloudProviderUrl:function(url){this.cloudProviderUrl=url+"/"+this.version+"/pcapi"},setProvider:function(provider){localStorage.setItem("cloud-provider",provider)},setUserId:function(userId){this.userId=userId},setVersion:function(version){this.version=version},updateItem:function(options){var path,requestOptions={};requestOptions.type="PUT";var userId=options.userId||getCloudLoginId();if(options.remoteDir==="records"){requestOptions.data=JSON.stringify(options.data,undefined,2);path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else if(options.remoteDir==="editors"){requestOptions.data=options.data;path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else{requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,path,options.urlParams)}console.debug("PUT item to "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},uploadFile:function(options,type){type=type||"POST";var userId=options.userid||getCloudLoginId();var requestOptions={type:type};requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,options.path);if(reservedDirs.indexOf(options.remoteDir)>-1){requestOptions.url=this.buildUserUrl(userId,options.remoteDir,options.path,options.urlParams)}console.debug("Upload item "+options.file.name+" to "+options.remoteDir+" with "+requestOptions.url);requestOptions.data=options.file;requestOptions.contentType=false;requestOptions.processData=false;requestOptions.beforeSend=function(request){request.setRequestHeader("Content-Type",options.file.type)};return doRequest(requestOptions)}};return _this}();if(typeof module==="object"&&typeof module.exports==="object"){module.exports=pcapi}else{if(typeof define==="function"&&define.amd){define(function(){return pcapi})}}if(typeof window==="object"&&typeof window.document==="object"){window.pcapi=pcapi}
"use strict";var pcapi=function(){var reservedDirs=["editors","records","features"];var clearCloudLogin=function(){localStorage.setItem("cloud-user",JSON.stringify({id:undefined}))};var doLogin=function(provider,callback,cbrowser){var loginUrl=_this.getCloudProviderUrl()+"/auth/"+provider;if(provider==="local"){doLoginLocal(callback,cbrowser,loginUrl)}else{doLoginDropBox(callback,cbrowser,loginUrl)}};var doLoginLocal=function(callback,cbrowser,loginUrl){var pollTimer,pollTimerCount=0,pollInterval=3e3,pollForMax=5*60*1e3;var pollUrl=loginUrl;console.debug("Login with: "+pollUrl);var cb=window.open(pollUrl,"_blank","location=no");var closeCb=function(userId){clearInterval(pollTimer);callback(userId)};console.debug("Poll: "+pollUrl);pollTimer=setInterval(function(){$.ajax({url:pollUrl,timeout:3e3,success:function(pollData){pollTimerCount+=pollInterval;if(typeof pollData==="object"){if(pollData.state===1||pollTimerCount>pollForMax){var cloudUserId;if(pollData.state===1){cloudUserId=pollData.userid;_this.setCloudLogin(cloudUserId)}cb.close();closeCb(cloudUserId)}}},error:function(error){console.error("Problem polling api: "+error.statusText);closeCb()}})},pollInterval);if(cbrowser){cbrowser(cb)}};var doLoginDropBox=function(callback,cbrowser,loginUrl){var pollTimer,pollTimerCount=0,pollInterval=3e3,pollForMax=5*60*1e3;var userId=getCloudLoginId();if(userId!==undefined){console.debug("got a user id: "+userId);loginUrl+="/"+userId}clearCloudLogin();console.debug("Login with: "+loginUrl+"?async=true");$.ajax({url:loginUrl+"?async=true",timeout:3e3,cache:false,success:function(data){console.debug("Redirect to: "+data.url);var cloudUserId=data.userid;var closeCb=function(userId){clearInterval(pollTimer);callback(userId)};var cb=window.open(data.url,"_blank","location=no");var pollUrl=loginUrl+"/"+cloudUserId+"?async=true";console.debug("Poll: "+pollUrl);pollTimer=setInterval(function(){$.ajax({url:pollUrl,success:function(pollData){pollTimerCount+=pollInterval;if(pollData.state===1||pollTimerCount>pollForMax){if(pollData.state===1){_this.setCloudLogin(cloudUserId)}cb.close();closeCb(cloudUserId)}},error:function(error){console.error("Problem polling api: "+error.statusText);closeCb({status:-1,msg:"Problem polling api"})},cache:false})},pollInterval);if(cbrowser){cbrowser(cb)}},error:function(jqXHR,textStatus){var msg;if(textStatus===undefined){textStatus=" Unspecified Error."}else if(textStatus==="timeout"){msg="Unable to login, please enable data connection."}else{msg="Problem with login: "+textStatus}callback({status:-1,msg:msg});console.error(msg)}})};var doRequest=function(options){var deferred=new $.Deferred;options.cache=false;$.ajax(options).then(function(data){if(typeof data==="string"&&options.contentType==="html"||typeof data==="object"){deferred.resolve(data)}else{try{deferred.resolve(JSON.parse(data))}catch(e){console.error(e);deferred.reject(e)}}}).fail(function(error){console.error("Problem with "+options.url+" : status="+status+" : "+error);deferred.reject(error)});return deferred.promise()};var getCloudLogin=function(){var login=null;var user=localStorage.getItem("cloud-user");if(user){login=JSON.parse(user)}return login};var getCloudLoginId=function(){var id;var login=getCloudLogin();if(typeof login==="object"){id=login.id}return id};var objectToURL=function(obj){var params=[];if(typeof obj==="object"){for(var key in obj){if(obj.hasOwnProperty(key)){params.push(encodeURIComponent(key)+"="+encodeURIComponent(obj[key]))}}}return params.join("&")};var endsWith=function(str,suffix){return str.indexOf(suffix,str.length-suffix.length)!==-1};var _this={init:function(options){this.baseUrl=options.url;this.version=options.version||"";this.cloudProviderUrl=options.url;if(this.version!==""){this.cloudProviderUrl+="/"+this.version+"/pcapi"}},buildUrl:function(remoteDir,path,urlParams){var userId=getCloudLoginId();return this.buildUserUrl(userId,remoteDir,path,urlParams)},buildUserUrl:function(userId,remoteDir,path,urlParams){path=path||"";var params=objectToURL(urlParams);if(params.length>0){params="?"+params}return this.getCloudProviderUrl()+"/"+remoteDir+"/"+this.getProvider()+"/"+userId+"/"+path+params},buildFSUrl:function(remoteDir,path){var userId=getCloudLoginId();return this.buildFSUserUrl(userId,remoteDir,path)},buildFSUserUrl:function(userId,remoteDir,path){path=path||"";if(userId!==""){userId="/"+userId}return this.getCloudProviderUrl()+"/fs/"+this.getProvider()+userId+"/"+remoteDir+"/"+path},checkLogin:function(callback){if(!this.userId){var user=getCloudLogin();if(user!==null&&user.id){var url=this.getCloudProviderUrl()+"/auth/"+this.getProvider();if(user.id!=="local"){url+="/"+user.id}console.debug("Check user with: "+url);$.ajax({url:url,type:"GET",dataType:"json",cache:false,success:$.proxy(function(data){if(data.state===1){this.setCloudLogin(user.id,user.cursor)}callback(true,data)},this),error:function(jqXHR,status,error){callback(false,error)}})}else{console.debug("No user session saved");this.logoutCloud()}}else{callback(this.userId)}},deleteItem:function(remoteDir,path,userId){userId=userId||getCloudLoginId();var options={};options.url=this.buildFSUserUrl(userId,remoteDir,path);options.type="DELETE";console.debug("Delete item from "+remoteDir+" with "+options.url);return doRequest(options)},doRequest:doRequest,exportRecord:function(userId,recordName){var url=this.buildUserUrl(userId,"records",recordName);var options={type:"GET",dataType:"json",url:url+"?ogc_sync=true",cache:false};return this.doRequest(options)},getAssets:function(){var options={remoteDir:"records",extras:"assets/images/",filters:{frmt:"url"}};return this.getItems(options)},getBaseUrl:function(){return this.baseUrl},getCloudProviderUrl:function(){return this.cloudProviderUrl},getEditor:function(options){options.contentType="html";return this.getItem(options)},getFSItems:function(remoteDir,userId){userId=userId||getCloudLoginId();var options={};options.url=this.buildFSUserUrl(userId,remoteDir);options.type="GET";console.debug("Get items of "+remoteDir+" with "+options.url);return doRequest(options)},getFSItem:function(options){var userId=options.userId||getCloudLoginId();var requestOptions={};requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,options.item);requestOptions.type="GET";console.debug("Get item "+options.item+" of "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},getItem:function(options){var userId=options.userId||getCloudLoginId();var requestOptions={};requestOptions.contentType=options.contentType||"json";requestOptions.url=this.buildUserUrl(userId,options.remoteDir,options.item);requestOptions.data=options.data;requestOptions.type="GET";console.debug("Get item "+options.item+" of "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},getItems:function(options){var userId=options.userId||getCloudLoginId();var requestOptions={};requestOptions.type="GET";requestOptions.url=this.buildUserUrl(userId,options.remoteDir,options.extras);requestOptions.data=options.filters||{};console.debug("Get items of "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},getParameters:function(){var query=window.location.search.substring(1);var queryString={};var params=query.split("&");for(var i=0;i<params.length;i++){var pair=params[i].split("=");if(typeof queryString[pair[0]]==="undefined"){queryString[pair[0]]=pair[1]}else if(typeof queryString[pair[0]]==="string"){var arr=[queryString[pair[0]],pair[1]];queryString[pair[0]]=arr}else{queryString[pair[0]].push(pair[1])}}return queryString},getProviders:function(){var options={type:"GET",url:this.getCloudProviderUrl()+"/auth/providers"};return doRequest(options)},getProvider:function(){return localStorage.getItem("cloud-provider")||"local"},getUser:function(){return this.user},getUserId:function(){return getCloudLoginId()},loginAsyncCloud:function(provider,cb,cbrowser){doLogin(provider,cb,cbrowser)},loginCloud:function(){if(!("uid"in this.getParameters())){var loginUrl=this.getCloudProviderUrl()+"/auth/"+this.getProvider()+"?callback="+$(location).attr("href");$.getJSON(loginUrl,function(data){$(location).attr("href",data.url)})}},logoutCloud:function(){var cb;var provider=this.getProvider();var loginUrl=_this.getCloudProviderUrl()+"/auth/"+provider;if(provider==="local"){cb=window.open(loginUrl,"_blank","location=no,clearsessioncache=yes");cb.addEventListener("loadstop",function(){cb.close()})}clearCloudLogin()},objectToURL:function(obj){var params=[];if(typeof obj==="object"){for(var key in obj){if(obj.hasOwnProperty(key)){params.push(encodeURIComponent(key)+"="+encodeURIComponent(obj[key]))}}}return params.join("&")},saveItem:function(options){var path,requestOptions={};var userId=options.userId||getCloudLoginId();requestOptions.type="POST";if(options.remoteDir==="records"){requestOptions.data=JSON.stringify(options.data,undefined,2);path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else if(options.remoteDir==="editors"){requestOptions.data=options.data;path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else{requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,path,options.urlParams)}console.debug("Post item to "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},setBaseUrl:function(url){this.baseUrl=url},setCloudLogin:function(userId,cursor){this.user={id:userId,cursor:cursor};localStorage.setItem("cloud-user",JSON.stringify(this.user))},setCloudProviderUrl:function(url){this.cloudProviderUrl=url+"/"+this.version+"/pcapi"},setProvider:function(provider){localStorage.setItem("cloud-provider",provider)},setUserId:function(userId){this.userId=userId},setVersion:function(version){this.version=version},updateItem:function(options){var path,requestOptions={};requestOptions.type="PUT";var userId=options.userId||getCloudLoginId();if(options.remoteDir==="records"){requestOptions.data=JSON.stringify(options.data,undefined,2);path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else if(options.remoteDir==="editors"){requestOptions.data=options.data;path=options.path;requestOptions.url=this.buildUserUrl(userId,options.remoteDir,path,options.urlParams)}else{requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,path,options.urlParams)}console.debug("PUT item to "+options.remoteDir+" with "+requestOptions.url);return doRequest(requestOptions)},uploadFile:function(options,type){type=type||"POST";var userId=options.userid||getCloudLoginId();var requestOptions={type:type};requestOptions.url=this.buildFSUserUrl(userId,options.remoteDir,options.path);if(reservedDirs.indexOf(options.remoteDir)>-1){requestOptions.url=this.buildUserUrl(userId,options.remoteDir,options.path,options.urlParams)}console.debug("Upload item "+options.file.name+" to "+options.remoteDir+" with "+requestOptions.url);requestOptions.data=options.file;requestOptions.contentType=false;requestOptions.processData=false;requestOptions.beforeSend=function(request){request.setRequestHeader("Content-Type",options.file.type)};return doRequest(requestOptions)}};return _this}();if(typeof module==="object"&&typeof module.exports==="object"){module.exports=pcapi}else{if(typeof define==="function"&&define.amd){define(function(){return pcapi})}}if(typeof window==="object"&&typeof window.document==="object"){window.pcapi=pcapi}

@@ -290,4 +290,7 @@ /*

this.baseUrl = options.url;
this.version = options.version;
this.cloudProviderUrl = options.url + "/" + options.version + "/pcapi";
this.version = options.version || "";
this.cloudProviderUrl = options.url;
if(this.version !== ""){
this.cloudProviderUrl += "/" + this.version + "/pcapi";
}
},

@@ -294,0 +297,0 @@

{
"name": "pcapi",
"version": "0.2.0",
"version": "0.2.1",
"description": "A javascript API for PCAPI",

@@ -5,0 +5,0 @@ "scripts": {

@@ -78,2 +78,14 @@ "use strict"

it('cloud provider url check with no version number', function(done){
var options = {
"url": "http://example.com",
"userId": "00000000-0000-0000-0000-000000000000"
};
testPcapi.init(options);
var url = "http://example.com";
assert.equal(testPcapi.getCloudProviderUrl(), url);
testPcapi.init(config.options[providers[1]]);
done();
});
//buildURL

@@ -80,0 +92,0 @@ it('buildURL, works for editors, records', function(done){

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