@htlkg/data
v0.0.3
Published
GraphQL client, queries, mutations, hooks, and stores for Hotelinking applications.
Downloads
276
Readme
@htlkg/data
GraphQL client, queries, mutations, hooks, and stores for Hotelinking applications.
Installation
npm install @htlkg/dataModules
Client
GraphQL client generation for client-side and server-side data fetching with Amplify.
Hooks
Vue composables for reactive data management: useBrands, useAccounts, useUsers, useProducts.
Queries
GraphQL query functions for accounts, brands, users, and products.
Mutations
GraphQL mutation functions for creating, updating, and deleting resources.
Stores
Nanostore factories for request-scoped state management in Astro SSR.
Content Collections
Astro content collection generators and schema definitions.
Quick Start
// Client-side data fetching
import { getSharedClient } from '@htlkg/data/client';
import type { Schema } from '@backend/data/resource';
const client = getSharedClient<Schema>();
const { data } = await client.models.Brand.list();
// Vue composables
import { useBrands, useAccounts } from '@htlkg/data/hooks';
const { brands, loading, error, refetch } = useBrands({
accountId: 'account-123',
activeOnly: true,
});
// Server-side queries
import { fetchBrands, fetchAccounts } from '@htlkg/data/queries';
const brands = await fetchBrands(client, { accountId });