open-index/open-npm huggingface dataset:
npm package: @simple-api/core
Description: Framework-agnostic fetch-based API engine
Latest version: 1.0.8

<p align="center">
  <img src="../../public/logo.png" width="200" alt="simple-api logo">
</p>

# @simple-api/core

**The high-performance, framework-agnostic engine powering simple-api.**

@simple-api/core is a production-grade API client builder designed for high-scale TypeScript applications. It provides a service-oriented architecture, built-in request deduplication, a powerful tiered middleware system, and automatic parameter injection.

---

## Core Features

- **Interceptors**: Global hooks for `onRequest`, `onResponse`, and `onError`.
- **PWA Caching**: Built-in Stale-While-Revalidate support via Web Cache API.
- **Polling**: Native background auto-refresh for any endpoint.
- **File Uploads**: Automatic conversion and header management for `multipart/form-data`.
- **Structured Errors**: Rich `ApiError` class with status codes and full response bodies.
- **Request Timeouts**: Built-in `AbortController` support.
- **Deduplication**: Automatic merging of concurrent identical `GET` requests.

---

## Installation

```bash
npm install @simple-api/core
```

---

## Quick Start

### 1. Define your API

```typescript
import { createApi } from "@simple-api/core";

export const api = createApi({
  baseUrl: "https://api.example.com",
  services: {
    users: {
      get: { method: "GET", path: "/users/:id" },
      update: { method: "PATCH", path: "/users/:id" },
    },
  },
});
```

### 2. Make Calls

```typescript
// Path parameters and types are automatically handled
const user = await api.users.get({ params: { id: "123" } });

// File uploads made easy
await api.users.update({
  params: { id: "123" },
  upload: true,
  body: { avatar: fileInput.files[0] },
});
```

---

## Technical Deep Dive

### Interceptors

Interceptors fire at specific execution points, regardless of your middleware stack.

```typescript
const api = createApi({
  interceptors: {
    onRequest: (ctx) => {
      console.log(`Starting ${ctx.service}.${ctx.endpoint}`);
      return ctx.options;
    },
    onResponse: (data) => data.payload ?? data,
  },
  ...
});
```

### PWA Caching (SWR)

```typescript
import { createCacheMiddleware } from "@simple-api/core";

const api = createApi({
  middleware: [createCacheMiddleware({ swr: true, ttl: 3600000 })],
  ...
});
```

### Native Polling

```typescript
// Re-fetch automatically every 5 seconds
api.users.list({ pollingInterval: 5000 });
```

### Middleware System

SimpleAPI uses a Koa-style `async (context, next)` middleware system.

1. **Global**: Runs on every request.
2. **Service**: Runs on every request to a specific service.
3. **Endpoint**: Runs only on a specific endpoint.

---

## Error Handling

When a request fails, the engine throws an `ApiError`.

```typescript
import { ApiError } from "@simple-api/core";

try {
  await api.users.get({ params: { id: "999" } });
} catch (error) {
  if (error instanceof ApiError) {
    console.error(error.status, error.data);
  }
}
```

---

## License

MIT © Elnatan Samuel
npm package: @simple-api/react
Description: React TanStack Query adapter for SimpleAPI Engine
Latest version: 1.0.8

<p align="center">
  <img src="../../public/logo.png" width="200" alt="simple-api logo">
</p>

# @simple-api/react

**Production-grade TanStack Query adapter for simple-api.**

@simple-api/react provides a seamless bridge between your API definitions and React components. It automatically generates type-safe hooks for every endpoint, with built-in support for mutations, wildcard query invalidation, and global synchronization.

---

## Key Features

- **Auto-generated Hooks**: Every endpoint becomes a hook (e.g., `api.users().get()`).
- **Wildcard Invalidation**: Nuke entire service caches with `invalidates: ['users/*']`.
- **Deep Type Safety**: Full inference from your core API definition down to the component props.
- **TanStack v5 Support**: Native support for the latest query features (`isPending`, `isError`, etc.).
- **Deduplication Integration**: Seamlessly works with the core engine's request deduplication.

---

## Installation

```bash
npm install @simple-api/react @simple-api/core @tanstack/react-query
```

---

## Quick Start

### 1. Create the Adapter

