forj 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -3
- package/src/clause-builder.ts +216 -0
- package/src/d1/index.ts +4 -0
- package/src/d1/model.ts +79 -0
- package/src/index.ts +1 -0
- package/src/model.ts +258 -0
- package/src/query-builder.ts +375 -0
- package/src/types.ts +260 -0
- package/src/utils.ts +134 -0
- package/dist/chunk-NVO75XBO.js +0 -1
- package/dist/d1.d.ts +0 -113
- package/dist/d1.js +0 -1
- package/dist/index-CwrzXlna.d.ts +0 -163
- package/dist/index.ts.d.ts +0 -2
- package/dist/index.ts.js +0 -1
package/src/utils.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import pluralize from 'pluralize'
|
|
2
|
+
import type { ZodTypeAny } from 'zod'
|
|
3
|
+
import type { DBSchema } from './types'
|
|
4
|
+
|
|
5
|
+
const operators = ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'IN', 'NOT IN', 'IS', 'IS NOT', 'BETWEEN']
|
|
6
|
+
|
|
7
|
+
export function isOperator(o: any) {
|
|
8
|
+
return typeof o == 'string' && operators.includes(o)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function parseSelectColumn(
|
|
12
|
+
col: string,
|
|
13
|
+
baseTable: string,
|
|
14
|
+
hasJoin: boolean
|
|
15
|
+
): string {
|
|
16
|
+
if (col.toLowerCase().includes(' as '))
|
|
17
|
+
return col
|
|
18
|
+
|
|
19
|
+
const explicit = col.includes('.')
|
|
20
|
+
if (!hasJoin && !explicit)
|
|
21
|
+
return col
|
|
22
|
+
|
|
23
|
+
const [table, column] = explicit ? col.split('.') : [baseTable, col]
|
|
24
|
+
return `${table}.${column} AS ${pluralize(table, 1)}_${column}`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function parseColumn(name: string, table: string, hasJoin: boolean = true) {
|
|
28
|
+
return !hasJoin || name.includes('.') ? name : table +'.'+ name
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function formatValue(value: any): string {
|
|
32
|
+
if (value == null || value == undefined)
|
|
33
|
+
return 'NULL'
|
|
34
|
+
|
|
35
|
+
const type = typeof value
|
|
36
|
+
if (type == 'number' || type == 'bigint')
|
|
37
|
+
return String(value)
|
|
38
|
+
|
|
39
|
+
if (type == 'boolean')
|
|
40
|
+
return value ? '1' : '0'
|
|
41
|
+
|
|
42
|
+
if (value instanceof Date)
|
|
43
|
+
return `'${value.toISOString().slice(0, 19).replace('T', ' ')}'`
|
|
44
|
+
|
|
45
|
+
return `'${String(value).replace(/'/g, "''")}'`
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const zodTypeMap: Record<string, string> = {
|
|
49
|
+
'ZodString': 'string',
|
|
50
|
+
'ZodNumber': 'number',
|
|
51
|
+
'ZodBoolean': 'boolean',
|
|
52
|
+
'ZodObject': 'object',
|
|
53
|
+
'ZodArray': 'array',
|
|
54
|
+
'ZodDate': 'object',
|
|
55
|
+
'ZodNull': 'object',
|
|
56
|
+
'ZodUndefined': 'undefined',
|
|
57
|
+
'ZodSymbol': 'symbol',
|
|
58
|
+
'ZodBigInt': 'bigint',
|
|
59
|
+
'ZodFunction': 'function',
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const isZod = (obj: any): obj is ZodTypeAny => obj && typeof obj == 'object' && '_def' in obj
|
|
63
|
+
|
|
64
|
+
export const zHas = (key: string, schema?: any) => schema != null && typeof schema == 'object' && !Array.isArray(schema) && (key in schema || 'shape' in schema && key in (schema.shape as Record<string, ZodTypeAny>))
|
|
65
|
+
|
|
66
|
+
export const zGet = (key: string, schema?: any): [string, ZodTypeAny] | false => {
|
|
67
|
+
const keys = key.split('.')
|
|
68
|
+
for (const i in keys) {
|
|
69
|
+
if (typeof schema != 'object') return false
|
|
70
|
+
|
|
71
|
+
const k = keys[i]
|
|
72
|
+
if ('shape' in schema && k in schema.shape) {
|
|
73
|
+
schema = schema.shape[k]
|
|
74
|
+
continue
|
|
75
|
+
} else if (k in schema) {
|
|
76
|
+
schema = schema[k]
|
|
77
|
+
continue
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return [keys[keys.length - 1], schema]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const zType = (key: string, schema?: any): string => {
|
|
87
|
+
const _ = zGet(key, schema)
|
|
88
|
+
if (!_ || !('_def' in _[1]))
|
|
89
|
+
return 'unknown'
|
|
90
|
+
key = _[0]
|
|
91
|
+
schema = _[1]
|
|
92
|
+
|
|
93
|
+
return ((schema?._def?.innerType?._def || schema?._def)?.typeName || '').split('Zod').pop().toLowerCase()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const zSame = (key: string, val: any, schema?: any, deep: boolean = false): boolean => {
|
|
97
|
+
if (!deep) {
|
|
98
|
+
const _ = zGet(key, schema)
|
|
99
|
+
if (!_) return _
|
|
100
|
+
key = _[0]
|
|
101
|
+
schema = _[1]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!('_def' in schema))
|
|
105
|
+
return false // typeof val == typeof schema[key] // TODO: improv it
|
|
106
|
+
|
|
107
|
+
let def = schema?._def || {}
|
|
108
|
+
if (schema?._def?.typeName == 'ZodOptional')
|
|
109
|
+
def = def?.innerType?._def || {}
|
|
110
|
+
|
|
111
|
+
const zType = def?.typeName || ''
|
|
112
|
+
|
|
113
|
+
if (!zType) return false
|
|
114
|
+
|
|
115
|
+
if (zType == 'ZodUnion' && def?.options?.length)
|
|
116
|
+
return def?.options?.some((z: any) => zSame(key, val, z, true))
|
|
117
|
+
|
|
118
|
+
else if (zType == 'ZodArray')
|
|
119
|
+
return Array.isArray(val)
|
|
120
|
+
|
|
121
|
+
else if (zType == 'ZodDate')
|
|
122
|
+
return val instanceof Date
|
|
123
|
+
|
|
124
|
+
return typeof val == zodTypeMap[zType]
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function isJoinCompare(val: any, schema?: DBSchema) {
|
|
128
|
+
// if (!schema) return typeof val == 'string' && val?.includes('.')
|
|
129
|
+
if (!schema || typeof val != 'string' || !val?.includes('.'))
|
|
130
|
+
return false
|
|
131
|
+
|
|
132
|
+
const keys = zGet(val, schema)
|
|
133
|
+
return keys && keys?.length
|
|
134
|
+
}
|
package/dist/chunk-NVO75XBO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"pluralize";var t=["=","!=",">","<",">=","<=","LIKE","IN","NOT IN","IS","IS NOT","BETWEEN"];function r(e,t,r=!0){return!r||e.includes(".")?e:t+"."+e}function s(e){if(null==e||null==e)return"NULL";const t=typeof e;return"number"==t||"bigint"==t?String(e):"boolean"==t?e?"1":"0":e instanceof Date?`'${e.toISOString().slice(0,19).replace("T"," ")}'`:`'${String(e).replace(/'/g,"''")}'`}var n={ZodString:"string",ZodNumber:"number",ZodBoolean:"boolean",ZodObject:"object",ZodArray:"array",ZodDate:"object",ZodNull:"object",ZodUndefined:"undefined",ZodSymbol:"symbol",ZodBigInt:"bigint",ZodFunction:"function"},i=(e,t)=>{const r=e.split(".");for(const e in r){if("object"!=typeof t)return!1;const s=r[e];if("shape"in t&&s in t.shape)t=t.shape[s];else{if(!(s in t))return!1;t=t[s]}}return[r[r.length-1],t]},h=(e,t)=>{const r=i(e,t);return r&&"_def"in r[1]?(e=r[0],t=r[1],((t?._def?.innerType?._def||t?._def)?.typeName||"").split("Zod").pop().toLowerCase()):"unknown"},o=(e,t,r,s=!1)=>{if(!s){const t=i(e,r);if(!t)return t;e=t[0],r=t[1]}if(!("_def"in r))return!1;let h=r?._def||{};"ZodOptional"==r?._def?.typeName&&(h=h?.innerType?._def||{});const u=h?.typeName||"";return!!u&&("ZodUnion"==u&&h?.options?.length?h?.options?.some(r=>o(e,t,r,!0)):"ZodArray"==u?Array.isArray(t):"ZodDate"==u?t instanceof Date:typeof t==n[u])};function u(e,t){if(!t||"string"!=typeof e||!e?.includes("."))return!1;const r=i(e,t);return r&&r?.length}var l=class e{#e;#t;#r=[];#s=[];get clauses(){return this.#r}set clauses(e){this.#r.push(...e)}get args(){return this.#s}set args(e){this.#s.push(...e)}get length(){return this.#r.length}constructor(e,t){this.#e=e,this.#t=t}#n(t,r="AND"){const s=new e(this.#e,this.#t);return t(s),s.length&&(this.#r.push(`${this.length?r+" ":""}(${s.clauses.join(" ")})`),this.#s.push(...s.args)),this}#i(e,t=[],r="AND"){return this.length&&(e=r+" "+e),this.#r.push(e),t?.length&&this.#s.push(...t),this}#h(e,...t){if("function"==typeof t[0])return this.#n(t[0],e);const s=t.length;let[n,i,l]=t;if(2==s&&(l=i,i="="),n=r(String(n),this.#e),this.#t&&!o(n,l,this.#t))throw new Error(`Table column '${String(n)}' of type '${h(n,this.#t)}' is not assignable as type of '${typeof l}'.`);return u(l,this.#t)?this.#i(`${n} ${i} ${l}`,[],e):this.#i(`${n} ${i} ?`,[l],e)}where(...e){return this.#h("AND",...e)}on(...e){return this.where(...e)}orWhere(...e){return this.#h("OR",...e)}orOn(...e){return this.orWhere(...e)}#o(e,t,s,n="AND"){return t?.length?this.#i(r(e,this.#e)+` ${s} (${t.map(()=>"?").join(", ")})`,t,n):this}whereIn(e,t){return this.#o(e,t,"IN")}in(e,t){return this.whereIn(e,t)}whereNotIn(e,t){return this.#o(e,t,"NOT IN")}notIn(e,t){return this.whereNotIn(e,t)}orWhereIn(e,t){return this.#o(e,t,"IN","OR")}orIn(e,t){return this.orWhereIn(e,t)}orWhereNotIn(e,t){return this.#o(e,t,"NOT IN","OR")}orNotIn(e,t){return this.orWhereNotIn(e,t)}#u(e,t,s,n,i="AND"){return this.#i(r(e,this.#e)+` ${n} ? AND ?`,[t,s],i)}whereBetween(e,t,r){return this.#u(e,t,r,"BETWEEN")}between(e,t,r){return this.whereBetween(e,t,r)}orWhereBetween(e,t,r){return this.#u(e,t,r,"BETWEEN","OR")}orBetween(e,t,r){return this.orWhereBetween(e,t,r)}whereNotBetween(e,t,r){return this.#u(e,t,r,"NOT BETWEEN")}notBetween(e,t,r){return this.whereNotBetween(e,t,r)}orWhereNotBetween(e,t,r){return this.#u(e,t,r,"NOT BETWEEN","OR")}orNotBetween(e,t,r){return this.orWhereNotBetween(e,t,r)}#l(e,t="IS",s="AND"){return this.#i(r(e,this.#e)+` ${t} NULL`,[],s)}whereNull(e){return this.#l(e)}onNull(e){return this.whereNull(e)}orWhereNull(e){return this.#l(e,"IS","OR")}orOnNull(e){return this.orWhereNull(e)}whereNotNull(e){return this.#l(e,"IS NOT")}onNotNull(e){return this.whereNotNull(e)}orWhereNotNull(e){return this.#l(e,"IS NOT","OR")}orNotNull(e){return this.orWhereNotNull(e)}},a=class{#e;#t;#a=[];#r;#c=[];#N=[];#w=!1;#g=!1;#f;#p;#d=[];#I;constructor(e,t,r){this.#e=e,this.#t=t,this.#I=r,this.#r=new l(e,t)}async run(){if(!this.#I?.run)throw new Error("No database connection.");return await(this.#I?.run(this))}async first(...e){e?.length&&this.select(...e);const t=await this.run();return t.results?.length?t.results[0]:null}async all(...e){e?.length&&this.select(...e);return(await this.run()).results}select(...e){return this.#a.push(...e.flat(1/0)),this}distinct(){return this.#w=!0,this}#b(e,s,...n){this.#g=!0;const i=(e?e+" ":"")+`JOIN ${s} ON `;if("function"==typeof n[0]){const e=new l(s,this.#t);return n[0](e),this.#d.push(i+e.clauses.join(" ")),this.#r.args=e.args,this}const a=n.length;let[c,N,w,g]=n;if(2==a)w=N,N="=";else if(3!=a||"string"==typeof(f=N)&&t.includes(f))4==a&&(w=r(g,w),N="=");else{if(w=r(w,N),this.#t&&!u(w,this.#t))throw new Error(`Table column '${w}' doesn't exists.`);N="="}var f;const p=r(String(c),String(s));if(this.#t&&!o(p,w,this.#t))throw new Error(`Table column '${p}' of type '${h(p,this.#t)}' is not assignable as type of '${typeof w}'.`);return u(w,this.#t)||(this.#r.args=[w],w="?"),this.#d.push(i+p+` ${N} ${w}`),this}join(e,...t){return this.#b(void 0,e,...t)}innerJoin(e,...t){return this.#b("INNER",e,...t)}leftJoin(e,...t){return this.#b("LEFT",e,...t)}rightJoin(e,...t){return this.#b("RIGHT",e,...t)}crossJoin(e,...t){return this.#b("CROSS",e,...t)}where(...e){return this.#r.where(...e),this}on(...e){return this.where(...e)}orWhere(...e){return this.#r.orWhere(...e),this}orOn(...e){return this.orWhere(...e)}whereIn(e,t){return this.#r.whereIn(e,t),this}in(e,t){return this.whereIn(e,t)}whereNotIn(e,t){return this.#r.whereNotIn(e,t),this}notIn(e,t){return this.whereNotIn(e,t)}orWhereIn(e,t){return this.#r.orWhereIn(e,t),this}orIn(e,t){return this.orWhereIn(e,t)}orWhereNotIn(e,t){return this.#r.orWhereNotIn(e,t),this}orNotIn(e,t){return this.orWhereNotIn(e,t)}whereBetween(e,t,r){return this.#r.whereBetween(e,t,r),this}between(e,t,r){return this.whereBetween(e,t,r)}orWhereBetween(e,t,r){return this.#r.orWhereBetween(e,t,r),this}orBetween(e,t,r){return this.orWhereBetween(e,t,r)}whereNotBetween(e,t,r){return this.#r.whereNotBetween(e,t,r),this}notBetween(e,t,r){return this.whereNotBetween(e,t,r)}orWhereNotBetween(e,t,r){return this.#r.orWhereNotBetween(e,t,r),this}orNotBetween(e,t,r){return this.orWhereNotBetween(e,t,r)}whereNull(e){return this.#r.whereNull(e),this}onNull(e){return this.whereNull(e)}orWhereNull(e){return this.#r.orWhereNull(e),this}orOnNull(e){return this.orWhereNull(e)}whereNotNull(e){return this.#r.whereNotNull(e),this}onNotNull(e){return this.whereNotNull(e)}orWhereNotNull(e){return this.#r.orWhereNotNull(e),this}orNotNull(e){return this.orWhereNotNull(e)}groupBy(...e){return this.#c.push(...e),this}order(e,t="ASC"){return this.#N.push(r(e,this.#e,this.#g)+" "+t.toUpperCase()),this}orderBy(e,t="ASC"){return this.order(e,t)}asc(e){return this.order(e,"ASC")}desc(e){return this.order(e,"DESC")}limit(e){return(e=parseInt(String(e))||0)&&(this.#f=e),this}offset(e){return this.#p=parseInt(String(e))||0,this}#W(e,t){let r=0,n="",i=0;for(let h=e.indexOf("?");-1!==h;h=e.indexOf("?",h+1)){if(r>=t.length)throw new Error(`Missing bind value at position ${r}`);n+=e.slice(i,h),n+=s(t[r++]),i=h+1}if(r<t.length)throw new Error(`Too many bind values: expected ${r}, got ${t.length}`);return n+e.slice(i)}get args(){return this.#r.args}get arguments(){return this.args}get bindings(){return this.args}get query(){let t="";const r=new Set;return this.#a.forEach(t=>{t=function(t,r,s){if(t.toLowerCase().includes(" as "))return t;const n=t.includes(".");if(!s&&!n)return t;const[i,h]=n?t.split("."):[r,t];return`${i}.${h} AS ${e(i,1)}_${h}`}(t,this.#e,this.#g),!r.has(t)&&r.add(t)}),t+=`SELECT ${this.#w?"DISTINCT ":""}${r.size?[...r].join(", "):"*"}`,t+=" FROM "+this.#e,this.#d.length&&(t+=" "+this.#d.join(" ")),this.#r.length&&(t+=" WHERE "+this.#r.clauses.join(" ")),this.#c.length&&(t+=" GROUP BY "+this.#c.join(", ")),this.#N.length&&(t+=" ORDER BY "+this.#N.join(", ")),null!=this.#f&&(t+=" LIMIT "+this.#f),null!=this.#p&&(t+=" OFFSET "+this.#p),t}get sql(){return this.#W(this.query,this.#r.args)}get raw(){return this.sql}};export{a as QueryBuilder};
|
package/dist/d1.d.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { D as DBSchema, P as Pipe, Q as QueryBuilder, W as WhereFn, O as Operator, a as OrderDirection, S as SchemaKeys, R as RunFn } from './index-CwrzXlna.js';
|
|
2
|
-
import { D1Database } from '@cloudflare/workers-types';
|
|
3
|
-
import z from 'zod';
|
|
4
|
-
|
|
5
|
-
declare abstract class Model$1<TB extends keyof DB, DB> {
|
|
6
|
-
readonly $DBShape: DB;
|
|
7
|
-
readonly $TShape: DB[TB];
|
|
8
|
-
static $table: string;
|
|
9
|
-
static $schema?: DBSchema;
|
|
10
|
-
static pipe<S, T>(): Pipe<S, T>;
|
|
11
|
-
static builder<S, T>(): QueryBuilder<S, T, keyof T>;
|
|
12
|
-
static select<// @ts-ignore
|
|
13
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, ...columns: C[] | C[][]): QueryBuilder<I["$DBShape"], T, C>;
|
|
14
|
-
static distinct<// @ts-ignore
|
|
15
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape']>(this: M): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
16
|
-
static where<// @ts-ignore
|
|
17
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, fn: WhereFn<T>): QueryBuilder<I['$DBShape'], T, C>;
|
|
18
|
-
static where<// @ts-ignore
|
|
19
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, value: T[C]): QueryBuilder<I['$DBShape'], T, C>;
|
|
20
|
-
static where<// @ts-ignore
|
|
21
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, operator: Operator, value: T[C]): QueryBuilder<I['$DBShape'], T, C>;
|
|
22
|
-
static on<// @ts-ignore
|
|
23
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, fn: WhereFn<T>): QueryBuilder<I['$DBShape'], T, C>;
|
|
24
|
-
static on<// @ts-ignore
|
|
25
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, value: T[C]): QueryBuilder<I['$DBShape'], T, C>;
|
|
26
|
-
static on<// @ts-ignore
|
|
27
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, operator: Operator, value: T[C]): QueryBuilder<I['$DBShape'], T, C>;
|
|
28
|
-
static whereIn<// @ts-ignore
|
|
29
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
30
|
-
static in<// @ts-ignore
|
|
31
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
32
|
-
static whereNotIn<// @ts-ignore
|
|
33
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
34
|
-
static notIn<// @ts-ignore
|
|
35
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
36
|
-
static whereBetween<// @ts-ignore
|
|
37
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
38
|
-
static between<// @ts-ignore
|
|
39
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
40
|
-
static whereNotBetween<// @ts-ignore
|
|
41
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
42
|
-
static notBetween<// @ts-ignore
|
|
43
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
44
|
-
static whereNull<// @ts-ignore
|
|
45
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
46
|
-
static onNull<// @ts-ignore
|
|
47
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
48
|
-
static whereNotNull<// @ts-ignore
|
|
49
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
50
|
-
static onNotNull<// @ts-ignore
|
|
51
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
52
|
-
static order<// @ts-ignore
|
|
53
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, direction?: OrderDirection): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
54
|
-
static orderBy<// @ts-ignore
|
|
55
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C, direction?: OrderDirection): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
56
|
-
static asc<// @ts-ignore
|
|
57
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
58
|
-
static desc<// @ts-ignore
|
|
59
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape'], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
60
|
-
static limit<// @ts-ignore
|
|
61
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape']>(this: M, val: number | string): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
62
|
-
static offset<// @ts-ignore
|
|
63
|
-
M extends typeof Model$1<TB, DB>, I extends InstanceType<M>, T extends I['$TShape']>(this: M, val: number | string): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
declare function ModelBuilder<TSchema extends DBSchema, TBase extends SchemaKeys<TSchema>>(schema: TSchema, base: TBase): {
|
|
67
|
-
new (): {
|
|
68
|
-
readonly $DBShape: z.TypeOf<TSchema>;
|
|
69
|
-
readonly $TShape: z.TypeOf<TSchema>[TBase];
|
|
70
|
-
};
|
|
71
|
-
$table: string;
|
|
72
|
-
$schema: TSchema;
|
|
73
|
-
$db: string | D1Database;
|
|
74
|
-
pipe<S, T>(): Pipe<S, T>;
|
|
75
|
-
DB(): D1Database;
|
|
76
|
-
run<S, T>(db: D1Database): RunFn<S, T>;
|
|
77
|
-
builder<S, T>(): QueryBuilder<S, T, keyof T>;
|
|
78
|
-
select<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, ...columns: C[] | C[][]): QueryBuilder<I["$DBShape"], T, C>;
|
|
79
|
-
distinct<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"]>(this: M): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
80
|
-
where<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, fn: WhereFn<T>): QueryBuilder<I["$DBShape"], T, C>;
|
|
81
|
-
where<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, value: T[C]): QueryBuilder<I["$DBShape"], T, C>;
|
|
82
|
-
where<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, operator: Operator, value: T[C]): QueryBuilder<I["$DBShape"], T, C>;
|
|
83
|
-
on<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, fn: WhereFn<T>): QueryBuilder<I["$DBShape"], T, C>;
|
|
84
|
-
on<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, value: T[C]): QueryBuilder<I["$DBShape"], T, C>;
|
|
85
|
-
on<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, operator: Operator, value: T[C]): QueryBuilder<I["$DBShape"], T, C>;
|
|
86
|
-
whereIn<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
87
|
-
in<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
88
|
-
whereNotIn<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
89
|
-
notIn<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, value: T[C][]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
90
|
-
whereBetween<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
91
|
-
between<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
92
|
-
whereNotBetween<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
93
|
-
notBetween<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, one: T[C], two: T[C]): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
94
|
-
whereNull<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
95
|
-
onNull<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
96
|
-
whereNotNull<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
97
|
-
onNotNull<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
98
|
-
order<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, direction?: OrderDirection): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
99
|
-
orderBy<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C, direction?: OrderDirection): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
100
|
-
asc<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
101
|
-
desc<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"], C extends keyof T>(this: M, column: C): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
102
|
-
limit<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"]>(this: M, val: number | string): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
103
|
-
offset<M extends typeof Model$1, I extends InstanceType<M>, T extends I["$TShape"]>(this: M, val: number | string): QueryBuilder<I["$DBShape"], T, keyof T>;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
declare abstract class Model<TB extends keyof DB, DB> extends Model$1<TB, DB> {
|
|
107
|
-
static $db: string | D1Database;
|
|
108
|
-
static pipe<S, T>(): Pipe<S, T>;
|
|
109
|
-
static DB(): D1Database;
|
|
110
|
-
static run<S, T>(db: D1Database): RunFn<S, T>;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export { Model, ModelBuilder };
|
package/dist/d1.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{QueryBuilder as t}from"./chunk-NVO75XBO.js";import e from"pluralize";var r=class{static{this.$table=""}static pipe(){throw new Error("Database connection not provided.")}static builder(){const r=this.$table||e(this.name.toLowerCase());return new t(r,this.$schema,this.pipe())}static select(...t){return this.builder().select(...t)}static distinct(){return this.builder().distinct()}static where(...t){return this.builder().where(...t)}static on(...t){return this.builder().where(...t)}static whereIn(t,e){return this.builder().whereIn(t,e)}static in(t,e){return this.builder().whereIn(t,e)}static whereNotIn(t,e){return this.builder().whereNotIn(t,e)}static notIn(t,e){return this.builder().whereNotIn(t,e)}static whereBetween(t,e,r){return this.builder().whereBetween(t,e,r)}static between(t,e,r){return this.builder().whereBetween(t,e,r)}static whereNotBetween(t,e,r){return this.builder().whereNotBetween(t,e,r)}static notBetween(t,e,r){return this.builder().whereNotBetween(t,e,r)}static whereNull(t){return this.builder().whereNull(t)}static onNull(t){return this.builder().whereNull(t)}static whereNotNull(t){return this.builder().whereNotNull(t)}static onNotNull(t){return this.builder().whereNotNull(t)}static order(t,e="ASC"){return this.builder().order(t,e)}static orderBy(t,e="ASC"){return this.builder().order(t,e)}static asc(t){return this.builder().asc(t)}static desc(t){return this.builder().desc(t)}static limit(t){return this.builder().limit(t)}static offset(t){return this.builder().offset(t)}};function i(t,e){return class extends s{static{this.$table=String(e)}static{this.$schema=t}}}var s=class extends r{static{this.$db="DB"}static pipe(){const t=this.DB();return{run:this.run(t)}}static DB(){if("string"==typeof this.$db){if(!(this.$db in process.env))throw new Error(`Database '${this.$db}' instance not provided.`);return process.env[this.$db]}return this.$db}static run(t){return async e=>{let r=t.prepare(e.query);e.args?.length&&(r=r.bind(...e.args));const i=await r.run(),s=i.meta;return{changes:s?.changes,duration:s?.duration,lastId:s?.last_row_id,rowsRead:s?.rows_read,rowsWritten:s?.rows_written,success:i.success,results:i.results}}}};export{s as Model,i as ModelBuilder};
|
package/dist/index-CwrzXlna.d.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
|
|
3
|
-
declare class QueryBuilder<S, T, C extends keyof T = keyof T> implements IJoinBuilder<S>, IClauseBuilder<T> {
|
|
4
|
-
#private;
|
|
5
|
-
constructor(table: string, schema?: DBSchema, pipe?: Pipe<S, T, C>);
|
|
6
|
-
run(): Promise<Result<T, C>>;
|
|
7
|
-
first<K extends keyof T>(...columns: K[] | K[][]): Promise<null | Item<T, C>>;
|
|
8
|
-
all<K extends keyof T>(...columns: K[] | K[][]): Promise<Item<T, C>[]>;
|
|
9
|
-
select<K extends keyof T>(...columns: K[] | K[][]): QueryBuilder<S, T, K>;
|
|
10
|
-
distinct(): this;
|
|
11
|
-
join<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
12
|
-
innerJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
13
|
-
leftJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
14
|
-
rightJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
15
|
-
crossJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
16
|
-
where(...args: WhereArgs<T>): this;
|
|
17
|
-
on(...args: WhereArgs<T>): this;
|
|
18
|
-
orWhere(...args: WhereArgs<T>): this;
|
|
19
|
-
orOn(...args: WhereArgs<T>): this;
|
|
20
|
-
whereIn(column: C, values: T[C][]): this;
|
|
21
|
-
in(column: C, values: T[C][]): this;
|
|
22
|
-
whereNotIn(column: C, values: T[C][]): this;
|
|
23
|
-
notIn(column: C, values: T[C][]): this;
|
|
24
|
-
orWhereIn(column: C, values: T[C][]): this;
|
|
25
|
-
orIn(column: C, values: T[C][]): this;
|
|
26
|
-
orWhereNotIn(column: C, values: T[C][]): this;
|
|
27
|
-
orNotIn(column: C, values: T[C][]): this;
|
|
28
|
-
whereBetween(column: C, one: T[C], two: T[C]): this;
|
|
29
|
-
between(column: C, one: T[C], two: T[C]): this;
|
|
30
|
-
orWhereBetween(column: C, one: T[C], two: T[C]): this;
|
|
31
|
-
orBetween(column: C, one: T[C], two: T[C]): this;
|
|
32
|
-
whereNotBetween(column: C, one: T[C], two: T[C]): this;
|
|
33
|
-
notBetween(column: C, one: T[C], two: T[C]): this;
|
|
34
|
-
orWhereNotBetween(column: C, one: T[C], two: T[C]): this;
|
|
35
|
-
orNotBetween(column: C, one: T[C], two: T[C]): this;
|
|
36
|
-
whereNull(column: C): this;
|
|
37
|
-
onNull(column: C): this;
|
|
38
|
-
orWhereNull(column: C): this;
|
|
39
|
-
orOnNull(column: C): this;
|
|
40
|
-
whereNotNull(column: C): this;
|
|
41
|
-
onNotNull(column: C): this;
|
|
42
|
-
orWhereNotNull(column: C): this;
|
|
43
|
-
orNotNull(column: C): this;
|
|
44
|
-
groupBy(...columns: string[]): this;
|
|
45
|
-
order(column: C, direction?: OrderDirection): this;
|
|
46
|
-
orderBy(column: C, direction?: OrderDirection): this;
|
|
47
|
-
asc(column: C): this;
|
|
48
|
-
desc(column: C): this;
|
|
49
|
-
limit(val: number | string): this;
|
|
50
|
-
offset(val: number | string): this;
|
|
51
|
-
get args(): Values;
|
|
52
|
-
get arguments(): Values;
|
|
53
|
-
get bindings(): Values;
|
|
54
|
-
get query(): string;
|
|
55
|
-
get sql(): string;
|
|
56
|
-
get raw(): string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
type Primitive = null | number | string | boolean;
|
|
60
|
-
type Value = Primitive | undefined;
|
|
61
|
-
type Values = Value[];
|
|
62
|
-
type Operator = '=' | '!=' | '<' | '>' | '<=' | '>=' | 'LIKE';
|
|
63
|
-
type OrderDirection = 'ASC' | 'DESC' | 'asc' | 'desc';
|
|
64
|
-
type DBSchema = z.ZodObject<any>;
|
|
65
|
-
type SchemaObject = Record<string, z.ZodTypeAny>;
|
|
66
|
-
type SchemaKeys<TSchema extends DBSchema> = TSchema extends z.ZodObject<infer TShape> ? keyof TShape : TSchema extends SchemaObject ? keyof TSchema : never;
|
|
67
|
-
type RunFn<S, T, C extends keyof T = keyof T> = (qb: QueryBuilder<S, T, C>) => Promise<Result<T, C>>;
|
|
68
|
-
type Pipe<S, T, C extends keyof T = keyof T> = {
|
|
69
|
-
run: RunFn<S, T, C>;
|
|
70
|
-
};
|
|
71
|
-
type Result<T, C extends keyof T> = {
|
|
72
|
-
changes: number;
|
|
73
|
-
duration: number;
|
|
74
|
-
lastId?: number | string;
|
|
75
|
-
rowsRead: number;
|
|
76
|
-
rowsWritten: number;
|
|
77
|
-
success: boolean;
|
|
78
|
-
results: Item<T, C>[];
|
|
79
|
-
};
|
|
80
|
-
type Item<B, S extends keyof B, T = Pick<B, S>> = {
|
|
81
|
-
[K in keyof T]: T[K];
|
|
82
|
-
} & {};
|
|
83
|
-
type WhereFn<T, C extends keyof T = keyof T> = (q: IClauseBuilder<T, C>) => void;
|
|
84
|
-
type WhereArgs<T, C extends keyof T = keyof T> = [WhereFn<T, C>] | [C, T[C]] | [C, Operator, T[C]];
|
|
85
|
-
interface IClauseBuilder<T, C extends keyof T = keyof T> {
|
|
86
|
-
where(fn: WhereFn<T, C>): this;
|
|
87
|
-
where(column: C, value: T[C]): this;
|
|
88
|
-
where(column: C, operator: Operator, value: T[C]): this;
|
|
89
|
-
where(...args: WhereArgs<T>): this;
|
|
90
|
-
on(fn: WhereFn<T, C>): this;
|
|
91
|
-
on(column: C, value: T[C]): this;
|
|
92
|
-
on(column: C, operator: Operator, value: T[C]): this;
|
|
93
|
-
on(...args: WhereArgs<T>): this;
|
|
94
|
-
orWhere(fn: WhereFn<T, C>): this;
|
|
95
|
-
orWhere(column: C, value: T[C]): this;
|
|
96
|
-
orWhere(column: C, operator: Operator, value: T[C]): this;
|
|
97
|
-
orWhere(...args: WhereArgs<T>): this;
|
|
98
|
-
orOn(fn: WhereFn<T, C>): this;
|
|
99
|
-
orOn(column: C, value: T[C]): this;
|
|
100
|
-
orOn(column: C, operator: Operator, value: T[C]): this;
|
|
101
|
-
orOn(...args: WhereArgs<T>): this;
|
|
102
|
-
whereIn(column: C, values: T[C][]): this;
|
|
103
|
-
in(column: C, values: T[C][]): this;
|
|
104
|
-
whereNotIn(column: C, values: T[C][]): this;
|
|
105
|
-
notIn(column: C, values: T[C][]): this;
|
|
106
|
-
orWhereIn(column: C, values: T[C][]): this;
|
|
107
|
-
orIn(column: C, values: T[C][]): this;
|
|
108
|
-
orWhereNotIn(column: C, values: T[C][]): this;
|
|
109
|
-
orNotIn(column: C, values: T[C][]): this;
|
|
110
|
-
whereBetween(column: C, one: T[C], two: T[C]): this;
|
|
111
|
-
between(column: C, one: T[C], two: T[C]): this;
|
|
112
|
-
orWhereBetween(column: C, one: T[C], two: T[C]): this;
|
|
113
|
-
orBetween(column: C, one: T[C], two: T[C]): this;
|
|
114
|
-
whereNotBetween(column: C, one: T[C], two: T[C]): this;
|
|
115
|
-
notBetween(column: C, one: T[C], two: T[C]): this;
|
|
116
|
-
orWhereNotBetween(column: C, one: T[C], two: T[C]): this;
|
|
117
|
-
orNotBetween(column: C, one: T[C], two: T[C]): this;
|
|
118
|
-
whereNull(column: C): this;
|
|
119
|
-
onNull(column: C): this;
|
|
120
|
-
orWhereNull(column: C): this;
|
|
121
|
-
orOnNull(column: C): this;
|
|
122
|
-
whereNotNull(column: C): this;
|
|
123
|
-
onNotNull(column: C): this;
|
|
124
|
-
orWhereNotNull(column: C): this;
|
|
125
|
-
orNotNull(column: C): this;
|
|
126
|
-
}
|
|
127
|
-
type JoinArgs<S, J extends keyof S> = [
|
|
128
|
-
WhereFn<S[J]>
|
|
129
|
-
] | [keyof S[J], S[J][keyof S[J]]] | [keyof S[J], Operator, S[J][keyof S[J]]] | [keyof S[J], keyof S, keyof S[keyof S]] | [keyof S[J], Operator, S[J][keyof S[J]]] | [keyof S[J], Operator, keyof S, keyof S[keyof S]];
|
|
130
|
-
interface IJoinBuilder<S> {
|
|
131
|
-
join<J extends keyof S>(table: J, fn: WhereFn<S[J]>): this;
|
|
132
|
-
join<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, value: T[C]): this;
|
|
133
|
-
join<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, operator: Operator, value: T[C]): this;
|
|
134
|
-
join<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, table2: J2, column2: C2): this;
|
|
135
|
-
join<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, operator: Operator, table2: J2, column2: C2): this;
|
|
136
|
-
join<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
137
|
-
innerJoin<J extends keyof S>(table: J, fn: WhereFn<S[J]>): this;
|
|
138
|
-
innerJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, value: T[C]): this;
|
|
139
|
-
innerJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, operator: Operator, value: T[C]): this;
|
|
140
|
-
innerJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, table2: J2, column2: C2): this;
|
|
141
|
-
innerJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, operator: Operator, table2: J2, column2: C2): this;
|
|
142
|
-
innerJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
143
|
-
leftJoin<J extends keyof S>(table: J, fn: WhereFn<S[J]>): this;
|
|
144
|
-
leftJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, value: T[C]): this;
|
|
145
|
-
leftJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, operator: Operator, value: T[C]): this;
|
|
146
|
-
leftJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, table2: J2, column2: C2): this;
|
|
147
|
-
leftJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, operator: Operator, table2: J2, column2: C2): this;
|
|
148
|
-
leftJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
149
|
-
rightJoin<J extends keyof S>(table: J, fn: WhereFn<S[J]>): this;
|
|
150
|
-
rightJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, value: T[C]): this;
|
|
151
|
-
rightJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, operator: Operator, value: T[C]): this;
|
|
152
|
-
rightJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, table2: J2, column2: C2): this;
|
|
153
|
-
rightJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, operator: Operator, table2: J2, column2: C2): this;
|
|
154
|
-
rightJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
155
|
-
crossJoin<J extends keyof S>(table: J, fn: WhereFn<S[J]>): this;
|
|
156
|
-
crossJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, value: T[C]): this;
|
|
157
|
-
crossJoin<J extends keyof S, T extends S[J], C extends keyof T>(table: J, column: C, operator: Operator, value: T[C]): this;
|
|
158
|
-
crossJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, table2: J2, column2: C2): this;
|
|
159
|
-
crossJoin<J extends keyof S, T extends S[J], C extends keyof T, J2 extends keyof S, C2 extends keyof S[J2]>(table: J, column: C, operator: Operator, table2: J2, column2: C2): this;
|
|
160
|
-
crossJoin<J extends keyof S>(table: J, ...args: JoinArgs<S, J>): this;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export { type DBSchema as D, type Operator as O, type Pipe as P, QueryBuilder as Q, type RunFn as R, type SchemaKeys as S, type WhereFn as W, type OrderDirection as a };
|
package/dist/index.ts.d.ts
DELETED
package/dist/index.ts.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{QueryBuilder}from"./chunk-NVO75XBO.js";
|