Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mojito-cache

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mojito-cache - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "mojito-cache",
"version": "0.0.2",
"version": "0.0.3",
"description": "A set of libraries for various caching strategies in mojito.",

@@ -5,0 +5,0 @@ "main": " ",

@@ -16,6 +16,7 @@ /*

var staticAppConfig;
this.dispatch = function (command, adapter) {
var refreshedAddons,
staticAppConfig,
cache,

@@ -45,31 +46,15 @@ cachedResource,

staticAppConfig = this.store.getStaticAppConfig();
staticAppConfig = staticAppConfig || this.store.getStaticAppConfig();
// Merge the cached command and the fresh command
newCommand = Y.merge(cachedResource.actionContext.command, command);
newCommand = cachedResource.actionContext.command;
// That was brutal - the cached command had properties that we wanted
// but they got overwritten by smaller objects from the fresh, unexpanded command.
// But we can' use Y.mix with the more delicate (recursive) merging because
// the command may contain circular references. So now we need to cherry-pick.
//
// We need to mix-in the expanded instance from the cache without overwriting
// the properties from the fresh command.instance.
// Here again we can't use merge because of circular references.
Y.mix(newCommand.instance, cachedResource.actionContext.command.instance);
// Update the params
newCommand.params = command.params;
// This is specific to mojito-pipeline
newCommand.task = command.task;
Y.mix(newCommand.instance.config, command.instance.config, true);
// So we didn't overwite the instance.config, but the cached instance bears
// some config that we want to retain, but we don't overwite to give
// priority to the fresh config.
// We're assuming there isn't any circular references here, so we merge.
Y.mix(newCommand.instance.config, cachedResource.actionContext.command.instance.config, false, null, 0, true);
// The cached AC gets the new command.
// TODO: verify we never need to clone this to avoid conflicts with resuming
// executions (e.g. in mojito-pipeline)
cachedResource.actionContext.command = newCommand;
// Instantiate again the addons that need to be refreshed
refreshedAddons = staticAppConfig['request-cache'] && staticAppConfig['request-cache'].refreshAddons;
Y.Array.each(refreshedAddons, function (addonName) {
refreshedAddons.forEach(function (addonName) {

@@ -76,0 +61,0 @@ var addonInstance,

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