npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@octaviaflow/execution-context

v0.1.1

Published

Durable, tenant-isolated execution context for Octaviaflow workflow engine — typed step envelopes, ExecutionContextStore (Valkey-backed), n-th level JSON Schema inferencer, and idempotent execution-event stream

Readme

@octaviaflow/execution-context

Durable, tenant-isolated execution context for the Octaviaflow workflow engine.

Provides:

  • Typed step envelopes{ data, schema, schemaHash, lineage, metadata, status } produced by every step.
  • ExecutionContextStore — Valkey-backed (via iovalkey) store with named health states; raises StoreUnavailableError rather than silently dropping writes.
  • N-th level JSON Schema inferencer — recursive 200-sample × depth-8 walk into JSON Schema 2020-12 with cardinality, nullability, and small-domain enums. Hash output is stable under property reordering.
  • Tenant prefix discipline — every Valkey key, S3 prefix, and Mongo DB name is constructed centrally and starts with t:{tenantId}: (or t/{tenantId}/ for object-store paths). Cross-tenant key collision is impossible at the store layer.
  • Idempotency primitivesidempotencyKey({executionId, stepId, attempt}) for store writes and event publishes.
  • Execution event stream — Valkey Streams transport (XADD / XREADGROUP / XACK) for the Engine ↔ Backend execution event protocol with publisher dedup at receive.

Distinct from the cross-service NATS-based @octaviaflow/eventbus (which carries CDC ingress events). This package's event stream is for intra-execution events: step.committed, step.failed, execution.status, execution.log.

Install

bun add @octaviaflow/execution-context iovalkey

Quick start — store

import {
  createValkeyExecutionContextStore,
  type StepEnvelope,
} from '@octaviaflow/execution-context';

const store = createValkeyExecutionContextStore({
  url: process.env.VALKEY_URL,
});

const scope = { tenantId: 'org_42', executionId: 'exec_abc' };

const envelope: StepEnvelope = {
  executionId: scope.executionId,
  stepId: 'fetch_customers',
  attempt: 0,
  data: [{ id: 1, name: 'Acme' }],
  schema: { type: 'array', items: { type: 'object' } },
  schemaHash: '...',
  schemaVersion: 1,
  lineage: [],
  metadata: { rowCount: 1, bytes: 120, elapsedMs: 42, producedAt: new Date().toISOString() },
  status: 'success',
};

await store.putStep(scope, envelope);
const back = await store.getStep(scope, 'fetch_customers');

Quick start — schema inference

import { inferSchema, schemaHash } from '@octaviaflow/execution-context';

const rows = [
  { id: 1, name: 'a', address: { city: 'NYC' } },
  { id: 2, name: null, address: { city: 'SF' } },
];
const schema = inferSchema(rows);
// { type: 'object',
//   properties: { id: {type:'integer'}, name: {type:'string'},
//                 address: {type:'object', properties: {city: {type:'string', enum:['NYC','SF']}}, required:['city']} },
//   required: ['address', 'id'] }
const hash = schemaHash(schema); // 64-char sha256, stable under property reorder

Quick start — execution event stream

import Valkey from 'iovalkey';
import {
  ExecutionEventPublisher,
  ExecutionEventSubscriber,
} from '@octaviaflow/execution-context';

const client = new Valkey(process.env.VALKEY_URL!);

const pub = new ExecutionEventPublisher({ client });
await pub.publish(
  { tenantId: 'org_42' },
  {
    kind: 'step.committed',
    executionId: 'exec_abc',
    attempt: 0,
    stepId: 'fetch_customers',
    ts: new Date().toISOString(),
  },
);

const sub = new ExecutionEventSubscriber({
  client,
  group: 'backend-mongo-writer',
  consumer: 'host-1',
});

await sub.runLoop({ tenantId: 'org_42' }, async (event, meta) => {
  await persistEvent(event, meta);
});

Tenant prefix discipline

All keys are constructed by typed helpers. Calls with an invalid tenantId throw InvalidTenantError. The valid tenant pattern is ^[a-zA-Z0-9_-]{1,64}$.

hot-tier  (Valkey)        →  t:{tenantId}:exec:{executionId}:steps:{stepId}
hot-tier  (Valkey)        →  t:{tenantId}:flow:{flowId}:vars
hot-tier  (Valkey)        →  t:{tenantId}:exec:{executionId}:lease
event stream (Valkey)     →  t:{tenantId}:events
cold-tier (S3)            →  t/{tenantId}/exec/{executionId}/steps/{stepId}.json
cold-tier (S3)            →  t/{tenantId}/archive/{flowId}/{executionId}.json

Logger

The package is logger-agnostic. Pass any object satisfying the Logger interface (debug / info / warn / error) to createValkeyExecutionContextStore, ExecutionEventPublisher, or ExecutionEventSubscriber. The default is a no-op logger.

License

Apache-2.0