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

js-data

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-data - npm Package Compare versions

Comparing version 3.0.0-rc.9 to 3.0.0

dist/js-data.min.js.map

7

CHANGELOG.md

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

##### 3.0.0 - 01 July 2017
**v3 Stable Release**
###### Bug fixes
- [#473] - Fixes #471 by @Tronix117
##### 3.0.0-rc.9 - 22 February 2017

@@ -2,0 +9,0 @@

20

dist/js-data.d.ts

@@ -128,3 +128,3 @@ export const version: {

afterSum(field: string, query: any, opts: any, result: any): any
afterUpdate(id: string|number, opts: any, result: any): any
afterUpdate(id: string|number, props: any, opts: any, result: any): any
afterUpdateAll(props: any, query: any, opts: any, result: any): any

@@ -226,6 +226,7 @@ afterUpdateMany(records: any[], opts: any, result: any): any

getMapper(name: string): Mapper
getMapperByName(name:string): Mapper
registerAdapter(name: string, adapter: any, opts?: any): void
}
export class DataStore extends Container {
collectionClass: typeof LinkedCollection
export class SimpleStore extends Container {
collectionClass: typeof Collection
_collections: Object

@@ -236,3 +237,3 @@ _pendingQueries: Object

usePendingFindAll: boolean
as(name: string): Mapper|LinkedCollection
as(name: string): Mapper|Collection
constructor(opts?: any)

@@ -246,3 +247,4 @@ add(mapperName: string, records: any[]|any, opts?: any): any[]|any

cacheFindAll(mapperName: string, data: any, hash: string, opts: any): void
createIndex(mapperName: string, name: any, fieldList: any, opts?: any): LinkedCollection
clear(): any
createIndex(mapperName: string, name: any, fieldList: any, opts?: any): Collection
filter(mapperName: string, query: any, thisArg?: any): any[]

@@ -267,3 +269,3 @@ get(mapperName: string, id: string|number): any

hashQuery(mapperName: string, query: any, opts?: any): string
getCollection(mapperName: string): LinkedCollection
getCollection(mapperName: string): Collection
update(mapperName: string, id: any, record: any, opts?: any): Promise<any>

@@ -273,2 +275,8 @@ updateAll(mapperName: string, props: any, query?: any, opts?: any): Promise<any[]|any>

}
export class DataStore extends SimpleStore {
collectionClass: typeof LinkedCollection
as(name: string): Mapper|LinkedCollection
createIndex(mapperName: string, name: any, fieldList: any, opts?: any): LinkedCollection
getCollection(mapperName: string): LinkedCollection
}
export class Query extends Component {

@@ -275,0 +283,0 @@ static ops: {

{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "3.0.0-rc.9",
"version": "3.0.0",
"homepage": "http://www.js-data.io",

@@ -52,3 +52,3 @@ "repository": {

"bundle": "npm run bundle:es5 && npm run bundle:next && repo-tools write-version dist/js-data.js dist/js-data.es2015.js",
"min": "uglifyjs dist/js-data.js -o dist/js-data.min.js --source-map dist/js-data.min.map --source-map-url js-data.min.map -v -m -c --keep-fnames --screw-ie8",
"min": "uglifyjs -o dist/js-data.min.js --source-map url=js-data.min.map -v -m -c --keep-fnames --screw-ie8 -- dist/js-data.js",
"banner": "node scripts/banner.js",

@@ -64,31 +64,31 @@ "gzip": "echo gzipped size: $(cat dist/js-data.min.js | gzip -f9 | wc -c)kb",

"devDependencies": {
"babel-core": "6.23.1",
"babel-eslint": "7.1.1",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-plugin-external-helpers": "6.22.0",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-es2015-modules-umd": "6.23.0",
"babel-plugin-transform-regenerator": "6.22.0",
"babel-plugin-transform-es2015-modules-umd": "6.24.1",
"babel-plugin-transform-regenerator": "6.24.1",
"babel-polyfill": "6.23.0",
"babel-preset-es2015": "6.22.0",
"chai": "3.5.0",
"babel-preset-es2015": "6.24.1",
"chai": "4.0.2",
"ink-docstrap": "git+https://github.com/js-data/docstrap.git#cfbe45fa313e1628c493076d5e15d2b855dfbf2c",
"js-data-repo-tools": "1.0.0",
"jsdoc": "3.4.3",
"karma": "1.5.0",
"karma": "1.7.0",
"karma-babel-preprocessor": "6.0.1",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-mocha": "1.3.0",
"karma-phantomjs-launcher": "1.0.2",
"karma-phantomjs-launcher": "1.0.4",
"karma-sauce-launcher": "1.1.0",
"karma-sinon": "1.0.5",
"mocha": "3.2.0",
"nyc": "10.1.2",
"mocha": "3.4.2",
"nyc": "11.0.3",
"phantomjs-prebuilt": "2.1.14",
"rollup": "0.41.4",
"rollup": "0.43.0",
"rollup-plugin-babel": "2.7.1",
"sinon": "1.17.7",
"standard": "8.6.0",
"uglify-js": "2.7.5"
"sinon": "2.3.6",
"standard": "10.0.2",
"uglify-js": "3.0.22"
}
}

@@ -49,2 +49,3 @@ import utils from './utils'

* replace
* skip
*

@@ -62,2 +63,6 @@ * Merge:

*
* Skip:
*
* Ignore new record, keep existing record.
*
* @name Collection#onConflict

@@ -262,4 +267,4 @@ * @type {string}

const onConflict = opts.onConflict || this.onConflict
if (onConflict !== 'merge' && onConflict !== 'replace') {
throw utils.err(`${DOMAIN}#add`, 'opts.onConflict')(400, 'one of (merge, replace)', onConflict, true)
if (onConflict !== 'merge' && onConflict !== 'replace' && onConflict !== 'skip') {
throw utils.err(`${DOMAIN}#add`, 'opts.onConflict')(400, 'one of (merge, replace, skip)', onConflict, true)
}

@@ -280,3 +285,4 @@ const existingNoValidate = existing._get(noValidatePath)

existing.set(record)
}
} // else if(onConflict === 'skip'){ do nothing }
if (opts.noValidate) {

@@ -518,3 +524,3 @@ // Restore previous `noValidate` value

get (id) {
const instances = this.query().get(id).run()
const instances = id === undefined ? [] : this.query().get(id).run()
return instances.length ? instances[0] : undefined

@@ -521,0 +527,0 @@ },

@@ -30,23 +30,2 @@ /**

/**
* Describes the version of this `JSData` object.
*
* @example
* console.log(JSData.version.full) // "3.0.0-beta.1"
*
* @name version
* @memberof module:js-data
* @property {string} full The full semver value.
* @property {number} major The major version number.
* @property {number} minor The minor version number.
* @property {number} patch The patch version number.
* @property {(string|boolean)} alpha The alpha version value, otherwise `false`
* if the current version is not alpha.
* @property {(string|boolean)} beta The beta version value, otherwise `false`
* if the current version is not beta.
* @since 2.0.0
* @type {Object}
*/
export const version = '<%= version %>'
/**
* JSData's utility methods.

@@ -262,2 +241,23 @@ *

/**
* Describes the version of this `JSData` object.
*
* @example
* console.log(JSData.version.full) // "3.0.0-beta.1"
*
* @name version
* @memberof module:js-data
* @property {string} full The full semver value.
* @property {number} major The major version number.
* @property {number} minor The minor version number.
* @property {number} patch The patch version number.
* @property {(string|boolean)} alpha The alpha version value, otherwise `false`
* if the current version is not alpha.
* @property {(string|boolean)} beta The beta version value, otherwise `false`
* if the current version is not beta.
* @since 2.0.0
* @type {Object}
*/
export const version = '<%= version %>'
export * from './decorators'

@@ -264,0 +264,0 @@

@@ -686,3 +686,3 @@ import utils from './utils'

}
if (!args.length || args.length === 1 && utils.isObject(args[0])) {
if (!args.length || (args.length === 1 && utils.isObject(args[0]))) {
this.getData()

@@ -689,0 +689,0 @@ return this

@@ -133,2 +133,4 @@ import utils, { safeSetLink } from './utils'

const _set = this._set
const mapper = this.constructor.mapper
_set(creatingPath, true)

@@ -139,3 +141,2 @@ _set(noValidatePath, !!opts.noValidate)

// Set the idAttribute value first, if it exists.
const mapper = this.constructor.mapper
const id = mapper ? utils.get(props, mapper.idAttribute) : undefined

@@ -142,0 +143,0 @@ if (id !== undefined) {

@@ -120,3 +120,3 @@ import utils from './utils'

this.getRelation().relationList.forEach((def) => {
if (def.getRelation() === mapper && this.isInversedTo(def)) {
if (def.getRelation() === mapper && this.isInversedTo(def) && this !== def) {
this.inverse = def

@@ -144,3 +144,3 @@ return true

const isEmptyLinks = !relatedData || utils.isArray(relatedData) && !relatedData.length
const isEmptyLinks = !relatedData || (utils.isArray(relatedData) && !relatedData.length)

@@ -195,3 +195,38 @@ if (isEmptyLinks && this.canFindLinkFor(record)) {

})
},
ensureLinkedDataHasProperType (props, opts) {
const relatedMapper = this.getRelation()
const relationData = this.getLocalField(props)
if (utils.isArray(relationData) && (!relationData.length || relatedMapper.is(relationData[0]))) {
return
}
if (relationData && !relatedMapper.is(relationData)) {
utils.set(props, this.localField, relatedMapper.createRecord(relationData, opts))
}
},
isRequiresParentId () {
return false
},
isRequiresChildId () {
return false
},
createChildRecord (props, relationData, opts) {
this.setForeignKey(props, relationData)
return this.createLinked(relationData, opts).then((result) => {
this.setLocalField(props, result)
})
},
createLinked (props, opts) {
const create = utils.isArray(props) ? 'createMany' : 'create'
return this.getRelation()[create](props, opts)
}
})

@@ -22,2 +22,18 @@ import utils from '../utils'

}
},
isRequiresParentId () {
return true
},
createParentRecord (props, opts) {
const relationData = this.getLocalField(props)
return this.createLinked(relationData, opts).then((record) => {
this.setForeignKey(props, record)
})
},
createChildRecord () {
throw new Error('"BelongsTo" relation does not support child creation as it cannot have children.')
}

@@ -24,0 +40,0 @@ }, {

@@ -81,2 +81,23 @@ import utils from '../utils'

})
},
isRequiresParentId () {
return !!this.localKeys && this.localKeys.length > 0
},
isRequiresChildId () {
return !!this.foreignKey
},
createParentRecord (props, opts) {
const relationData = this.getLocalField(props)
const foreignIdField = this.getRelation().idAttribute
return this.createLinked(relationData, opts).then((records) => {
utils.set(props, this.localKeys, records.map((record) => utils.get(record, foreignIdField)))
})
},
createLinked (props, opts) {
return this.getRelation().createMany(props, opts)
}

@@ -83,0 +104,0 @@ }, {

@@ -12,2 +12,6 @@ import utils from '../utils'

}
},
isRequiresChildId () {
return true
}

