v2.0.0-pre.18
Module Overview
Setup & Store Creation
These are the primary utilities for creating stores.
ts
// Setup & Store Creation
export { useService } from './use-service'
export { useAuth } from './use-auth'
export { feathersPiniaHooks } from './hooks'
- useService is a composition for creating service stores.
- useAuth is a composition utility which allows you to create a highly-flexible setup stores for auth.
- feathersPiniaHooks adds feathers-pinia hooks to a Feathers Client service.
Composition API Utils
New APIs in v1ts
// Composition API Utils
export { useFind } from './use-find'
export { useGet } from './use-get'
export { useClone } from './use-clone'
export { useClones } from './use-clones'
- useFind is a utility that assists you in implementing the Live Query pattern. Give it a set of params and you'll get back live-updating lists of
data
, as well as pagination utilities likenext
, andprev
. It's super versatile, handling declarative and imperative workflows that support both the client- and server-side pagination. It's similar to SWR but far more intelligent, being able to reuse data between different queries. - useGet is similar to
useFind
but for theget
method. - useClone is like
useClones
but for a single prop. - useClones removes boilerplate from the clone and commit pattern. It automatically clones all component props containing a
feathers-pinia
instance.
Data Modeling & Associations
ts
// Data Modeling & Associations
export { useBaseModel, useFeathersModel } from './use-base-model'
export { associateFind } from './associate-find'
export { associateGet } from './associate-get'
- useFeathersModel creates Model functions fully connected to a Feathers service.
- useBaseModel creates Model functions for standalone data, optionally connected to a Feathers service.
- associateFind creates an array-based relationship with another Model class
- associateGet creates a single-object-based relationship with another Model class
SSR & Storage
ts
// SSR & Storage
export { OFetch } from './feathers-ofetch'
export { syncWithStorage } from './storage-sync'
export { clearStorage } from './clear-storage'
OFetch
is a utility that combines the universal fetch utility called ofetch with the Feathers-Client. It enables compatibility with Nuxt3 with SSR enabled.syncWithStorage
synchronizes specific parts of a store's state intolocalStorage
or any Storage-compatible adapter you provide.clearStorage
clears data stored with the above utilities.
Learn more about these utilities in syncWithStorage
Feathers-Vuex Migration Utils
ts
// Feathers-Vuex Migration Utils
export { useFindWatched } from './use-find-watched'
export { useGetWatched } from './use-get-watched'
export { usePagination } from './use-pagination'
These utilities exist to assist with migration from Feathers-Vuex. Use them for migrating existing Feathers-Vuex code, but not for new development. Use the new useFind
and useGet
utilities for new development.
useFindWatched
is the equivalent to Feathers-Vuex'suseFind
utility. See useFindWatcheduseGetWatched
is the equivalent to Feathers-Vuex'suseGet
utility. See useGetWatched.usePagination
is a composition api utility that handles typical pagination logic. See usePagination