```typescript
import { createApi } from "@simple-api/core";
import { createReactAdapter } from "@simple-api/react";

const api = createApi({
  baseUrl: "https://api.example.com",
  services: {
    users: {
      get: { method: "GET", path: "/users/:id" },
      update: { method: "PATCH", path: "/users/:id" },
    },
  },
});

export const useApi = createReactAdapter(api);
```

### 2. Fetching Data

```tsx
export const UserProfile = ({ id }) => {
  const { users } = useApi();
  const { data, isLoading } = users().get({ params: { id } });

  if (isLoading) return <div>Loading...</div>;
  return <h1>{data.name}</h1>;
};
```

---

## Advanced Invalidation

### Wildcard Patterns

The adapter supports wildcard invalidation strings to clear complex cache segments easily.

```tsx
const { execute } = users().update({
  params: { id: "123" },
  invalidates: ["users/*"], // Invalidates every query in the 'users' service
});
```

---

## Hook Options

Standard TanStack Query options can be passed via `hookOptions`.

```typescript
users().get({
  params: { id },
  hookOptions: {
    staleTime: 600000,
    gcTime: 3600000,
    enabled: !!id,
  },
});
```

---

## License

MIT © Elnatan Samuel
npm package: @simple-api/react-native
Description: React Native adapter for SimpleAPI Engine
Latest version: 1.0.8

<p align="center">
  <img src="../../public/logo.png" width="200" alt="simple-api logo">
</p>

# @simple-api/react-native

**The mobile-optimized adapter for simple-api.**

@simple-api/react-native is a specialized wrapper around @simple-api/react, tuned for the mobile environment. It ensures that your API engine performs optimally on iOS and Android devices, focusing on battery efficiency, connectivity resilience, and shared logic.

---

## Key Features

- **Offline Queue**: mutation persistence and replay support for flaky networks.
- **Battery Efficient**: Leverages the core engine's request deduplication to minimize radio usage.
- **Mobile Optimized**: Defaults tuned for React Native fetch and environmental constraints.
- **Shared Architecture**: Use the exact same API definitions for both web and mobile.

---

## Installation

```bash
npm install @simple-api/react-native @simple-api/core @tanstack/react-query
```

---

## Quick Start

### 1. Define your API

```typescript
// shared/api.ts
import { createApi } from "@simple-api/core";

export const apiDefinition = createApi({
  baseUrl: "https://api.myapp.com",
  services: {
    posts: {
      list: { method: "GET", path: "/posts" },
      create: { method: "POST", path: "/posts" },
    },
  },
});
```

### 2. Mobile-Specific Adapter

```tsx
// hooks/useApi.ts
import { createReactAdapter } from "@simple-api/react-native";
import { apiDefinition } from "../shared/api";

export const useMobileApi = createReactAdapter(apiDefinition);
```

---

## Offline Queue

The React Native adapter includes a powerful `createOfflineQueue` utility for handling mutations when the device is disconnected.

```tsx
import { createOfflineQueue } from "@simple-api/react-native";

const queue = createOfflineQueue({
  onSuccess: (id, res) => console.log("Synced!", res),
  maxRetries: 5,
});

// Add anytime. If online, it fires. If offline, it waits.
queue.add(() => api.posts.create({ body: { text: "Offline post" } }));

// Replay manually or on network event
queue.flush();
```

---

## License

MIT © Elnatan Samuel
npm package: @simple-api/svelte
Description: Svelte TanStack Query adapter for SimpleAPI Engine
Latest version: 1.0.8

<p align="center">
  <img src="../../public/logo.png" width="200" alt="simple-api logo">
</p>

# @simple-api/svelte

**Production-grade TanStack Query adapter for simple-api, optimized for Svelte.**

@simple-api/svelte brings the power of type-safe API definitions to the Svelte ecosystem. It leverages Svelte's native reactive stores and TanStack Query v5 to provide a high-performance, type-safe data fetching layer.

---

## Key Features

- **Svelte-Native Reactivity**: Uses Svelte's `$` store syntax for seamless data access.
- **Auto-generated Functions**: Every endpoint becomes a reactive hook (e.g., `api.users().get()`).
- **Deep Type Safety**: End-to-end TypeScript inference ensures component data scales with your API.
- **TanStack v5 Support**: Native support for the latest async patterns and mutation management.

