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

reductive-dev-tools

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reductive-dev-tools - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

270

lib/js/src/connectors.bs.js

@@ -13,3 +13,2 @@ // Generated by BUCKLESCRIPT VERSION 4.0.18, PLEASE EDIT WITH CARE

var Belt_Option = require("bs-platform/lib/js/belt_Option.js");
var Caml_format = require("bs-platform/lib/js/caml_format.js");
var Caml_option = require("bs-platform/lib/js/caml_option.js");

@@ -181,78 +180,4 @@ var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions.js");

var LiftedStateNotCachedWhileExpected = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.LiftedStateNotCachedWhileExpected");
var ConnectionNotFound = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.ConnectionNotFound");
function sweepLiftedState(devTools, liftedState, store) {
var skippedActions = liftedState.skippedActionIds;
var newLiftedState = $$Array.fold_left((function (newLiftedState, param) {
var skipped = newLiftedState.skippedActionIds[0];
var actionsById = newLiftedState.actionsById;
var newActionsById = $$Array.fold_left((function (targetActionsById, param) {
var key = param[0];
var match = Caml_format.caml_int_of_string(key) > skipped;
targetActionsById[match ? String(Caml_format.caml_int_of_string(key) - 1 | 0) : key] = param[1];
return targetActionsById;
}), { }, $$Array.map((function (key) {
return /* tuple */[
key,
actionsById[key]
];
}), Belt_Array.keep(Object.keys(actionsById), (function (key) {
return Caml_format.caml_int_of_string(key) !== skipped;
}))));
var computedStates = Belt_Array.keepWithIndex(newLiftedState.computedStates, (function (param, index) {
return index !== skipped;
}));
var skippedActionIds = Belt_Array.map(Belt_Array.keep(newLiftedState.skippedActionIds, (function (actionId) {
return actionId !== skipped;
})), (function (entity) {
var match = entity > skipped;
if (match) {
return entity - 1 | 0;
} else {
return entity;
}
}));
var stagedActionIds = Belt_Array.map(Belt_Array.keep(newLiftedState.stagedActionIds, (function (entity) {
return entity !== skipped;
})), (function (entity) {
var match = entity > skipped;
if (match) {
return entity - 1 | 0;
} else {
return entity;
}
}));
var currentStateIndex = newLiftedState.currentStateIndex;
var nextActionId = newLiftedState.nextActionId;
var match = currentStateIndex > skipped;
var match$1 = nextActionId > skipped;
return {
actionsById: newActionsById,
computedStates: computedStates,
currentStateIndex: match ? currentStateIndex - 1 | 0 : currentStateIndex,
nextActionId: match$1 ? nextActionId - 1 | 0 : nextActionId,
skippedActionIds: skippedActionIds,
stagedActionIds: stagedActionIds
};
}), Object.assign({ }, liftedState), skippedActions);
Extension$ReductiveDevTools.send(devTools, null, newLiftedState);
var jumpResetNeeded = $$Array.fold_left((function (jumpResetNeeded, skipped) {
if (jumpResetNeeded) {
return true;
} else {
return skipped >= liftedState.currentStateIndex;
}
}), false, skippedActions);
if (jumpResetNeeded) {
var stagedActions = newLiftedState.stagedActionIds;
var targetState = Caml_array.caml_array_get(newLiftedState.computedStates, stagedActions.length - 1 | 0).state;
mutateState(Curry._1(deserializeObject, targetState), store);
return /* () */0;
} else {
return 0;
}
}
var PayloadNotFound$1 = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.PayloadNotFound");

@@ -262,79 +187,4 @@

