Updates
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
||||
import type { BUN_SQLITE_TableSchemaType } from "../../types";
|
||||
import type { NSQLITE_TableSchemaType } from "../../types";
|
||||
type Param = {
|
||||
paradigm: "JavaScript" | "TypeScript" | undefined;
|
||||
table: BUN_SQLITE_TableSchemaType;
|
||||
table: NSQLITE_TableSchemaType;
|
||||
query?: any;
|
||||
typeDefName?: string;
|
||||
allValuesOptional?: boolean;
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ function generateTypeDefinition({ paradigm, table, query, typeDefName, allValues
|
||||
tdName = typeDefName
|
||||
? typeDefName
|
||||
: dbName
|
||||
? `BUN_SQLITE_${dbName}_${table.tableName}`.toUpperCase()
|
||||
: `BUN_SQLITE_${query.single}_${query.single_table}`.toUpperCase();
|
||||
? `NSQLITE_${dbName}_${table.tableName}`.toUpperCase()
|
||||
: `NSQLITE_${query.single}_${query.single_table}`.toUpperCase();
|
||||
const fields = table.fields;
|
||||
function typeMap(schemaType) {
|
||||
var _a, _b, _c;
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bun
|
||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
||||
#!/usr/bin/env node
|
||||
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||
declare class SQLiteSchemaManager {
|
||||
private db;
|
||||
private db_manager_table_name;
|
||||
private recreate_vector_table;
|
||||
private db_schema;
|
||||
constructor({ schema, recreate_vector_table, }: {
|
||||
schema: BUN_SQLITE_DatabaseSchemaType;
|
||||
schema: NSQLITE_DatabaseSchemaType;
|
||||
recreate_vector_table?: boolean;
|
||||
});
|
||||
private createDbManagerTable;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bun
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
||||
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||
type Params = {
|
||||
dbSchema?: BUN_SQLITE_DatabaseSchemaType;
|
||||
dbSchema?: NSQLITE_DatabaseSchemaType;
|
||||
};
|
||||
export default function dbSchemaToType(params?: Params): string[] | undefined;
|
||||
export {};
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ function dbSchemaToType(params) {
|
||||
let datasquirelSchema = params === null || params === void 0 ? void 0 : params.dbSchema;
|
||||
if (!datasquirelSchema)
|
||||
return;
|
||||
let tableNames = `export const BunSQLiteTables = [\n${datasquirelSchema.tables
|
||||
let tableNames = `export const NSQLiteTables = [\n${datasquirelSchema.tables
|
||||
.map((tbl) => ` "${tbl.tableName}",`)
|
||||
.join("\n")}\n] as const`;
|
||||
const dbTablesSchemas = datasquirelSchema.tables;
|
||||
@@ -33,7 +33,7 @@ function dbSchemaToType(params) {
|
||||
const defObj = (0, db_generate_type_defs_1.default)({
|
||||
paradigm: "TypeScript",
|
||||
table: final_table,
|
||||
typeDefName: `BUN_SQLITE_${defDbName}_${final_table.tableName.toUpperCase()}`,
|
||||
typeDefName: `NSQLITE_${defDbName}_${final_table.tableName.toUpperCase()}`,
|
||||
allValuesOptional: true,
|
||||
addExport: true,
|
||||
});
|
||||
@@ -44,7 +44,7 @@ function dbSchemaToType(params) {
|
||||
})
|
||||
.filter((schm) => typeof schm == "string");
|
||||
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];
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
||||
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||
type Params = {
|
||||
dbSchema: BUN_SQLITE_DatabaseSchemaType;
|
||||
dbSchema: NSQLITE_DatabaseSchemaType;
|
||||
dst_file: string;
|
||||
};
|
||||
export default function dbSchemaToTypeDef({ dbSchema, dst_file }: Params): void;
|
||||
|
||||
Vendored
+2
-2
@@ -1,2 +1,2 @@
|
||||
import type { BUN_SQLITE_DatabaseSchemaType } from "../../types";
|
||||
export declare const DbSchema: BUN_SQLITE_DatabaseSchemaType;
|
||||
import type { NSQLITE_DatabaseSchemaType } from "../../types";
|
||||
export declare const DbSchema: NSQLITE_DatabaseSchemaType;
|
||||
|
||||
Reference in New Issue
Block a user