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

prompt-anything

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prompt-anything - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

4

build/Prompt.d.ts

@@ -26,3 +26,2 @@ /// <reference types="node" />

export declare type VisualGenerator<DataType> = (data: DataType) => Promise<VisualInterface>;
export declare type PromptCondition<DataType> = (data: DataType) => Promise<boolean>;
export declare type StoredMessage = {

@@ -69,4 +68,3 @@ message: MessageInterface;

readonly function?: PromptFunction<DataType, MessageType>;
readonly condition?: PromptCondition<DataType>;
constructor(visualGenerator: VisualGenerator<DataType> | VisualInterface, f?: PromptFunction<DataType, MessageType>, condition?: PromptCondition<DataType>, duration?: number);
constructor(visualGenerator: VisualGenerator<DataType> | VisualInterface, f?: PromptFunction<DataType, MessageType>, duration?: number);
/**

@@ -73,0 +71,0 @@ * Returns the visual given the data

@@ -15,3 +15,3 @@ "use strict";

class Prompt {
constructor(visualGenerator, f, condition, duration = 0) {
constructor(visualGenerator, f, duration = 0) {
this.messages = [];

@@ -21,3 +21,2 @@ this.visualGenerator = visualGenerator;

this.function = f;
this.condition = condition;
}

@@ -24,0 +23,0 @@ /**

import { Prompt } from "./Prompt";
import { TreeNode } from "./TreeNode";
import { MessageInterface } from "./interfaces/Message";
export declare type PromptNodeCondition<DataType> = (data: DataType) => Promise<boolean>;
export declare class PromptNode<DataType, MessageType extends MessageInterface> extends TreeNode<PromptNode<DataType, MessageType>> {
prompt: Prompt<DataType, MessageType>;
constructor(prompt: Prompt<DataType, MessageType>);
readonly condition?: PromptNodeCondition<DataType>;
/**
* @param prompt Prompt to run
* @param condition Condition for this node to run
*/
constructor(prompt: Prompt<DataType, MessageType>, condition?: PromptNodeCondition<DataType>);
/**
* Asserts that the children of this node are valid.

@@ -14,3 +20,3 @@ * If a node has 2 or more children, then they must all

/**
* Determine what the next prompt is given data.
* Determine what the next prompt node is given data.
*

@@ -17,0 +23,0 @@ * @param data The data before this prompt

@@ -14,5 +14,10 @@ "use strict";

class PromptNode extends TreeNode_1.TreeNode {
constructor(prompt) {
/**
* @param prompt Prompt to run
* @param condition Condition for this node to run
*/
constructor(prompt, condition) {
super();
this.prompt = prompt;
this.condition = condition;
}

@@ -31,3 +36,3 @@ /**

for (const child of children) {
if (!child.prompt.condition) {
if (!child.condition) {
return false;

@@ -39,3 +44,3 @@ }

/**
* Determine what the next prompt is given data.
* Determine what the next prompt node is given data.
*

@@ -49,4 +54,3 @@ * @param data The data before this prompt

const child = children[i];
const childPrompt = child.prompt;
if (!childPrompt.condition || (yield childPrompt.condition(data))) {
if (!child.condition || (yield child.condition(data))) {
return child;

@@ -53,0 +57,0 @@ }

@@ -10,3 +10,3 @@ import { Prompt } from './Prompt';

/**
* Checks whether the tree of prompts is valid. A valid tree
* Checks whether the tree of nodes is valid. A valid tree
* is one all children has a condition if there 2 or more

@@ -13,0 +13,0 @@ * children.

@@ -18,3 +18,3 @@ "use strict";

/**
* Checks whether the tree of prompts is valid. A valid tree
* Checks whether the tree of nodes is valid. A valid tree
* is one all children has a condition if there 2 or more

@@ -66,3 +66,3 @@ * children.

const node = nodes[i];
const condition = node.prompt.condition;
const condition = node.condition;
if (!condition || (yield condition(this.initialData))) {

@@ -69,0 +69,0 @@ return node;

{
"name": "prompt-anything",
"version": "1.2.0",
"version": "1.3.0",
"description": "Framework to build a a tree of modular and interactable prompts for anything",

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

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