You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@getoccasion/mitragyna

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getoccasion/mitragyna - npm Package Compare versions

Comparing version
0.2.1
to
0.2.2
.tags

Sorry, the diff of this file is not supported yet

+23
-12

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

_underscore2.default.bindAll(_this5, "afterUpdate", "assignChanges", "queueReflectionChange", "shiftReflectionQueue", "queueChange", "handleSubmit", "updateRoot");
_underscore2.default.bindAll(_this5, 'afterUpdate', 'assignChanges', 'queueReflectionChange', 'shiftReflectionQueue', 'queueChange', 'handleSubmit', 'updateRoot');

@@ -715,5 +715,5 @@ var root = context.root;

var reflectionInstance = (parent || root).klass().reflectOnAssociation(reflection);
if (_underscore2.default.isUndefined(reflectionInstance)) throw "Reflection " + reflection + " not found.";
if (_underscore2.default.isUndefined(reflectionInstance)) throw 'Reflection ' + reflection + ' not found.';
var inverseReflection = reflectionInstance.inverseOf();
if (_underscore2.default.isUndefined(inverseReflection)) throw "Reflection " + reflection + " must have inverse.";
if (_underscore2.default.isUndefined(inverseReflection)) throw 'Reflection ' + reflection + ' must have inverse.';