var LiftedStateNotCachedWhileExpected$1 = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.LiftedStateNotCachedWhileExpected");
function sweepLiftedState$1(devTools, liftedState, store) {
function processToogleAction(store, payload, liftedState, meta) {
var skippedActions = liftedState.skippedActionIds;
var newLiftedState = $$Array.fold_left((function (newLiftedState, param) {
var skipped = newLiftedState.skippedActionIds[0];
var actionsById = newLiftedState.actionsById;
var newActionsById = $$Array.fold_left((function (targetActionsById, param) {
var key = param[0];
var match = Caml_format.caml_int_of_string(key) > skipped;
targetActionsById[match ? String(Caml_format.caml_int_of_string(key) - 1 | 0) : key] = param[1];
return targetActionsById;
}), { }, $$Array.map((function (key) {
return /* tuple */[
key,
actionsById[key]
];
}), Belt_Array.keep(Object.keys(actionsById), (function (key) {
return Caml_format.caml_int_of_string(key) !== skipped;
}))));
var computedStates = Belt_Array.keepWithIndex(newLiftedState.computedStates, (function (param, index) {
return index !== skipped;
}));
var skippedActionIds = Belt_Array.map(Belt_Array.keep(newLiftedState.skippedActionIds, (function (actionId) {
return actionId !== skipped;
})), (function (entity) {
var match = entity > skipped;
if (match) {
return entity - 1 | 0;
} else {
return entity;
}
}));
var stagedActionIds = Belt_Array.map(Belt_Array.keep(newLiftedState.stagedActionIds, (function (entity) {
return entity !== skipped;
})), (function (entity) {
var match = entity > skipped;
if (match) {
return entity - 1 | 0;
} else {
return entity;
}
}));
var currentStateIndex = newLiftedState.currentStateIndex;
var nextActionId = newLiftedState.nextActionId;
var match = currentStateIndex > skipped;
var match$1 = nextActionId > skipped;
return {
actionsById: newActionsById,
computedStates: computedStates,
currentStateIndex: match ? currentStateIndex - 1 | 0 : currentStateIndex,
nextActionId: match$1 ? nextActionId - 1 | 0 : nextActionId,
skippedActionIds: skippedActionIds,
stagedActionIds: stagedActionIds
};
}), Object.assign({ }, liftedState), skippedActions);
Extension$ReductiveDevTools.send(devTools, null, newLiftedState);
var jumpResetNeeded = $$Array.fold_left((function (jumpResetNeeded, skipped) {
if (jumpResetNeeded) {
return true;
} else {
return skipped >= liftedState.currentStateIndex;
}
}), false, skippedActions);
if (jumpResetNeeded) {
var stagedActions = newLiftedState.stagedActionIds;
var targetState = Caml_array.caml_array_get(newLiftedState.computedStates, stagedActions.length - 1 | 0).state;
var state = Curry._1(deserializeObject, targetState);
store[/* state */0] = state;
return notifyListeners(store);
} else {
return 0;
}
}
function processToogleAction(store, payload, liftedState, cachedLiftedState) {
var skippedActions = liftedState.skippedActionIds;
var stagedActions = liftedState.stagedActionIds;

@@ -357,2 +207,3 @@ var computedStates = liftedState.computedStates;

store[/* state */0] = state;
var preservedActionCount = meta[/* actionCount */2];
$$Array.iter((function (i) {

@@ -372,2 +223,3 @@ var stagedActionKey = String(Caml_array.caml_array_get(stagedActions, i));

})));
meta[/* actionCount */2] = preservedActionCount;
if (liftedState.currentStateIndex !== (stagedActions.length - 1 | 0)) {

@@ -384,3 +236,3 @@ var targetState = Caml_array.caml_array_get(computedStates, liftedState.currentStateIndex).state;

}
cachedLiftedState[0] = Caml_option.some(liftedState);
meta[/* liftedState */0] = Caml_option.some(liftedState);
return liftedState;

@@ -390,6 +242,5 @@ }

