Registry / devops / acture-migration

acture-migration

JSON →
library1.2.0jsnpmunverified

Strangler-fig migration primitives for adopting acture in an existing codebase. v1.2.0, stable, maintained by Thor Whalen. Five functions: wrapMutation, actureMiddleware, createDomInterceptor, chooseImplementation, shadowCompare. Designed as an optional accelerator for acture's strangler-fig pattern; agents can also hand-write integration. Includes .claude/skills/ companion scripts for guided migration workflow. Ships TypeScript types, requires acture ^1.0.0 and zod ^4.0.0.

npm install acture-migration
INSTALL
IMPORT
SIG · ACTURE-MIGRATION
A
acture-migration
devopsjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wrapMutation
import { wrapMutation } from 'acture-migration'
import { wrapMutation } from 'acture-migration/wrapMutation'; const wrapMutation = require('acture-migration').wrapMutation
Package is ESM-only, ships types. Named exports only.
actureMiddleware
import { actureMiddleware } from 'acture-migration'
import actureMiddleware from 'acture-migration'
Default export does not exist; must use named import.
createDomInterceptor
import { createDomInterceptor } from 'acture-migration'
const createDomInterceptor = require('acture-migration').createDomInterceptor
ESM-only – no CJS output.
chooseImplementation
import { chooseImplementation } from 'acture-migration'
Composable with any feature-flag SDK.
shadowCompare
import { shadowCompare } from 'acture-migration'
import { shadowCompare } from 'acture-migration/shadowCompare'
All exports at package root; no subpath exports.

Shows how to wrap an existing Zustand store mutation with wrapMutation, preserving the call signature while registering a command with the registry.

import { wrapMutation } from 'acture-migration'; import { registry } from './acture/registry'; import { z } from 'zod'; import { useTodoStore } from './store'; export const addTodo = wrapMutation( (params: { text: string }) => useTodoStore.getState().addTodo(params.text), { id: 'app.todo.add', title: 'Add todo', category: 'Todo', registry, params: z.object({ text: z.string().min(1) }), }, );
Debug
Known issues
breakingEvent form data extraction changed: In v1.1.0, form fields were extracted via FormData. In v1.2.0, if form has no data-acture-command, the interceptor ignores it. Existing forms with data-acture-command but missing data-acture-params may break.
fix
Add data-acture-params to your forms or wrap params in paramsFrom callback.
affects: >=1.1.0 <1.2.0
breakingMin peer dependency acture ^1.0.0 required; using acture <1.0.0 causes TypeScript compilation errors for registry types.
fix
Update acture to >=1.0.0.
affects: >=0.0.0 <1.0.0
breakingMin peer dependency zod ^4.0.0 required; using zod 3.x causes runtime schema validation failures due to API changes.
fix
Update zod to >=4.0.0.
affects: >=3.0.0 <4.0.0
deprecated`actureMiddleware` options `filter` and `transform` were deprecated in v1.1.0 and removed in v1.2.0. Use `onDispatch` callback for custom logic.
fix
Replace `filter` and `transform` with logic inside `onDispatch`.
affects: >=1.0.0 <1.1.0
gotcha`wrapMutation` returns a function with the same signature, but it also registers a command. If you call the returned function from outside the registry, it still executes the legacy handler — no double-execution. However, if you also dispatch via registry, the command runs the same handler again. Call sites that also dispatch accidentally can cause duplicate execution.
fix
Ensure call sites don't both call the wrapped function directly and dispatch the command. Use a flag in the registry to guard idempotency.
affects: >=1.0.0
gotcha`actureMiddleware` does NOT re-dispatch the store action. Actions with type matching a command id are intercepted silently. If you need the action to still be dispatched to other middleware/reducers, you must explicitly dispatch it in `onDispatch`.
fix
Add `store.dispatch(action)` inside `onDispatch` if the original Redux flow must continue.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: registry.dispatch is not a function
You passed a non-registry object to wrapMutation's opts.registry or to actureMiddleware's first argument.
fix
Ensure you import `registry` from your acture project's registry file (e.g., './acture/registry') and pass that object.
Module not found: Error: Can't resolve 'acture-migration' in '/path/to/project'
Package not installed or installed in a different registry scope.
fix
Run `pnpm add acture-migration acture zod` from the project root.
TypeError: Cannot read properties of undefined (reading 'parse')
zod params validation called on undefined because `params` schema not provided or missing in opts.
fix
Add `params: z.object({ ... })` to the opts object in wrapMutation or call.
Warning: actureMiddleware: action.type 'app.todo.add' matched a command, but 'command' key not found in action meta.
The middleware checks for action.meta.command to decide if it should fire onDispatch. Older redux actions without meta.command are ignored.
fix
Ensure your dispatched Redux actions include meta.command (e.g., `dispatch({ type: 'app.todo.add', meta: { command: true } })`).
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
acture-migrationrequiredThis package itself
acturerequiredPeer dependency – provides registry, command primitives
zodrequiredPeer dependency – schema validation for command params
Agent activity
37 hits · last 30 days
node
32
OpenAI (training)
1
Resources