0.2.10 โ€ข Published 1 year ago

qman v0.2.10

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Ultra lightweight query manager

  • super small bundle size ๐Ÿ“ฆ
  • manages deterministic query keys and invocations ๐Ÿ› ๏ธ
  • enhances type safety of existing fetching packages ๐Ÿงช
  • organizes fetching structure into schemas ๐Ÿซ
  • fully tree shake-able ๐ŸŒด

Usage

import { query, schema } from 'qman'
import { use } from 'qman/swr' // or qman/query

// Specifies your getters, can be api route, db handlers, anything that returns a promise
const getAllUsers = () => fetch('your.api/users/')
const getUserById = (id: string) => fetch(`your.api/users/${id}`)

// Specifies a schema that organizes your api, declare multiple schemas based on category
export const users = schema(
  'users',
  query('allUsers', getAllUsers, use), 
  query('byId', getUserById, use),
  query('somePromise', directDBPromiseFn) // note we don't have to use swr/query adapters here
)

// Later in code (usually in different file) use your schema.
users.get('allUsers', [])
users.get('byId', ['exampleId123']) // You get full type-safety here with exact argument names i.e. `[id: string]`

This also ensures your query keys are always unique even if different schemas have same queries. i.e. you can have a schema called users and posts which both ship byId query. You can be sure and safe that even if you mutate / revalidate, it will stay within the schema boundaries and will get type safety according to schema definitions.

Advanced usage

Adds support for advanced query usage, such as

  • firebase
  • subscriptions
  • infinite and paginated queries
  • mutations
  • and more

documentation will come with beta release, will expand on these topics.

0.2.10

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.4

1 year ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago