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

@flatfile/ai-agents

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flatfile/ai-agents - npm Package Compare versions

Comparing version 0.1.0-alpha.14 to 0.1.0-alpha.15

78

dist/index.js

@@ -414,3 +414,2 @@ // src/graphs/blueprint.graph.ts

// src/workflows/blueprint.workflow.ts
import * as JsonPatch from "fast-json-patch/index.mjs";
import { z as z7 } from "zod";

@@ -523,2 +522,68 @@

// src/utils/json.patch.ts
function getValueByPath(document, path2) {
const keys = path2.split("/").slice(1);
return keys.reduce((acc, key) => acc[key], document);
}
function setValueByPath(document, path2, value) {
const keys = path2.split("/").slice(1);
const lastKey = keys.pop();
const target = keys.reduce((acc, key) => acc[key], document);
if (Array.isArray(target) && lastKey === "-") {
;
target.push(value);
} else if (lastKey) {
;
target[lastKey] = value;
}
}
function removeValueByPath(document, path2) {
const keys = path2.split("/").slice(1);
const lastKey = keys.pop();
const target = keys.reduce((acc, key) => acc[key], document);
if (Array.isArray(target) && lastKey !== void 0) {
;
target.splice(Number(lastKey), 1);
} else if (lastKey) {
delete target[lastKey];
}
}
function applyPatch(document, patch) {
patch.forEach((operation) => {
const pathExists = getValueByPath(document, operation.path) !== void 0;
if (!pathExists && operation.op !== "add" && operation.op !== "move" && operation.op !== "copy") {
throw new Error(`Path does not exist: ${operation.path}`);
}
switch (operation.op) {
case "add":
setValueByPath(document, operation.path, operation.value);
break;
case "remove":
removeValueByPath(document, operation.path);
break;
case "replace":
setValueByPath(document, operation.path, operation.value);
break;
case "move":
const valueToMove = getValueByPath(document, operation.from);
removeValueByPath(document, operation.from);
setValueByPath(document, operation.path, valueToMove);
break;
case "copy":
const valueToCopy = getValueByPath(document, operation.from);
setValueByPath(document, operation.path, valueToCopy);
break;
case "test":
const valueToTest = getValueByPath(document, operation.path);
if (JSON.stringify(valueToTest) !== JSON.stringify(operation.value)) {
throw new Error(`Test operation failed at path: ${operation.path}`);
}
break;
default:
throw new Error(`Unsupported operation: ${operation.op}`);
}
});
return document;
}
// src/utils/retry.ts

@@ -675,6 +740,4 @@ async function retry(fn, options = {

debug && console.time(`applying constraints to ${sheet.name}`);
const processedFields = JsonPatch.applyPatch(
fields,
constraintsPatch.fields
).newDocument;
const patchResult = applyPatch(fields, constraintsPatch.fields);
const processedFields = Array.isArray(patchResult) ? patchResult : Object.values(patchResult);
debug && console.timeEnd(`applying constraints to ${sheet.name}`);

@@ -737,6 +800,3 @@ processedSheet.fields.push(...processedFields);

debug && console.time(`applying references to ${sheet.name}`);
const processedFields = JsonPatch.applyPatch(
sheet.fields,
referencesPatch.fields
).newDocument;
const processedFields = applyPatch(sheet.fields, referencesPatch.fields);
debug && console.timeEnd(`applying references to ${sheet.name}`);

@@ -743,0 +803,0 @@ sheets[sheets.indexOf(sheet)].fields = processedFields;

3

package.json
{
"name": "@flatfile/ai-agents",
"version": "0.1.0-alpha.14",
"version": "0.1.0-alpha.15",
"description": "A collection of AI Agents and Workflows for building in Flatfile",

@@ -46,3 +46,2 @@ "packageManager": "npm@10.8.3",

"dotenv": "^16.4.5",
"fast-json-patch": "^3.1.1",
"pdf-parse": "^1.1.1",

@@ -49,0 +48,0 @@ "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",

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