---

## Installation

```bash
npm install @simple-api/svelte @simple-api/core @tanstack/svelte-query
```

---

## Quick Start

### 1. Create the Adapter

```typescript
import { createApi } from "@simple-api/core";
import { createSvelteAdapter } from "@simple-api/svelte";

const api = createApi({
  baseUrl: "https://api.example.com",
  services: {
    users: {
      get: { method: "GET", path: "/users/:id" },
    },
  },
});

export const useApi = createSvelteAdapter(api);
```

### 2. Fetching Data

```svelte
<script>
  import { useApi } from './api';
  const { users } = useApi();

  const user = users().get({ params: { id: '1' } });
</script>

{#if $user.isLoading}
  <p>Loading...</p>
{:else if $user.isError}
  <p>Error: {$user.error.message}</p>
{:else}
  <h1>{$user.data.name}</h1>
{/if}
```

---

## Advanced Options

Standard TanStack Query options can be passed via `hookOptions`.

```typescript
users().get({
  params: { id },
  hookOptions: {
    staleTime: 60000,
    enabled: !!id,
  },
});
```

---

## License

MIT © Elnatan Samuel
npm package: @simple-api/zustand
Description: Zustand synchronization middleware for SimpleAPI Engine
Latest version: 1.0.8

<p align="center">
  <img src="../../public/logo.png" width="200" alt="simple-api logo">
</p>

# @simple-api/zustand

**Seamless API-to-Store synchronization for simple-api.**

@simple-api/zustand provides a specialized middleware that pipes API responses directly into your Zustand stores. It eliminates the boilerplate of manually fetching data and explicitly calling store update functions.

---

## Key Features

- **Auto-Dispatch**: API responses are automatically injected into your store upon completion.
- **Key Mapping**: Map specific API calls to designated store keys for granular management.
- **Type Safety**: Full TypeScript support ensures injected data matches your store state.
- **Reactive Updates**: UI components react instantly to API returns without extra code.

---

## Installation

```bash
npm install @simple-api/zustand @simple-api/core zustand
```

---

## Quick Start

### 1. Define your Store

```typescript
import { create } from "zustand";

export const useUserStore = create((set) => ({
  profile: null,
  setProfile: (profile) => set({ profile }),
}));
```

### 2. Configure the Middleware

```typescript
import { createApi } from "@simple-api/core";
import { createZustandMiddleware } from "@simple-api/zustand";
import { useUserStore } from "./store";

const api = createApi({
  baseUrl: "https://api.example.com",
  middleware: [
    createZustandMiddleware({
      stores: {
        userProfile: (data) => useUserStore.getState().setProfile(data),
      },
    }),
  ],
  services: {
    users: {
      get: { method: "GET", path: "/me" },
    },
  },
});
```

### 3. Trigger & Sync

```typescript
// The 'userProfile' store key is updated automatically on success
await api.users.get({
  storeKey: "userProfile",
});
```

---

## License

MIT © Elnatan Samuel
npm package: @simple-cinema/core
Description: Core utilities and shared setup
Author: Ulugbek
Latest version: 1.1.1

# @simple-cinema/core

Shared configuration and utilities for the Simple Cinema monorepo.

## Contents

- **Prettier config** — a shared formatting config used across all packages.

## Installation

```bash
yarn add @simple-cinema/core
```

Requires `prettier@^3.0.0` as a peer dependency.

## Usage

### Prettier

Reference the config in your `package.json`:

```json
{
  "prettier": "@simple-cinema/core/src/prettier.config.mjs"
}
```

Or in a `prettier.config.mjs` / `.prettierrc.mjs` file:

```js
export { default } from "@simple-cinema/core/src/prettier.config.mjs";
```
npm package: @simple-codebook/local-client
Description: This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Latest version: 1.0.4

# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

## Previewing your code

The project has a built in method called `show()` that the user can use to preview their code in the preview window
next to whatever code cell they are currently working in.

## Referencing code in other cells!

You can reference code written in previous cells (cells above the current cell you are working in)!

e.g. defining `const App = () => { return <h1>Basic Component</h1>; }` inside the first code cell will allow you to `show(<App />)` inside a
lower code cell and see your App component previewed in the relevant preview window.