@@ -778,2 +778,4 @@ state = _extends({}, state, {

console.log('afterUpdate', this.props.subject.klass().name);
if (inverseReflection) {

@@ -805,2 +807,4 @@ var oldTarget = resource.association(inverseReflection.name).target;

console.log('assignChanges', this.props.subject.klass().name);
if (_underscore2.default.keys(queuedChanges).length == 0) return;

@@ -874,3 +878,5 @@

parent = _props9.parent;
var root = this.context.root;
var _context3 = this.context,
root = _context3.root,
afterUpdateRoot = _context3.afterUpdateRoot;
var _state4 = this.state,

@@ -889,3 +895,3 @@ resource = _state4.resource,

shiftReflectionQueue: this.shiftReflectionQueue,
root: parent || root || resource,
root: root || resource,
resource: resource,

@@ -955,3 +961,4 @@ updateRoot: this.updateRoot,

componentProps = _props11.componentProps,
componentRef = _props11.componentRef;
componentRef = _props11.componentRef,
renderFormElement = _props11.renderFormElement;
var resource = this.state.resource;

@@ -976,6 +983,6 @@

if (isNestedResource) {
if (!isNestedResource && renderFormElement) {
return _react2.default.createElement(
'section',
{ className: className },
'form',
{ className: className, onSubmit: this.handleSubmit },
body

@@ -985,4 +992,4 @@ );

return _react2.default.createElement(
'form',
{ className: className, onSubmit: this.handleSubmit },
'section',
{ className: className },
body

@@ -995,2 +1002,3 @@ );

value: function updateRoot(newRoot) {
console.log('updateRoot', this.props.subject.klass().name);
var afterUpdate = this.props.afterUpdate;

@@ -1003,2 +1011,3 @@ var resource = this.state.resource;

if (afterUpdate) {
console.log(' -> afterUpdate is set');
afterUpdate(newRoot, resource);

@@ -1020,2 +1029,3 @@ this.setState({ updating: true });

componentProps: _propTypes2.default.object,
renderFormElement: _propTypes2.default.bool,
onInvalidSubmit: _propTypes2.default.func,

@@ -1051,4 +1061,5 @@ onSubmit: _propTypes2.default.func,

componentProps: {},
componentRef: _underscore2.default.noop
componentRef: _underscore2.default.noop,
renderFormelement: true
};
});

@@ -542,2 +542,3 @@ import React from 'react';

componentProps: PropTypes.object,
renderFormElement: PropTypes.bool,
onInvalidSubmit: PropTypes.func,

@@ -577,2 +578,3 @@ onSubmit: PropTypes.func,

componentRef: _.noop,
renderFormelement: true,
};

@@ -585,9 +587,9 @@

this,
"afterUpdate",
"assignChanges",
"queueReflectionChange",
"shiftReflectionQueue",
"queueChange",
"handleSubmit",
"updateRoot"
'afterUpdate',
'assignChanges',
'queueReflectionChange',
'shiftReflectionQueue',
'queueChange',
'handleSubmit',
'updateRoot'
);

@@ -602,5 +604,5 @@

var reflectionInstance = (parent || root).klass().reflectOnAssociation(reflection);
if (_.isUndefined(reflectionInstance)) throw "Reflection " + reflection + " not found.";
if (_.isUndefined(reflectionInstance)) throw 'Reflection ' + reflection + ' not found.';
var inverseReflection = reflectionInstance.inverseOf();
if (_.isUndefined(inverseReflection)) throw "Reflection " + reflection + " must have inverse.";
if (_.isUndefined(inverseReflection)) throw 'Reflection ' + reflection + ' must have inverse.';

@@ -651,2 +653,4 @@ state = {

console.log('afterUpdate', this.props.subject.klass().name);
if (inverseReflection) {

@@ -674,2 +678,4 @@ var oldTarget = resource.association(inverseReflection.name).target;

console.log('assignChanges', this.props.subject.klass().name);
if (_.keys(queuedChanges).length == 0) return;

@@ -731,3 +737,3 @@

const { afterUpdate, parent } = this.props;
const { root } = this.context;
const { root, afterUpdateRoot } = this.context;
const { resource, queuedReflectionChanges, updating } = this.state;

@@ -742,3 +748,3 @@

shiftReflectionQueue: this.shiftReflectionQueue,
root: parent || root || resource,
root: root || resource,
resource,

@@ -797,3 +803,3 @@ updateRoot: this.updateRoot,

const { isNestedResource } = this.context;
const { afterError, children, className, component, componentProps, componentRef } = this.props;
const { afterError, children, className, component, componentProps, componentRef, renderFormElement } = this.props;
const { resource } = this.state;

@@ -818,5 +824,3 @@

if (isNestedResource) {
return <section className={className}>{body}</section>;
} else {
if (!isNestedResource && renderFormElement) {
return (

@@ -827,2 +831,4 @@ <form className={className} onSubmit={this.handleSubmit}>

);
} else {
return <section className={className}>{body}</section>;
}

@@ -832,2 +838,3 @@ }

updateRoot(newRoot) {
console.log('updateRoot', this.props.subject.klass().name);
const { afterUpdate } = this.props;

@@ -839,2 +846,3 @@ const { resource } = this.state;

if (afterUpdate) {
console.log(' -> afterUpdate is set');
afterUpdate(newRoot, resource);

@@ -841,0 +849,0 @@ this.setState({ updating: true });

{
"name": "@getoccasion/mitragyna",
"version": "0.2.1",
"version": "0.2.2",
"description": "A library for managing ActiveResource.js as React components",

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

@@ -54,5 +54,35 @@ ActiveResource.js binding framework for React components

```jsx
<Resource component={Customer} reflection="customer" subject={subject.customer()} parent={subject} />
function useBoomTown() {
return [streetRef, street, setStreet]
}
// App.jsx
fuction App() {
const [streetRef, street, setStreet] = useBoomTown()
return(
<Resource subject={myOrder} afterUpdate={saveMyOrder}>
<Resource component={Customer} subject={subject.customer()}>
<Resource component={Address} subject={subject.address()}>
<input type='text' name="street" ref={streetRef}>
<input type='text' name="town" ref={townRef}>
<input type='text' name="hood" ref={hoodRef}>
<input type='text' name="region" ref={regionRef}>
</Resource>
<Resource compo subject={subject.address()} />
</Resource>
<Resource component={Attendees} subject={subject.attendees()} />
</Resource>
</Resource>
)
}
```
### Binding and updating values from Fields

@@ -59,0 +89,0 @@

@@ -9,2 +9,3 @@ export class Resource extends React.Component {

componentProps: PropTypes.object,
renderFormElement: PropTypes.bool,
onInvalidSubmit: PropTypes.func,

@@ -44,2 +45,3 @@ onSubmit: PropTypes.func,

componentRef: _.noop,
renderFormelement: true,
};

@@ -52,9 +54,9 @@

this,
"afterUpdate",
"assignChanges",
"queueReflectionChange",
"shiftReflectionQueue",
"queueChange",
"handleSubmit",
"updateRoot"
'afterUpdate',
'assignChanges',
'queueReflectionChange',
'shiftReflectionQueue',
'queueChange',
'handleSubmit',
'updateRoot'
);

@@ -69,5 +71,5 @@

var reflectionInstance = (parent || root).klass().reflectOnAssociation(reflection);
if (_.isUndefined(reflectionInstance)) throw "Reflection " + reflection + " not found.";
if (_.isUndefined(reflectionInstance)) throw 'Reflection ' + reflection + ' not found.';
var inverseReflection = reflectionInstance.inverseOf();
if (_.isUndefined(inverseReflection)) throw "Reflection " + reflection + " must have inverse.";
if (_.isUndefined(inverseReflection)) throw 'Reflection ' + reflection + ' must have inverse.';

@@ -118,2 +120,4 @@ state = {

console.log('afterUpdate', this.props.subject.klass().name);
if (inverseReflection) {

@@ -141,2 +145,4 @@ var oldTarget = resource.association(inverseReflection.name).target;

console.log('assignChanges', this.props.subject.klass().name);
if (_.keys(queuedChanges).length == 0) return;

@@ -198,3 +204,3 @@

const { afterUpdate, parent } = this.props;
const { root } = this.context;
const { root, afterUpdateRoot } = this.context;
const { resource, queuedReflectionChanges, updating } = this.state;

@@ -209,3 +215,3 @@

shiftReflectionQueue: this.shiftReflectionQueue,
root: parent || root || resource,
root: root || resource,
resource,

@@ -264,3 +270,3 @@ updateRoot: this.updateRoot,

const { isNestedResource } = this.context;
const { afterError, children, className, component, componentProps, componentRef } = this.props;
const { afterError, children, className, component, componentProps, componentRef, renderFormElement } = this.props;
const { resource } = this.state;

@@ -285,5 +291,3 @@

if (isNestedResource) {
return <section className={className}>{body}</section>;
} else {
if (!isNestedResource && renderFormElement) {
return (

@@ -294,2 +298,4 @@ <form className={className} onSubmit={this.handleSubmit}>

);
} else {
return <section className={className}>{body}</section>;
}

@@ -299,2 +305,3 @@ }

updateRoot(newRoot) {
console.log('updateRoot', this.props.subject.klass().name);
const { afterUpdate } = this.props;

@@ -306,2 +313,3 @@ const { resource } = this.state;

if (afterUpdate) {
console.log(' -> afterUpdate is set');
afterUpdate(newRoot, resource);

@@ -308,0 +316,0 @@ this.setState({ updating: true });