function handle(connection, store, actionCreators) {
function handle(connection, store, meta, actionCreators) {
var initialState = Reductive.Store[/* getState */5](store);
Extension$ReductiveDevTools.init(connection, Curry._1(serializeObject, initialState));
var cachedLiftedState = /* record */Block.record(["contents"], [undefined]);
Extension$ReductiveDevTools.subscribe(connection, (function (action) {

@@ -417,3 +268,3 @@ var match = action.type;

var initial = initialState;
var cachedLiftedState$1 = cachedLiftedState;
var meta$1 = meta;
var payload$1 = unwrap(Caml_option.undefined_to_opt(action$3.payload), [

@@ -428,3 +279,3 @@ PayloadNotFound$1,

var initial$1 = initial;
var cachedLiftedState$2 = cachedLiftedState$1;
var meta$2 = meta$1;
var payloadType = payload$2.type;

@@ -434,2 +285,3 @@ var exit = 0;

case "COMMIT" :
meta$2[/* actionCount */2] = 0;
return Extension$ReductiveDevTools.init(devTools$1, Reductive.Store[/* getState */5](store$3));

@@ -443,2 +295,3 @@ case "IMPORT_STATE" :

notifyListeners(store$3);
meta$2[/* actionCount */2] = nextLiftedState.nextActionId - 1 | 0;
return Extension$ReductiveDevTools.send(devTools$1, null, nextLiftedState);

@@ -449,7 +302,6 @@ case "JUMP_TO_ACTION" :

break;
case "LOCK_CHANGES" :
return /* () */0;
case "RESET" :
store$3[/* state */0] = initial$1;
notifyListeners(store$3);
meta$2[/* actionCount */2] = 0;
return Extension$ReductiveDevTools.init(devTools$1, Reductive.Store[/* getState */5](store$3));

@@ -464,10 +316,6 @@ case "ROLLBACK" :

notifyListeners(store$3);
meta$2[/* actionCount */2] = 0;
return Extension$ReductiveDevTools.init(devTools$1, Reductive.Store[/* getState */5](store$3));
case "LOCK_CHANGES" :
case "SWEEP" :
var liftedState = unwrap(cachedLiftedState$2[0], [
LiftedStateNotCachedWhileExpected$1,
"liftedState hasn't been cached while expected"
]);
sweepLiftedState$1(devTools$1, liftedState, store$3);
cachedLiftedState$2[0] = undefined;
return /* () */0;

@@ -479,4 +327,4 @@ case "TOGGLE_ACTION" :

]);
var liftedState$1 = JSON.parse(stateString$1);
Extension$ReductiveDevTools.send(devTools$1, null, processToogleAction(store$3, payload$2, liftedState$1, cachedLiftedState$2));
var liftedState = JSON.parse(stateString$1);
Extension$ReductiveDevTools.send(devTools$1, null, processToogleAction(store$3, payload$2, liftedState, meta$2));
return notifyListeners(store$3);

@@ -491,10 +339,12 @@ default:

]);
var match$1 = cachedLiftedState$2[0];
if (match$1 !== undefined) {
var liftedState$2 = Caml_option.valFromOption(match$1);
var actionId = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.actionId));
var actionInLiftedStateRange = actionId < liftedState$2.nextActionId;
var actionId = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.actionId));
var match$1 = actionId === meta$2[/* actionCount */2];
meta$2[/* rewindActionIdx */1] = match$1 ? undefined : actionId;
var match$2 = meta$2[/* liftedState */0];
if (match$2 !== undefined) {
var liftedState$1 = Caml_option.valFromOption(match$2);
var actionInLiftedStateRange = actionId < liftedState$1.nextActionId;
if (actionInLiftedStateRange) {
var skippedActions = liftedState$2.skippedActionIds;
var computedStates$1 = liftedState$2.computedStates;
var skippedActions = liftedState$1.skippedActionIds;
var computedStates$1 = liftedState$1.computedStates;
var nonSkippedIdx = actionId;

@@ -561,10 +411,31 @@ while(skippedActions.includes(nonSkippedIdx)) {

var devTools = Extension$ReductiveDevTools.connect(Extension$ReductiveDevTools.devToolsEnhancer, targetOptions);
var meta = /* record */Block.record([
"liftedState",
"rewindActionIdx",
"actionCount"
], [
undefined,
undefined,
0
]);
var devToolsDispatch = function (store, next, action) {
var target = enhancer !== undefined ? Curry._3(enhancer, store, next, action) : Curry._1(next, action);
Extension$ReductiveDevTools.send(devTools, Curry._2(serializeMaybeVariant, action, false), Curry._1(serializeObject, Reductive.Store[/* getState */5](store)));
return target;
var match = meta[/* rewindActionIdx */1];
if (match !== undefined && match < meta[/* actionCount */2]) {
return 0;
} else {
var store$1 = store;
var next$1 = next;
var action$1 = action;
if (enhancer !== undefined) {
Curry._3(enhancer, store$1, next$1, action$1);
} else {
Curry._1(next$1, action$1);
}
meta[/* actionCount */2] = meta[/* actionCount */2] + 1 | 0;
return Extension$ReductiveDevTools.send(devTools, Curry._2(serializeMaybeVariant, action$1, false), Curry._1(serializeObject, Reductive.Store[/* getState */5](store$1)));
}
};
var store = Curry._4(storeCreator, reducer, preloadedState, devToolsDispatch, /* () */0);
var actionCreators = targetOptions.actionCreators;
handle(devTools, store, actionCreators === undefined ? undefined : Caml_option.some(actionCreators));
handle(devTools, store, meta, actionCreators === undefined ? undefined : Caml_option.some(actionCreators));
return store;

@@ -581,3 +452,11 @@ }

retainedStates[connectionId] = component[/* state */1];
Extension$ReductiveDevTools.init(devTools, Curry._1(serializeObject, component[/* state */1]));
var meta = /* record */Block.record([
"liftedState",
"rewindActionIdx",
"actionCount"
], [
undefined,
undefined,
0
]);
var connection = devTools;

@@ -591,6 +470,6 @@ var store = /* record */Block.record([

]);
var meta$1 = meta;
var actionCreators$1 = actionCreators === undefined ? undefined : Caml_option.some(actionCreators);
var initialState = getState(store);
Extension$ReductiveDevTools.init(connection, Curry._1(serializeObject, initialState));
var cachedLiftedState = /* record */Block.record(["contents"], [undefined]);
Extension$ReductiveDevTools.subscribe(connection, (function (action) {

@@ -617,3 +496,3 @@ var match = action.type;

var initial = initialState;
var cachedLiftedState$1 = cachedLiftedState;
var meta$2 = meta$1;
var payload$1 = unwrap(Caml_option.undefined_to_opt(action$2.payload), [

@@ -628,3 +507,3 @@ PayloadNotFound,

var initial$1 = initial;
var cachedLiftedState$2 = cachedLiftedState$1;
var meta$3 = meta$2;
var payloadType = payload$2.type;

@@ -634,2 +513,3 @@ var exit = 0;

case "COMMIT" :
meta$3[/* actionCount */2] = 0;
return Extension$ReductiveDevTools.init(devTools$1, getState(store$3));

@@ -641,2 +521,3 @@ case "IMPORT_STATE" :

mutateState(Curry._1(deserializeObject, targetState), store$3);
meta$3[/* actionCount */2] = nextLiftedState.nextActionId - 1 | 0;
return Extension$ReductiveDevTools.send(devTools$1, null, nextLiftedState);

@@ -649,2 +530,3 @@ case "JUMP_TO_ACTION" :

mutateState(initial$1, store$3);
meta$3[/* actionCount */2] = 0;
return Extension$ReductiveDevTools.init(devTools$1, getState(store$3));

@@ -657,12 +539,6 @@ case "ROLLBACK" :

mutateState(Curry._1(deserializeObject, JSON.parse(stateString)), store$3);
meta$3[/* actionCount */2] = 0;
return Extension$ReductiveDevTools.init(devTools$1, getState(store$3));
case "LOCK_CHANGES" :
case "SWEEP" :
var liftedState = unwrap(cachedLiftedState$2[0], [
LiftedStateNotCachedWhileExpected,
"liftedState hasn't been cached while expected"
]);
sweepLiftedState(devTools$1, liftedState, store$3);
cachedLiftedState$2[0] = undefined;
return /* () */0;
case "LOCK_CHANGES" :
case "TOGGLE_ACTION" :

@@ -678,10 +554,12 @@ return /* () */0;

]);
var match$1 = cachedLiftedState$2[0];
if (match$1 !== undefined) {
var liftedState$1 = Caml_option.valFromOption(match$1);
var actionId = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.actionId));
var actionInLiftedStateRange = actionId < liftedState$1.nextActionId;
var actionId = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.actionId));
var match$1 = actionId === meta$3[/* actionCount */2];
meta$3[/* rewindActionIdx */1] = match$1 ? undefined : actionId;
var match$2 = meta$3[/* liftedState */0];
if (match$2 !== undefined) {
var liftedState = Caml_option.valFromOption(match$2);
var actionInLiftedStateRange = actionId < liftedState.nextActionId;
if (actionInLiftedStateRange) {
var skippedActions = liftedState$1.skippedActionIds;
var computedStates$1 = liftedState$1.computedStates;
var skippedActions = liftedState.skippedActionIds;
var computedStates$1 = liftedState.computedStates;
var nonSkippedIdx = actionId;

@@ -688,0 +566,0 @@ while(skippedActions.includes(nonSkippedIdx)) {

{
"name": "reductive-dev-tools",
"version": "0.1.2",
"version": "0.1.3",
"description": "reductive and reason-react reducer component integration with Redux DevTools",

@@ -5,0 +5,0 @@ "main": "lib/js/src/reductiveDevTools.bs.js",

@@ -19,2 +19,3 @@ ## reductive-dev-tools

2. Prefer variants with associated data to plain (`SomeAction(unit)` to `SomeAction`) since plain varaints do no carry debug metedata with them (represented as numbers in js)
3. Extension will be locked (newly dispatched actions will be ignored) when you jump back in action history.

@@ -21,0 +22,0 @@ ## Supported DevTools Features

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