@@ -14,0 +18,0 @@ }, {

@@ -792,3 +792,5 @@ /**

for (i = 0; i < len; i++) {
fn.call(thisArg, obj[keys[i]], keys[i], obj)
if (fn.call(thisArg, obj[keys[i]], keys[i], obj) === false) {
break
}
}

@@ -1497,19 +1499,27 @@ },

let _equal = true
if (utils.isObject(a) && utils.isObject(b)) {
utils.forOwn(a, function (value, key) {
_equal = _equal && utils.deepEqual(value, b[key])
})
if (!_equal) {
return _equal
if (utils.isArray(a) && utils.isArray(b)) {
if (a.length !== b.length) {
return false
}
utils.forOwn(b, function (value, key) {
_equal = _equal && utils.deepEqual(value, a[key])
})
} else if (utils.isArray(a) && utils.isArray(b)) {
a.forEach(function (value, i) {
_equal = _equal && utils.deepEqual(value, b[i])
if (!_equal) {
for (let i = a.length; i--;) {
if (!utils.deepEqual(a[i], b[i])) {
// Exit loop early
return false
}
}
} else if (utils.isObject(a) && utils.isObject(b)) {
utils.forOwn(a, function (value, key) {
if (!(_equal = utils.deepEqual(value, b[key]))) {
// Exit loop early
return false
}
})
if (_equal) {
utils.forOwn(b, function (value, key) {
if (!(_equal = utils.deepEqual(value, a[key]))) {
// Exit loop early
return false
}
})
}
} else {

@@ -1516,0 +1526,0 @@ return false

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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