New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

miwon

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

miwon

State container with cache normalizing

latest
Source
npmnpm
Version
1.0.18
Version published
Maintainers
1
Created
Source

Miwon

Miwon is oriented to intergrated state container with api fetching and cache normalizing.

Concept

  • Cache Normalizing like Apollo Client
  • Handling sever-side-data like TanStack Query

Notice

  • Miwon is a kind of seasoning for cook.
  • This library is experimental and unstable. (also, document is unkind)

Installation

npm install miwon

yarn add miwon

Quick Start

1. Add Miwon to your project

import { addMiwon } from 'miwon'

const miwon = addMiwon({
  config: {
    baseURL: 'https://my-json-server.typicode.com' //change base url for your project
  }
})

2. Build Normalizer.

import { schema, normalize } from 'miwon'

const postsNormalizer = (res: any) => {
  const commentEntity = new schema.Entity('comments')

  const postEntity = new schema.Entity('posts', {
    comments: [commentEntity]
  })

  const posts = new schema.Array(postEntity)
  return normalize(res, posts).entities
}

3. Get data with Normalizer.

miwon.miwonQuery('/2hakjoon/miwon/posts', postsNormalizer).then(
  () => console.log(getState()) // you can see normalized result which cached
)

Todo

  • store
    • createStore
  • subscription
    • subscribe
    • unsubscribe
    • clear
    • getSubscriptions
  • fetcher
    • createFetcher
    • errorHandling
  • cahce
    • cache with normalized data
    • get cache with key
  • normalizer

Keywords

state

FAQs

Package last updated on 15 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts