Updates
This commit is contained in:
parent
9e922be199
commit
c7f2f22b32
86
README.md
86
README.md
@ -69,12 +69,12 @@ npm install @moduletrace/nsqlite
|
|||||||
|
|
||||||
### 1. Create the config file
|
### 1. Create the config file
|
||||||
|
|
||||||
Create `bun-sqlite.config.ts` at your project root:
|
Create `nsqlite.config.ts` at your project root:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import type { BunSQLiteConfig } from "@moduletrace/nsqlite";
|
import type { NSQLiteConfig } from "@moduletrace/nsqlite";
|
||||||
|
|
||||||
const config: BunSQLiteConfig = {
|
const config: NSQLiteConfig = {
|
||||||
db_name: "my-app.db",
|
db_name: "my-app.db",
|
||||||
db_schema_file_name: "schema.ts",
|
db_schema_file_name: "schema.ts",
|
||||||
db_dir: "./db", // optional: where to store the db file
|
db_dir: "./db", // optional: where to store the db file
|
||||||
@ -90,9 +90,9 @@ export default config;
|
|||||||
Create `./db/schema.ts` (matching `db_schema_file_name` above):
|
Create `./db/schema.ts` (matching `db_schema_file_name` above):
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "@moduletrace/nsqlite";
|
import type { NSQLITE_DatabaseSchemaType } from "@moduletrace/nsqlite";
|
||||||
|
|
||||||
const schema: BUN_SQLITE_DatabaseSchemaType = {
|
const schema: NSQLITE_DatabaseSchemaType = {
|
||||||
dbName: "my-app",
|
dbName: "my-app",
|
||||||
tables: [
|
tables: [
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ export default schema;
|
|||||||
### 3. Sync the schema to SQLite
|
### 3. Sync the schema to SQLite
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx bun-sqlite schema
|
npx nsqlite schema
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates the SQLite database file and creates/updates all tables to match your schema.
|
This creates the SQLite database file and creates/updates all tables to match your schema.
|
||||||
@ -147,7 +147,7 @@ await NodeSQLite.delete({ table: "users", targetId: 1 });
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The config file must be named `bun-sqlite.config.ts` and placed at the root of your project.
|
The config file must be named `nsqlite.config.ts` and placed at the root of your project.
|
||||||
|
|
||||||
| Field | Type | Required | Description |
|
| Field | Type | Required | Description |
|
||||||
| --------------------- | -------- | -------- | ------------------------------------------------------------------------------------------ |
|
| --------------------- | -------- | -------- | ------------------------------------------------------------------------------------------ |
|
||||||
@ -165,21 +165,21 @@ The config file must be named `bun-sqlite.config.ts` and placed at the root of y
|
|||||||
### Database Schema
|
### Database Schema
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
interface BUN_SQLITE_DatabaseSchemaType {
|
interface NSQLITE_DatabaseSchemaType {
|
||||||
dbName?: string;
|
dbName?: string;
|
||||||
tables: BUN_SQLITE_TableSchemaType[];
|
tables: NSQLITE_TableSchemaType[];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Table Schema
|
### Table Schema
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
interface BUN_SQLITE_TableSchemaType {
|
interface NSQLITE_TableSchemaType {
|
||||||
tableName: string;
|
tableName: string;
|
||||||
tableDescription?: string;
|
tableDescription?: string;
|
||||||
fields: BUN_SQLITE_FieldSchemaType[];
|
fields: NSQLITE_FieldSchemaType[];
|
||||||
indexes?: BUN_SQLITE_IndexSchemaType[];
|
indexes?: NSQLITE_IndexSchemaType[];
|
||||||
uniqueConstraints?: BUN_SQLITE_UniqueConstraintSchemaType[];
|
uniqueConstraints?: NSQLITE_UniqueConstraintSchemaType[];
|
||||||
parentTableName?: string; // inherit fields from another table in the schema
|
parentTableName?: string; // inherit fields from another table in the schema
|
||||||
tableNameOld?: string; // rename: set this to the old name to trigger ALTER TABLE RENAME
|
tableNameOld?: string; // rename: set this to the old name to trigger ALTER TABLE RENAME
|
||||||
isVector?: boolean; // mark this as a sqlite-vec virtual table
|
isVector?: boolean; // mark this as a sqlite-vec virtual table
|
||||||
@ -190,7 +190,7 @@ interface BUN_SQLITE_TableSchemaType {
|
|||||||
### Field Schema
|
### Field Schema
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
type BUN_SQLITE_FieldSchemaType = {
|
type NSQLITE_FieldSchemaType = {
|
||||||
fieldName?: string;
|
fieldName?: string;
|
||||||
dataType: "TEXT" | "INTEGER";
|
dataType: "TEXT" | "INTEGER";
|
||||||
primaryKey?: boolean;
|
primaryKey?: boolean;
|
||||||
@ -199,7 +199,7 @@ type BUN_SQLITE_FieldSchemaType = {
|
|||||||
unique?: boolean;
|
unique?: boolean;
|
||||||
defaultValue?: string | number;
|
defaultValue?: string | number;
|
||||||
defaultValueLiteral?: string; // raw SQL literal, e.g. "CURRENT_TIMESTAMP"
|
defaultValueLiteral?: string; // raw SQL literal, e.g. "CURRENT_TIMESTAMP"
|
||||||
foreignKey?: BUN_SQLITE_ForeignKeyType;
|
foreignKey?: NSQLITE_ForeignKeyType;
|
||||||
isVector?: boolean; // vector embedding column
|
isVector?: boolean; // vector embedding column
|
||||||
vectorSize?: number; // embedding dimensions (default: 1536)
|
vectorSize?: number; // embedding dimensions (default: 1536)
|
||||||
sideCar?: boolean; // sqlite-vec "+" prefix for side-car columns
|
sideCar?: boolean; // sqlite-vec "+" prefix for side-car columns
|
||||||
@ -210,7 +210,7 @@ type BUN_SQLITE_FieldSchemaType = {
|
|||||||
### Foreign Key
|
### Foreign Key
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
interface BUN_SQLITE_ForeignKeyType {
|
interface NSQLITE_ForeignKeyType {
|
||||||
destinationTableName: string;
|
destinationTableName: string;
|
||||||
destinationTableColumnName: string;
|
destinationTableColumnName: string;
|
||||||
cascadeDelete?: boolean;
|
cascadeDelete?: boolean;
|
||||||
@ -221,7 +221,7 @@ interface BUN_SQLITE_ForeignKeyType {
|
|||||||
### Index
|
### Index
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
interface BUN_SQLITE_IndexSchemaType {
|
interface NSQLITE_IndexSchemaType {
|
||||||
indexName?: string;
|
indexName?: string;
|
||||||
indexType?: "regular" | "full_text" | "vector";
|
indexType?: "regular" | "full_text" | "vector";
|
||||||
indexTableFields?: { value: string; dataType: string }[];
|
indexTableFields?: { value: string; dataType: string }[];
|
||||||
@ -231,7 +231,7 @@ interface BUN_SQLITE_IndexSchemaType {
|
|||||||
### Unique Constraint
|
### Unique Constraint
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
interface BUN_SQLITE_UniqueConstraintSchemaType {
|
interface NSQLITE_UniqueConstraintSchemaType {
|
||||||
constraintName?: string;
|
constraintName?: string;
|
||||||
constraintTableFields?: { value: string }[];
|
constraintTableFields?: { value: string }[];
|
||||||
}
|
}
|
||||||
@ -241,12 +241,12 @@ interface BUN_SQLITE_UniqueConstraintSchemaType {
|
|||||||
|
|
||||||
## CLI Commands
|
## CLI Commands
|
||||||
|
|
||||||
The package provides a `bun-sqlite` CLI binary.
|
The package provides a `nsqlite` CLI binary.
|
||||||
|
|
||||||
### `schema` — Sync database to schema
|
### `schema` — Sync database to schema
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx bun-sqlite schema [options]
|
npx nsqlite schema [options]
|
||||||
```
|
```
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
@ -258,19 +258,19 @@ npx bun-sqlite schema [options]
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Sync schema only
|
# Sync schema only
|
||||||
npx bun-sqlite schema
|
npx nsqlite schema
|
||||||
|
|
||||||
# Sync schema and regenerate types
|
# Sync schema and regenerate types
|
||||||
npx bun-sqlite schema --typedef
|
npx nsqlite schema --typedef
|
||||||
|
|
||||||
# Sync schema, recreate vector tables, and regenerate types
|
# Sync schema, recreate vector tables, and regenerate types
|
||||||
npx bun-sqlite schema --vector --typedef
|
npx nsqlite schema --vector --typedef
|
||||||
```
|
```
|
||||||
|
|
||||||
### `typedef` — Generate TypeScript types only
|
### `typedef` — Generate TypeScript types only
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx bun-sqlite typedef
|
npx nsqlite typedef
|
||||||
```
|
```
|
||||||
|
|
||||||
Reads the schema and writes TypeScript type definitions to the path configured in `typedef_file_path`.
|
Reads the schema and writes TypeScript type definitions to the path configured in `typedef_file_path`.
|
||||||
@ -280,7 +280,7 @@ Reads the schema and writes TypeScript type definitions to the path configured i
|
|||||||
### `backup` — Back up the database
|
### `backup` — Back up the database
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx bun-sqlite backup
|
npx nsqlite backup
|
||||||
```
|
```
|
||||||
|
|
||||||
Copies the current database file into `db_backup_dir` with a timestamped filename. After copying, the oldest backups are automatically pruned so the number of stored backups never exceeds `max_backups` (default: 10).
|
Copies the current database file into `db_backup_dir` with a timestamped filename. After copying, the oldest backups are automatically pruned so the number of stored backups never exceeds `max_backups` (default: 10).
|
||||||
@ -288,7 +288,7 @@ Copies the current database file into `db_backup_dir` with a timestamped filenam
|
|||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx bun-sqlite backup
|
npx nsqlite backup
|
||||||
# Backing up database ...
|
# Backing up database ...
|
||||||
# DB Backup Success!
|
# DB Backup Success!
|
||||||
```
|
```
|
||||||
@ -298,7 +298,7 @@ npx bun-sqlite backup
|
|||||||
### `restore` — Restore the database from a backup
|
### `restore` — Restore the database from a backup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx bun-sqlite restore
|
npx nsqlite restore
|
||||||
```
|
```
|
||||||
|
|
||||||
Presents an interactive list of available backups sorted by date (newest first). Select a backup to overwrite the current database file with it.
|
Presents an interactive list of available backups sorted by date (newest first). Select a backup to overwrite the current database file with it.
|
||||||
@ -306,7 +306,7 @@ Presents an interactive list of available backups sorted by date (newest first).
|
|||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx bun-sqlite restore
|
npx nsqlite restore
|
||||||
# Restoring up database ...
|
# Restoring up database ...
|
||||||
# ? Select a backup: (Use arrow keys)
|
# ? Select a backup: (Use arrow keys)
|
||||||
# ❯ Backup #1: Mon Mar 02 2026 14:30:00
|
# ❯ Backup #1: Mon Mar 02 2026 14:30:00
|
||||||
@ -660,10 +660,10 @@ const res = await NodeSQLite.select({
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Initial sync
|
# Initial sync
|
||||||
npx bun-sqlite schema
|
npx nsqlite schema
|
||||||
|
|
||||||
# Recreate vector tables (e.g. after changing vectorSize)
|
# Recreate vector tables (e.g. after changing vectorSize)
|
||||||
npx bun-sqlite schema --vector
|
npx nsqlite schema --vector
|
||||||
```
|
```
|
||||||
|
|
||||||
### Query vectors
|
### Query vectors
|
||||||
@ -691,16 +691,16 @@ const res = await NodeSQLite.select({
|
|||||||
|
|
||||||
Run the `typedef` command (or pass `--typedef` to `schema`) to generate a `.ts` file containing:
|
Run the `typedef` command (or pass `--typedef` to `schema`) to generate a `.ts` file containing:
|
||||||
|
|
||||||
- A `const` array of all table names (`BunSQLiteTables`)
|
- A `const` array of all table names (`NSQLiteTables`)
|
||||||
- A `type` for each table (named `BUN_SQLITE_<DB_NAME>_<TABLE_NAME>`)
|
- A `type` for each table (named `NSQLITE_<DB_NAME>_<TABLE_NAME>`)
|
||||||
- An intersection type `BUN_SQLITE_<DB_NAME>_ALL_TYPEDEFS`
|
- An intersection type `NSQLITE_<DB_NAME>_ALL_TYPEDEFS`
|
||||||
|
|
||||||
**Example output** (`db/types/db.ts`):
|
**Example output** (`db/types/db.ts`):
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
export const BunSQLiteTables = ["users"] as const;
|
export const NSQLiteTables = ["users"] as const;
|
||||||
|
|
||||||
export type BUN_SQLITE_MY_APP_USERS = {
|
export type NSQLITE_MY_APP_USERS = {
|
||||||
/** The unique identifier of the record. */
|
/** The unique identifier of the record. */
|
||||||
id?: number;
|
id?: number;
|
||||||
/** The time when the record was created. (Unix Timestamp) */
|
/** The time when the record was created. (Unix Timestamp) */
|
||||||
@ -712,17 +712,17 @@ export type BUN_SQLITE_MY_APP_USERS = {
|
|||||||
email?: string;
|
email?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BUN_SQLITE_MY_APP_ALL_TYPEDEFS = BUN_SQLITE_MY_APP_USERS; // intersection of all table types
|
export type NSQLITE_MY_APP_ALL_TYPEDEFS = NSQLITE_MY_APP_USERS; // intersection of all table types
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the generated types with the CRUD API for full type safety:
|
Use the generated types with the CRUD API for full type safety:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import NodeSQLite from "@moduletrace/nsqlite";
|
import NodeSQLite from "@moduletrace/nsqlite";
|
||||||
import { BUN_SQLITE_MY_APP_USERS, BunSQLiteTables } from "./db/types/db";
|
import { NSQLITE_MY_APP_USERS, NSQLiteTables } from "./db/types/db";
|
||||||
|
|
||||||
const res = await NodeSQLite.select<BUN_SQLITE_MY_APP_USERS>({
|
const res = await NodeSQLite.select<NSQLITE_MY_APP_USERS>({
|
||||||
table: "users" as (typeof BunSQLiteTables)[number],
|
table: "users" as (typeof NSQLiteTables)[number],
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -784,14 +784,14 @@ node-sqlite/
|
|||||||
│ └── trim-backups.ts # Prune oldest backups over max_backups
|
│ └── trim-backups.ts # Prune oldest backups over max_backups
|
||||||
└── test/
|
└── test/
|
||||||
├── test-01/ # Basic example project
|
├── test-01/ # Basic example project
|
||||||
│ ├── bun-sqlite.config.ts
|
│ ├── nsqlite.config.ts
|
||||||
│ ├── db/
|
│ ├── db/
|
||||||
│ │ ├── bun-sqlite-schema.ts
|
│ │ ├── nsqlite-schema.ts
|
||||||
│ │ └── types/bun-sqlite.ts # Generated types
|
│ │ └── types/nsqlite.ts # Generated types
|
||||||
│ └── src/
|
│ └── src/
|
||||||
│ └── sql.ts
|
│ └── sql.ts
|
||||||
└── test-02/ # Full CRUD example project
|
└── test-02/ # Full CRUD example project
|
||||||
├── bun-sqlite.config.ts
|
├── nsqlite.config.ts
|
||||||
├── index.ts
|
├── index.ts
|
||||||
└── src/crud/
|
└── src/crud/
|
||||||
├── insert.ts
|
├── insert.ts
|
||||||
|
|||||||
213
bun.lock
213
bun.lock
@ -1,213 +0,0 @@
|
|||||||
{
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"workspaces": {
|
|
||||||
"": {
|
|
||||||
"name": "@moduletrace/node-sqlite",
|
|
||||||
"dependencies": {
|
|
||||||
"@inquirer/prompts": "^8.3.0",
|
|
||||||
"better-sqlite3": "^12.6.2",
|
|
||||||
"chalk": "^5.6.2",
|
|
||||||
"commander": "^14.0.3",
|
|
||||||
"inquirer": "^13.3.0",
|
|
||||||
"lodash": "^4.17.23",
|
|
||||||
"mysql": "^2.18.1",
|
|
||||||
"sqlite-vec": "^0.1.7-alpha.2",
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/better-sqlite3": "^7.6.13",
|
|
||||||
"@types/bun": "latest",
|
|
||||||
"@types/lodash": "^4.17.24",
|
|
||||||
"@types/mysql": "^2.15.27",
|
|
||||||
"@types/node": "^25.3.3",
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"typescript": "^5",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"packages": {
|
|
||||||
"@inquirer/ansi": ["@inquirer/ansi@2.0.3", "", {}, "sha512-g44zhR3NIKVs0zUesa4iMzExmZpLUdTLRMCStqX3GE5NT6VkPcxQGJ+uC8tDgBUC/vB1rUhUd55cOf++4NZcmw=="],
|
|
||||||
|
|
||||||
"@inquirer/checkbox": ["@inquirer/checkbox@5.1.0", "", { "dependencies": { "@inquirer/ansi": "^2.0.3", "@inquirer/core": "^11.1.5", "@inquirer/figures": "^2.0.3", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-/HjF1LN0a1h4/OFsbGKHNDtWICFU/dqXCdym719HFTyJo9IG7Otr+ziGWc9S0iQuohRZllh+WprSgd5UW5Fw0g=="],
|
|
||||||
|
|
||||||
"@inquirer/confirm": ["@inquirer/confirm@6.0.8", "", { "dependencies": { "@inquirer/core": "^11.1.5", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-Di6dgmiZ9xCSUxWUReWTqDtbhXCuG2MQm2xmgSAIruzQzBqNf49b8E07/vbCYY506kDe8BiwJbegXweG8M1klw=="],
|
|
||||||
|
|
||||||
"@inquirer/core": ["@inquirer/core@11.1.5", "", { "dependencies": { "@inquirer/ansi": "^2.0.3", "@inquirer/figures": "^2.0.3", "@inquirer/type": "^4.0.3", "cli-width": "^4.1.0", "fast-wrap-ansi": "^0.2.0", "mute-stream": "^3.0.0", "signal-exit": "^4.1.0" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-QQPAX+lka8GyLcZ7u7Nb1h6q72iZ/oy0blilC3IB2nSt1Qqxp7akt94Jqhi/DzARuN3Eo9QwJRvtl4tmVe4T5A=="],
|
|
||||||
|
|
||||||
"@inquirer/editor": ["@inquirer/editor@5.0.8", "", { "dependencies": { "@inquirer/core": "^11.1.5", "@inquirer/external-editor": "^2.0.3", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-sLcpbb9B3XqUEGrj1N66KwhDhEckzZ4nI/W6SvLXyBX8Wic3LDLENlWRvkOGpCPoserabe+MxQkpiMoI8irvyA=="],
|
|
||||||
|
|
||||||
"@inquirer/expand": ["@inquirer/expand@5.0.8", "", { "dependencies": { "@inquirer/core": "^11.1.5", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-QieW3F1prNw3j+hxO7/NKkG1pk3oz7pOB6+5Upwu3OIwADfPX0oZVppsqlL+Vl/uBHHDSOBY0BirLctLnXwGGg=="],
|
|
||||||
|
|
||||||
"@inquirer/external-editor": ["@inquirer/external-editor@2.0.3", "", { "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.2" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-LgyI7Agbda74/cL5MvA88iDpvdXI2KuMBCGRkbCl2Dg1vzHeOgs+s0SDcXV7b+WZJrv2+ERpWSM65Fpi9VfY3w=="],
|
|
||||||
|
|
||||||
"@inquirer/figures": ["@inquirer/figures@2.0.3", "", {}, "sha512-y09iGt3JKoOCBQ3w4YrSJdokcD8ciSlMIWsD+auPu+OZpfxLuyz+gICAQ6GCBOmJJt4KEQGHuZSVff2jiNOy7g=="],
|
|
||||||
|
|
||||||
"@inquirer/input": ["@inquirer/input@5.0.8", "", { "dependencies": { "@inquirer/core": "^11.1.5", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-p0IJslw0AmedLEkOU+yrEX3Aj2RTpQq7ZOf8nc1DIhjzaxRWrrgeuE5Kyh39fVRgtcACaMXx/9WNo8+GjgBOfw=="],
|
|
||||||
|
|
||||||
"@inquirer/number": ["@inquirer/number@4.0.8", "", { "dependencies": { "@inquirer/core": "^11.1.5", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-uGLiQah9A0F9UIvJBX52m0CnqtLaym0WpT9V4YZrjZ+YRDKZdwwoEPz06N6w8ChE2lrnsdyhY9sL+Y690Kh9gQ=="],
|
|
||||||
|
|
||||||
"@inquirer/password": ["@inquirer/password@5.0.8", "", { "dependencies": { "@inquirer/ansi": "^2.0.3", "@inquirer/core": "^11.1.5", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-zt1sF4lYLdvPqvmvHdmjOzuUUjuCQ897pdUCO8RbXMUDKXJTTyOQgtn23le+jwcb+MpHl3VAFvzIdxRAf6aPlA=="],
|
|
||||||
|
|
||||||
"@inquirer/prompts": ["@inquirer/prompts@8.3.0", "", { "dependencies": { "@inquirer/checkbox": "^5.1.0", "@inquirer/confirm": "^6.0.8", "@inquirer/editor": "^5.0.8", "@inquirer/expand": "^5.0.8", "@inquirer/input": "^5.0.8", "@inquirer/number": "^4.0.8", "@inquirer/password": "^5.0.8", "@inquirer/rawlist": "^5.2.4", "@inquirer/search": "^4.1.4", "@inquirer/select": "^5.1.0" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-JAj66kjdH/F1+B7LCigjARbwstt3SNUOSzMdjpsvwJmzunK88gJeXmcm95L9nw1KynvFVuY4SzXh/3Y0lvtgSg=="],
|
|
||||||
|
|
||||||
"@inquirer/rawlist": ["@inquirer/rawlist@5.2.4", "", { "dependencies": { "@inquirer/core": "^11.1.5", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-fTuJ5Cq9W286isLxwj6GGyfTjx1Zdk4qppVEPexFuA6yioCCXS4V1zfKroQqw7QdbDPN73xs2DiIAlo55+kBqg=="],
|
|
||||||
|
|
||||||
"@inquirer/search": ["@inquirer/search@4.1.4", "", { "dependencies": { "@inquirer/core": "^11.1.5", "@inquirer/figures": "^2.0.3", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-9yPTxq7LPmYjrGn3DRuaPuPbmC6u3fiWcsE9ggfLcdgO/ICHYgxq7mEy1yJ39brVvgXhtOtvDVjDh9slJxE4LQ=="],
|
|
||||||
|
|
||||||
"@inquirer/select": ["@inquirer/select@5.1.0", "", { "dependencies": { "@inquirer/ansi": "^2.0.3", "@inquirer/core": "^11.1.5", "@inquirer/figures": "^2.0.3", "@inquirer/type": "^4.0.3" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-OyYbKnchS1u+zRe14LpYrN8S0wH1vD0p2yKISvSsJdH2TpI87fh4eZdWnpdbrGauCRWDph3NwxRmM4Pcm/hx1Q=="],
|
|
||||||
|
|
||||||
"@inquirer/type": ["@inquirer/type@4.0.3", "", { "peerDependencies": { "@types/node": ">=18" } }, "sha512-cKZN7qcXOpj1h+1eTTcGDVLaBIHNMT1Rz9JqJP5MnEJ0JhgVWllx7H/tahUp5YEK1qaByH2Itb8wLG/iScD5kw=="],
|
|
||||||
|
|
||||||
"@types/better-sqlite3": ["@types/better-sqlite3@7.6.13", "", { "dependencies": { "@types/node": "*" } }, "sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA=="],
|
|
||||||
|
|
||||||
"@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="],
|
|
||||||
|
|
||||||
"@types/lodash": ["@types/lodash@4.17.24", "", {}, "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ=="],
|
|
||||||
|
|
||||||
"@types/mysql": ["@types/mysql@2.15.27", "", { "dependencies": { "@types/node": "*" } }, "sha512-YfWiV16IY0OeBfBCk8+hXKmdTKrKlwKN1MNKAPBu5JYxLwBEZl7QzeEpGnlZb3VMGJrrGmB84gXiH+ofs/TezA=="],
|
|
||||||
|
|
||||||
"@types/node": ["@types/node@25.3.3", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ=="],
|
|
||||||
|
|
||||||
"base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
|
|
||||||
|
|
||||||
"better-sqlite3": ["better-sqlite3@12.6.2", "", { "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.1" } }, "sha512-8VYKM3MjCa9WcaSAI3hzwhmyHVlH8tiGFwf0RlTsZPWJ1I5MkzjiudCo4KC4DxOaL/53A5B1sI/IbldNFDbsKA=="],
|
|
||||||
|
|
||||||
"bignumber.js": ["bignumber.js@9.0.0", "", {}, "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="],
|
|
||||||
|
|
||||||
"bindings": ["bindings@1.5.0", "", { "dependencies": { "file-uri-to-path": "1.0.0" } }, "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="],
|
|
||||||
|
|
||||||
"bl": ["bl@4.1.0", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="],
|
|
||||||
|
|
||||||
"buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
|
|
||||||
|
|
||||||
"bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="],
|
|
||||||
|
|
||||||
"chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
|
|
||||||
|
|
||||||
"chardet": ["chardet@2.1.1", "", {}, "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ=="],
|
|
||||||
|
|
||||||
"chownr": ["chownr@1.1.4", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="],
|
|
||||||
|
|
||||||
"cli-width": ["cli-width@4.1.0", "", {}, "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ=="],
|
|
||||||
|
|
||||||
"commander": ["commander@14.0.3", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],
|
|
||||||
|
|
||||||
"core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="],
|
|
||||||
|
|
||||||
"decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="],
|
|
||||||
|
|
||||||
"deep-extend": ["deep-extend@0.6.0", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="],
|
|
||||||
|
|
||||||
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
|
||||||
|
|
||||||
"end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
|
|
||||||
|
|
||||||
"expand-template": ["expand-template@2.0.3", "", {}, "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="],
|
|
||||||
|
|
||||||
"fast-string-truncated-width": ["fast-string-truncated-width@3.0.3", "", {}, "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g=="],
|
|
||||||
|
|
||||||
"fast-string-width": ["fast-string-width@3.0.2", "", { "dependencies": { "fast-string-truncated-width": "^3.0.2" } }, "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg=="],
|
|
||||||
|
|
||||||
"fast-wrap-ansi": ["fast-wrap-ansi@0.2.0", "", { "dependencies": { "fast-string-width": "^3.0.2" } }, "sha512-rLV8JHxTyhVmFYhBJuMujcrHqOT2cnO5Zxj37qROj23CP39GXubJRBUFF0z8KFK77Uc0SukZUf7JZhsVEQ6n8w=="],
|
|
||||||
|
|
||||||
"file-uri-to-path": ["file-uri-to-path@1.0.0", "", {}, "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="],
|
|
||||||
|
|
||||||
"fs-constants": ["fs-constants@1.0.0", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="],
|
|
||||||
|
|
||||||
"github-from-package": ["github-from-package@0.0.0", "", {}, "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="],
|
|
||||||
|
|
||||||
"iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
|
|
||||||
|
|
||||||
"ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
|
|
||||||
|
|
||||||
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
|
||||||
|
|
||||||
"ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
|
|
||||||
|
|
||||||
"inquirer": ["inquirer@13.3.0", "", { "dependencies": { "@inquirer/ansi": "^2.0.3", "@inquirer/core": "^11.1.5", "@inquirer/prompts": "^8.3.0", "@inquirer/type": "^4.0.3", "mute-stream": "^3.0.0", "run-async": "^4.0.6", "rxjs": "^7.8.2" }, "peerDependencies": { "@types/node": ">=18" } }, "sha512-APTrZe9IhrsshL0u2PgmEMLP3CXDBjZ99xh5dR2+sryOt5R+JGL0KNuaTTT2lW54B9eNQDMutPR05UYTL7Xb1Q=="],
|
|
||||||
|
|
||||||
"isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="],
|
|
||||||
|
|
||||||
"lodash": ["lodash@4.17.23", "", {}, "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w=="],
|
|
||||||
|
|
||||||
"mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
|
|
||||||
|
|
||||||
"minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
|
|
||||||
|
|
||||||
"mkdirp-classic": ["mkdirp-classic@0.5.3", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="],
|
|
||||||
|
|
||||||
"mute-stream": ["mute-stream@3.0.0", "", {}, "sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw=="],
|
|
||||||
|
|
||||||
"mysql": ["mysql@2.18.1", "", { "dependencies": { "bignumber.js": "9.0.0", "readable-stream": "2.3.7", "safe-buffer": "5.1.2", "sqlstring": "2.3.1" } }, "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig=="],
|
|
||||||
|
|
||||||
"napi-build-utils": ["napi-build-utils@2.0.0", "", {}, "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="],
|
|
||||||
|
|
||||||
"node-abi": ["node-abi@3.87.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ=="],
|
|
||||||
|
|
||||||
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
|
||||||
|
|
||||||
"prebuild-install": ["prebuild-install@7.1.3", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": "bin.js" }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="],
|
|
||||||
|
|
||||||
"process-nextick-args": ["process-nextick-args@2.0.1", "", {}, "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="],
|
|
||||||
|
|
||||||
"pump": ["pump@3.0.4", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],
|
|
||||||
|
|
||||||
"rc": ["rc@1.2.8", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": "cli.js" }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="],
|
|
||||||
|
|
||||||
"readable-stream": ["readable-stream@2.3.7", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw=="],
|
|
||||||
|
|
||||||
"run-async": ["run-async@4.0.6", "", {}, "sha512-IoDlSLTs3Yq593mb3ZoKWKXMNu3UpObxhgA/Xuid5p4bbfi2jdY1Hj0m1K+0/tEuQTxIGMhQDqGjKb7RuxGpAQ=="],
|
|
||||||
|
|
||||||
"rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="],
|
|
||||||
|
|
||||||
"safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="],
|
|
||||||
|
|
||||||
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
|
||||||
|
|
||||||
"semver": ["semver@7.7.4", "", { "bin": "bin/semver.js" }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
|
||||||
|
|
||||||
"signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
|
|
||||||
|
|
||||||
"simple-concat": ["simple-concat@1.0.1", "", {}, "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="],
|
|
||||||
|
|
||||||
"simple-get": ["simple-get@4.0.1", "", { "dependencies": { "decompress-response": "^6.0.0", "once": "^1.3.1", "simple-concat": "^1.0.0" } }, "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA=="],
|
|
||||||
|
|
||||||
"sqlite-vec": ["sqlite-vec@0.1.7-alpha.2", "", { "optionalDependencies": { "sqlite-vec-darwin-arm64": "0.1.7-alpha.2", "sqlite-vec-darwin-x64": "0.1.7-alpha.2", "sqlite-vec-linux-arm64": "0.1.7-alpha.2", "sqlite-vec-linux-x64": "0.1.7-alpha.2", "sqlite-vec-windows-x64": "0.1.7-alpha.2" } }, "sha512-rNgRCv+4V4Ed3yc33Qr+nNmjhtrMnnHzXfLVPeGb28Dx5mmDL3Ngw/Wk8vhCGjj76+oC6gnkmMG8y73BZWGBwQ=="],
|
|
||||||
|
|
||||||
"sqlite-vec-darwin-arm64": ["sqlite-vec-darwin-arm64@0.1.7-alpha.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-raIATOqFYkeCHhb/t3r7W7Cf2lVYdf4J3ogJ6GFc8PQEgHCPEsi+bYnm2JT84MzLfTlSTIdxr4/NKv+zF7oLPw=="],
|
|
||||||
|
|
||||||
"sqlite-vec-darwin-x64": ["sqlite-vec-darwin-x64@0.1.7-alpha.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-jeZEELsQjjRsVojsvU5iKxOvkaVuE+JYC8Y4Ma8U45aAERrDYmqZoHvgSG7cg1PXL3bMlumFTAmHynf1y4pOzA=="],
|
|
||||||
|
|
||||||
"sqlite-vec-linux-arm64": ["sqlite-vec-linux-arm64@0.1.7-alpha.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-6Spj4Nfi7tG13jsUG+W7jnT0bCTWbyPImu2M8nWp20fNrd1SZ4g3CSlDAK8GBdavX7wRlbBHCZ+BDa++rbDewA=="],
|
|
||||||
|
|
||||||
"sqlite-vec-linux-x64": ["sqlite-vec-linux-x64@0.1.7-alpha.2", "", { "os": "linux", "cpu": "x64" }, "sha512-IcgrbHaDccTVhXDf8Orwdc2+hgDLAFORl6OBUhcvlmwswwBP1hqBTSEhovClG4NItwTOBNgpwOoQ7Qp3VDPWLg=="],
|
|
||||||
|
|
||||||
"sqlite-vec-windows-x64": ["sqlite-vec-windows-x64@0.1.7-alpha.2", "", { "os": "win32", "cpu": "x64" }, "sha512-TRP6hTjAcwvQ6xpCZvjP00pdlda8J38ArFy1lMYhtQWXiIBmWnhMaMbq4kaeCYwvTTddfidatRS+TJrwIKB/oQ=="],
|
|
||||||
|
|
||||||
"sqlstring": ["sqlstring@2.3.1", "", {}, "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ=="],
|
|
||||||
|
|
||||||
"string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],
|
|
||||||
|
|
||||||
"strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
|
|
||||||
|
|
||||||
"tar-fs": ["tar-fs@2.1.4", "", { "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" } }, "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ=="],
|
|
||||||
|
|
||||||
"tar-stream": ["tar-stream@2.2.0", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],
|
|
||||||
|
|
||||||
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
|
||||||
|
|
||||||
"tunnel-agent": ["tunnel-agent@0.6.0", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
|
|
||||||
|
|
||||||
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
||||||
|
|
||||||
"undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],
|
|
||||||
|
|
||||||
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
|
||||||
|
|
||||||
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
|
||||||
|
|
||||||
"bl/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
|
||||||
|
|
||||||
"tar-stream/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
dist/commands/index.d.ts
vendored
2
dist/commands/index.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env node
|
||||||
/**
|
/**
|
||||||
* # Declare Global Variables
|
* # Declare Global Variables
|
||||||
*/
|
*/
|
||||||
|
|||||||
8
dist/commands/index.js
vendored
8
dist/commands/index.js
vendored
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env node
|
||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
@ -13,9 +13,9 @@ const restore_1 = __importDefault(require("./restore"));
|
|||||||
* # Describe Program
|
* # Describe Program
|
||||||
*/
|
*/
|
||||||
commander_1.program
|
commander_1.program
|
||||||
.name(`bun-sqlite`)
|
.name(`nsqlite`)
|
||||||
.description(`SQLite manager for Bun`)
|
.description(`SQLite manager for Node JS`)
|
||||||
.version(`1.0.0`);
|
.version(`1.1.0`);
|
||||||
/**
|
/**
|
||||||
* # Declare Commands
|
* # Declare Commands
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
dist/data/app-data.d.ts
vendored
2
dist/data/app-data.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
export declare const AppData: {
|
export declare const AppData: {
|
||||||
readonly ConfigFileName: "bun-sqlite.config.ts";
|
readonly ConfigFileName: "nsqlite.config.ts";
|
||||||
readonly MaxBackups: 10;
|
readonly MaxBackups: 10;
|
||||||
readonly DefaultBackupDirName: ".backups";
|
readonly DefaultBackupDirName: ".backups";
|
||||||
};
|
};
|
||||||
|
|||||||
2
dist/data/app-data.js
vendored
2
dist/data/app-data.js
vendored
@ -2,7 +2,7 @@
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.AppData = void 0;
|
exports.AppData = void 0;
|
||||||
exports.AppData = {
|
exports.AppData = {
|
||||||
ConfigFileName: "bun-sqlite.config.ts",
|
ConfigFileName: "nsqlite.config.ts",
|
||||||
MaxBackups: 10,
|
MaxBackups: 10,
|
||||||
DefaultBackupDirName: ".backups",
|
DefaultBackupDirName: ".backups",
|
||||||
};
|
};
|
||||||
|
|||||||
4
dist/functions/init.d.ts
vendored
4
dist/functions/init.d.ts
vendored
@ -1,2 +1,2 @@
|
|||||||
import type { BunSQLiteConfigReturn } from "../types";
|
import type { NSQLiteConfigReturn } from "../types";
|
||||||
export default function init(): BunSQLiteConfigReturn;
|
export default function init(): NSQLiteConfigReturn;
|
||||||
|
|||||||
4
dist/lib/sqlite/db-generate-type-defs.d.ts
vendored
4
dist/lib/sqlite/db-generate-type-defs.d.ts
vendored
@ -1,7 +1,7 @@
|
|||||||
import type { BUN_SQLITE_TableSchemaType } from "../../types";
|
import type { NSQLITE_TableSchemaType } from "../../types";
|
||||||
type Param = {
|
type Param = {
|
||||||
paradigm: "JavaScript" | "TypeScript" | undefined;
|
paradigm: "JavaScript" | "TypeScript" | undefined;
|
||||||
table: BUN_SQLITE_TableSchemaType;
|
table: NSQLITE_TableSchemaType;
|
||||||
query?: any;
|
query?: any;
|
||||||
typeDefName?: string;
|
typeDefName?: string;
|
||||||
allValuesOptional?: boolean;
|
allValuesOptional?: boolean;
|
||||||
|
|||||||
4
dist/lib/sqlite/db-generate-type-defs.js
vendored
4
dist/lib/sqlite/db-generate-type-defs.js
vendored
@ -8,8 +8,8 @@ function generateTypeDefinition({ paradigm, table, query, typeDefName, allValues
|
|||||||
tdName = typeDefName
|
tdName = typeDefName
|
||||||
? typeDefName
|
? typeDefName
|
||||||
: dbName
|
: dbName
|
||||||
? `BUN_SQLITE_${dbName}_${table.tableName}`.toUpperCase()
|
? `NSQLITE_${dbName}_${table.tableName}`.toUpperCase()
|
||||||
: `BUN_SQLITE_${query.single}_${query.single_table}`.toUpperCase();
|
: `NSQLITE_${query.single}_${query.single_table}`.toUpperCase();
|
||||||
const fields = table.fields;
|
const fields = table.fields;
|
||||||
function typeMap(schemaType) {
|
function typeMap(schemaType) {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c;
|
||||||
|
|||||||
6
dist/lib/sqlite/db-schema-manager.d.ts
vendored
6
dist/lib/sqlite/db-schema-manager.d.ts
vendored
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env node
|
||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||||
declare class SQLiteSchemaManager {
|
declare class SQLiteSchemaManager {
|
||||||
private db;
|
private db;
|
||||||
private db_manager_table_name;
|
private db_manager_table_name;
|
||||||
private recreate_vector_table;
|
private recreate_vector_table;
|
||||||
private db_schema;
|
private db_schema;
|
||||||
constructor({ schema, recreate_vector_table, }: {
|
constructor({ schema, recreate_vector_table, }: {
|
||||||
schema: BUN_SQLITE_DatabaseSchemaType;
|
schema: NSQLITE_DatabaseSchemaType;
|
||||||
recreate_vector_table?: boolean;
|
recreate_vector_table?: boolean;
|
||||||
});
|
});
|
||||||
private createDbManagerTable;
|
private createDbManagerTable;
|
||||||
|
|||||||
2
dist/lib/sqlite/db-schema-manager.js
vendored
2
dist/lib/sqlite/db-schema-manager.js
vendored
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env node
|
||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
|||||||
4
dist/lib/sqlite/db-schema-to-typedef.d.ts
vendored
4
dist/lib/sqlite/db-schema-to-typedef.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||||
type Params = {
|
type Params = {
|
||||||
dbSchema?: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema?: NSQLITE_DatabaseSchemaType;
|
||||||
};
|
};
|
||||||
export default function dbSchemaToType(params?: Params): string[] | undefined;
|
export default function dbSchemaToType(params?: Params): string[] | undefined;
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
6
dist/lib/sqlite/db-schema-to-typedef.js
vendored
6
dist/lib/sqlite/db-schema-to-typedef.js
vendored
@ -11,7 +11,7 @@ function dbSchemaToType(params) {
|
|||||||
let datasquirelSchema = params === null || params === void 0 ? void 0 : params.dbSchema;
|
let datasquirelSchema = params === null || params === void 0 ? void 0 : params.dbSchema;
|
||||||
if (!datasquirelSchema)
|
if (!datasquirelSchema)
|
||||||
return;
|
return;
|
||||||
let tableNames = `export const BunSQLiteTables = [\n${datasquirelSchema.tables
|
let tableNames = `export const NSQLiteTables = [\n${datasquirelSchema.tables
|
||||||
.map((tbl) => ` "${tbl.tableName}",`)
|
.map((tbl) => ` "${tbl.tableName}",`)
|
||||||
.join("\n")}\n] as const`;
|
.join("\n")}\n] as const`;
|
||||||
const dbTablesSchemas = datasquirelSchema.tables;
|
const dbTablesSchemas = datasquirelSchema.tables;
|
||||||
@ -33,7 +33,7 @@ function dbSchemaToType(params) {
|
|||||||
const defObj = (0, db_generate_type_defs_1.default)({
|
const defObj = (0, db_generate_type_defs_1.default)({
|
||||||
paradigm: "TypeScript",
|
paradigm: "TypeScript",
|
||||||
table: final_table,
|
table: final_table,
|
||||||
typeDefName: `BUN_SQLITE_${defDbName}_${final_table.tableName.toUpperCase()}`,
|
typeDefName: `NSQLITE_${defDbName}_${final_table.tableName.toUpperCase()}`,
|
||||||
allValuesOptional: true,
|
allValuesOptional: true,
|
||||||
addExport: true,
|
addExport: true,
|
||||||
});
|
});
|
||||||
@ -44,7 +44,7 @@ function dbSchemaToType(params) {
|
|||||||
})
|
})
|
||||||
.filter((schm) => typeof schm == "string");
|
.filter((schm) => typeof schm == "string");
|
||||||
const allTd = (defNames === null || defNames === void 0 ? void 0 : defNames[0])
|
const allTd = (defNames === null || defNames === void 0 ? void 0 : defNames[0])
|
||||||
? `export type BUN_SQLITE_${defDbName}_ALL_TYPEDEFS = ${defNames.join(` & `)}`
|
? `export type NSQLITE_${defDbName}_ALL_TYPEDEFS = ${defNames.join(` & `)}`
|
||||||
: ``;
|
: ``;
|
||||||
return [tableNames, ...schemas, allTd];
|
return [tableNames, ...schemas, allTd];
|
||||||
}
|
}
|
||||||
|
|||||||
4
dist/lib/sqlite/schema-to-typedef.d.ts
vendored
4
dist/lib/sqlite/schema-to-typedef.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||||
type Params = {
|
type Params = {
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
dst_file: string;
|
dst_file: string;
|
||||||
};
|
};
|
||||||
export default function dbSchemaToTypeDef({ dbSchema, dst_file }: Params): void;
|
export default function dbSchemaToTypeDef({ dbSchema, dst_file }: Params): void;
|
||||||
|
|||||||
4
dist/lib/sqlite/schema.d.ts
vendored
4
dist/lib/sqlite/schema.d.ts
vendored
@ -1,2 +1,2 @@
|
|||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||||
export declare const DbSchema: BUN_SQLITE_DatabaseSchemaType;
|
export declare const DbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
|
|||||||
78
dist/types/index.d.ts
vendored
78
dist/types/index.d.ts
vendored
@ -1,32 +1,32 @@
|
|||||||
import type { RequestOptions } from "https";
|
import type { RequestOptions } from "https";
|
||||||
export type BUN_SQLITE_DatabaseFullName = string;
|
export type NSQLITE_DatabaseFullName = string;
|
||||||
export declare const UsersOmitedFields: readonly ["password", "social_id", "verification_status", "date_created", "date_created_code", "date_created_timestamp", "date_updated", "date_updated_code", "date_updated_timestamp"];
|
export declare const UsersOmitedFields: readonly ["password", "social_id", "verification_status", "date_created", "date_created_code", "date_created_timestamp", "date_updated", "date_updated_code", "date_updated_timestamp"];
|
||||||
export interface BUN_SQLITE_DatabaseSchemaType {
|
export interface NSQLITE_DatabaseSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
dbName?: string;
|
dbName?: string;
|
||||||
dbSlug?: string;
|
dbSlug?: string;
|
||||||
dbFullName?: string;
|
dbFullName?: string;
|
||||||
dbDescription?: string;
|
dbDescription?: string;
|
||||||
dbImage?: string;
|
dbImage?: string;
|
||||||
tables: BUN_SQLITE_TableSchemaType[];
|
tables: NSQLITE_TableSchemaType[];
|
||||||
childrenDatabases?: BUN_SQLITE_ChildrenDatabaseObject[];
|
childrenDatabases?: NSQLITE_ChildrenDatabaseObject[];
|
||||||
childDatabase?: boolean;
|
childDatabase?: boolean;
|
||||||
childDatabaseDbId?: string | number;
|
childDatabaseDbId?: string | number;
|
||||||
updateData?: boolean;
|
updateData?: boolean;
|
||||||
collation?: (typeof MariaDBCollations)[number];
|
collation?: (typeof MariaDBCollations)[number];
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_ChildrenDatabaseObject {
|
export interface NSQLITE_ChildrenDatabaseObject {
|
||||||
dbId?: string | number;
|
dbId?: string | number;
|
||||||
}
|
}
|
||||||
export declare const MariaDBCollations: readonly ["utf8mb4_bin", "utf8mb4_unicode_520_ci"];
|
export declare const MariaDBCollations: readonly ["utf8mb4_bin", "utf8mb4_unicode_520_ci"];
|
||||||
export interface BUN_SQLITE_TableSchemaType {
|
export interface NSQLITE_TableSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
tableName: string;
|
tableName: string;
|
||||||
tableDescription?: string;
|
tableDescription?: string;
|
||||||
fields: BUN_SQLITE_FieldSchemaType[];
|
fields: NSQLITE_FieldSchemaType[];
|
||||||
indexes?: BUN_SQLITE_IndexSchemaType[];
|
indexes?: NSQLITE_IndexSchemaType[];
|
||||||
uniqueConstraints?: BUN_SQLITE_UniqueConstraintSchemaType[];
|
uniqueConstraints?: NSQLITE_UniqueConstraintSchemaType[];
|
||||||
childrenTables?: BUN_SQLITE_ChildrenTablesType[];
|
childrenTables?: NSQLITE_ChildrenTablesType[];
|
||||||
/**
|
/**
|
||||||
* Whether this is a child table
|
* Whether this is a child table
|
||||||
*/
|
*/
|
||||||
@ -61,7 +61,7 @@ export interface BUN_SQLITE_TableSchemaType {
|
|||||||
isVector?: boolean;
|
isVector?: boolean;
|
||||||
vectorType?: string;
|
vectorType?: string;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_ChildrenTablesType {
|
export interface NSQLITE_ChildrenTablesType {
|
||||||
tableId?: string | number;
|
tableId?: string | number;
|
||||||
dbId?: string | number;
|
dbId?: string | number;
|
||||||
}
|
}
|
||||||
@ -96,18 +96,18 @@ export declare const TextFieldTypesArray: readonly [{
|
|||||||
readonly title: "Code";
|
readonly title: "Code";
|
||||||
readonly value: "code";
|
readonly value: "code";
|
||||||
}];
|
}];
|
||||||
export declare const BUN_SQLITE_DATATYPES: readonly [{
|
export declare const NSQLITE_DATATYPES: readonly [{
|
||||||
readonly value: "TEXT";
|
readonly value: "TEXT";
|
||||||
}, {
|
}, {
|
||||||
readonly value: "INTEGER";
|
readonly value: "INTEGER";
|
||||||
}];
|
}];
|
||||||
export type BUN_SQLITE_FieldSchemaType = {
|
export type NSQLITE_FieldSchemaType = {
|
||||||
id?: number | string;
|
id?: number | string;
|
||||||
fieldName?: string;
|
fieldName?: string;
|
||||||
fieldDescription?: string;
|
fieldDescription?: string;
|
||||||
originName?: string;
|
originName?: string;
|
||||||
updatedField?: boolean;
|
updatedField?: boolean;
|
||||||
dataType: (typeof BUN_SQLITE_DATATYPES)[number]["value"];
|
dataType: (typeof NSQLITE_DATATYPES)[number]["value"];
|
||||||
nullValue?: boolean;
|
nullValue?: boolean;
|
||||||
notNullValue?: boolean;
|
notNullValue?: boolean;
|
||||||
primaryKey?: boolean;
|
primaryKey?: boolean;
|
||||||
@ -115,7 +115,7 @@ export type BUN_SQLITE_FieldSchemaType = {
|
|||||||
autoIncrement?: boolean;
|
autoIncrement?: boolean;
|
||||||
defaultValue?: string | number;
|
defaultValue?: string | number;
|
||||||
defaultValueLiteral?: string;
|
defaultValueLiteral?: string;
|
||||||
foreignKey?: BUN_SQLITE_ForeignKeyType;
|
foreignKey?: NSQLITE_ForeignKeyType;
|
||||||
defaultField?: boolean;
|
defaultField?: boolean;
|
||||||
plainText?: boolean;
|
plainText?: boolean;
|
||||||
unique?: boolean;
|
unique?: boolean;
|
||||||
@ -156,7 +156,7 @@ CREATE VIRTUAL TABLE documents USING vec0(
|
|||||||
|
|
||||||
-- INSERTING (Notice: No '+' here)
|
-- INSERTING (Notice: No '+' here)
|
||||||
INSERT INTO documents(embedding, title, raw_body)
|
INSERT INTO documents(embedding, title, raw_body)
|
||||||
VALUES (vec_f32(?), 'Bun Docs', 'Bun is a fast JavaScript runtime...');
|
VALUES (vec_f32(?), 'Node Docs', 'Node is a fast JavaScript runtime...');
|
||||||
|
|
||||||
-- QUERYING (Notice: No '+' here)
|
-- QUERYING (Notice: No '+' here)
|
||||||
SELECT title, raw_body
|
SELECT title, raw_body
|
||||||
@ -168,7 +168,7 @@ WHERE embedding MATCH ? AND k = 1;
|
|||||||
} & {
|
} & {
|
||||||
[key in (typeof TextFieldTypesArray)[number]["value"]]?: boolean;
|
[key in (typeof TextFieldTypesArray)[number]["value"]]?: boolean;
|
||||||
};
|
};
|
||||||
export interface BUN_SQLITE_ForeignKeyType {
|
export interface NSQLITE_ForeignKeyType {
|
||||||
foreignKeyName?: string;
|
foreignKeyName?: string;
|
||||||
destinationTableName?: string;
|
destinationTableName?: string;
|
||||||
destinationTableColumnName?: string;
|
destinationTableColumnName?: string;
|
||||||
@ -176,28 +176,28 @@ export interface BUN_SQLITE_ForeignKeyType {
|
|||||||
cascadeDelete?: boolean;
|
cascadeDelete?: boolean;
|
||||||
cascadeUpdate?: boolean;
|
cascadeUpdate?: boolean;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_IndexSchemaType {
|
export interface NSQLITE_IndexSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
indexName?: string;
|
indexName?: string;
|
||||||
indexType?: (typeof IndexTypes)[number];
|
indexType?: (typeof IndexTypes)[number];
|
||||||
indexTableFields?: BUN_SQLITE_IndexTableFieldType[];
|
indexTableFields?: NSQLITE_IndexTableFieldType[];
|
||||||
alias?: string;
|
alias?: string;
|
||||||
newTempIndex?: boolean;
|
newTempIndex?: boolean;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_UniqueConstraintSchemaType {
|
export interface NSQLITE_UniqueConstraintSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
constraintName?: string;
|
constraintName?: string;
|
||||||
alias?: string;
|
alias?: string;
|
||||||
constraintTableFields?: BUN_SQLITE_UniqueConstraintFieldType[];
|
constraintTableFields?: NSQLITE_UniqueConstraintFieldType[];
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_UniqueConstraintFieldType {
|
export interface NSQLITE_UniqueConstraintFieldType {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_IndexTableFieldType {
|
export interface NSQLITE_IndexTableFieldType {
|
||||||
value: string;
|
value: string;
|
||||||
dataType: string;
|
dataType: string;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_MYSQL_SHOW_INDEXES_Type {
|
export interface NSQLITE_MYSQL_SHOW_INDEXES_Type {
|
||||||
Key_name: string;
|
Key_name: string;
|
||||||
Table: string;
|
Table: string;
|
||||||
Column_name: string;
|
Column_name: string;
|
||||||
@ -207,7 +207,7 @@ export interface BUN_SQLITE_MYSQL_SHOW_INDEXES_Type {
|
|||||||
Index_comment: string;
|
Index_comment: string;
|
||||||
Comment: string;
|
Comment: string;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_MYSQL_SHOW_COLUMNS_Type {
|
export interface NSQLITE_MYSQL_SHOW_COLUMNS_Type {
|
||||||
Field: string;
|
Field: string;
|
||||||
Type: string;
|
Type: string;
|
||||||
Null: string;
|
Null: string;
|
||||||
@ -215,7 +215,7 @@ export interface BUN_SQLITE_MYSQL_SHOW_COLUMNS_Type {
|
|||||||
Default: string;
|
Default: string;
|
||||||
Extra: string;
|
Extra: string;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_MARIADB_SHOW_INDEXES_TYPE {
|
export interface NSQLITE_MARIADB_SHOW_INDEXES_TYPE {
|
||||||
Table: string;
|
Table: string;
|
||||||
Non_unique: 0 | 1;
|
Non_unique: 0 | 1;
|
||||||
Key_name: string;
|
Key_name: string;
|
||||||
@ -230,12 +230,12 @@ export interface BUN_SQLITE_MARIADB_SHOW_INDEXES_TYPE {
|
|||||||
Index_comment?: string;
|
Index_comment?: string;
|
||||||
Ignored?: "YES" | "NO";
|
Ignored?: "YES" | "NO";
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_MYSQL_FOREIGN_KEYS_Type {
|
export interface NSQLITE_MYSQL_FOREIGN_KEYS_Type {
|
||||||
CONSTRAINT_NAME: string;
|
CONSTRAINT_NAME: string;
|
||||||
CONSTRAINT_SCHEMA: string;
|
CONSTRAINT_SCHEMA: string;
|
||||||
TABLE_NAME: string;
|
TABLE_NAME: string;
|
||||||
}
|
}
|
||||||
export interface BUN_SQLITE_MYSQL_user_databases_Type {
|
export interface NSQLITE_MYSQL_user_databases_Type {
|
||||||
id: number;
|
id: number;
|
||||||
user_id: number;
|
user_id: number;
|
||||||
db_full_name: string;
|
db_full_name: string;
|
||||||
@ -362,7 +362,7 @@ export interface GetReturn<R extends any = any> {
|
|||||||
payload?: R;
|
payload?: R;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
schema?: BUN_SQLITE_TableSchemaType;
|
schema?: NSQLITE_TableSchemaType;
|
||||||
finalQuery?: string;
|
finalQuery?: string;
|
||||||
}
|
}
|
||||||
export interface GetSchemaRequestQuery {
|
export interface GetSchemaRequestQuery {
|
||||||
@ -383,7 +383,7 @@ export interface PostReturn {
|
|||||||
payload?: Object[] | string | PostInsertReturn;
|
payload?: Object[] | string | PostInsertReturn;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
error?: any;
|
error?: any;
|
||||||
schema?: BUN_SQLITE_TableSchemaType;
|
schema?: NSQLITE_TableSchemaType;
|
||||||
}
|
}
|
||||||
export interface PostDataPayload {
|
export interface PostDataPayload {
|
||||||
action: "insert" | "update" | "delete";
|
action: "insert" | "update" | "delete";
|
||||||
@ -615,8 +615,8 @@ export type ServerQueryParamsJoinMatchSourceTargetObject = {
|
|||||||
export type ApiConnectBody = {
|
export type ApiConnectBody = {
|
||||||
url: string;
|
url: string;
|
||||||
key: string;
|
key: string;
|
||||||
database: BUN_SQLITE_MYSQL_user_databases_Type;
|
database: NSQLITE_MYSQL_user_databases_Type;
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
type: "pull" | "push";
|
type: "pull" | "push";
|
||||||
user_id?: string | number;
|
user_id?: string | number;
|
||||||
};
|
};
|
||||||
@ -876,7 +876,7 @@ export type APIResponseObject<T extends {
|
|||||||
countQueryObject?: ResponseQueryObject;
|
countQueryObject?: ResponseQueryObject;
|
||||||
status?: number;
|
status?: number;
|
||||||
count?: number;
|
count?: number;
|
||||||
errors?: BUNSQLITEErrorObject[];
|
errors?: NSQLITEErrorObject[];
|
||||||
debug?: any;
|
debug?: any;
|
||||||
batchPayload?: any[][] | null;
|
batchPayload?: any[][] | null;
|
||||||
errorData?: any;
|
errorData?: any;
|
||||||
@ -965,7 +965,7 @@ export type DefaultEntryType = {
|
|||||||
[k: string]: string | number | null;
|
[k: string]: string | number | null;
|
||||||
};
|
};
|
||||||
export declare const IndexTypes: readonly ["regular", "full_text", "vector"];
|
export declare const IndexTypes: readonly ["regular", "full_text", "vector"];
|
||||||
export type BUNSQLITEErrorObject = {
|
export type NSQLITEErrorObject = {
|
||||||
sql?: string;
|
sql?: string;
|
||||||
sqlValues?: any[];
|
sqlValues?: any[];
|
||||||
error?: string;
|
error?: string;
|
||||||
@ -986,7 +986,7 @@ export type SQLInsertGenParams = {
|
|||||||
tableName: string;
|
tableName: string;
|
||||||
dbFullName?: string;
|
dbFullName?: string;
|
||||||
};
|
};
|
||||||
export type BunSQLiteConfig = {
|
export type NSQLiteConfig = {
|
||||||
db_name: string;
|
db_name: string;
|
||||||
/**
|
/**
|
||||||
* The Name of the Database Schema File. Eg `db_schema.ts`. This is
|
* The Name of the Database Schema File. Eg `db_schema.ts`. This is
|
||||||
@ -1008,8 +1008,8 @@ export type BunSQLiteConfig = {
|
|||||||
*/
|
*/
|
||||||
typedef_file_path?: string;
|
typedef_file_path?: string;
|
||||||
};
|
};
|
||||||
export type BunSQLiteConfigReturn = {
|
export type NSQLiteConfigReturn = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
};
|
};
|
||||||
export declare const DefaultFields: BUN_SQLITE_FieldSchemaType[];
|
export declare const DefaultFields: NSQLITE_FieldSchemaType[];
|
||||||
|
|||||||
4
dist/types/index.js
vendored
4
dist/types/index.js
vendored
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.DefaultFields = exports.IndexTypes = exports.DockerComposeServices = exports.QueryFields = exports.DsqlCrudActions = exports.DataCrudRequestMethodsLowerCase = exports.DataCrudRequestMethods = exports.ServerQueryEqualities = exports.ServerQueryOperators = exports.BUN_SQLITE_DATATYPES = exports.TextFieldTypesArray = exports.MariaDBCollations = exports.UsersOmitedFields = void 0;
|
exports.DefaultFields = exports.IndexTypes = exports.DockerComposeServices = exports.QueryFields = exports.DsqlCrudActions = exports.DataCrudRequestMethodsLowerCase = exports.DataCrudRequestMethods = exports.ServerQueryEqualities = exports.ServerQueryOperators = exports.NSQLITE_DATATYPES = exports.TextFieldTypesArray = exports.MariaDBCollations = exports.UsersOmitedFields = void 0;
|
||||||
exports.UsersOmitedFields = [
|
exports.UsersOmitedFields = [
|
||||||
"password",
|
"password",
|
||||||
"social_id",
|
"social_id",
|
||||||
@ -28,7 +28,7 @@ exports.TextFieldTypesArray = [
|
|||||||
{ title: "Shell", value: "shell" },
|
{ title: "Shell", value: "shell" },
|
||||||
{ title: "Code", value: "code" },
|
{ title: "Code", value: "code" },
|
||||||
];
|
];
|
||||||
exports.BUN_SQLITE_DATATYPES = [
|
exports.NSQLITE_DATATYPES = [
|
||||||
{ value: "TEXT" },
|
{ value: "TEXT" },
|
||||||
{ value: "INTEGER" },
|
{ value: "INTEGER" },
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { type BUN_SQLITE_DatabaseSchemaType } from "../types";
|
import { type NSQLITE_DatabaseSchemaType } from "../types";
|
||||||
type Params = {
|
type Params = {
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
};
|
};
|
||||||
export default function ({ dbSchema }: Params): BUN_SQLITE_DatabaseSchemaType;
|
export default function ({ dbSchema }: Params): NSQLITE_DatabaseSchemaType;
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
4
dist/utils/grab-db-backup-file-name.d.ts
vendored
4
dist/utils/grab-db-backup-file-name.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
export default function grabDBBackupFileName({ config }: Params): string;
|
export default function grabDBBackupFileName({ config }: Params): string;
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
4
dist/utils/grab-db-dir.d.ts
vendored
4
dist/utils/grab-db-dir.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
export default function grabDBDir({ config }: Params): {
|
export default function grabDBDir({ config }: Params): {
|
||||||
db_dir: string;
|
db_dir: string;
|
||||||
|
|||||||
4
dist/utils/grab-sorted-backups.d.ts
vendored
4
dist/utils/grab-sorted-backups.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
export default function grabSortedBackups({ config }: Params): string[];
|
export default function grabSortedBackups({ config }: Params): string[];
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
4
dist/utils/trim-backups.d.ts
vendored
4
dist/utils/trim-backups.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
export default function trimBackups({ config }: Params): void;
|
export default function trimBackups({ config }: Params): void;
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
16
package-lock.json
generated
16
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/node-sqlite",
|
"name": "@moduletrace/nsqlite",
|
||||||
"version": "1.0.8",
|
"version": "1.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@moduletrace/node-sqlite",
|
"name": "@moduletrace/nsqlite",
|
||||||
"version": "1.0.8",
|
"version": "1.0.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@inquirer/prompts": "^8.3.0",
|
"@inquirer/prompts": "^8.3.0",
|
||||||
"better-sqlite3": "^12.6.2",
|
"better-sqlite3": "^12.6.2",
|
||||||
@ -18,7 +18,7 @@
|
|||||||
"sqlite-vec": "^0.1.7-alpha.2"
|
"sqlite-vec": "^0.1.7-alpha.2"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"bun-sqlite": "dist/commands/index.js"
|
"nsqlite": "dist/commands/index.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/better-sqlite3": "^7.6.13",
|
"@types/better-sqlite3": "^7.6.13",
|
||||||
@ -397,9 +397,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "25.3.3",
|
"version": "25.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.3.5.tgz",
|
||||||
"integrity": "sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ==",
|
"integrity": "sha512-oX8xrhvpiyRCQkG1MFchB09f+cXftgIXb3a7UUa4Y3wpmZPw5tyZGTLWhlESOLq1Rq6oDlc8npVU2/9xiCuXMA==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/nsqlite",
|
"name": "@moduletrace/nsqlite",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "SQLite manager for Node JS",
|
"description": "SQLite manager for Node JS",
|
||||||
"author": "Benjamin Toby",
|
"author": "Benjamin Toby",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { program } from "commander";
|
import { program } from "commander";
|
||||||
import schema from "./schema";
|
import schema from "./schema";
|
||||||
@ -15,9 +15,9 @@ declare global {}
|
|||||||
* # Describe Program
|
* # Describe Program
|
||||||
*/
|
*/
|
||||||
program
|
program
|
||||||
.name(`bun-sqlite`)
|
.name(`nsqlite`)
|
||||||
.description(`SQLite manager for Bun`)
|
.description(`SQLite manager for Node JS`)
|
||||||
.version(`1.0.0`);
|
.version(`1.1.0`);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* # Declare Commands
|
* # Declare Commands
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export const AppData = {
|
export const AppData = {
|
||||||
ConfigFileName: "bun-sqlite.config.ts",
|
ConfigFileName: "nsqlite.config.ts",
|
||||||
MaxBackups: 10,
|
MaxBackups: 10,
|
||||||
DefaultBackupDirName: ".backups",
|
DefaultBackupDirName: ".backups",
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
@ -3,12 +3,12 @@ import fs from "fs";
|
|||||||
import { AppData } from "../data/app-data";
|
import { AppData } from "../data/app-data";
|
||||||
import grabDirNames from "../data/grab-dir-names";
|
import grabDirNames from "../data/grab-dir-names";
|
||||||
import type {
|
import type {
|
||||||
BunSQLiteConfig,
|
NSQLiteConfig,
|
||||||
BunSQLiteConfigReturn,
|
NSQLiteConfigReturn,
|
||||||
BUN_SQLITE_DatabaseSchemaType,
|
NSQLITE_DatabaseSchemaType,
|
||||||
} from "../types";
|
} from "../types";
|
||||||
|
|
||||||
export default function init(): BunSQLiteConfigReturn {
|
export default function init(): NSQLiteConfigReturn {
|
||||||
try {
|
try {
|
||||||
const { ROOT_DIR } = grabDirNames();
|
const { ROOT_DIR } = grabDirNames();
|
||||||
const { ConfigFileName } = AppData;
|
const { ConfigFileName } = AppData;
|
||||||
@ -25,7 +25,7 @@ export default function init(): BunSQLiteConfigReturn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ConfigImport = require(ConfigFilePath);
|
const ConfigImport = require(ConfigFilePath);
|
||||||
const Config = ConfigImport["default"] as BunSQLiteConfig;
|
const Config = ConfigImport["default"] as NSQLiteConfig;
|
||||||
|
|
||||||
if (!Config.db_name) {
|
if (!Config.db_name) {
|
||||||
console.error(`\`db_name\` is required in your config`);
|
console.error(`\`db_name\` is required in your config`);
|
||||||
@ -51,7 +51,7 @@ export default function init(): BunSQLiteConfigReturn {
|
|||||||
const DbSchemaImport = require(DBSchemaFilePath);
|
const DbSchemaImport = require(DBSchemaFilePath);
|
||||||
const DbSchema = DbSchemaImport[
|
const DbSchema = DbSchemaImport[
|
||||||
"default"
|
"default"
|
||||||
] as BUN_SQLITE_DatabaseSchemaType;
|
] as NSQLITE_DatabaseSchemaType;
|
||||||
|
|
||||||
const backup_dir =
|
const backup_dir =
|
||||||
Config.db_backup_dir || AppData["DefaultBackupDirName"];
|
Config.db_backup_dir || AppData["DefaultBackupDirName"];
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import type {
|
import type {
|
||||||
BUN_SQLITE_FieldSchemaType,
|
NSQLITE_FieldSchemaType,
|
||||||
BUN_SQLITE_TableSchemaType,
|
NSQLITE_TableSchemaType,
|
||||||
} from "../../types";
|
} from "../../types";
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
paradigm: "JavaScript" | "TypeScript" | undefined;
|
paradigm: "JavaScript" | "TypeScript" | undefined;
|
||||||
table: BUN_SQLITE_TableSchemaType;
|
table: NSQLITE_TableSchemaType;
|
||||||
query?: any;
|
query?: any;
|
||||||
typeDefName?: string;
|
typeDefName?: string;
|
||||||
allValuesOptional?: boolean;
|
allValuesOptional?: boolean;
|
||||||
@ -29,12 +29,12 @@ export default function generateTypeDefinition({
|
|||||||
tdName = typeDefName
|
tdName = typeDefName
|
||||||
? typeDefName
|
? typeDefName
|
||||||
: dbName
|
: dbName
|
||||||
? `BUN_SQLITE_${dbName}_${table.tableName}`.toUpperCase()
|
? `NSQLITE_${dbName}_${table.tableName}`.toUpperCase()
|
||||||
: `BUN_SQLITE_${query.single}_${query.single_table}`.toUpperCase();
|
: `NSQLITE_${query.single}_${query.single_table}`.toUpperCase();
|
||||||
|
|
||||||
const fields = table.fields;
|
const fields = table.fields;
|
||||||
|
|
||||||
function typeMap(schemaType: BUN_SQLITE_FieldSchemaType) {
|
function typeMap(schemaType: NSQLITE_FieldSchemaType) {
|
||||||
if (schemaType.options && schemaType.options.length > 0) {
|
if (schemaType.options && schemaType.options.length > 0) {
|
||||||
return schemaType.options
|
return schemaType.options
|
||||||
.map((opt) =>
|
.map((opt) =>
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { type Database } from "better-sqlite3";
|
import { type Database } from "better-sqlite3";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import DbClient from ".";
|
import DbClient from ".";
|
||||||
import type {
|
import type {
|
||||||
BUN_SQLITE_DatabaseSchemaType,
|
NSQLITE_DatabaseSchemaType,
|
||||||
BUN_SQLITE_FieldSchemaType,
|
NSQLITE_FieldSchemaType,
|
||||||
BUN_SQLITE_TableSchemaType,
|
NSQLITE_TableSchemaType,
|
||||||
} from "../../types";
|
} from "../../types";
|
||||||
|
|
||||||
// Schema Manager Class
|
// Schema Manager Class
|
||||||
@ -14,13 +14,13 @@ class SQLiteSchemaManager {
|
|||||||
private db: Database;
|
private db: Database;
|
||||||
private db_manager_table_name: string;
|
private db_manager_table_name: string;
|
||||||
private recreate_vector_table: boolean;
|
private recreate_vector_table: boolean;
|
||||||
private db_schema: BUN_SQLITE_DatabaseSchemaType;
|
private db_schema: NSQLITE_DatabaseSchemaType;
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
schema,
|
schema,
|
||||||
recreate_vector_table = false,
|
recreate_vector_table = false,
|
||||||
}: {
|
}: {
|
||||||
schema: BUN_SQLITE_DatabaseSchemaType;
|
schema: NSQLITE_DatabaseSchemaType;
|
||||||
recreate_vector_table?: boolean;
|
recreate_vector_table?: boolean;
|
||||||
}) {
|
}) {
|
||||||
this.db = DbClient;
|
this.db = DbClient;
|
||||||
@ -115,7 +115,7 @@ class SQLiteSchemaManager {
|
|||||||
* Sync a single table (create or update)
|
* Sync a single table (create or update)
|
||||||
*/
|
*/
|
||||||
private async syncTable(
|
private async syncTable(
|
||||||
table: BUN_SQLITE_TableSchemaType,
|
table: NSQLITE_TableSchemaType,
|
||||||
existingTables: string[],
|
existingTables: string[],
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
let tableExists = existingTables.includes(table.tableName);
|
let tableExists = existingTables.includes(table.tableName);
|
||||||
@ -151,9 +151,7 @@ class SQLiteSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Create a new table
|
* Create a new table
|
||||||
*/
|
*/
|
||||||
private async createTable(
|
private async createTable(table: NSQLITE_TableSchemaType): Promise<void> {
|
||||||
table: BUN_SQLITE_TableSchemaType,
|
|
||||||
): Promise<void> {
|
|
||||||
console.log(`Creating table: ${table.tableName}`);
|
console.log(`Creating table: ${table.tableName}`);
|
||||||
|
|
||||||
let new_table = _.cloneDeep(table);
|
let new_table = _.cloneDeep(table);
|
||||||
@ -219,9 +217,7 @@ class SQLiteSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Update an existing table
|
* Update an existing table
|
||||||
*/
|
*/
|
||||||
private async updateTable(
|
private async updateTable(table: NSQLITE_TableSchemaType): Promise<void> {
|
||||||
table: BUN_SQLITE_TableSchemaType,
|
|
||||||
): Promise<void> {
|
|
||||||
console.log(`Updating table: ${table.tableName}`);
|
console.log(`Updating table: ${table.tableName}`);
|
||||||
|
|
||||||
const existingColumns = this.getTableColumns(table.tableName);
|
const existingColumns = this.getTableColumns(table.tableName);
|
||||||
@ -278,7 +274,7 @@ class SQLiteSchemaManager {
|
|||||||
*/
|
*/
|
||||||
private async addColumn(
|
private async addColumn(
|
||||||
tableName: string,
|
tableName: string,
|
||||||
field: BUN_SQLITE_FieldSchemaType,
|
field: NSQLITE_FieldSchemaType,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
console.log(`Adding column: ${tableName}.${field.fieldName}`);
|
console.log(`Adding column: ${tableName}.${field.fieldName}`);
|
||||||
|
|
||||||
@ -298,9 +294,7 @@ class SQLiteSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Recreate table (for complex schema changes)
|
* Recreate table (for complex schema changes)
|
||||||
*/
|
*/
|
||||||
private async recreateTable(
|
private async recreateTable(table: NSQLITE_TableSchemaType): Promise<void> {
|
||||||
table: BUN_SQLITE_TableSchemaType,
|
|
||||||
): Promise<void> {
|
|
||||||
if (table.isVector) {
|
if (table.isVector) {
|
||||||
if (!this.recreate_vector_table) {
|
if (!this.recreate_vector_table) {
|
||||||
return;
|
return;
|
||||||
@ -374,7 +368,7 @@ class SQLiteSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Build column definition SQL
|
* Build column definition SQL
|
||||||
*/
|
*/
|
||||||
private buildColumnDefinition(field: BUN_SQLITE_FieldSchemaType): string {
|
private buildColumnDefinition(field: NSQLITE_FieldSchemaType): string {
|
||||||
if (!field.fieldName) {
|
if (!field.fieldName) {
|
||||||
throw new Error("Field name is required");
|
throw new Error("Field name is required");
|
||||||
}
|
}
|
||||||
@ -429,7 +423,7 @@ class SQLiteSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Map DSQL data types to SQLite types
|
* Map DSQL data types to SQLite types
|
||||||
*/
|
*/
|
||||||
private mapDataType(field: BUN_SQLITE_FieldSchemaType): string {
|
private mapDataType(field: NSQLITE_FieldSchemaType): string {
|
||||||
const dataType = field.dataType?.toLowerCase() || "text";
|
const dataType = field.dataType?.toLowerCase() || "text";
|
||||||
const vectorSize = field.vectorSize || 1536;
|
const vectorSize = field.vectorSize || 1536;
|
||||||
|
|
||||||
@ -481,9 +475,7 @@ class SQLiteSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Build foreign key constraint
|
* Build foreign key constraint
|
||||||
*/
|
*/
|
||||||
private buildForeignKeyConstraint(
|
private buildForeignKeyConstraint(field: NSQLITE_FieldSchemaType): string {
|
||||||
field: BUN_SQLITE_FieldSchemaType,
|
|
||||||
): string {
|
|
||||||
const fk = field.foreignKey!;
|
const fk = field.foreignKey!;
|
||||||
let constraint = `FOREIGN KEY ("${field.fieldName}") REFERENCES "${fk.destinationTableName}"("${fk.destinationTableColumnName}")`;
|
let constraint = `FOREIGN KEY ("${field.fieldName}") REFERENCES "${fk.destinationTableName}"("${fk.destinationTableColumnName}")`;
|
||||||
|
|
||||||
@ -501,9 +493,7 @@ class SQLiteSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Sync indexes for a table
|
* Sync indexes for a table
|
||||||
*/
|
*/
|
||||||
private async syncIndexes(
|
private async syncIndexes(table: NSQLITE_TableSchemaType): Promise<void> {
|
||||||
table: BUN_SQLITE_TableSchemaType,
|
|
||||||
): Promise<void> {
|
|
||||||
if (!table.indexes || table.indexes.length === 0) {
|
if (!table.indexes || table.indexes.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -560,7 +550,7 @@ class SQLiteSchemaManager {
|
|||||||
|
|
||||||
// Example usage
|
// Example usage
|
||||||
async function main() {
|
async function main() {
|
||||||
const schema: BUN_SQLITE_DatabaseSchemaType = {
|
const schema: NSQLITE_DatabaseSchemaType = {
|
||||||
dbName: "example_db",
|
dbName: "example_db",
|
||||||
tables: [
|
tables: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||||
import generateTypeDefinition from "./db-generate-type-defs";
|
import generateTypeDefinition from "./db-generate-type-defs";
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
dbSchema?: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema?: NSQLITE_DatabaseSchemaType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function dbSchemaToType(params?: Params): string[] | undefined {
|
export default function dbSchemaToType(params?: Params): string[] | undefined {
|
||||||
@ -11,7 +11,7 @@ export default function dbSchemaToType(params?: Params): string[] | undefined {
|
|||||||
|
|
||||||
if (!datasquirelSchema) return;
|
if (!datasquirelSchema) return;
|
||||||
|
|
||||||
let tableNames = `export const BunSQLiteTables = [\n${datasquirelSchema.tables
|
let tableNames = `export const NSQLiteTables = [\n${datasquirelSchema.tables
|
||||||
.map((tbl) => ` "${tbl.tableName}",`)
|
.map((tbl) => ` "${tbl.tableName}",`)
|
||||||
.join("\n")}\n] as const`;
|
.join("\n")}\n] as const`;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ export default function dbSchemaToType(params?: Params): string[] | undefined {
|
|||||||
const defObj = generateTypeDefinition({
|
const defObj = generateTypeDefinition({
|
||||||
paradigm: "TypeScript",
|
paradigm: "TypeScript",
|
||||||
table: final_table,
|
table: final_table,
|
||||||
typeDefName: `BUN_SQLITE_${defDbName}_${final_table.tableName.toUpperCase()}`,
|
typeDefName: `NSQLITE_${defDbName}_${final_table.tableName.toUpperCase()}`,
|
||||||
allValuesOptional: true,
|
allValuesOptional: true,
|
||||||
addExport: true,
|
addExport: true,
|
||||||
});
|
});
|
||||||
@ -57,7 +57,7 @@ export default function dbSchemaToType(params?: Params): string[] | undefined {
|
|||||||
.filter((schm) => typeof schm == "string");
|
.filter((schm) => typeof schm == "string");
|
||||||
|
|
||||||
const allTd = defNames?.[0]
|
const allTd = defNames?.[0]
|
||||||
? `export type BUN_SQLITE_${defDbName}_ALL_TYPEDEFS = ${defNames.join(` & `)}`
|
? `export type NSQLITE_${defDbName}_ALL_TYPEDEFS = ${defNames.join(` & `)}`
|
||||||
: ``;
|
: ``;
|
||||||
|
|
||||||
return [tableNames, ...schemas, allTd];
|
return [tableNames, ...schemas, allTd];
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||||
import dbSchemaToType from "./db-schema-to-typedef";
|
import dbSchemaToType from "./db-schema-to-typedef";
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
dst_file: string;
|
dst_file: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||||
|
|
||||||
export const DbSchema: BUN_SQLITE_DatabaseSchemaType = {
|
export const DbSchema: NSQLITE_DatabaseSchemaType = {
|
||||||
dbName: "travis-ai",
|
dbName: "travis-ai",
|
||||||
tables: [],
|
tables: [],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { RequestOptions } from "https";
|
import type { RequestOptions } from "https";
|
||||||
|
|
||||||
export type BUN_SQLITE_DatabaseFullName = string;
|
export type NSQLITE_DatabaseFullName = string;
|
||||||
|
|
||||||
export const UsersOmitedFields = [
|
export const UsersOmitedFields = [
|
||||||
"password",
|
"password",
|
||||||
@ -14,22 +14,22 @@ export const UsersOmitedFields = [
|
|||||||
"date_updated_timestamp",
|
"date_updated_timestamp",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export interface BUN_SQLITE_DatabaseSchemaType {
|
export interface NSQLITE_DatabaseSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
dbName?: string;
|
dbName?: string;
|
||||||
dbSlug?: string;
|
dbSlug?: string;
|
||||||
dbFullName?: string;
|
dbFullName?: string;
|
||||||
dbDescription?: string;
|
dbDescription?: string;
|
||||||
dbImage?: string;
|
dbImage?: string;
|
||||||
tables: BUN_SQLITE_TableSchemaType[];
|
tables: NSQLITE_TableSchemaType[];
|
||||||
childrenDatabases?: BUN_SQLITE_ChildrenDatabaseObject[];
|
childrenDatabases?: NSQLITE_ChildrenDatabaseObject[];
|
||||||
childDatabase?: boolean;
|
childDatabase?: boolean;
|
||||||
childDatabaseDbId?: string | number;
|
childDatabaseDbId?: string | number;
|
||||||
updateData?: boolean;
|
updateData?: boolean;
|
||||||
collation?: (typeof MariaDBCollations)[number];
|
collation?: (typeof MariaDBCollations)[number];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_ChildrenDatabaseObject {
|
export interface NSQLITE_ChildrenDatabaseObject {
|
||||||
dbId?: string | number;
|
dbId?: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,14 +38,14 @@ export const MariaDBCollations = [
|
|||||||
"utf8mb4_unicode_520_ci",
|
"utf8mb4_unicode_520_ci",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export interface BUN_SQLITE_TableSchemaType {
|
export interface NSQLITE_TableSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
tableName: string;
|
tableName: string;
|
||||||
tableDescription?: string;
|
tableDescription?: string;
|
||||||
fields: BUN_SQLITE_FieldSchemaType[];
|
fields: NSQLITE_FieldSchemaType[];
|
||||||
indexes?: BUN_SQLITE_IndexSchemaType[];
|
indexes?: NSQLITE_IndexSchemaType[];
|
||||||
uniqueConstraints?: BUN_SQLITE_UniqueConstraintSchemaType[];
|
uniqueConstraints?: NSQLITE_UniqueConstraintSchemaType[];
|
||||||
childrenTables?: BUN_SQLITE_ChildrenTablesType[];
|
childrenTables?: NSQLITE_ChildrenTablesType[];
|
||||||
/**
|
/**
|
||||||
* Whether this is a child table
|
* Whether this is a child table
|
||||||
*/
|
*/
|
||||||
@ -81,7 +81,7 @@ export interface BUN_SQLITE_TableSchemaType {
|
|||||||
vectorType?: string;
|
vectorType?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_ChildrenTablesType {
|
export interface NSQLITE_ChildrenTablesType {
|
||||||
tableId?: string | number;
|
tableId?: string | number;
|
||||||
dbId?: string | number;
|
dbId?: string | number;
|
||||||
}
|
}
|
||||||
@ -99,18 +99,18 @@ export const TextFieldTypesArray = [
|
|||||||
{ title: "Code", value: "code" },
|
{ title: "Code", value: "code" },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const BUN_SQLITE_DATATYPES = [
|
export const NSQLITE_DATATYPES = [
|
||||||
{ value: "TEXT" },
|
{ value: "TEXT" },
|
||||||
{ value: "INTEGER" },
|
{ value: "INTEGER" },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type BUN_SQLITE_FieldSchemaType = {
|
export type NSQLITE_FieldSchemaType = {
|
||||||
id?: number | string;
|
id?: number | string;
|
||||||
fieldName?: string;
|
fieldName?: string;
|
||||||
fieldDescription?: string;
|
fieldDescription?: string;
|
||||||
originName?: string;
|
originName?: string;
|
||||||
updatedField?: boolean;
|
updatedField?: boolean;
|
||||||
dataType: (typeof BUN_SQLITE_DATATYPES)[number]["value"];
|
dataType: (typeof NSQLITE_DATATYPES)[number]["value"];
|
||||||
nullValue?: boolean;
|
nullValue?: boolean;
|
||||||
notNullValue?: boolean;
|
notNullValue?: boolean;
|
||||||
primaryKey?: boolean;
|
primaryKey?: boolean;
|
||||||
@ -118,7 +118,7 @@ export type BUN_SQLITE_FieldSchemaType = {
|
|||||||
autoIncrement?: boolean;
|
autoIncrement?: boolean;
|
||||||
defaultValue?: string | number;
|
defaultValue?: string | number;
|
||||||
defaultValueLiteral?: string;
|
defaultValueLiteral?: string;
|
||||||
foreignKey?: BUN_SQLITE_ForeignKeyType;
|
foreignKey?: NSQLITE_ForeignKeyType;
|
||||||
defaultField?: boolean;
|
defaultField?: boolean;
|
||||||
plainText?: boolean;
|
plainText?: boolean;
|
||||||
unique?: boolean;
|
unique?: boolean;
|
||||||
@ -159,7 +159,7 @@ CREATE VIRTUAL TABLE documents USING vec0(
|
|||||||
|
|
||||||
-- INSERTING (Notice: No '+' here)
|
-- INSERTING (Notice: No '+' here)
|
||||||
INSERT INTO documents(embedding, title, raw_body)
|
INSERT INTO documents(embedding, title, raw_body)
|
||||||
VALUES (vec_f32(?), 'Bun Docs', 'Bun is a fast JavaScript runtime...');
|
VALUES (vec_f32(?), 'Node Docs', 'Node is a fast JavaScript runtime...');
|
||||||
|
|
||||||
-- QUERYING (Notice: No '+' here)
|
-- QUERYING (Notice: No '+' here)
|
||||||
SELECT title, raw_body
|
SELECT title, raw_body
|
||||||
@ -172,7 +172,7 @@ WHERE embedding MATCH ? AND k = 1;
|
|||||||
[key in (typeof TextFieldTypesArray)[number]["value"]]?: boolean;
|
[key in (typeof TextFieldTypesArray)[number]["value"]]?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface BUN_SQLITE_ForeignKeyType {
|
export interface NSQLITE_ForeignKeyType {
|
||||||
foreignKeyName?: string;
|
foreignKeyName?: string;
|
||||||
destinationTableName?: string;
|
destinationTableName?: string;
|
||||||
destinationTableColumnName?: string;
|
destinationTableColumnName?: string;
|
||||||
@ -181,32 +181,32 @@ export interface BUN_SQLITE_ForeignKeyType {
|
|||||||
cascadeUpdate?: boolean;
|
cascadeUpdate?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_IndexSchemaType {
|
export interface NSQLITE_IndexSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
indexName?: string;
|
indexName?: string;
|
||||||
indexType?: (typeof IndexTypes)[number];
|
indexType?: (typeof IndexTypes)[number];
|
||||||
indexTableFields?: BUN_SQLITE_IndexTableFieldType[];
|
indexTableFields?: NSQLITE_IndexTableFieldType[];
|
||||||
alias?: string;
|
alias?: string;
|
||||||
newTempIndex?: boolean;
|
newTempIndex?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_UniqueConstraintSchemaType {
|
export interface NSQLITE_UniqueConstraintSchemaType {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
constraintName?: string;
|
constraintName?: string;
|
||||||
alias?: string;
|
alias?: string;
|
||||||
constraintTableFields?: BUN_SQLITE_UniqueConstraintFieldType[];
|
constraintTableFields?: NSQLITE_UniqueConstraintFieldType[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_UniqueConstraintFieldType {
|
export interface NSQLITE_UniqueConstraintFieldType {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_IndexTableFieldType {
|
export interface NSQLITE_IndexTableFieldType {
|
||||||
value: string;
|
value: string;
|
||||||
dataType: string;
|
dataType: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_MYSQL_SHOW_INDEXES_Type {
|
export interface NSQLITE_MYSQL_SHOW_INDEXES_Type {
|
||||||
Key_name: string;
|
Key_name: string;
|
||||||
Table: string;
|
Table: string;
|
||||||
Column_name: string;
|
Column_name: string;
|
||||||
@ -217,7 +217,7 @@ export interface BUN_SQLITE_MYSQL_SHOW_INDEXES_Type {
|
|||||||
Comment: string;
|
Comment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_MYSQL_SHOW_COLUMNS_Type {
|
export interface NSQLITE_MYSQL_SHOW_COLUMNS_Type {
|
||||||
Field: string;
|
Field: string;
|
||||||
Type: string;
|
Type: string;
|
||||||
Null: string;
|
Null: string;
|
||||||
@ -226,7 +226,7 @@ export interface BUN_SQLITE_MYSQL_SHOW_COLUMNS_Type {
|
|||||||
Extra: string;
|
Extra: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_MARIADB_SHOW_INDEXES_TYPE {
|
export interface NSQLITE_MARIADB_SHOW_INDEXES_TYPE {
|
||||||
Table: string;
|
Table: string;
|
||||||
Non_unique: 0 | 1;
|
Non_unique: 0 | 1;
|
||||||
Key_name: string;
|
Key_name: string;
|
||||||
@ -242,13 +242,13 @@ export interface BUN_SQLITE_MARIADB_SHOW_INDEXES_TYPE {
|
|||||||
Ignored?: "YES" | "NO";
|
Ignored?: "YES" | "NO";
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_MYSQL_FOREIGN_KEYS_Type {
|
export interface NSQLITE_MYSQL_FOREIGN_KEYS_Type {
|
||||||
CONSTRAINT_NAME: string;
|
CONSTRAINT_NAME: string;
|
||||||
CONSTRAINT_SCHEMA: string;
|
CONSTRAINT_SCHEMA: string;
|
||||||
TABLE_NAME: string;
|
TABLE_NAME: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BUN_SQLITE_MYSQL_user_databases_Type {
|
export interface NSQLITE_MYSQL_user_databases_Type {
|
||||||
id: number;
|
id: number;
|
||||||
user_id: number;
|
user_id: number;
|
||||||
db_full_name: string;
|
db_full_name: string;
|
||||||
@ -387,7 +387,7 @@ export interface GetReturn<R extends any = any> {
|
|||||||
payload?: R;
|
payload?: R;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
schema?: BUN_SQLITE_TableSchemaType;
|
schema?: NSQLITE_TableSchemaType;
|
||||||
finalQuery?: string;
|
finalQuery?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ export interface PostReturn {
|
|||||||
payload?: Object[] | string | PostInsertReturn;
|
payload?: Object[] | string | PostInsertReturn;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
error?: any;
|
error?: any;
|
||||||
schema?: BUN_SQLITE_TableSchemaType;
|
schema?: NSQLITE_TableSchemaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostDataPayload {
|
export interface PostDataPayload {
|
||||||
@ -709,8 +709,8 @@ export type ServerQueryParamsJoinMatchSourceTargetObject = {
|
|||||||
export type ApiConnectBody = {
|
export type ApiConnectBody = {
|
||||||
url: string;
|
url: string;
|
||||||
key: string;
|
key: string;
|
||||||
database: BUN_SQLITE_MYSQL_user_databases_Type;
|
database: NSQLITE_MYSQL_user_databases_Type;
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
type: "pull" | "push";
|
type: "pull" | "push";
|
||||||
user_id?: string | number;
|
user_id?: string | number;
|
||||||
};
|
};
|
||||||
@ -994,7 +994,7 @@ export type APIResponseObject<
|
|||||||
countQueryObject?: ResponseQueryObject;
|
countQueryObject?: ResponseQueryObject;
|
||||||
status?: number;
|
status?: number;
|
||||||
count?: number;
|
count?: number;
|
||||||
errors?: BUNSQLITEErrorObject[];
|
errors?: NSQLITEErrorObject[];
|
||||||
debug?: any;
|
debug?: any;
|
||||||
batchPayload?: any[][] | null;
|
batchPayload?: any[][] | null;
|
||||||
errorData?: any;
|
errorData?: any;
|
||||||
@ -1115,7 +1115,7 @@ export type DefaultEntryType = {
|
|||||||
|
|
||||||
export const IndexTypes = ["regular", "full_text", "vector"] as const;
|
export const IndexTypes = ["regular", "full_text", "vector"] as const;
|
||||||
|
|
||||||
export type BUNSQLITEErrorObject = {
|
export type NSQLITEErrorObject = {
|
||||||
sql?: string;
|
sql?: string;
|
||||||
sqlValues?: any[];
|
sqlValues?: any[];
|
||||||
error?: string;
|
error?: string;
|
||||||
@ -1141,7 +1141,7 @@ export type SQLInsertGenParams = {
|
|||||||
dbFullName?: string;
|
dbFullName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BunSQLiteConfig = {
|
export type NSQLiteConfig = {
|
||||||
db_name: string;
|
db_name: string;
|
||||||
/**
|
/**
|
||||||
* The Name of the Database Schema File. Eg `db_schema.ts`. This is
|
* The Name of the Database Schema File. Eg `db_schema.ts`. This is
|
||||||
@ -1164,12 +1164,12 @@ export type BunSQLiteConfig = {
|
|||||||
typedef_file_path?: string;
|
typedef_file_path?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BunSQLiteConfigReturn = {
|
export type NSQLiteConfigReturn = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultFields: BUN_SQLITE_FieldSchemaType[] = [
|
export const DefaultFields: NSQLITE_FieldSchemaType[] = [
|
||||||
{
|
{
|
||||||
fieldName: "id",
|
fieldName: "id",
|
||||||
dataType: "INTEGER",
|
dataType: "INTEGER",
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { DefaultFields, type BUN_SQLITE_DatabaseSchemaType } from "../types";
|
import { DefaultFields, type NSQLITE_DatabaseSchemaType } from "../types";
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ({ dbSchema }: Params): BUN_SQLITE_DatabaseSchemaType {
|
export default function ({ dbSchema }: Params): NSQLITE_DatabaseSchemaType {
|
||||||
const finaldbSchema = _.cloneDeep(dbSchema);
|
const finaldbSchema = _.cloneDeep(dbSchema);
|
||||||
finaldbSchema.tables = finaldbSchema.tables.map((t) => {
|
finaldbSchema.tables = finaldbSchema.tables.map((t) => {
|
||||||
const newTable = _.cloneDeep(t);
|
const newTable = _.cloneDeep(t);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function grabDBBackupFileName({ config }: Params) {
|
export default function grabDBBackupFileName({ config }: Params) {
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import grabDirNames from "../data/grab-dir-names";
|
import grabDirNames from "../data/grab-dir-names";
|
||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
import { AppData } from "../data/app-data";
|
import { AppData } from "../data/app-data";
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function grabDBDir({ config }: Params) {
|
export default function grabDBDir({ config }: Params) {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import grabDBDir from "../utils/grab-db-dir";
|
import grabDBDir from "../utils/grab-db-dir";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function grabSortedBackups({ config }: Params) {
|
export default function grabSortedBackups({ config }: Params) {
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import grabDBDir from "../utils/grab-db-dir";
|
import grabDBDir from "../utils/grab-db-dir";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import type { BunSQLiteConfig } from "../types";
|
import type { NSQLiteConfig } from "../types";
|
||||||
import grabSortedBackups from "./grab-sorted-backups";
|
import grabSortedBackups from "./grab-sorted-backups";
|
||||||
import { AppData } from "../data/app-data";
|
import { AppData } from "../data/app-data";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
config: BunSQLiteConfig;
|
config: NSQLiteConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function trimBackups({ config }: Params) {
|
export default function trimBackups({ config }: Params) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user