New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mobx-decorated-models

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-decorated-models - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

17

dist/build.full.js

@@ -109,3 +109,3 @@ (function (global, factory) {

var SimpleHandlers = {
var Fields = {
identifier: function identifier$$1(options) {

@@ -122,3 +122,3 @@ return getSerializer(options, serializr.identifier);

var AsyncHandlers = {
var Associations = {
hasMany: function hasMany(modelKlass, options) {

@@ -132,3 +132,3 @@ var defaultSerializer = serializr.list(serializr.object(modelKlass));

var defaultSerializer = serializr.object(serializr.getDefaultModelSchema(modelKlass));
return Object.assign({
return Object.assign(options, {
model: modelKlass,

@@ -151,3 +151,3 @@ deserializer: function deserializer(value, cb, context) {

}
}, options);
});
}

@@ -173,3 +173,2 @@ };

function decorateModel(model) {
Object.assign(model.prototype, MixedInInstanceMethods);

@@ -185,4 +184,4 @@ Object.assign(model, MixedInClassMethods);

if (SimpleHandlers[type]) {
serializeSchema[name] = SimpleHandlers[type](options, name);
if (Fields[type]) {
serializeSchema[name] = Fields[type](options, name);
}

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

if (AsyncHandlers[type]) {
addReference(model, name, options, AsyncHandlers[type]);
if (Associations[type]) {
addReference(model, name, options, Associations[type]);
}

@@ -199,0 +198,0 @@ });

@@ -106,3 +106,3 @@ import { createModelSchema, deserialize, getDefaultModelSchema, identifier, list, object, primitive, serialize, update } from 'serializr';

var SimpleHandlers = {
var Fields = {
identifier: function identifier$$1(options) {

@@ -119,3 +119,3 @@ return getSerializer(options, identifier);

var AsyncHandlers = {
var Associations = {
hasMany: function hasMany(modelKlass, options) {

@@ -129,3 +129,3 @@ var defaultSerializer = list(object(modelKlass));

var defaultSerializer = object(getDefaultModelSchema(modelKlass));
return Object.assign({
return Object.assign(options, {
model: modelKlass,

@@ -148,3 +148,3 @@ deserializer: function deserializer(value, cb, context) {

}
}, options);
});
}

@@ -170,3 +170,2 @@ };

function decorateModel(model) {
Object.assign(model.prototype, MixedInInstanceMethods);

@@ -182,4 +181,4 @@ Object.assign(model, MixedInClassMethods);

if (SimpleHandlers[type]) {
serializeSchema[name] = SimpleHandlers[type](options, name);
if (Fields[type]) {
serializeSchema[name] = Fields[type](options, name);
}

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

if (AsyncHandlers[type]) {
addReference(model, name, options, AsyncHandlers[type]);
if (Associations[type]) {
addReference(model, name, options, Associations[type]);
}

@@ -196,0 +195,0 @@ });

@@ -52,3 +52,3 @@ import {

const SimpleHandlers = {
const Fields = {
identifier: options => getSerializer(options, identifier),

@@ -60,3 +60,3 @@ field: options => getSerializer(options, primitive),

const AsyncHandlers = {
const Associations = {
hasMany(modelKlass, options) {

@@ -70,3 +70,3 @@ const defaultSerializer = list(object(modelKlass));

const defaultSerializer = object(getDefaultModelSchema(modelKlass));
return Object.assign({
return Object.assign(options, {
model: modelKlass,

@@ -87,3 +87,3 @@ deserializer(value, cb, context) {

},
}, options);
});
},

@@ -110,3 +110,2 @@ };

function decorateModel(model) {
Object.assign(model.prototype, MixedInInstanceMethods);

@@ -119,4 +118,4 @@ Object.assign(model, MixedInClassMethods);

schema.forEach(({ type, options }, name) => {
if (SimpleHandlers[type]) {
serializeSchema[name] = SimpleHandlers[type](options, name);
if (Fields[type]) {
serializeSchema[name] = Fields[type](options, name);
}

@@ -126,4 +125,4 @@ });

schema.forEach(({ type, options }, name) => {
if (AsyncHandlers[type]) {
addReference(model, name, options, AsyncHandlers[type]);
if (Associations[type]) {
addReference(model, name, options, Associations[type]);
}

@@ -130,0 +129,0 @@ });

{
"name": "mobx-decorated-models",
"version": "0.4.2",
"version": "0.4.3",
"description": "Decorators to make using Mobx for model type structures easier",

@@ -5,0 +5,0 @@ "main": "dist/build.full.js",

@@ -50,2 +50,7 @@ import { autorun } from 'mobx';

it('finds model for belongsTo', () => {
const box = Box.deserialize({ id: 1, watercraft: { name: 'Boaty' } });
expect(box.watercraft).toBeInstanceOf(Ship);
});
it('sets an inverse for belongsTo', () => {

@@ -52,0 +57,0 @@ const ship = Ship.deserialize({ name: 'HMS Mobx', box: { width: 42 } });

@@ -34,2 +34,3 @@ import { observable, computed } from 'mobx';

@belongsTo vessel;
@belongsTo({ model: 'boat' }) watercraft;
@belongsTo container;

@@ -36,0 +37,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc