wikibase-serialization
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -5,7 +5,7 @@ { | ||
"browser": true, | ||
"jquery": true | ||
"jquery": true, | ||
"commonjs": true | ||
}, | ||
"globals": { | ||
"dataValues": false, | ||
"module": false, | ||
"util": false, | ||
@@ -12,0 +12,0 @@ "wikibase": false |
@@ -0,1 +1,3 @@ | ||
var path = require( 'path' ); | ||
module.exports = function ( config ) { | ||
@@ -39,2 +41,19 @@ config.set( { | ||
preprocessors: { | ||
'src/**/*.js': [ 'webpack' ], | ||
'tests/**/*.tests.js': [ 'webpack' ], | ||
'tests/MockEntity.js': [ 'webpack' ], | ||
'node_modules/wikibase-data-model/src/index.js': [ 'webpack' ] | ||
}, | ||
webpack: { | ||
mode: 'development', | ||
resolve: { | ||
alias: { | ||
// eslint-disable-next-line no-undef | ||
'wikibase.datamodel': path.resolve( __dirname, 'node_modules/wikibase-data-model/src/index.js' ) | ||
} | ||
} | ||
}, | ||
port: 9876, | ||
@@ -41,0 +60,0 @@ |
{ | ||
"name": "wikibase-serialization", | ||
"description": "Wikibase datamodel serialization implementation in JavaScript", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"license": "GPL-2.0+", | ||
@@ -32,3 +32,3 @@ "contributors": [ | ||
"jquery": "^3.2.1", | ||
"wikibase-data-model": "^4.0.0", | ||
"wikibase-data-model": "^5.1.0", | ||
"wikibase-data-values": "^0.10.0" | ||
@@ -43,3 +43,5 @@ }, | ||
"karma-qunit": "^1.2.1", | ||
"qunit": "^1.0.0" | ||
"karma-webpack": "^4.0.2", | ||
"qunit": "^1.0.0", | ||
"webpack": "^4.40.2" | ||
}, | ||
@@ -46,0 +48,0 @@ "scripts": { |
@@ -7,2 +7,18 @@ # Wikibase Serialization JavaScript | ||
### 4.0.0 (2019-10-08) | ||
* Added index.js as the public interface | ||
* Removed: | ||
* DeserializerFactory | ||
* SerializerFactory | ||
* EntitySerializer | ||
* FingerprintSerializer | ||
* ItemSerializer | ||
* MultiTermMapSerializer | ||
* MultiTermSerializer | ||
* PropertySerializer | ||
* SiteLinkSerializer | ||
* SiteLinkSetSerializer | ||
* StatementGroupSerializer | ||
* StatementGroupSetSerializer | ||
### 3.0.0 (2017-10-10) | ||
@@ -9,0 +25,0 @@ |
@@ -5,6 +5,8 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
SnakListDeserializer = require( './SnakListDeserializer.js' ); | ||
/** | ||
* @class wikibase.serialization.ClaimDeserializer | ||
* @class ClaimDeserializer | ||
* @extends wikibase.serialization.Deserializer | ||
@@ -14,11 +16,11 @@ * @since 2.0 | ||
* @author H. Snater < mediawiki@snater.com > | ||
* @author Daniel Werner < daniel.werner@wikimedia.de > | ||
* @author Daniel Werner < daniel.a.r.werner@gmail.com > | ||
* | ||
* @constructor | ||
*/ | ||
MODULE.ClaimDeserializer = util.inherit( 'WbClaimDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbClaimDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.Claim} | ||
* @return {datamodel.Claim} | ||
*/ | ||
@@ -31,3 +33,3 @@ deserialize: function( serialization ) { | ||
if( serialization.qualifiers !== undefined ) { | ||
qualifiers = ( new MODULE.SnakListDeserializer() ).deserialize( | ||
qualifiers = ( new SnakListDeserializer() ).deserialize( | ||
serialization.qualifiers, | ||
@@ -38,3 +40,3 @@ serialization['qualifiers-order'] | ||
return new wb.datamodel.Claim( mainSnak, qualifiers, guid ); | ||
return new datamodel.Claim( mainSnak, qualifiers, guid ); | ||
} | ||
@@ -41,0 +43,0 @@ } ); |
@@ -12,3 +12,3 @@ ( function( wb, util, $ ) { | ||
* @license GPL-2.0+ | ||
* @author Daniel Werner < daniel.werner@wikimedia.de > | ||
* @author Daniel Werner < daniel.a.r.werner@gmail.com > | ||
* | ||
@@ -29,2 +29,3 @@ * @constructor | ||
module.exports = SELF; | ||
}( wikibase, util, jQuery ) ); |
@@ -5,3 +5,7 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
ItemDeserializer = require( './ItemDeserializer.js' ), | ||
PropertyDeserializer = require( './PropertyDeserializer.js' ), | ||
StrategyProvider = require( '../StrategyProvider.js' ); | ||
@@ -18,8 +22,8 @@ /** | ||
MODULE.EntityDeserializer = util.inherit( 'WbEntityDeserializer', PARENT, function() { | ||
this._strategyProvider = new MODULE.StrategyProvider(); | ||
this._strategyProvider = new StrategyProvider(); | ||
this._strategyProvider.registerStrategy( | ||
new MODULE.ItemDeserializer(), wb.datamodel.Item.TYPE | ||
new ItemDeserializer(), datamodel.Item.TYPE | ||
); | ||
this._strategyProvider.registerStrategy( | ||
new MODULE.PropertyDeserializer(), wb.datamodel.Property.TYPE | ||
new PropertyDeserializer(), datamodel.Property.TYPE | ||
); | ||
@@ -44,3 +48,3 @@ }, { | ||
* | ||
* @return {wikibase.datamodel.Entity} | ||
* @return {datamodel.Entity} | ||
* | ||
@@ -60,2 +64,3 @@ * @throws {Error} if unable to detect the entity type from the serialization. | ||
module.exports = MODULE.EntityDeserializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,5 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
MultiTermMapDeserializer = require( './MultiTermMapDeserializer.js' ); | ||
@@ -17,13 +19,13 @@ /** | ||
*/ | ||
MODULE.FingerprintDeserializer = util.inherit( 'WbFingerprintDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbFingerprintDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.Fingerprint} | ||
* @return {datamodel.Fingerprint} | ||
*/ | ||
deserialize: function( serialization ) { | ||
var termMapDeserializer = new MODULE.TermMapDeserializer(), | ||
multiTermMapDeserializer = new MODULE.MultiTermMapDeserializer(); | ||
multiTermMapDeserializer = new MultiTermMapDeserializer(); | ||
return new wb.datamodel.Fingerprint( | ||
return new datamodel.Fingerprint( | ||
termMapDeserializer.deserialize( serialization.labels ), | ||
@@ -30,0 +32,0 @@ termMapDeserializer.deserialize( serialization.descriptions ), |
@@ -5,3 +5,6 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
Item = require( 'wikibase.datamodel' ).Item, | ||
FingerprintDeserializer = require( './FingerprintDeserializer.js' ), | ||
SiteLinkSetDeserializer = require( './SiteLinkSetDeserializer.js' ); | ||
@@ -17,7 +20,7 @@ /** | ||
*/ | ||
MODULE.ItemDeserializer = util.inherit( 'WbItemDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbItemDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.Item} | ||
* @return {Item} | ||
* | ||
@@ -27,11 +30,11 @@ * @throws {Error} if serialization does not resolve to a serialized Item. | ||
deserialize: function( serialization ) { | ||
if( serialization.type !== wb.datamodel.Item.TYPE ) { | ||
if( serialization.type !== Item.TYPE ) { | ||
throw new Error( 'Serialization does not resolve to an Item' ); | ||
} | ||
var fingerprintDeserializer = new MODULE.FingerprintDeserializer(), | ||
var fingerprintDeserializer = new FingerprintDeserializer(), | ||
statementGroupSetDeserializer = new MODULE.StatementGroupSetDeserializer(), | ||
siteLinkSetDeserializer = new MODULE.SiteLinkSetDeserializer(); | ||
siteLinkSetDeserializer = new SiteLinkSetDeserializer(); | ||
return new wb.datamodel.Item( | ||
return new Item( | ||
serialization.id, | ||
@@ -38,0 +41,0 @@ fingerprintDeserializer.deserialize( serialization ), |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -17,7 +18,7 @@ /** | ||
*/ | ||
MODULE.MultiTermDeserializer = util.inherit( 'WbMultiTermDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbMultiTermDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.MultiTerm} | ||
* @return {datamodel.MultiTerm} | ||
* | ||
@@ -38,3 +39,3 @@ * @throws {Error} if serialization is empty. | ||
return new wb.datamodel.MultiTerm( languageCode, terms ); | ||
return new datamodel.MultiTerm( languageCode, terms ); | ||
} | ||
@@ -41,0 +42,0 @@ } ); |
@@ -5,3 +5,5 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
MultiTermDeserializer = require( './MultiTermDeserializer.js' ); | ||
@@ -17,11 +19,11 @@ /** | ||
*/ | ||
MODULE.MultiTermMapDeserializer = util.inherit( 'WbMultiTermMapDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbMultiTermMapDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.MultiTermMap} | ||
* @return {datamodel.MultiTermMap} | ||
*/ | ||
deserialize: function( serialization ) { | ||
var multiTerms = {}, | ||
multiTermDeserializer = new MODULE.MultiTermDeserializer(); | ||
multiTermDeserializer = new MultiTermDeserializer(); | ||
@@ -33,3 +35,3 @@ for( var languageCode in serialization ) { | ||
return new wb.datamodel.MultiTermMap( multiTerms ); | ||
return new datamodel.MultiTermMap( multiTerms ); | ||
} | ||
@@ -36,0 +38,0 @@ } ); |
@@ -5,3 +5,5 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
FingerprintDeserializer = require( './FingerprintDeserializer.js' ); | ||
@@ -17,7 +19,7 @@ /** | ||
*/ | ||
MODULE.PropertyDeserializer = util.inherit( 'WbPropertyDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbPropertyDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.Property} | ||
* @return {datamodel.Property} | ||
* | ||
@@ -27,10 +29,10 @@ * @throws {Error} if serialization does not resolve to a serialized Property. | ||
deserialize: function( serialization ) { | ||
if( serialization.type !== wb.datamodel.Property.TYPE ) { | ||
if( serialization.type !== datamodel.Property.TYPE ) { | ||
throw new Error( 'Serialization does not resolve to a Property' ); | ||
} | ||
var fingerprintDeserializer = new MODULE.FingerprintDeserializer(), | ||
var fingerprintDeserializer = new FingerprintDeserializer(), | ||
statementGroupSetDeserializer = new MODULE.StatementGroupSetDeserializer(); | ||
return new wb.datamodel.Property( | ||
return new datamodel.Property( | ||
serialization.id, | ||
@@ -37,0 +39,0 @@ serialization.datatype, |
@@ -5,3 +5,5 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
SnakListDeserializer = require( './SnakListDeserializer.js' ); | ||
@@ -17,11 +19,11 @@ /** | ||
*/ | ||
MODULE.ReferenceDeserializer = util.inherit( 'WbReferenceDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbReferenceDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.Reference} | ||
* @return {datamodel.Reference} | ||
*/ | ||
deserialize: function( serialization ) { | ||
return new wikibase.datamodel.Reference( | ||
( new MODULE.SnakListDeserializer() ).deserialize( | ||
return new datamodel.Reference( | ||
( new SnakListDeserializer() ).deserialize( | ||
serialization.snaks, | ||
@@ -28,0 +30,0 @@ serialization['snaks-order'] |
@@ -5,6 +5,8 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
ReferenceDeserializer = require( './ReferenceDeserializer.js' ); | ||
/** | ||
* @class wikibase.serialization.ReferenceListDeserializer | ||
* @class ReferenceListDeserializer | ||
* @extends wikibase.serialization.Deserializer | ||
@@ -17,11 +19,11 @@ * @since 2.0 | ||
*/ | ||
MODULE.ReferenceListDeserializer = util.inherit( 'WbReferenceListDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbReferenceListDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.ReferenceList} | ||
* @return {datamodel.ReferenceList} | ||
*/ | ||
deserialize: function( serialization ) { | ||
var references = [], | ||
referenceDeserializer = new MODULE.ReferenceDeserializer(); | ||
referenceDeserializer = new ReferenceDeserializer(); | ||
@@ -32,3 +34,3 @@ for( var i = 0; i < serialization.length; i++ ) { | ||
return new wikibase.datamodel.ReferenceList( references ); | ||
return new datamodel.ReferenceList( references ); | ||
} | ||
@@ -35,0 +37,0 @@ } ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -17,3 +18,3 @@ /** | ||
*/ | ||
MODULE.SiteLinkDeserializer = util.inherit( 'WbSiteLinkDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbSiteLinkDeserializer', PARENT, { | ||
/** | ||
@@ -23,6 +24,6 @@ * @inheritdoc | ||
* @param {Object} serialization | ||
* @return {wikibase.datamodel.SiteLink} | ||
* @return {datamodel.SiteLink} | ||
*/ | ||
deserialize: function( serialization ) { | ||
return new wb.datamodel.SiteLink( | ||
return new datamodel.SiteLink( | ||
serialization.site, | ||
@@ -29,0 +30,0 @@ serialization.title, |
@@ -5,3 +5,5 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
SiteLinkDeserializer = require( './SiteLinkDeserializer.js' ); | ||
@@ -17,11 +19,11 @@ /** | ||
*/ | ||
MODULE.SiteLinkSetDeserializer = util.inherit( 'WbSiteLinkSetDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbSiteLinkSetDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.SiteLinkSet} | ||
* @return {datamodel.SiteLinkSet} | ||
*/ | ||
deserialize: function( serialization ) { | ||
var siteLinks = [], | ||
siteLinkDeserializer = new MODULE.SiteLinkDeserializer(); | ||
siteLinkDeserializer = new SiteLinkDeserializer(); | ||
@@ -32,3 +34,3 @@ for( var siteId in serialization ) { | ||
return new wikibase.datamodel.SiteLinkSet( siteLinks ); | ||
return new datamodel.SiteLinkSet( siteLinks ); | ||
} | ||
@@ -35,0 +37,0 @@ } ); |
@@ -5,3 +5,4 @@ ( function( wb, util, dv ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -14,3 +15,3 @@ /** | ||
* @author H. Snater < mediawiki@snater.com > | ||
* @author Daniel Werner < daniel.werner@wikimedia.de > | ||
* @author Daniel Werner < daniel.a.r.werner@gmail.com > | ||
* | ||
@@ -23,3 +24,3 @@ * @constructor | ||
* | ||
* @return {wikibase.datamodel.Snak} | ||
* @return {datamodel.Snak} | ||
* | ||
@@ -30,5 +31,5 @@ * @throws {Error} if no constructor for the snak type detected exists. | ||
if( serialization.snaktype === 'novalue' ) { | ||
return new wb.datamodel.PropertyNoValueSnak( serialization.property, serialization.hash ); | ||
return new datamodel.PropertyNoValueSnak( serialization.property, serialization.hash ); | ||
} else if( serialization.snaktype === 'somevalue' ) { | ||
return new wb.datamodel.PropertySomeValueSnak( serialization.property, serialization.hash ); | ||
return new datamodel.PropertySomeValueSnak( serialization.property, serialization.hash ); | ||
} else if( serialization.snaktype === 'value' ) { | ||
@@ -45,3 +46,3 @@ var dataValue = null, | ||
return new wb.datamodel.PropertyValueSnak( serialization.property, dataValue, serialization.hash ); | ||
return new datamodel.PropertyValueSnak( serialization.property, dataValue, serialization.hash ); | ||
} | ||
@@ -53,2 +54,3 @@ | ||
module.exports = MODULE.SnakDeserializer; | ||
}( wikibase, util, dataValues ) ); |
@@ -5,8 +5,9 @@ ( function( wb, util, $ ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
/** | ||
* @param {Object[]} serializedSnaks | ||
* @param {wikibase.datamodel.Snak[]} snaks | ||
* @return {wikibase.datamodel.SnakList} | ||
* @param {datamodel.Snak[]} snaks | ||
* @return {datamodel.SnakList} | ||
*/ | ||
@@ -24,3 +25,3 @@ function addSerializedSnaksToSnakList( serializedSnaks, snaks ) { | ||
/** | ||
* @class wikibase.serialization.SnakListDeserializer | ||
* @class SnakListDeserializer | ||
* @extends wikibase.serialization.Deserializer | ||
@@ -33,3 +34,3 @@ * @since 2.0 | ||
*/ | ||
MODULE.SnakListDeserializer = util.inherit( 'WbSnakListDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbSnakListDeserializer', PARENT, { | ||
/** | ||
@@ -40,3 +41,3 @@ * @inheritdoc | ||
* @param {string[]} [order] | ||
* @return {wikibase.datamodel.SnakList} | ||
* @return {datamodel.SnakList} | ||
* | ||
@@ -81,3 +82,3 @@ * @throws {Error} if the order parameter is provided but the property id of a snak | ||
return new wb.datamodel.SnakList( snaks ); | ||
return new datamodel.SnakList( snaks ); | ||
} | ||
@@ -84,0 +85,0 @@ } ); |
@@ -5,6 +5,9 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
ReferenceListDeserializer = require( './ReferenceListDeserializer.js' ), | ||
ClaimDeserializer = require( './ClaimDeserializer.js' ); | ||
/** | ||
* @class wikibase.serialization.StatementDeserializer | ||
* @class StatementDeserializer | ||
* @extends wikibase.serialization.Deserializer | ||
@@ -21,18 +24,19 @@ * @since 2.0 | ||
* | ||
* @return {wikibase.datamodel.Statement} | ||
* @return {datamodel.Statement} | ||
*/ | ||
deserialize: function( serialization ) { | ||
var claim = ( new MODULE.ClaimDeserializer() ).deserialize( serialization ), | ||
var claim = ( new ClaimDeserializer() ).deserialize( serialization ), | ||
references = null, | ||
rank = wb.datamodel.Statement.RANK[serialization.rank.toUpperCase()]; | ||
rank = datamodel.Statement.RANK[serialization.rank.toUpperCase()]; | ||
if( serialization.references !== undefined ) { | ||
var referenceDeserializer = new MODULE.ReferenceListDeserializer(); | ||
var referenceDeserializer = new ReferenceListDeserializer(); | ||
references = referenceDeserializer.deserialize( serialization.references ); | ||
} | ||
return new wb.datamodel.Statement( claim, references, rank ); | ||
return new datamodel.Statement( claim, references, rank ); | ||
} | ||
} ); | ||
module.exports = MODULE.StatementDeserializer; | ||
}( wikibase, util ) ); |
@@ -5,6 +5,7 @@ ( function( wb, util, $ ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
/** | ||
* @class wikibase.serialization.StatementGroupDeserializer | ||
* @class StatementGroupDeserializer | ||
* @extends wikibase.serialization.Deserializer | ||
@@ -17,7 +18,7 @@ * @since 2.0 | ||
*/ | ||
MODULE.StatementGroupDeserializer = util.inherit( 'WbStatementGroupDeserializer', PARENT, { | ||
module.exports = util.inherit( 'WbStatementGroupDeserializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @return {wikibase.datamodel.StatementGroup} | ||
* @return {datamodel.StatementGroup} | ||
* | ||
@@ -34,3 +35,3 @@ * @throws {Error} if serialization is an empty object. | ||
return new wb.datamodel.StatementGroup( statementList.getPropertyIds()[0], statementList ); | ||
return new datamodel.StatementGroup( statementList.getPropertyIds()[0], statementList ); | ||
} | ||
@@ -37,0 +38,0 @@ } ); |
@@ -5,3 +5,5 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ), | ||
StatementGroupDeserializer = require( './StatementGroupDeserializer.js' ); | ||
@@ -21,6 +23,6 @@ /** | ||
* | ||
* @return {wikibase.datamodel.StatementGroupSet} | ||
* @return {datamodel.StatementGroupSet} | ||
*/ | ||
deserialize: function( serialization ) { | ||
var statemenGroupDeserializer = new MODULE.StatementGroupDeserializer(), | ||
var statemenGroupDeserializer = new StatementGroupDeserializer(), | ||
statementGroups = []; | ||
@@ -34,3 +36,3 @@ | ||
return new wb.datamodel.StatementGroupSet( statementGroups ); | ||
return new datamodel.StatementGroupSet( statementGroups ); | ||
} | ||
@@ -37,0 +39,0 @@ } ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @return {wikibase.datamodel.StatementList} | ||
* @return {datamodel.StatementList} | ||
*/ | ||
@@ -32,6 +33,7 @@ deserialize: function( serialization ) { | ||
return new wikibase.datamodel.StatementList( statements ); | ||
return new datamodel.StatementList( statements ); | ||
} | ||
} ); | ||
module.exports = MODULE.StatementListDeserializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,9 +22,10 @@ /** | ||
* | ||
* @return {wikibase.datamodel.Term} | ||
* @return {datamodel.Term} | ||
*/ | ||
deserialize: function( serialization ) { | ||
return new wb.datamodel.Term( serialization.language, serialization.value ); | ||
return new datamodel.Term( serialization.language, serialization.value ); | ||
} | ||
} ); | ||
module.exports = MODULE.TermDeserializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Deserializer; | ||
PARENT = MODULE.Deserializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @return {wikibase.datamodel.TermMap} | ||
* @return {datamodel.TermMap} | ||
*/ | ||
@@ -32,6 +33,7 @@ deserialize: function( serialization ) { | ||
return new wb.datamodel.TermMap( terms ); | ||
return new datamodel.TermMap( terms ); | ||
} | ||
} ); | ||
module.exports = MODULE.TermMapDeserializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.Claim} claim | ||
* @param {datamodel.Claim} claim | ||
* @return {Object} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( claim ) { | ||
if( !( claim instanceof wb.datamodel.Claim ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.Claim' ); | ||
if( !( claim instanceof datamodel.Claim ) ) { | ||
throw new Error( 'Not an instance of datamodel.Claim' ); | ||
} | ||
@@ -56,2 +57,3 @@ | ||
module.exports = MODULE.ClaimSerializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.ReferenceList} referenceList | ||
* @param {datamodel.ReferenceList} referenceList | ||
* @return {Object[]} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( referenceList ) { | ||
if( !( referenceList instanceof wb.datamodel.ReferenceList ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.ReferenceList' ); | ||
if( !( referenceList instanceof datamodel.ReferenceList ) ) { | ||
throw new Error( 'Not an instance of datamodel.ReferenceList' ); | ||
} | ||
@@ -45,2 +46,3 @@ | ||
module.exports = MODULE.ReferenceListSerializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.Reference} reference | ||
* @param {datamodel.Reference} reference | ||
* @return {Object} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( reference ) { | ||
if( !( reference instanceof wb.datamodel.Reference ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.Reference' ); | ||
if( !( reference instanceof datamodel.Reference ) ) { | ||
throw new Error( 'Not an instance of datamodel.Reference' ); | ||
} | ||
@@ -50,2 +51,3 @@ | ||
module.exports = MODULE.ReferenceSerializer; | ||
}( wikibase, util ) ); |
@@ -12,3 +12,3 @@ ( function( wb, util, $ ) { | ||
* @license GPL-2.0+ | ||
* @author Daniel Werner < daniel.werner@wikimedia.de > | ||
* @author Daniel Werner < daniel.a.r.werner@gmail.com > | ||
* | ||
@@ -29,2 +29,3 @@ * @constructor | ||
module.exports = SELF; | ||
}( wikibase, util, jQuery ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.SnakList} snakList | ||
* @param {datamodel.SnakList} snakList | ||
* @return {Object} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( snakList ) { | ||
if( !( snakList instanceof wb.datamodel.SnakList ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.SnakList' ); | ||
if( !( snakList instanceof datamodel.SnakList ) ) { | ||
throw new Error( 'Not an instance of datamodel.SnakList' ); | ||
} | ||
@@ -50,2 +51,3 @@ | ||
module.exports = MODULE.SnakListSerializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.Snak} snak | ||
* @param {datamodel.Snak} snak | ||
* @return {Object} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( snak ) { | ||
if( !( snak instanceof wb.datamodel.Snak ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.Snak' ); | ||
if( !( snak instanceof datamodel.Snak ) ) { | ||
throw new Error( 'Not an instance of datamodel.Snak' ); | ||
} | ||
@@ -42,3 +43,3 @@ | ||
if( snak instanceof wikibase.datamodel.PropertyValueSnak ) { | ||
if( snak instanceof datamodel.PropertyValueSnak ) { | ||
var dataValue = snak.getValue(); | ||
@@ -56,2 +57,3 @@ | ||
module.exports = MODULE.SnakSerializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.StatementList} statementList | ||
* @param {datamodel.StatementList} statementList | ||
* @return {Object[]} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( statementList ) { | ||
if( !( statementList instanceof wb.datamodel.StatementList ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.StatementList' ); | ||
if( !( statementList instanceof datamodel.StatementList ) ) { | ||
throw new Error( 'Not an instance of datamodel.StatementList' ); | ||
} | ||
@@ -45,2 +46,3 @@ | ||
module.exports = MODULE.StatementListSerializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -21,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.Statement} statement | ||
* @param {datamodel.Statement} statement | ||
* @return {Object} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( statement ) { | ||
if( !( statement instanceof wb.datamodel.Statement ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.Statement' ); | ||
if( !( statement instanceof datamodel.Statement ) ) { | ||
throw new Error( 'Not an instance of datamodel.Statement' ); | ||
} | ||
@@ -46,4 +47,4 @@ | ||
if( rank !== undefined ) { | ||
for( var rankName in wb.datamodel.Statement.RANK ) { | ||
if( rank === wb.datamodel.Statement.RANK[rankName] ) { | ||
for( var rankName in datamodel.Statement.RANK ) { | ||
if( rank === datamodel.Statement.RANK[rankName] ) { | ||
serialization.rank = rankName.toLowerCase(); | ||
@@ -59,2 +60,3 @@ break; | ||
module.exports = MODULE.StatementSerializer; | ||
}( wikibase, util ) ); |
( function( wb, util ) { | ||
'use strict'; | ||
var TermSerializer = require( './TermSerializer.js' ); | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -20,3 +22,3 @@ /** | ||
* | ||
* @param {wikibase.datamodel.TermMap} termMap | ||
* @param {datamodel.TermMap} termMap | ||
* @return {Object} | ||
@@ -27,8 +29,8 @@ * | ||
serialize: function( termMap ) { | ||
if( !( termMap instanceof wb.datamodel.TermMap ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.TermMap' ); | ||
if( !( termMap instanceof datamodel.TermMap ) ) { | ||
throw new Error( 'Not an instance of datamodel.TermMap' ); | ||
} | ||
var serialization = {}, | ||
termSerializer = new MODULE.TermSerializer(), | ||
termSerializer = new TermSerializer(), | ||
languageCodes = termMap.getKeys(); | ||
@@ -46,2 +48,3 @@ | ||
module.exports = MODULE.TermMapSerializer; | ||
}( wikibase, util ) ); |
@@ -5,3 +5,4 @@ ( function( wb, util ) { | ||
var MODULE = wb.serialization, | ||
PARENT = MODULE.Serializer; | ||
PARENT = MODULE.Serializer, | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -17,7 +18,7 @@ /** | ||
*/ | ||
MODULE.TermSerializer = util.inherit( 'WbTermSerializer', PARENT, { | ||
module.exports = util.inherit( 'WbTermSerializer', PARENT, { | ||
/** | ||
* @inheritdoc | ||
* | ||
* @param {wikibase.datamodel.Term} term | ||
* @param {datamodel.Term} term | ||
* @return {Object} | ||
@@ -28,4 +29,4 @@ * | ||
serialize: function( term ) { | ||
if( !( term instanceof wb.datamodel.Term ) ) { | ||
throw new Error( 'Not an instance of wikibase.datamodel.Term' ); | ||
if( !( term instanceof datamodel.Term ) ) { | ||
throw new Error( 'Not an instance of datamodel.Term' ); | ||
} | ||
@@ -32,0 +33,0 @@ |
@@ -74,2 +74,4 @@ ( function( wb, $ ) { | ||
module.exports = SELF; | ||
}( wikibase, jQuery ) ); |
@@ -8,2 +8,5 @@ /** | ||
var ClaimDeserializer = require( '../../src/Deserializers/ClaimDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
QUnit.module( 'wikibase.serialization.ClaimDeserializer' ); | ||
@@ -21,3 +24,3 @@ | ||
}, | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' ) | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' ) | ||
], [ | ||
@@ -39,5 +42,5 @@ { | ||
}, | ||
new wb.datamodel.Claim( | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), | ||
new wb.datamodel.SnakList( [ new wb.datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
new datamodel.Claim( | ||
new datamodel.PropertyNoValueSnak( 'P1' ), | ||
new datamodel.SnakList( [ new datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
'Q1$1' | ||
@@ -50,3 +53,3 @@ ) | ||
assert.expect( 2 ); | ||
var claimDeserializer = new wb.serialization.ClaimDeserializer(); | ||
var claimDeserializer = new ClaimDeserializer(); | ||
@@ -53,0 +56,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -9,2 +9,4 @@ /** | ||
QUnit.module( 'wikibase.serialization.EntityDeserializer' ); | ||
var FingerprintDeserializer = require( '../../src/Deserializers/FingerprintDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -30,3 +32,3 @@ /** | ||
var fingerprintDeserializer = new wb.serialization.FingerprintDeserializer(); | ||
var fingerprintDeserializer = new FingerprintDeserializer(); | ||
@@ -59,12 +61,12 @@ return new wb.serialization.tests.MockEntity( | ||
}, { | ||
fingerprint: new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'label' ) } ), | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'description' ) } ), | ||
new wb.datamodel.MultiTermMap( { en: new wb.datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
fingerprint: new datamodel.Fingerprint( | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'label' ) } ), | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'description' ) } ), | ||
new datamodel.MultiTermMap( { en: new datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
), | ||
statementGroupSet: new wb.datamodel.StatementGroupSet( [ | ||
new wb.datamodel.StatementGroup( 'P1', new wb.datamodel.StatementList( [ | ||
new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' | ||
statementGroupSet: new datamodel.StatementGroupSet( [ | ||
new datamodel.StatementGroup( 'P1', new datamodel.StatementList( [ | ||
new datamodel.Statement( | ||
new datamodel.Claim( | ||
new datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' | ||
) | ||
@@ -85,3 +87,3 @@ ) | ||
} ), | ||
new wb.datamodel.Property( | ||
new datamodel.Property( | ||
'P1', | ||
@@ -105,7 +107,7 @@ 'string', | ||
} ), | ||
new wb.datamodel.Item( | ||
new datamodel.Item( | ||
'Q1', | ||
defaults[1].fingerprint, | ||
defaults[1].statementGroupSet, | ||
new wb.datamodel.SiteLinkSet( [ new wb.datamodel.SiteLink( 'someSite', 'page' ) ] ) | ||
new datamodel.SiteLinkSet( [ new datamodel.SiteLink( 'someSite', 'page' ) ] ) | ||
) | ||
@@ -112,0 +114,0 @@ ] |
@@ -9,2 +9,4 @@ /** | ||
QUnit.module( 'wikibase.serialization.FingerprintDeserializer' ); | ||
var FingerprintDeserializer = require( '../../src/Deserializers/FingerprintDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -18,3 +20,3 @@ var testSets = [ | ||
}, | ||
new wb.datamodel.Fingerprint() | ||
new datamodel.Fingerprint() | ||
], [ | ||
@@ -26,6 +28,6 @@ { | ||
}, | ||
new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'label' ) } ), | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'description' ) } ), | ||
new wb.datamodel.MultiTermMap( { en: new wb.datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
new datamodel.Fingerprint( | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'label' ) } ), | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'description' ) } ), | ||
new datamodel.MultiTermMap( { en: new datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
) | ||
@@ -37,3 +39,3 @@ ] | ||
assert.expect( 2 ); | ||
var fingerprintDeserializer = new wb.serialization.FingerprintDeserializer(); | ||
var fingerprintDeserializer = new FingerprintDeserializer(); | ||
@@ -40,0 +42,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -10,2 +10,4 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var defaults = [ | ||
@@ -30,12 +32,12 @@ { | ||
}, { | ||
fingerprint: new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'label' ) } ), | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'description' ) } ), | ||
new wb.datamodel.MultiTermMap( { en: new wb.datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
fingerprint: new datamodel.Fingerprint( | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'label' ) } ), | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'description' ) } ), | ||
new datamodel.MultiTermMap( { en: new datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
), | ||
statementGroupSet: new wb.datamodel.StatementGroupSet( [ | ||
new wb.datamodel.StatementGroup( 'P1', new wb.datamodel.StatementList( [ | ||
new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' | ||
statementGroupSet: new datamodel.StatementGroupSet( [ | ||
new datamodel.StatementGroup( 'P1', new datamodel.StatementList( [ | ||
new datamodel.Statement( | ||
new datamodel.Claim( | ||
new datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' | ||
) | ||
@@ -62,7 +64,7 @@ ) | ||
} ), | ||
new wb.datamodel.Item( | ||
new datamodel.Item( | ||
'Q1', | ||
defaults[1].fingerprint, | ||
defaults[1].statementGroupSet, | ||
new wb.datamodel.SiteLinkSet( [ new wb.datamodel.SiteLink( 'someSite', 'page' ) ] ) | ||
new datamodel.SiteLinkSet( [ new datamodel.SiteLink( 'someSite', 'page' ) ] ) | ||
) | ||
@@ -69,0 +71,0 @@ ] |
@@ -9,2 +9,4 @@ /** | ||
QUnit.module( 'wikibase.serialization.MultiTermDeserializer' ); | ||
var MultiTermDeserializer = require( '../../src/Deserializers/MultiTermDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -14,3 +16,3 @@ var testSets = [ | ||
[ { language: 'en', value: 'test1' }, { language: 'en', value: 'test2' } ], | ||
new wb.datamodel.MultiTerm( 'en', [ 'test1', 'test2' ] ) | ||
new datamodel.MultiTerm( 'en', [ 'test1', 'test2' ] ) | ||
] | ||
@@ -21,3 +23,3 @@ ]; | ||
assert.expect( 1 ); | ||
var multiTermDeserializer = new wb.serialization.MultiTermDeserializer(); | ||
var multiTermDeserializer = new MultiTermDeserializer(); | ||
@@ -24,0 +26,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -9,2 +9,4 @@ /** | ||
QUnit.module( 'wikibase.serialization.MultiTermMapDeserializer' ); | ||
var MultiTermMapDeserializer = require( '../../src/Deserializers/MultiTermMapDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -14,3 +16,3 @@ var testSets = [ | ||
{}, | ||
new wb.datamodel.MultiTermMap() | ||
new datamodel.MultiTermMap() | ||
], [ | ||
@@ -21,5 +23,5 @@ { | ||
}, | ||
new wb.datamodel.MultiTermMap( { | ||
en: new wb.datamodel.MultiTerm( 'en', [ 'en-test' ] ), | ||
de: new wb.datamodel.MultiTerm( 'de', [ 'de-test' ] ) | ||
new datamodel.MultiTermMap( { | ||
en: new datamodel.MultiTerm( 'en', [ 'en-test' ] ), | ||
de: new datamodel.MultiTerm( 'de', [ 'de-test' ] ) | ||
} ) | ||
@@ -31,5 +33,5 @@ ], [ | ||
}, | ||
new wb.datamodel.MultiTermMap( { | ||
en: new wb.datamodel.MultiTerm( 'en', [ 'en-test' ] ), | ||
de: new wb.datamodel.MultiTerm( 'en', [ 'en-test' ] ) | ||
new datamodel.MultiTermMap( { | ||
en: new datamodel.MultiTerm( 'en', [ 'en-test' ] ), | ||
de: new datamodel.MultiTerm( 'en', [ 'en-test' ] ) | ||
} ) | ||
@@ -41,3 +43,3 @@ ] | ||
assert.expect( 3 ); | ||
var multiTermMapDeserializer = new wb.serialization.MultiTermMapDeserializer(); | ||
var multiTermMapDeserializer = new MultiTermMapDeserializer(); | ||
@@ -44,0 +46,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -10,2 +10,4 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var defaults = [ | ||
@@ -30,12 +32,12 @@ { | ||
}, { | ||
fingerprint: new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'label' ) } ), | ||
new wb.datamodel.TermMap( { en: new wb.datamodel.Term( 'en', 'description' ) } ), | ||
new wb.datamodel.MultiTermMap( { en: new wb.datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
fingerprint: new datamodel.Fingerprint( | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'label' ) } ), | ||
new datamodel.TermMap( { en: new datamodel.Term( 'en', 'description' ) } ), | ||
new datamodel.MultiTermMap( { en: new datamodel.MultiTerm( 'en', [ 'alias' ] ) } ) | ||
), | ||
statementGroupSet: new wb.datamodel.StatementGroupSet( [ | ||
new wb.datamodel.StatementGroup( 'P1', new wb.datamodel.StatementList( [ | ||
new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' | ||
statementGroupSet: new datamodel.StatementGroupSet( [ | ||
new datamodel.StatementGroup( 'P1', new datamodel.StatementList( [ | ||
new datamodel.Statement( | ||
new datamodel.Claim( | ||
new datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' | ||
) | ||
@@ -56,3 +58,3 @@ ) | ||
} ), | ||
new wb.datamodel.Property( | ||
new datamodel.Property( | ||
'P1', | ||
@@ -59,0 +61,0 @@ 'string', |
@@ -8,2 +8,5 @@ /** | ||
var ReferenceDeserializer = require( '../../src/Deserializers/ReferenceDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
QUnit.module( 'wikibase.serialization.ReferenceDeserializer' ); | ||
@@ -23,4 +26,4 @@ | ||
}, | ||
new wb.datamodel.Reference( | ||
new wb.datamodel.SnakList( [ new wb.datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
new datamodel.Reference( | ||
new datamodel.SnakList( [ new datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
'i am a hash' | ||
@@ -46,7 +49,7 @@ ) | ||
}, | ||
new wb.datamodel.Reference( | ||
new wb.datamodel.SnakList( [ | ||
new wb.datamodel.PropertyNoValueSnak( 'P2' ), | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), | ||
new wb.datamodel.PropertySomeValueSnak( 'P1' ) | ||
new datamodel.Reference( | ||
new datamodel.SnakList( [ | ||
new datamodel.PropertyNoValueSnak( 'P2' ), | ||
new datamodel.PropertyNoValueSnak( 'P1' ), | ||
new datamodel.PropertySomeValueSnak( 'P1' ) | ||
] ), | ||
@@ -60,3 +63,3 @@ 'i am a hash' | ||
assert.expect( 2 ); | ||
var referenceDeserializer = new wb.serialization.ReferenceDeserializer(); | ||
var referenceDeserializer = new ReferenceDeserializer(); | ||
@@ -63,0 +66,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -8,2 +8,5 @@ /** | ||
var ReferenceListDeserializer = require( '../../src/Deserializers/ReferenceListDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
QUnit.module( 'wikibase.serialization.ReferenceListDeserializer' ); | ||
@@ -14,3 +17,3 @@ | ||
[], | ||
new wb.datamodel.ReferenceList() | ||
new datamodel.ReferenceList() | ||
], [ | ||
@@ -23,3 +26,3 @@ [ | ||
], | ||
new wb.datamodel.ReferenceList( [ new wb.datamodel.Reference() ] ) | ||
new datamodel.ReferenceList( [ new datamodel.Reference() ] ) | ||
], [ | ||
@@ -37,5 +40,5 @@ [ | ||
], | ||
new wb.datamodel.ReferenceList( [ | ||
new wb.datamodel.Reference( null, 'hash1' ), | ||
new wb.datamodel.Reference( null, 'hash2' ) | ||
new datamodel.ReferenceList( [ | ||
new datamodel.Reference( null, 'hash1' ), | ||
new datamodel.Reference( null, 'hash2' ) | ||
] ) | ||
@@ -47,3 +50,3 @@ ] | ||
assert.expect( 3 ); | ||
var referenceListDeserializer = new wb.serialization.ReferenceListDeserializer(); | ||
var referenceListDeserializer = new ReferenceListDeserializer(); | ||
@@ -50,0 +53,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -9,2 +9,4 @@ /** | ||
QUnit.module( 'wikibase.serialization.SiteLinkDeserializer' ); | ||
var SiteLinkDeserializer = require( '../../src/Deserializers/SiteLinkDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -18,3 +20,3 @@ var testSets = [ | ||
}, | ||
new wb.datamodel.SiteLink( 'site-id', 'page-title', [ 'badge-1', 'badge-2' ] ) | ||
new datamodel.SiteLink( 'site-id', 'page-title', [ 'badge-1', 'badge-2' ] ) | ||
] | ||
@@ -25,3 +27,3 @@ ]; | ||
assert.expect( 1 ); | ||
var siteLinkDeserializer = new wb.serialization.SiteLinkDeserializer(); | ||
var siteLinkDeserializer = new SiteLinkDeserializer(); | ||
@@ -28,0 +30,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -9,2 +9,4 @@ /** | ||
QUnit.module( 'wikibase.serialization.SiteLinkSetDeserializer' ); | ||
var SiteLinkSetDeserializer = require( '../../src/Deserializers/SiteLinkSetDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
@@ -14,3 +16,3 @@ var testSets = [ | ||
{}, | ||
new wb.datamodel.SiteLinkSet() | ||
new datamodel.SiteLinkSet() | ||
], [ | ||
@@ -24,3 +26,3 @@ { | ||
}, | ||
new wb.datamodel.SiteLinkSet( [ new wb.datamodel.SiteLink( 'site', 'page' ) ] ) | ||
new datamodel.SiteLinkSet( [ new datamodel.SiteLink( 'site', 'page' ) ] ) | ||
] | ||
@@ -31,3 +33,3 @@ ]; | ||
assert.expect( 2 ); | ||
var siteLinkSetDeserializer = new wb.serialization.SiteLinkSetDeserializer(); | ||
var siteLinkSetDeserializer = new SiteLinkSetDeserializer(); | ||
@@ -34,0 +36,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -11,2 +11,4 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
@@ -18,3 +20,3 @@ [ | ||
}, | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ) | ||
new datamodel.PropertyNoValueSnak( 'P1' ) | ||
], [ | ||
@@ -25,3 +27,3 @@ { | ||
}, | ||
new wb.datamodel.PropertySomeValueSnak( 'P1' ) | ||
new datamodel.PropertySomeValueSnak( 'P1' ) | ||
], [ | ||
@@ -36,3 +38,3 @@ { | ||
}, | ||
new wb.datamodel.PropertyValueSnak( 'P1', new dv.StringValue( 'some string' ) ) | ||
new datamodel.PropertyValueSnak( 'P1', new dv.StringValue( 'some string' ) ) | ||
], [ | ||
@@ -51,3 +53,3 @@ { | ||
}, | ||
new wb.datamodel.PropertyValueSnak( 'P1', new dv.UnDeserializableValue( | ||
new datamodel.PropertyValueSnak( 'P1', new dv.UnDeserializableValue( | ||
{ foo: 'bar' }, | ||
@@ -54,0 +56,0 @@ 'string', |
@@ -9,2 +9,5 @@ /** | ||
var SnakListDeserializer = require( '../../src/Deserializers/SnakListDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
QUnit.module( 'wikibase.serialization.SnakListDeserializer' ); | ||
@@ -18,3 +21,3 @@ | ||
], | ||
new wb.datamodel.SnakList() | ||
new datamodel.SnakList() | ||
], [ | ||
@@ -30,3 +33,3 @@ [ | ||
], | ||
new wb.datamodel.SnakList( [ new wb.datamodel.PropertyNoValueSnak( 'P1' ) ] ) | ||
new datamodel.SnakList( [ new datamodel.PropertyNoValueSnak( 'P1' ) ] ) | ||
], [ | ||
@@ -49,6 +52,6 @@ [ | ||
], | ||
new wb.datamodel.SnakList( [ | ||
new wb.datamodel.PropertyNoValueSnak( 'P2' ), | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), | ||
new wb.datamodel.PropertySomeValueSnak( 'P1' ) | ||
new datamodel.SnakList( [ | ||
new datamodel.PropertyNoValueSnak( 'P2' ), | ||
new datamodel.PropertyNoValueSnak( 'P1' ), | ||
new datamodel.PropertySomeValueSnak( 'P1' ) | ||
] ) | ||
@@ -60,3 +63,3 @@ ] | ||
assert.expect( 3 ); | ||
var snakListDeserializer = new wb.serialization.SnakListDeserializer(); | ||
var snakListDeserializer = new SnakListDeserializer(); | ||
@@ -63,0 +66,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -10,2 +10,4 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
@@ -21,6 +23,6 @@ [ | ||
}, | ||
new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
null, | ||
wb.datamodel.Statement.RANK.NORMAL | ||
datamodel.Statement.RANK.NORMAL | ||
) | ||
@@ -40,6 +42,6 @@ ], [ | ||
}, | ||
new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
new wb.datamodel.ReferenceList( [ new wb.datamodel.Reference() ] ), | ||
wb.datamodel.Statement.RANK.PREFERRED | ||
new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
new datamodel.ReferenceList( [ new datamodel.Reference() ] ), | ||
datamodel.Statement.RANK.PREFERRED | ||
) | ||
@@ -46,0 +48,0 @@ ] |
@@ -8,2 +8,5 @@ /** | ||
var StatementGroupDeserializer = require( '../../src/Deserializers/StatementGroupDeserializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
QUnit.module( 'wikibase.serialization.StatementGroupDeserializer' ); | ||
@@ -23,5 +26,5 @@ | ||
], | ||
new wb.datamodel.StatementGroup( 'P1', | ||
new wb.datamodel.StatementList( [ new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
new datamodel.StatementGroup( 'P1', | ||
new datamodel.StatementList( [ new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
) ] ) | ||
@@ -34,3 +37,3 @@ ) | ||
assert.expect( 2 ); | ||
var statementGroupDeserializer = new wb.serialization.StatementGroupDeserializer(); | ||
var statementGroupDeserializer = new StatementGroupDeserializer(); | ||
@@ -37,0 +40,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
@@ -10,6 +10,8 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
{}, | ||
new wb.datamodel.StatementGroupSet() | ||
new datamodel.StatementGroupSet() | ||
], [ | ||
@@ -38,11 +40,11 @@ { | ||
}, | ||
new wb.datamodel.StatementGroupSet( [ | ||
new wb.datamodel.StatementGroup( 'P1', | ||
new wb.datamodel.StatementList( [ new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
new datamodel.StatementGroupSet( [ | ||
new datamodel.StatementGroup( 'P1', | ||
new datamodel.StatementList( [ new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
) ] ) | ||
), | ||
new wb.datamodel.StatementGroup( 'P2', | ||
new wb.datamodel.StatementList( [ new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P2' ) ) | ||
new datamodel.StatementGroup( 'P2', | ||
new datamodel.StatementList( [ new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P2' ) ) | ||
) ] ) | ||
@@ -49,0 +51,0 @@ ) |
@@ -10,6 +10,8 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
[], | ||
new wb.datamodel.StatementList() | ||
new datamodel.StatementList() | ||
], [ | ||
@@ -26,4 +28,4 @@ [ | ||
], | ||
new wb.datamodel.StatementList( [ new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
new datamodel.StatementList( [ new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
) ] ) | ||
@@ -30,0 +32,0 @@ ] |
@@ -10,6 +10,8 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
{ language: 'en', value: 'test' }, | ||
new wb.datamodel.Term( 'en', 'test' ) | ||
new datamodel.Term( 'en', 'test' ) | ||
] | ||
@@ -16,0 +18,0 @@ ]; |
@@ -10,6 +10,8 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
{}, | ||
new wb.datamodel.TermMap() | ||
new datamodel.TermMap() | ||
], [ | ||
@@ -20,5 +22,5 @@ { | ||
}, | ||
new wb.datamodel.TermMap( { | ||
en: new wb.datamodel.Term( 'en', 'en-test' ), | ||
de: new wb.datamodel.Term( 'de', 'de-test' ) | ||
new datamodel.TermMap( { | ||
en: new datamodel.Term( 'en', 'en-test' ), | ||
de: new datamodel.Term( 'de', 'de-test' ) | ||
} ) | ||
@@ -30,5 +32,5 @@ ], [ | ||
}, | ||
new wb.datamodel.TermMap( { | ||
en: new wb.datamodel.Term( 'en', 'en-test' ), | ||
de: new wb.datamodel.Term( 'en', 'en-test' ) | ||
new datamodel.TermMap( { | ||
en: new datamodel.Term( 'en', 'en-test' ), | ||
de: new datamodel.Term( 'en', 'en-test' ) | ||
} ) | ||
@@ -35,0 +37,0 @@ ] |
@@ -9,5 +9,6 @@ /** | ||
wb.serialization.tests = wb.serialization.tests || {}; | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
/** | ||
* @extends wikibase.datamodel.Entity | ||
* @extends datamodel.Entity | ||
* | ||
@@ -17,7 +18,7 @@ * @constructor | ||
* @param {string} id | ||
* @param {wikibase.datamodel.Fingerprint} fingerprint | ||
* @param {datamodel.Fingerprint} fingerprint | ||
*/ | ||
var SELF = wb.serialization.tests.MockEntity = util.inherit( | ||
'wbMockEntity', | ||
wb.datamodel.Entity, | ||
datamodel.FingerprintableEntity, | ||
function WbMockEntity( id, fingerprint ) { | ||
@@ -24,0 +25,0 @@ this._id = id; |
@@ -10,17 +10,19 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
'i am an id', | ||
new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap(), | ||
new wb.datamodel.TermMap(), | ||
new wb.datamodel.MultiTermMap() | ||
new datamodel.Fingerprint( | ||
new datamodel.TermMap(), | ||
new datamodel.TermMap(), | ||
new datamodel.MultiTermMap() | ||
) | ||
], [ | ||
'i am an id', | ||
new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap( { de: new wb.datamodel.Term( 'de', 'de-label' ) } ), | ||
new wb.datamodel.TermMap( { de: new wb.datamodel.Term( 'de', 'de-description' ) } ), | ||
new wb.datamodel.MultiTermMap( { | ||
de: new wb.datamodel.MultiTerm( 'de', [ 'de-alias' ] ) | ||
new datamodel.Fingerprint( | ||
new datamodel.TermMap( { de: new datamodel.Term( 'de', 'de-label' ) } ), | ||
new datamodel.TermMap( { de: new datamodel.Term( 'de', 'de-description' ) } ), | ||
new datamodel.MultiTermMap( { | ||
de: new datamodel.MultiTerm( 'de', [ 'de-alias' ] ) | ||
} ) | ||
@@ -47,6 +49,6 @@ ) | ||
'i am an id', | ||
new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap(), | ||
new wb.datamodel.TermMap(), | ||
new wb.datamodel.MultiTermMap() | ||
new datamodel.Fingerprint( | ||
new datamodel.TermMap(), | ||
new datamodel.TermMap(), | ||
new datamodel.MultiTermMap() | ||
) | ||
@@ -60,6 +62,6 @@ ) ).isEmpty(), | ||
'i am an id', | ||
new wb.datamodel.Fingerprint( | ||
new wb.datamodel.TermMap( { de: new wb.datamodel.Term( 'de', 'de-term' ) } ), | ||
new wb.datamodel.TermMap(), | ||
new wb.datamodel.MultiTermMap() | ||
new datamodel.Fingerprint( | ||
new datamodel.TermMap( { de: new datamodel.Term( 'de', 'de-term' ) } ), | ||
new datamodel.TermMap(), | ||
new datamodel.MultiTermMap() | ||
) | ||
@@ -66,0 +68,0 @@ ) ).isEmpty(), |
@@ -10,5 +10,7 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' ), | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ), null, 'Q1$1' ), | ||
{ | ||
@@ -23,5 +25,5 @@ id: 'Q1$1', | ||
], [ | ||
new wb.datamodel.Claim( | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), | ||
new wb.datamodel.SnakList( [ new wb.datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
new datamodel.Claim( | ||
new datamodel.PropertyNoValueSnak( 'P1' ), | ||
new datamodel.SnakList( [ new datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
'Q1$1' | ||
@@ -28,0 +30,0 @@ ), |
@@ -10,8 +10,10 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.ReferenceList(), | ||
new datamodel.ReferenceList(), | ||
[] | ||
], [ | ||
new wb.datamodel.ReferenceList( [ new wb.datamodel.Reference() ] ), | ||
new datamodel.ReferenceList( [ new datamodel.Reference() ] ), | ||
[ | ||
@@ -24,5 +26,5 @@ { | ||
], [ | ||
new wb.datamodel.ReferenceList( [ | ||
new wb.datamodel.Reference( null, 'hash1' ), | ||
new wb.datamodel.Reference( null, 'hash2' ) | ||
new datamodel.ReferenceList( [ | ||
new datamodel.Reference( null, 'hash1' ), | ||
new datamodel.Reference( null, 'hash2' ) | ||
] ), | ||
@@ -29,0 +31,0 @@ [ |
@@ -10,6 +10,8 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.Reference( | ||
new wb.datamodel.SnakList( [ new wb.datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
new datamodel.Reference( | ||
new datamodel.SnakList( [ new datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
'i am a hash' | ||
@@ -28,7 +30,7 @@ ), | ||
], [ | ||
new wb.datamodel.Reference( | ||
new wb.datamodel.SnakList( [ | ||
new wb.datamodel.PropertyNoValueSnak( 'P2' ), | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), | ||
new wb.datamodel.PropertySomeValueSnak( 'P1' ) | ||
new datamodel.Reference( | ||
new datamodel.SnakList( [ | ||
new datamodel.PropertyNoValueSnak( 'P2' ), | ||
new datamodel.PropertyNoValueSnak( 'P1' ), | ||
new datamodel.PropertySomeValueSnak( 'P1' ) | ||
] ), | ||
@@ -35,0 +37,0 @@ 'i am a hash' |
@@ -10,8 +10,10 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.SnakList(), | ||
new datamodel.SnakList(), | ||
{} | ||
], [ | ||
new wb.datamodel.SnakList( [ new wb.datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
new datamodel.SnakList( [ new datamodel.PropertyNoValueSnak( 'P1' ) ] ), | ||
{ | ||
@@ -24,6 +26,6 @@ P1: [ { | ||
], [ | ||
new wb.datamodel.SnakList( [ | ||
new wb.datamodel.PropertyNoValueSnak( 'P2' ), | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), | ||
new wb.datamodel.PropertySomeValueSnak( 'P1' ) | ||
new datamodel.SnakList( [ | ||
new datamodel.PropertyNoValueSnak( 'P2' ), | ||
new datamodel.PropertyNoValueSnak( 'P1' ), | ||
new datamodel.PropertySomeValueSnak( 'P1' ) | ||
] ), | ||
@@ -30,0 +32,0 @@ { |
@@ -11,5 +11,7 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.PropertyNoValueSnak( 'P1' ), | ||
new datamodel.PropertyNoValueSnak( 'P1' ), | ||
{ | ||
@@ -20,3 +22,3 @@ snaktype: 'novalue', | ||
], [ | ||
new wb.datamodel.PropertySomeValueSnak( 'P1' ), | ||
new datamodel.PropertySomeValueSnak( 'P1' ), | ||
{ | ||
@@ -27,3 +29,3 @@ snaktype: 'somevalue', | ||
], [ | ||
new wb.datamodel.PropertyValueSnak( 'P1', new dv.StringValue( 'some string' ) ), | ||
new datamodel.PropertyValueSnak( 'P1', new dv.StringValue( 'some string' ) ), | ||
{ | ||
@@ -30,0 +32,0 @@ snaktype: 'value', |
@@ -10,9 +10,11 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.StatementList(), | ||
new datamodel.StatementList(), | ||
[] | ||
], [ | ||
new wb.datamodel.StatementList( [ new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
new datamodel.StatementList( [ new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ) | ||
) ] ), | ||
@@ -19,0 +21,0 @@ [ |
@@ -10,8 +10,10 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
null, | ||
wb.datamodel.Statement.RANK.NORMAL | ||
datamodel.Statement.RANK.NORMAL | ||
), | ||
@@ -27,6 +29,6 @@ { | ||
], [ | ||
new wb.datamodel.Statement( | ||
new wb.datamodel.Claim( new wb.datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
new wb.datamodel.ReferenceList( [ new wb.datamodel.Reference() ] ), | ||
wb.datamodel.Statement.RANK.PREFERRED | ||
new datamodel.Statement( | ||
new datamodel.Claim( new datamodel.PropertyNoValueSnak( 'P1' ) ), | ||
new datamodel.ReferenceList( [ new datamodel.Reference() ] ), | ||
datamodel.Statement.RANK.PREFERRED | ||
), | ||
@@ -33,0 +35,0 @@ { |
@@ -10,10 +10,12 @@ /** | ||
var datamodel = require( 'wikibase.datamodel' ); | ||
var testSets = [ | ||
[ | ||
new wb.datamodel.TermMap(), | ||
new datamodel.TermMap(), | ||
{} | ||
], [ | ||
new wb.datamodel.TermMap( { | ||
en: new wb.datamodel.Term( 'en', 'en-test' ), | ||
de: new wb.datamodel.Term( 'de', 'de-test' ) | ||
new datamodel.TermMap( { | ||
en: new datamodel.Term( 'en', 'en-test' ), | ||
de: new datamodel.Term( 'de', 'de-test' ) | ||
} ), | ||
@@ -25,5 +27,5 @@ { | ||
], [ | ||
new wb.datamodel.TermMap( { | ||
en: new wb.datamodel.Term( 'en', 'en-test' ), | ||
de: new wb.datamodel.Term( 'en', 'en-test' ) | ||
new datamodel.TermMap( { | ||
en: new datamodel.Term( 'en', 'en-test' ), | ||
de: new datamodel.Term( 'en', 'en-test' ) | ||
} ), | ||
@@ -30,0 +32,0 @@ { |
@@ -8,2 +8,5 @@ /** | ||
var TermSerializer = require( './../../src/Serializers/TermSerializer.js' ), | ||
datamodel = require( 'wikibase.datamodel' ); | ||
QUnit.module( 'wikibase.serialization.TermSerializer' ); | ||
@@ -13,3 +16,3 @@ | ||
[ | ||
new wb.datamodel.Term( 'en', 'test' ), | ||
new datamodel.Term( 'en', 'test' ), | ||
{ language: 'en', value: 'test' } | ||
@@ -21,3 +24,3 @@ ] | ||
assert.expect( 1 ); | ||
var termSerializer = new wb.serialization.TermSerializer(); | ||
var termSerializer = new TermSerializer(); | ||
@@ -24,0 +27,0 @@ for( var i = 0; i < testSets.length; i++ ) { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a 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
150
106358
9
76
2958
1
+ Addedwikibase-data-model@5.1.0(transitive)
- Removedwikibase-data-model@4.1.0(transitive)
Updatedwikibase-data-model@^5.1.0