Registry / testing / vrf-rest

vrf-rest

JSON →
library0.11.0jsnpmunverified

REST effect for the vrf form engine (v0.11.0). Enables automatic REST API integration for Vue forms built with vrf: forms declare resources and vrf-rest generates GET, POST, PATCH requests from form configuration (auto, single, action modes). Supports file uploads via multipayload format. Ships TypeScript types. Release cadence is irregular; currently stable.

npm install vrf-rest
INSTALL
IMPORT
SIG · VRF-REST
V
vrf-rest
testingjavascriptv0.11.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.

useRestEffect
✓ import { useRestEffect } from 'vrf-rest'
✗ const useRestEffect = require('vrf-rest')
ESM-only package, no CommonJS export. useRestEffect is the main composable.
RestEffect
✓ import type { RestEffect } from 'vrf-rest'
✗ import { RestEffect } from 'vrf-rest'
RestEffect is a TypeScript type, not a runtime value.
vrf-rest (default)
✓ import vrfRest from 'vrf-rest'
✗ import { default as vrfRest } from 'vrf-rest'
Package also exports a default export (the Vue plugin install function).

Shows how to install the vrf-rest plugin with Vue and vrf, setting a base URL and auth header.

import { createApp } from 'vue'; import { createVrf } from 'vrf'; import vrfRest from 'vrf-rest'; const app = createApp(App); const vrf = createVrf(); app.use(vrf); app.use(vrfRest, { baseURL: process.env.VITE_API_BASE ?? '/api', headers: { Authorization: `Bearer ${process.env.API_TOKEN ?? ''}` } }); app.mount('#app');
Debug
Known issues
gotchavrf-rest requires the 'vrf' peer dependency to be installed and initialized before use.
fix
Ensure 'vrf' is installed: npm install vrf, and call app.use(vrf) before app.use(vrfRest).
affects: >=0.0.0
deprecatedThe 'multipayload' format is not standard REST; only documented as a Rails mixin example.
fix
Consider using standard multipart/form-data with JSON metadata if needed.
affects: >=0.0.0
gotchaAction mode uses a different URL pattern (e.g., /todos/:id/add_comment) which may conflict with routes expecting CRUD.
fix
Define explicit routes for action endpoints in your backend.
affects: >=0.0.0
gotchaThe 'single' mode uses PATCH /todos (no id) which can accidentally update all records if backend is not scoped.
fix
Ensure backend route for PATCH /todos acts on a single resource (e.g., current user).
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'vrf-rest' or its corresponding type declarations.
vrf-rest is not installed or types are missing.
fix
npm install vrf-rest (if types exist they are bundled).
Vue.use() is not a function. You are likely using Vue 3 and calling app.use(vrfRest) but vrfRest is not a Vue plugin.
vrf-rest may not be registered correctly.
fix
Ensure import vrfRest from 'vrf-rest' returns a default function that is a Vue plugin.
Uncaught TypeError: Cannot read properties of undefined (reading 'baseURL')
Options object passed to vrfRest plugin is missing baseURL or vrf is not initialized.
fix
Provide options object with baseURL: process.env.VITE_API_BASE ?? '/api', and ensure app.use(vrf) is called first.
Upgrade
Version history
0.11.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Resources
vrf-rest — npm install vrf-rest · libregistry