Huge News!Announcing our $40M Series B led by Abstract Ventures.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.5.0 to 0.5.1

6

dist/build.full.js

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

serializer: function serializer(obj, prop, parent) {
return isSerializable(parent, prop) ? obj : undefined;
return isSerializable(parent, prop) ? obj : serializr.SKIP;
},

@@ -111,3 +111,3 @@ deserializer: function deserializer(json, cb) {

serializer: function serializer() {
return undefined;
return serializr.SKIP;
},

@@ -160,3 +160,3 @@ deserializer: fns.deserializer

if (!isSerializable(parent, name)) {
return undefined;
return serializr.SKIP;
}

@@ -163,0 +163,0 @@ return defaultSerializer.serializer(belongsTo);

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

import { createModelSchema, custom, deserialize, getDefaultModelSchema, identifier, list, object, primitive, serialize, update } from 'serializr';
import { SKIP, createModelSchema, custom, deserialize, getDefaultModelSchema, identifier, list, object, primitive, serialize, update } from 'serializr';
import { intercept, observable } from 'mobx';

@@ -67,3 +67,3 @@

serializer: function serializer(obj, prop, parent) {
return isSerializable(parent, prop) ? obj : undefined;
return isSerializable(parent, prop) ? obj : SKIP;
},

@@ -108,3 +108,3 @@ deserializer: function deserializer(json, cb) {

serializer: function serializer() {
return undefined;
return SKIP;
},

@@ -157,3 +157,3 @@ deserializer: fns.deserializer

if (!isSerializable(parent, name)) {
return undefined;
return SKIP;
}

@@ -160,0 +160,0 @@ return defaultSerializer.serializer(belongsTo);

import {
serialize, deserialize, createModelSchema, primitive, list, object,
serialize, deserialize, createModelSchema, primitive, list, object, SKIP,
identifier, getDefaultModelSchema, update, custom as customSerializer,

@@ -8,3 +8,3 @@ } from 'serializr';

import {
isSerializable, markNonserializable
isSerializable, markNonserializable,
} from './serializable';

@@ -18,3 +18,3 @@ import getSchema from './schema';

serializer(obj, prop, parent) {
return isSerializable(parent, prop) ? obj : undefined;
return isSerializable(parent, prop) ? obj : SKIP;
},

@@ -58,3 +58,3 @@ deserializer(json, cb) {

return {
serializer: () => undefined,
serializer: () => SKIP,
deserializer: fns.deserializer,

@@ -100,3 +100,3 @@ };

serializer(belongsTo, name, parent) {
if (!isSerializable(parent, name)) { return undefined; }
if (!isSerializable(parent, name)) { return SKIP; }
return defaultSerializer.serializer(belongsTo);

@@ -103,0 +103,0 @@ },

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

@@ -13,3 +13,3 @@ "main": "dist/build.full.js",

"mobx": "^3.0.2",
"serializr": "https://github.com/nathanstitt/serializr#serializer-args"
"serializr": "1.1.11"
},

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

@@ -152,2 +152,23 @@ # Decorators for creating model type structures with mobx

### session
Session fields are useful for storing data that should not be persisted.
They're write-only, meaning they're updated by the `deserialize` static method and `update()` instance method, but are not included in the JSON generated by `serialize()`
*example:*
```javascript
@identifiedBy('user')
class User {
@field id;
@session isLoggedIn;
}
const user = new User();
user.update({ id: 1234, isLoggedIn: true });
user.serialize(); // => { id: 1234 }; // note the "isLoggedIn" property is ommited
```
### belongsTo

@@ -302,6 +323,1 @@

```
# Future plans
* Sessions: properties that will be set from JSON but won't be serialized. https://github.com/mobxjs/serializr/pull/32 is needed before this can be supported

@@ -67,3 +67,3 @@ import { autorun } from 'mobx';

it('merges both attributes and session props', () => {
it('session props are set but not serialized', () => {
const box = Box.deserialize({ width: 3, color: 'red' });

@@ -70,0 +70,0 @@ expect(box.color).toEqual('red');

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 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