Local JavaScript and TypeScript modules

Import

WOML
<imports>
  <module name="pricing" from="./modules/pricing.ts" />
</imports>

name is the service alias. from is a static relative .js or .ts path. The module uses named ESM exports:

TypeScript
export function total(price: number, quantity: number) {
  return price * quantity;
}

Call it as:

JavaScript
return services.pricing.total(context.payload.price, context.payload.quantity);

Supported:

  • named ESM exports;
  • static relative .js and .ts imports inside the local module graph;
  • pure functions and functions using the injected services global;
  • deterministic bundling and immutable recovery artifacts.

Unsupported:

  • default exports;
  • CommonJS;
  • dynamic imports;
  • npm/package imports;
  • runtime package installation; and
  • initialization side effects.

Local modules receive services and native Fetch. They do not automatically receive context, attempt, or secrets; pass required values explicitly. This makes secret and data dependencies visible at the workflow call site.

woml check and woml run refresh woml-env.d.ts automatically. woml types is only for an explicit refresh or custom output path.