Socket
Socket
Sign inDemoInstall

quidproquo-core

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quidproquo-core - npm Package Compare versions

Comparing version 0.0.172 to 0.0.173

39

lib/commonjs/stories/context/askContextProvideValue.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.askContextProvideValue = void 0;
const actions_1 = require("../../actions");
const context_1 = require("../../actions/context");
const stories_1 = require("../../stories");
function* askProcessAction(action) {
return (yield action);
}
function* askContextProvideValue(contextIdentifier, value, storyIterator) {

@@ -39,3 +44,37 @@ let nextResult = storyIterator.next();

continue;
// We have a batch that could contain a context action :(
}
else if (nextResult.value.type === actions_1.SystemActionType.Batch) {
// Extract the batch action payload from the batch action
const batchActionPayload = nextResult.value.payload;
// Process each action in the batch using askMap
const batchActionsToRun = yield* (0, stories_1.askMap)(batchActionPayload.actions, function* (action) {
// Check if the action is a context action (List or Read)
const isContextAction = [context_1.ContextActionType.List, context_1.ContextActionType.Read].includes(action.type);
// Return an object containing the action, isContextAction flag, and the result
// If it's a context action, recursively call askContextProvideValue to process the action
// and obtain the result; otherwise, set result to undefined
return {
action,
isContextAction,
result: isContextAction
? yield* askContextProvideValue(contextIdentifier, value, askProcessAction(action))
: undefined,
};
});
// Filter out the context actions from the batch actions
const remainingBatchActionsToRun = batchActionsToRun.filter((ba) => !ba.isContextAction);
// Run the remaining actions (non-context) in a normal batch
const results = yield* (0, actions_1.askBatch)(remainingBatchActionsToRun.map((ba) => ba.action));
// Assign the results to the corresponding actions in the remainingBatchActionsToRun array
remainingBatchActionsToRun.forEach((ba, index) => {
ba.result = results[index];
});
// Create an array of all the results, including both context and non-context actions
const allResults = batchActionsToRun.map((ba) => ba.result);
// Pass the all results array back to the story iterator
nextResult = storyIterator.next(allResults);
// Continue processing the next action in the story iterator
continue;
}
// Otherwise this is not a context action

@@ -42,0 +81,0 @@ // use the parent processor to process it.

4

lib/commonjs/types/StorySession.d.ts

@@ -48,2 +48,3 @@ import { ErrorTypeEnum } from './ErrorTypeEnum';

export type AskResponseReturnType<T extends AskResponse<any>> = ExtractGeneratorReturnType<T>;
export type qpqStory = <T = any>(...args: any[]) => AskResponse<T>;
export interface ActionHistory<T = any> {

@@ -66,3 +67,4 @@ act: Action<T>;

STORAGEDRIVE_EVENT = "STORAGEDRIVE_EVENT",
CLOUD_FLARE_DEPLOY = "CLOUD_FLARE_DEPLOY"
CLOUD_FLARE_DEPLOY = "CLOUD_FLARE_DEPLOY",
UNIT_TEST = "UNIT_TEST"
}

@@ -69,0 +71,0 @@ export interface qpqConsoleLog {

@@ -17,2 +17,3 @@ "use strict";

QpqRuntimeType["CLOUD_FLARE_DEPLOY"] = "CLOUD_FLARE_DEPLOY";
QpqRuntimeType["UNIT_TEST"] = "UNIT_TEST";
})(QpqRuntimeType = exports.QpqRuntimeType || (exports.QpqRuntimeType = {}));
{
"name": "quidproquo-core",
"version": "0.0.172",
"version": "0.0.173",
"description": "",

@@ -28,5 +28,5 @@ "main": "./lib/commonjs/index.js",

"devDependencies": {
"quidproquo-tsconfig": "0.0.172",
"quidproquo-tsconfig": "0.0.173",
"typescript": "^4.9.3"
}
}
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