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

wikibase-sdk

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wikibase-sdk - npm Package Compare versions

Comparing version 7.0.13 to 7.1.0

3

CHANGELOG.md
# CHANGELOG
*versions follow [SemVer](http://semver.org)*
## 7.1.0 - 2019-09-08
* Expose parsed instance URLs: `wbk.instance`
## 7.0.0 - 2019-05-31

@@ -5,0 +8,0 @@ **Breaking Changes**:

16

lib/utils/build_url.js
const isBrowser = typeof location !== 'undefined' && typeof document !== 'undefined'
const qs = isBrowser ? require('./querystring_lite') : require('querystring')
module.exports = instance => {
instance = instance.replace(/\/$/, '')
const instanceApiEndpoint = `${instance}/w/api.php`
.replace('/w/api.php/w/api.php', '/w/api.php')
return queryObj => {
// Request CORS headers if the request is made from a browser
// See https://www.wikidata.org/w/api.php ('origin' parameter)
if (isBrowser) queryObj.origin = '*'
return instanceApiEndpoint + '?' + qs.stringify(queryObj)
}
module.exports = instanceApiEndpoint => queryObj => {
// Request CORS headers if the request is made from a browser
// See https://www.wikidata.org/w/api.php ('origin' parameter)
if (isBrowser) queryObj.origin = '*'
return instanceApiEndpoint + '?' + qs.stringify(queryObj)
}

@@ -17,4 +17,10 @@ const { isPlainObject } = require('./utils/utils')

const buildUrl = require('./utils/build_url')(instance)
const instanceRoot = instance
.replace(/\/$/, '')
.replace('/w/api.php', '')
const instanceApiEndpoint = `${instanceRoot}/w/api.php`
const buildUrl = require('./utils/build_url')(instanceApiEndpoint)
const wikibaseApiFunctions = {

@@ -43,3 +49,8 @@ searchEntities: require('./queries/search_entities')(buildUrl),

return Object.assign({}, common, wikibaseApiFunctions, wikibaseQueryServiceFunctions)
return Object.assign({
instance: {
root: instanceRoot,
apiEndpoint: instanceApiEndpoint
}
}, common, wikibaseApiFunctions, wikibaseQueryServiceFunctions)
}

@@ -46,0 +57,0 @@

{
"name": "wikibase-sdk",
"version": "7.0.13",
"version": "7.1.0",
"description": "A javascript tool-suite to query wikibase and simplify its results",

@@ -5,0 +5,0 @@ "main": "lib/wikibase-sdk.js",

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