Loop Engine

Packages

Registry Client

@loop-engine/registry-client

Loop definition registry with local, HTTP, and Better Data adapters.

Install

1npm install @loop-engine/registry-client

The default: local registry

For most use cases, pass loop definitions directly to createLoopSystem:

1import { createLoopSystem } from '@loop-engine/sdk'
2import { procurement, replenishment } from './loops'
3 
4const { engine } = await createLoopSystem({
5 loops: [procurement, replenishment]
6})

No external registry is required.

Loading from a directory

1import { localRegistry } from '@loop-engine/registry-client'
2import { createLoopSystem } from '@loop-engine/sdk'
3 
4const { engine } = await createLoopSystem({
5 loops: [],
6 registry: localRegistry({ loopsDir: './loops' })
7})

Works in Node.js. In browser, use definitions[].

Loading YAML from disk + inline definitions

1const registry = localRegistry({
2 loopsDir: './loops',
3 definitions: [customLoop]
4})

Inline definitions are loaded and available alongside file-based definitions.

HTTP registry (any server)

1import { httpRegistry } from '@loop-engine/registry-client'
2 
3const registry = httpRegistry({
4 baseUrl: 'https://your-registry.example.com',
5 headers: { Authorization: `Bearer ${token}` }
6})

Server contract:

  • GET /loops
  • GET /loops?domain={domain}
  • GET /loops/{loopId}
  • GET /loops/{loopId}/{version}
  • POST /loops
  • DELETE /loops/{loopId}

Better Data platform registry

1import { betterDataRegistry } from '@loop-engine/registry-client/betterdata'
2 
3const registry = betterDataRegistry({
4 apiKey: process.env.BD_API_KEY!,
5 orgId: 'your-org-id'
6})

LoopRegistry interface

1import type { LoopRegistry } from '@loop-engine/registry-client'
2 
3const myRegistry: LoopRegistry = {
4 get: async (id) => null,
5 getVersion: async (id, version) => null,
6 list: async (options) => [],
7 has: async (id) => false,
8 register: async (definition, options) => {},
9 remove: async (id) => false
10}