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

modeled-mobx

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modeled-mobx - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

2

dist/interceptors.d.ts
import { Model, ModelInstance } from './types';
import { ModelSchema } from './schema';
export declare function configureHasOne(parent: ModelInstance, property: string, desiredModel: Model): void;
export declare function configureHasMany(parent: ModelInstance, property: string, desiredModel: Model): void;
export declare function addInterceptors(model: ModelInstance, schema: ModelSchema): void;

39

dist/modeled-mobx.js

@@ -37,2 +37,3 @@ var mobx = require('mobx');

if (property) {
mobx.observable(model, property);
decorate(target, property, field);

@@ -209,2 +210,13 @@ } else {

}
function addInterceptors(model, schema) {
schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && mobx.isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
}

@@ -214,3 +226,3 @@ function modelize(model, properties, options) {

if (!properties && !decoratedSchema || properties && properties.decorateOnly) {
if (!properties && !decoratedSchema) {
mobx.makeObservable(model);

@@ -223,10 +235,13 @@ return;

if (properties) {
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
if (!properties) {
mobx.makeObservable(model);
addInterceptors(model, schema);
return;
}
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
Array.from(schema.properties.keys()).forEach(property => {

@@ -244,11 +259,3 @@ if (Object.prototype.hasOwnProperty.call(model, property) && !mobx.isObservableProp(model, property)) {

schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && mobx.isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
addInterceptors(model, schema);
}

@@ -255,0 +262,0 @@

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

import { observable, intercept, isObservableArray, makeObservable, isObservableProp } from 'mobx';
import { observable, isObservableProp, intercept, isObservableArray, makeObservable } from 'mobx';

@@ -37,2 +37,3 @@ const $schema = Symbol('modeled mobx schema');

if (property) {
observable(model, property);
decorate(target, property, field);

@@ -209,2 +210,13 @@ } else {

}
function addInterceptors(model, schema) {
schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
}

@@ -214,3 +226,3 @@ function modelize(model, properties, options) {

if (!properties && !decoratedSchema || properties && properties.decorateOnly) {
if (!properties && !decoratedSchema) {
makeObservable(model);

@@ -223,10 +235,13 @@ return;

if (properties) {
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
if (!properties) {
makeObservable(model);
addInterceptors(model, schema);
return;
}
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
Array.from(schema.properties.keys()).forEach(property => {

@@ -244,11 +259,3 @@ if (Object.prototype.hasOwnProperty.call(model, property) && !isObservableProp(model, property)) {

schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
addInterceptors(model, schema);
}

@@ -255,0 +262,0 @@

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

import { observable, intercept, isObservableArray, makeObservable, isObservableProp } from 'mobx';
import { observable, isObservableProp, intercept, isObservableArray, makeObservable } from 'mobx';

@@ -37,2 +37,3 @@ const $schema = Symbol('modeled mobx schema');

if (property) {
observable(model, property);
decorate(target, property, field);

@@ -209,2 +210,13 @@ } else {

}
function addInterceptors(model, schema) {
schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
}

@@ -214,3 +226,3 @@ function modelize(model, properties, options) {

if (!properties && !decoratedSchema || properties && properties.decorateOnly) {
if (!properties && !decoratedSchema) {
makeObservable(model);

@@ -223,10 +235,13 @@ return;

if (properties) {
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
if (!properties) {
makeObservable(model);
addInterceptors(model, schema);
return;
}
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
Array.from(schema.properties.keys()).forEach(property => {

@@ -244,11 +259,3 @@ if (Object.prototype.hasOwnProperty.call(model, property) && !isObservableProp(model, property)) {

schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
addInterceptors(model, schema);
}

@@ -255,0 +262,0 @@

@@ -40,2 +40,3 @@ (function (global, factory) {

if (property) {
mobx.observable(model, property);
decorate(target, property, field);

@@ -212,2 +213,13 @@ } else {

}
function addInterceptors(model, schema) {
schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && mobx.isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
}

@@ -217,3 +229,3 @@ function modelize(model, properties, options) {

if (!properties && !decoratedSchema || properties && properties.decorateOnly) {
if (!properties && !decoratedSchema) {
mobx.makeObservable(model);

@@ -226,10 +238,13 @@ return;

if (properties) {
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
if (!properties) {
mobx.makeObservable(model);
addInterceptors(model, schema);
return;
}
Object.keys(properties).forEach(property => {
if (!schema.recordProperty(property, properties[property])) {
mobxAnnotations[property] = properties[property];
}
});
Array.from(schema.properties.keys()).forEach(property => {

@@ -247,11 +262,3 @@ if (Object.prototype.hasOwnProperty.call(model, property) && !mobx.isObservableProp(model, property)) {

schema.properties.forEach((options, property) => {
if (options && options.type == 'model' && mobx.isObservableProp(model, property)) {
if (Array.isArray(model[property])) {
configureHasMany(model, property, options.model);
} else {
configureHasOne(model, property, options.model);
}
}
});
addInterceptors(model, schema);
}

@@ -258,0 +265,0 @@

@@ -6,7 +6,4 @@ import { CreateObservableOptions } from "mobx";

};
declare type DecorateOnly = {
decorateOnly: true;
};
export declare function modelize(model: ModelInstance, properties: DecorateOnly): void;
export declare function modelize(model: ModelInstance, properties?: ModelizeProperties<ModelInstance>, options?: CreateObservableOptions): void;
export declare function modelize(model: ModelInstance): void;
export declare function modelize(model: ModelInstance, properties: ModelizeProperties<ModelInstance>, options?: CreateObservableOptions): void;
export {};
{
"name": "modeled-mobx",
"version": "0.5.0",
"version": "0.5.1",
"description": "MobX powered classes with type-coercion and serialization/hydration",

@@ -5,0 +5,0 @@ "author": "nathanstitt",

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

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