// npm package
@jagreehal/workflow
Typed async workflows with automatic error inference. Build type-safe workflows with Result types, step caching, resume state, and human-in-the-loop support.
weekly
46
monthly
189
versions
17
maintainers
1
license
MIT
first publish
2025-12-21
publisher
GitHub Actions
tarball
6,167,244 B
AUTO-PUBLISHED·1 version indexed·latest published 2026-01-15
// publisher campaignby GitHub Actions
9 caught packages from this accountThis is not an isolated catch. The same publisher has shipped 8 other packages that our pipeline flagged — the shape of a coordinated campaign, not a one-off. Each link below opens that sibling's analysis.
// offending code· @1.16.0· 1 file flagged
- @1.16.0··AUTO-PUBLISHED·publisher: GitHub Actionsheuristic 75/100static flags 1llm skippedmature-packagehas-source-repoosv-flagged:MAL-2026-5185public-github-push
// offending code· 1 file flaggedpatterns: 1
--- package/package.json (excerpt) --- { "name": "@jagreehal/workflow", "version": "1.16.0", "type": "module", "description": "Typed async workflows with automatic error inference. Build type-safe workflows with Result types, step caching, resume state, and human-in-the-loop support.", "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" }, "./core": { "types": "./dist/core.d.ts", "import": "./dist/core.js", "require": "./dist/core.cjs" }, "./workflow": { "types": "./dist/workflow.d.ts", "import": "./dist/workflow.js", "require": "./dist/workflow.cjs" }, "./visualize": { "types": "./dist/visualize.d.ts", "import": "./dist/visualize.js", "require": "./dist/visualize.cjs" }, "./batch": { "types": "./dist/batch.d.ts", "import": "./dist/batch.js", "require": "./dist/batch.cjs" }, "./resource": { "types": "./dist/resource.d.ts", "import": "./dist/resource.js", "require": "./dist/resource.cjs" }, "./duration": { "types": "./dist/duration.d.ts", "import": "./dist/duration.js", "require": "./dist/duration.cjs" }, "./match": { "types": "./dist/match.d.ts", "import": "./dist/match.js", "require": "./dist/match.cjs" }, "./schedule": { "types": "./dist/sch --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- dist/batch.cjs (bundled) --- "use strict";var Y=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var pe=Object.prototype.hasOwnProperty;var Ee=(e,u)=>{for(var m in u)Y(e,m,{get:u[m],enumerable:!0})},ye=(e,u,m,x)=>{if(u&&typeof u=="object"||typeof u=="function")for(let k of le(u))!pe.call(e,k)&&k!==m&&Y(e,k,{get:()=>u[k],enumerable:!(x=ce(u,k))||x.enumerable});return e};var me=e=>ye(Y({},"__esModule",{value:!0}),e);var Pe={};Ee(Pe,{batchPresets:()=>Ae,isBatchProcessingError:()=>ae,isInvalidBatchConfigError:()=>he,processInBatches:()=>be});module.exports=me(Pe);var V=e=>({ok:!0,value:e}),b=(e,u)=>({ok:!1,error:e,...u?.cause!==void 0?{cause:u.cause}:{}});var Te=e=>typeof e=="object"&&e!==null&&e.type==="UNEXPECTED_ERROR",z=Symbol.for("step_timeout_marker");function te(e){return typeof e!="object"||e===null?!1:e.type==="STEP_TIMEOUT"?!0:z in e}function we(e){if(!(typeof e!="object"||e===null)){if(e.type==="STEP_TIMEOUT"){let u=e;return{timeoutMs:u.timeoutMs,stepName:u.stepName,stepKey:u.stepKey,attempt:u.attempt}}if(z in e)return e[z]}}var oe=Symbol("early-exit");function fe(e,u){return{[oe]:!0,error:e,meta:u}}function ke(e){return typeof e=="object"&&e!==null&&e[oe]===!0}var se=Symbol("mapper-exception");function de(e){return{[se]:!0,thrown:e}}function Re(e){return typeof e=="object"&&e!==null&&e[se]===!0}function Ce(e){return typeof e=="string"?{name:e}:e??{}}function J(e,u){let{backoff:m,initialDelay:x,maxDelay:k,jitter:g}=u,l;switch(m){case"fixed":l=x;break;case"linear":l=x*e;break;case"exponential":l=x*Math.pow(2,e-1);break}if(l=Math.min(l,k),g){let t=l*.25*Math.random();l=l+t}return Math.floor(l)}function Z(e){return new Promise(u=>setTimeout(u,e))}var ne=Symbol("timeout");async function xe(e,u,m){let x=new AbortController,k=u.error??{type:"STEP_TIMEOUT",stepName:m.name,stepKey:m.key,timeoutMs:u.ms,attempt:m.attempt},g,l=new Promise((v,a)=>{g=setTimeout(()=>{x.abort(),a({[ne]:!0,error:k})},u.ms)}),t;u.signal?t=Promise.resolve(e(x.signal)):t=Promis --- dist/batch.d.ts (bundled) --- import { AsyncResult } from './core.js'; /** * @jagreehal/workflow/batch * * Batch processing utilities with progress tracking and checkpoints. * Useful for I/O-heavy operations like generating embeddings, API calls, or database writes. * * Tree-shakable - only import if needed. * * @example * ```typescript * import { processInBatches, ok, err, type AsyncResult } from '@jagreehal/workflow'; * * // Generate embeddings in batches with progress tracking * const embedText = async (text: string): AsyncResult<number[], 'EMBED_ERROR'> => { * const response = await fetch('/api/embed', { body: text }); * return response.ok ? ok(await response.json()) : err('EMBED_ERROR'); * }; * * const checkpoint = async (): AsyncResult<void, 'DB_ERROR'> => { * await db.checkpoint(); * return ok(undefined); * }; * * const result = await processInBatches( * texts, * embedText, * { batchSize: 20, concurrency: 3, batchDelayMs: 50 }, * { * afterBatch: checkpoint, * onProgress: (p) => console.log(`${p.percent}% complete`), * } * ); * ``` */ /** * Configuration for batch processing. */ interface BatchConfig { /** * Number of items to process per batch. * Lower values = more frequent checkpoints, less memory pressure. * Higher values = fewer checkpoints, more throughput. * @default 20 */ batchSize: number; /** * Maximum concurrent operations within a batch. * Controls parallelism for I/O-bound operations. * @default 5 */ concurrency: number; /** * Delay in milliseconds between batches. * Provides backpressure to allow event loop breathing and GC. * Set to 0 for no delay. * @default 0 */ batchDelayMs?: number; } /** * Progress information for batch processing. */ interface BatchProgress { /** Current batch number (1-indexed) */ batch: number; /** Total number of batches */ totalBatches: number; /** Items processed so far * --- dist/batch.js (bundled) --- var V=e=>({ok:!0,value:e}),b=(e,y)=>({ok:!1,error:e,...y?.cause!==void 0?{cause:y.cause}:{}});var ae=e=>typeof e=="object"&&e!==null&&e.type==="UNEXPECTED_ERROR",z=Symbol.for("step_timeout_marker");function ee(e){return typeof e!="object"||e===null?!1:e.type==="STEP_TIMEOUT"?!0:z in e}function ie(e){if(!(typeof e!="object"||e===null)){if(e.type==="STEP_TIMEOUT"){let y=e;return{timeoutMs:y.timeoutMs,stepName:y.stepName,stepKey:y.stepKey,attempt:y.attempt}}if(z in e)return e[z]}}var re=Symbol("early-exit");function ce(e,y){return{[re]:!0,error:e,meta:y}}function le(e){return typeof e=="object"&&e!==null&&e[re]===!0}var oe=Symbol("mapper-exception");function pe(e){return{[oe]:!0,thrown:e}}function Ee(e){return typeof e=="object"&&e!==null&&e[oe]===!0}function ye(e){return typeof e=="string"?{name:e}:e??{}}function Y(e,y){let{backoff:f,initialDelay:g,maxDelay:R,jitter:x}=y,c;switch(f){case"fixed":c=g;break;case"linear":c=g*e;break;case"exponential":c=g*Math.pow(2,e-1);break}if(c=Math.min(c,R),x){let t=c*.25*Math.random();c=c+t}return Math.floor(c)}function J(e){return new Promise(y=>setTimeout(y,e))}var te=Symbol("timeout");async function me(e,y,f){let g=new AbortController,R=y.error??{type:"STEP_TIMEOUT",stepName:f.name,stepKey:f.key,timeoutMs:y.ms,attempt:f.attempt},x,c=new Promise((v,u)=>{x=setTimeout(()=>{g.abort(),u({[te]:!0,error:R})},y.ms)}),t;y.signal?t=Promise.resolve(e(g.signal)):t=Promise.resolve(e());try{return await Promise.race([t,c])}catch(v){if(typeof v=="object"&&v!==null&&v[te]===!0){let u=v.error;if(typeof u=="object"&&u!==null&&u.type!=="STEP_TIMEOUT"){let S={timeoutMs:y.ms,stepName:f.name,stepKey:f.key,attempt:f.attempt};z in u?u[z]=S:Object.defineProperty(u,z,{value:S,enumerable:!1,writable:!0,configurable:!1})}throw u}throw v}finally{clearTimeout(x)}}var B={backoff:"exponential",initialDelay:100,maxDelay:3e4,jitter:!0,retryOn:()=>!0,onRetry:()=>{}};async function ne(e,y){let{onError:f,onEvent:g,catchUnexpected:R,workflowId:x,context:c}=y&&typeof y --- dist/core.cjs (bundled) --- "use strict";var G=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var we=(e,n)=>{for(var t in n)G(e,t,{get:n[t],enumerable:!0})},me=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let w of Ee(n))!ye.call(e,w)&&w!==t&&G(e,w,{get:()=>n[w],enumerable:!(a=ce(n,w))||a.enumerable});return e};var Te=e=>me(G({},"__esModule",{value:!0}),e);var ze={};we(ze,{EARLY_EXIT_SYMBOL:()=>ee,STEP_TIMEOUT_MARKER:()=>D,UnwrapError:()=>X,all:()=>Ye,allAsync:()=>$e,allSettled:()=>Je,allSettledAsync:()=>He,andThen:()=>Ie,any:()=>qe,anyAsync:()=>Ge,bimap:()=>je,createEarlyExit:()=>se,err:()=>f,from:()=>he,fromNullable:()=>_e,fromPromise:()=>be,getStepTimeoutMeta:()=>oe,hydrate:()=>ie,isEarlyExit:()=>ue,isErr:()=>de,isOk:()=>ke,isSerializedResult:()=>Xe,isStepTimeoutError:()=>Q,isUnexpectedError:()=>re,map:()=>ve,mapError:()=>Me,mapErrorTry:()=>Fe,mapTry:()=>Ke,match:()=>Oe,ok:()=>g,orElse:()=>Ne,orElseAsync:()=>Ve,partition:()=>Be,recover:()=>Le,recoverAsync:()=>We,run:()=>Z,tap:()=>Ue,tapError:()=>De,tryAsync:()=>Pe,unwrap:()=>Se,unwrapOr:()=>ge,unwrapOrElse:()=>Ae});module.exports=Te(ze);var g=e=>({ok:!0,value:e}),f=(e,n)=>({ok:!1,error:e,...n?.cause!==void 0?{cause:n.cause}:{}}),ke=e=>e.ok,de=e=>!e.ok,re=e=>typeof e=="object"&&e!==null&&e.type==="UNEXPECTED_ERROR",D=Symbol.for("step_timeout_marker");function Q(e){return typeof e!="object"||e===null?!1:e.type==="STEP_TIMEOUT"?!0:D in e}function oe(e){if(!(typeof e!="object"||e===null)){if(e.type==="STEP_TIMEOUT"){let n=e;return{timeoutMs:n.timeoutMs,stepName:n.stepName,stepKey:n.stepKey,attempt:n.attempt}}if(D in e)return e[D]}}var ee=Symbol("early-exit");function se(e,n){return{[ee]:!0,error:e,meta:n}}function ue(e){return typeof e=="object"&&e!==null&&e[ee]===!0}var ae=Symbol("mapper-exception");function fe(e
