open-index/open-npm huggingface dataset:
npm package: @handcraft/eva
Description: A lisp like script language
Author: penghui
Latest version: 1.0.1

# 介绍

Eva is the mini language in course [Building an Interpreter from scratch](https://www.udemy.com/course/essentials-of-interpretation/), and this is a version implemented in typescript.

Install eva command line tool with following command.

```bash
npm i -g @handcraft/eva
```

You can use eva command to evaluate eva script from different sources.

Use `-e` argument to execute code directly.

```bash
eva -e '(var x 10) (print (* x 15))'
eva -e '(print ((lambda (x) (* x x)) 2))'
```

Use `-f` argument to execute local script file.

```bash
eva -f test/test.eva
eva -f test/math-test.eva
```

Otherwise you'll have a interactive shell like node.

```bash
eva

> (var x 10)
> (x)
10
```
npm package: @handcraftech/plugin-route-url-change-event
Description: A plugin that listens and controls URL changes
Author: jinrui
Latest version: 0.2.0

# URL Changel Event
a wrapper event that listen & control URL changes

## Installation
you can install with ```npm install @handcraftech/plugin-route-url-change-event```
```javascript
    /* in ES 5 */
    require('@handcraftech/plugin-route-url-change-event')
    /* in ES 6 */
    import '@handcraftech/plugin-route-url-change-event'
```
or
```html
    <script src="url-change-event.js"></script>
```
> Due to override some history method, you should import this lib before your code.

## Usage
```javascript
window.addEventListener('urlchange', function(e) {
    // your code here
})
```
### UrlChangeEvent instance
Properties
* ```oldURL``` {__URL__} - the url before change.
* ```newURL``` {__URL__ | __null__} - the url after change. __WARNING:__ when event.action is __beforeunload__, this value is null.
* ```action``` {[pushState|replaceState|popstate|beforeunload]} - the action that causes the url to change. 

Method
* ```preventDefault``` - prevent url change

## License
MIT licensed
npm package: @handev-id/simple-api-instance
Description: CLI tool to generate API Instance folder structure with axios service
Author: Handev ID
Latest version: 1.0.3

## Installation

```ts
npm install @handev-id/simple-api-instance
```

## 1. Quick Start

Run this command in your terminal:

```ts
npx simple-api-instance
```

This will automatically generate a ready-to-use /api folder inside your src directory.

```ts
src/
 └── api/
     ├── service.ts
     ├── models/
     │   └── example.ts
     └── endpoints/
         └── example.ts

```

---

## 2. API Instance

All API requests are handled through a single centralized Axios instance located at src/api/service.ts:

```ts
// src/api/service.ts
import axios from "axios";

const service = axios.create({
  baseURL: "https://example.com/api",
});

export default service;
```

## 3. Create Model

Define TypeScript models inside src/apis/models/:

```ts
// src/apis/models/example.ts
export type Example = {
  id: number;
  name: string;
};
```

---

## 4. Create Endpoint

All endpoint functions must use the centralized service.ts,
and be placed inside src/apis/endpoints/.

```ts
// src/apis/endpoints/service.ts
import { Example } from "../models/example";
import service from "../service";

export function exampleIndexApi({
  additionalParams,
}: {
  additionalParams: string;
}): Promise<Example[]> {
  return service
    .get("/example", {
      params: {
        page: 1,
        limit: 20,
        additionalParams,

        // Or another query parameters
      },
    })
    .then((response) => response.data);
}

export function exampleStoreApi(body: Example): Promise<Example[]> {
  return service.post("/example", body).then((response) => response.data);
}
```

## 5. Usage Example

### GET Method

```tsx
// src/App.tsx
import { useApi } from "@handev-id/simple-api-instance";
import { exampleIndexApi } from "./api/endpoints/example.ts";
import { AxiosError } from "axios";

const exampleGet = useApi({
  api: exampleIndexApi,
  onSuccess: () => {
    alert("Success Get Data!");
  },
  onFail: (e) => {
    const error = e as AxiosError;
    console.log(error);
  },
});

useEffect(() => {
  exampleGet.process({});
}, []);

console.log(exampleGet.data);
```

### POST Method

```tsx
// src/App.tsx
import { useApi } from "@handev-id/simple-api-instance";
import { exampleStoreApi } from "./api/endpoints/example.ts";
import { Example } from "./api/models/example.ts";
import { AxiosError } from "axios";

const exampleStore = useApi({
  api: exampleStoreApi,
  onSuccess: () => {
    alert("Success Store Data!");
  },
  onFail: (e) => {
    const error = e as AxiosError;
    console.log(error);
  },
});

const onSubmit = (data: Example) => {
  exampleStore.process(data);
};

console.log(exampleStore.data);
```
npm package: @handfish/drizzle-effect
Description: Generate `effect` schemas from Drizzle ORM schemas
Author: Drizzle Team
Latest version: 0.0.17

<div align='center'>
<h1>drizzle-effect <a href=''><img alt='npm' src='https://img.shields.io/npm/v/drizzle-effect?label='></a></h1>
<img alt='npm' src='https://img.shields.io/npm/dm/drizzle-effect'>
<img alt='npm bundle size' src='https://img.shields.io/bundlephobia/min/drizzle-effect'>
<a href='https://discord.gg/yfjTbVXMW4'><img alt='Discord' src='https://img.shields.io/discord/1043890932593987624'></a>
<img alt='License' src='https://img.shields.io/npm/l/drizzle-effect'>
<h6><i>If you know SQL, you know Drizzle ORM</i></h6>
<hr />
</div>

`drizzle-effect` is a plugin for [Drizzle ORM](https://github.com/drizzle-team/drizzle-orm) that allows you to generate [Effect](https://effect.website/) schemas from Drizzle ORM schemas.

| Database   | Insert schema | Select schema |
| :--------- | :-----------: | :-----------: |
| PostgreSQL |      ✅       |      ✅       |
| MySQL      |      ✅       |      ✅       |
| SQLite     |      ✅       |      ✅       |

# Usage

```ts
import { pgEnum, pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
import { createInsertSchema, createSelectSchema } from 'drizzle-effect';
import { Schema } from '@effect/schema';

const users = pgTable('users', {
  id: serial('id').primaryKey(),
  name: text('name').notNull(),
  email: text('email').notNull(),
  role: text('role', { enum: ['admin', 'user'] }).notNull(),
  createdAt: timestamp('created_at').notNull().defaultNow(),
});

// Schema for inserting a user - can be used to validate API requests
const insertUserSchema = createInsertSchema(users);

// Schema for selecting a user - can be used to validate API responses
const selectUserSchema = createSelectSchema(users);

// Overriding the fields
const insertUserSchema = createInsertSchema(users, {
  role: Schema.String,
});

const emailPattern = /[^ .@]+@[^ .@]+\.[^ .@]/;

// Refining the fields - useful if you want to change the fields before they become nullable/optional in the final schema
const insertUserSchema = createInsertSchema(users, {
  id: (schema) => schema.id.pipe(Schema.positive()),
  email: (schema) => schema.email.pipe(Schema.pattern(emailPattern)),
  role: Schema.String,
});

// Usage

const user = Schema.decodeSync(insertUserSchema)({
  name: 'John Doe',
  email: 'johndoe@test.com',
  role: 'admin',
});

// Effect schema type is also inferred from the table schema, so you have full type safety.
// Additionally it is created using `Schema.Struct`, so you can do:
const requestSchema = insertUserSchema.pick('name', 'email');
```
npm package: @handfish/drizzle-kit
Description: Drizzle Kit is a CLI migrator tool for Drizzle ORM. It is probably the one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input. <https://github
Author: Drizzle Team
Latest version: 0.30.1

## Drizzle Kit

Drizzle Kit is a CLI migrator tool for Drizzle ORM. It is probably the one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
<https://github.com/drizzle-team/drizzle-kit-mirror> - is a mirror repository for issues.

## Documentation

Check the full documentation on [the website](https://orm.drizzle.team/kit-docs/overview).

### How it works

Drizzle Kit traverses a schema module and generates a snapshot to compare with the previous version, if there is one.
Based on the difference, it will generate all needed SQL migrations. If there are any cases that can't be resolved automatically, such as renames, it will prompt the user for input.

For example, for this schema module:

```typescript
// src/db/schema.ts

import { integer, pgTable, serial, text, varchar } from "drizzle-orm/pg-core";

const users = pgTable("users", {
    id: serial("id").primaryKey(),
    fullName: varchar("full_name", { length: 256 }),
  }, (table) => ({
    nameIdx: index("name_idx", table.fullName),
  })
);

export const authOtp = pgTable("auth_otp", {
  id: serial("id").primaryKey(),
  phone: varchar("phone", { length: 256 }),
  userId: integer("user_id").references(() => users.id),
});
```

It will generate:

```SQL
CREATE TABLE IF NOT EXISTS auth_otp (
 "id" SERIAL PRIMARY KEY,
 "phone" character varying(256),
 "user_id" INT
);

CREATE TABLE IF NOT EXISTS users (
 "id" SERIAL PRIMARY KEY,
 "full_name" character varying(256)
);

DO $$ BEGIN
 ALTER TABLE auth_otp ADD CONSTRAINT auth_otp_user_id_fkey FOREIGN KEY ("user_id") REFERENCES users(id);
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;

CREATE INDEX IF NOT EXISTS users_full_name_index ON users (full_name);
```

### Installation & configuration

```shell
npm install -D drizzle-kit
```

Running with CLI options:

```jsonc
// package.json
{
 "scripts": {
  "generate": "drizzle-kit generate --out migrations-folder --schema src/db/schema.ts"
 }
}
```

```shell
npm run generate
```