sumak 0.0.1

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/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import{i as e,n as t,r as n,t as r}from"./_chunks/base.mjs";import{n as i,t as a}from"./_chunks/pg.mjs";import{i as o,n as s,r as ee,t as te}from"./_chunks/errors.mjs";import{n as ne,t as re}from"./_chunks/mysql.mjs";import{n as ie,t as ae}from"./_chunks/sqlite.mjs";import{C as oe,S as se,_ as ce,a as le,b as ue,c as de,d as fe,f as c,g as pe,h as me,i as he,l as ge,m as _e,n as ve,o as ye,p as be,r as xe,s as Se,t as Ce,u as we,v as Te,x as Ee,y as De}from"./_chunks/schema.mjs";function l(e,t,n){return Object.freeze({type:`table_ref`,name:e,alias:t,schema:n})}function u(){return Object.freeze({type:`select`,distinct:!1,columns:Object.freeze([]),joins:Object.freeze([]),groupBy:Object.freeze([]),orderBy:Object.freeze([]),ctes:Object.freeze([]),forUpdate:!1})}function d(e){return Object.freeze({type:`insert`,table:e,columns:Object.freeze([]),values:Object.freeze([]),returning:Object.freeze([]),ctes:Object.freeze([])})}function f(e){return Object.freeze({type:`update`,table:e,set:Object.freeze([]),returning:Object.freeze([]),ctes:Object.freeze([])})}function p(e){return Object.freeze({type:`delete`,table:e,returning:Object.freeze([]),ctes:Object.freeze([])})}function m(e,t){return{type:`column_ref`,column:e,table:t}}function Oe(e,t,n){return{type:`column_ref`,column:e,table:n,alias:t}}function h(e){return{type:`literal`,value:e}}function g(e){return{type:`star`,table:e}}function _(e,t){return{type:`param`,index:e,value:t}}function ke(e,t=[]){return{type:`raw`,sql:e,params:t}}function Ae(e,t){return{type:`subquery`,query:e,alias:t}}function v(e,t,n){return{type:`function_call`,name:e,args:t,alias:n}}function y(e,t,n){return{type:`binary_op`,op:e,left:t,right:n}}function b(e,t,n=`prefix`){return{type:`unary_op`,op:e,operand:t,position:n}}function x(e,t){return y(`AND`,e,t)}function S(e,t){return y(`OR`,e,t)}function C(e,t){return y(`=`,e,t)}function je(e,t){return y(`!=`,e,t)}function Me(e,t){return y(`>`,e,t)}function Ne(e,t){return y(`>=`,e,t)}function Pe(e,t){return y(`<`,e,t)}function Fe(e,t){return y(`<=`,e,t)}function Ie(e,t){return y(`LIKE`,e,t)}function Le(e,t,n,r=!1){return{type:`between`,expr:e,low:t,high:n,negated:r}}function Re(e,t,n=!1){return{type:`in`,expr:e,values:t,negated:n}}function w(e,t=!1){return{type:`is_null`,expr:e,negated:t}}function ze(e,t){return{type:`cast`,expr:e,dataType:t}}function Be(e,t=!1){return{type:`exists`,query:e,negated:t}}function Ve(e){return b(`NOT`,e)}var He=class{transform(e){switch(e.type){case`select`:return this.transformSelect(e);case`insert`:return this.transformInsert(e);case`update`:return this.transformUpdate(e);case`delete`:return this.transformDelete(e);default:return this.transformExpression(e)}}transformSelect(e){return{...e,columns:e.columns.map(e=>this.transformExpression(e)),where:e.where?this.transformExpression(e.where):void 0,having:e.having?this.transformExpression(e.having):void 0,joins:e.joins.map(e=>({...e,on:e.on?this.transformExpression(e.on):void 0})),orderBy:e.orderBy.map(e=>({...e,expr:this.transformExpression(e.expr)}))}}transformInsert(e){return{...e,values:e.values.map(e=>e.map(e=>this.transformExpression(e)))}}transformUpdate(e){return{...e,set:e.set.map(e=>({...e,value:this.transformExpression(e.value)})),where:e.where?this.transformExpression(e.where):void 0}}transformDelete(e){return{...e,where:e.where?this.transformExpression(e.where):void 0}}transformExpression(e){switch(e.type){case`binary_op`:return{...e,left:this.transformExpression(e.left),right:this.transformExpression(e.right)};case`unary_op`:return{...e,operand:this.transformExpression(e.operand)};case`function_call`:return{...e,args:e.args.map(e=>this.transformExpression(e))};case`between`:return{...e,expr:this.transformExpression(e.expr),low:this.transformExpression(e.low),high:this.transformExpression(e.high)};case`in`:return{...e,expr:this.transformExpression(e.expr),values:Array.isArray(e.values)?e.values.map(e=>this.transformExpression(e)):e.values};case`is_null`:return{...e,expr:this.transformExpression(e.expr)};case`cast`:return{...e,expr:this.transformExpression(e.expr)};case`json_access`:return{...e,expr:this.transformExpression(e.expr)};case`array_expr`:return{...e,elements:e.elements.map(e=>this.transformExpression(e))};case`window_function`:return{...e,fn:this.transformExpression(e.fn),partitionBy:e.partitionBy.map(e=>this.transformExpression(e)),orderBy:e.orderBy.map(e=>({...e,expr:this.transformExpression(e.expr)}))};default:return e}}};function Ue(e,t){switch(e.type){case`select`:return t.visitSelect(e);case`insert`:return t.visitInsert(e);case`update`:return t.visitUpdate(e);case`delete`:return t.visitDelete(e);default:return t.visitExpression(e)}}var T=class e{node;constructor(e){this.node=e??u()}columns(...t){let n=t.map(e=>typeof e==`string`?m(e):e);return new e({...this.node,columns:[...this.node.columns,...n]})}allColumns(){return new e({...this.node,columns:[...this.node.columns,g()]})}distinct(){return new e({...this.node,distinct:!0})}from(t,n){if(typeof t==`string`){let r={type:`table_ref`,name:t,alias:n};return new e({...this.node,from:r})}return n&&t.type!==`subquery`?new e({...this.node,from:{...t,alias:n}}):new e({...this.node,from:t})}where(t){return new e({...this.node,where:t})}join(t,n,r,i){let a={type:`join`,joinType:t,table:typeof n==`string`?{type:`table_ref`,name:n,alias:i}:n,on:r};return new e({...this.node,joins:[...this.node.joins,a]})}innerJoin(e,t,n){return this.join(`INNER`,e,t,n)}leftJoin(e,t,n){return this.join(`LEFT`,e,t,n)}rightJoin(e,t,n){return this.join(`RIGHT`,e,t,n)}groupBy(...t){let n=t.map(e=>typeof e==`string`?m(e):e);return new e({...this.node,groupBy:[...this.node.groupBy,...n]})}having(t){return new e({...this.node,having:t})}orderBy(t,n=`ASC`,r){let i={expr:typeof t==`string`?m(t):t,direction:n,nulls:r};return new e({...this.node,orderBy:[...this.node.orderBy,i]})}limit(t){return new e({...this.node,limit:t})}offset(t){return new e({...this.node,offset:t})}forUpdate(){return new e({...this.node,forUpdate:!0})}with(t,n,r=!1){let i={name:t,query:n,recursive:r};return new e({...this.node,ctes:[...this.node.ctes,i]})}union(e){return this.setOp(`UNION`,e)}unionAll(e){return this.setOp(`UNION ALL`,e)}intersect(e){return this.setOp(`INTERSECT`,e)}except(e){return this.setOp(`EXCEPT`,e)}setOp(t,n){return new e({...this.node,setOp:{op:t,query:n}})}build(){return{...this.node}}};function We(...e){let t=new T;return e.length>0?t.columns(...e):t.allColumns()}var E=class e{node;paramIndex;constructor(e,t=0){this.node=e??d({name:``}),this.paramIndex=t}into(t){let n=typeof t==`string`?{type:`table_ref`,name:t}:t;return new e({...this.node,table:n},this.paramIndex)}columns(...t){return new e({...this.node,columns:[...this.node.columns,...t]},this.paramIndex)}values(...t){let n=this.paramIndex,r=t.map(e=>{let t=_(n,e);return n++,t});return new e({...this.node,values:[...this.node.values,r]},n)}returning(...t){return new e({...this.node,returning:[...this.node.returning,...t]},this.paramIndex)}onConflictDoNothing(...t){let n={columns:t,action:`nothing`};return new e({...this.node,onConflict:n},this.paramIndex)}onConflictDoUpdate(t,n,r){let i={columns:t,action:{set:n},where:r};return new e({...this.node,onConflict:i},this.paramIndex)}with(t,n,r=!1){let i={name:t,query:n,recursive:r};return new e({...this.node,ctes:[...this.node.ctes,i]},this.paramIndex)}build(){return{...this.node}}};function Ge(e){return new E().into(e)}var D=class e{node;constructor(e){this.node=e??f({name:``})}table(t){let n=typeof t==`string`?{type:`table_ref`,name:t}:t;return new e({...this.node,table:n})}set(t,n){return new e({...this.node,set:[...this.node.set,{column:t,value:n}]})}where(t){return new e({...this.node,where:t})}from(t){let n=typeof t==`string`?{type:`table_ref`,name:t}:t;return new e({...this.node,from:n})}returning(...t){return new e({...this.node,returning:[...this.node.returning,...t]})}with(t,n,r=!1){let i={name:t,query:n,recursive:r};return new e({...this.node,ctes:[...this.node.ctes,i]})}build(){return{...this.node}}};function Ke(e){return new D().table(e)}var O=class e{node;constructor(e){this.node=e??p({name:``})}from(t){let n=typeof t==`string`?{type:`table_ref`,name:t}:t;return new e({...this.node,table:n})}where(t){return new e({...this.node,where:t})}returning(...t){return new e({...this.node,returning:[...this.node.returning,...t]})}with(t,n,r=!1){let i={name:t,query:n,recursive:r};return new e({...this.node,ctes:[...this.node.ctes,i]})}build(){return{...this.node}}};function qe(e){return new O().from(e)}const k=new Set(`SELECT.FROM.WHERE.AND.OR.JOIN.INNER JOIN.LEFT JOIN.RIGHT JOIN.FULL JOIN.CROSS JOIN.ON.GROUP BY.HAVING.ORDER BY.LIMIT.OFFSET.INSERT INTO.VALUES.UPDATE.SET.DELETE FROM.RETURNING.WITH.WITH RECURSIVE.UNION.UNION ALL.INTERSECT.EXCEPT.FOR UPDATE.ON CONFLICT.DO NOTHING.DO UPDATE SET`.split(`.`));function Je(e,t={}){let n=t.indent??` `,r=[],i=0,a=Ye(e),o=0;for(;o<a.length;){let e=a[o];if(e===`(`){i++,A(r,e),o++;continue}if(e===`)`){i=Math.max(0,i-1),A(r,e),o++;continue}let t=o+1<a.length?`${e} ${a[o+1]}`:``,s=o+2<a.length?`${e} ${a[o+1]} ${a[o+2]}`:``;if(k.has(s.toUpperCase())){r.push(`${n.repeat(i)}${s}`),o+=3;continue}if(k.has(t.toUpperCase())){r.push(`${n.repeat(i)}${t}`),o+=2;continue}if(k.has(e.toUpperCase())){r.push(`${n.repeat(i)}${e}`),o++;continue}A(r,e),o++}return r.join(`
2
+ `)}function A(e,t){e.length===0?e.push(t):e[e.length-1]+=` ${t}`}function Ye(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`'`||i===`"`){for(n+=i,r++;r<e.length&&e[r]!==i;){if(e[r]===i&&r+1<e.length&&e[r+1]===i){n+=i+i,r+=2;continue}n+=e[r],r++}r<e.length&&(n+=e[r]);continue}if(i===`(`||i===`)`){n.trim()&&(t.push(n.trim()),n=``),t.push(i);continue}if(i===`,`||i===`;`){n.trim()&&(t.push(n.trim()),n=``),t.push(i);continue}if(/\s/.test(i)){n.trim()&&(t.push(n.trim()),n=``);continue}n+=i}return n.trim()&&t.push(n.trim()),t}function j(){return{tag:`empty`}}function M(e){return{tag:`text`,text:e}}function N(){return{tag:`line`}}function Xe(e,t){return{tag:`nest`,indent:e,doc:t}}function Ze(e){return{tag:`group`,doc:e}}function P(...e){let t=e.filter(e=>e.tag!==`empty`);return t.length===0?j():t.length===1?t[0]:{tag:`concat`,docs:t}}function Qe(e,t){if(t.length===0)return j();let n=[];for(let r=0;r<t.length;r++)r>0&&n.push(e),n.push(t[r]);return P(...n)}function $e(e){return P(M(e),N())}function et(e,t=80){let n=``,r=0,i=[[0,`break`,e]];for(;i.length>0;){let[e,a,o]=i.pop();switch(o.tag){case`empty`:break;case`text`:n+=o.text,r+=o.text.length;break;case`line`:a===`flat`?(n+=` `,r+=1):(n+=`
3
+ `+` `.repeat(e),r=e);break;case`nest`:i.push([e+o.indent,a,o.doc]);break;case`group`:if(a===`flat`)i.push([e,`flat`,o.doc]);else{let n=tt(o.doc);n!==null&&r+n<=t?i.push([e,`flat`,o.doc]):i.push([e,`break`,o.doc])}break;case`concat`:for(let t=o.docs.length-1;t>=0;t--)i.push([e,a,o.docs[t]]);break}}return n}function tt(e){let t=0,n=[e];for(;n.length>0;){let e=n.pop();switch(e.tag){case`empty`:break;case`text`:t+=e.text.length;break;case`line`:t+=1;break;case`nest`:n.push(e.doc);break;case`group`:n.push(e.doc);break;case`concat`:for(let t=e.docs.length-1;t>=0;t--)n.push(e.docs[t]);break}}return t}var F=class{_node;constructor(e,t){this._node=m(e,t)}eq(e){return B(z(`=`,this._node,R(e)))}neq(e){return B(z(`!=`,this._node,R(e)))}gt(e){return B(z(`>`,this._node,R(e)))}gte(e){return B(z(`>=`,this._node,R(e)))}lt(e){return B(z(`<`,this._node,R(e)))}lte(e){return B(z(`<=`,this._node,R(e)))}like(e){return B(z(`LIKE`,this._node,h(e)))}in(e){return B({type:`in`,expr:this._node,values:e.map(e=>R(e)),negated:!1})}notIn(e){return B({type:`in`,expr:this._node,values:e.map(e=>R(e)),negated:!0})}isNull(){return B({type:`is_null`,expr:this._node,negated:!1})}isNotNull(){return B({type:`is_null`,expr:this._node,negated:!0})}between(e,t){return B({type:`between`,expr:this._node,low:R(e),high:R(t),negated:!1})}eqCol(e){return B(z(`=`,this._node,e._node))}toExpr(){return B(this._node)}};let I=0;function L(){I=0}function R(e){return _(I++,e)}function z(e,t,n){return{type:`binary_op`,op:e,left:t,right:n}}function B(e){return{node:e}}function V(e){return new Proxy({},{get(e,t){return new F(t,void 0)}})}function nt(e,t){return B(x(e.node,t.node))}function rt(e,t){return B(S(e.node,t.node))}function it(e){return B(h(e))}function at(e,...t){return B(v(e,t.map(e=>e.node)))}function ot(){return B(v(`COUNT`,[g()]))}function H(e){return e.node}var U=class e{_builder;_table;constructor(e,t){this._builder=e,this._table=t??``}select(...t){return new e(this._builder.columns(...t),this._table)}selectAll(){return new e(this._builder.allColumns(),this._table)}selectExpr(t,n){let r=H(t),i=r.type===`column_ref`||r.type===`function_call`?{...r,alias:n}:{type:`raw`,sql:``,params:[]};return new e(this._builder.columns(i),this._table)}distinct(){return new e(this._builder.distinct(),this._table)}where(t){if(typeof t==`function`){L();let n=t(V(this._table));return new e(this._builder.where(H(n)),this._table)}return new e(this._builder.where(H(t)),this._table)}innerJoin(t,n){let r=W(n,this._table,t);return new e(this._builder.innerJoin(t,H(r)),this._table)}leftJoin(t,n){let r=W(n,this._table,t);return new e(this._builder.leftJoin(t,H(r)),this._table)}rightJoin(t,n){let r=W(n,this._table,t);return new e(this._builder.rightJoin(t,H(r)),this._table)}groupBy(...t){return new e(this._builder.groupBy(...t),this._table)}having(t){if(typeof t==`function`){L();let n=t(V(this._table));return new e(this._builder.having(H(n)),this._table)}return new e(this._builder.having(H(t)),this._table)}orderBy(t,n=`ASC`,r){return new e(this._builder.orderBy(t,n,r),this._table)}limit(t){return new e(this._builder.limit({type:`literal`,value:t}),this._table)}offset(t){return new e(this._builder.offset({type:`literal`,value:t}),this._table)}forUpdate(){return new e(this._builder.forUpdate(),this._table)}with(t,n,r=!1){return new e(this._builder.with(t,n,r),this._table)}union(t){return new e(this._builder.union(t.build()),this._table)}unionAll(t){return new e(this._builder.unionAll(t.build()),this._table)}build(){return this._builder.build()}compile(e){return e.print(this.build())}};function st(e,t){return new Proxy({},{get(e,t){return new Proxy({},{get(e,n){return new F(n,t)}})}})}function W(e,t,n){return typeof e==`function`?e(st(t,n)):e}var G=class e{_builder;_paramIdx;constructor(e,t=0){this._builder=new E().into(e),this._paramIdx=t}_withBuilder(t,n){let r=new e(``);return r._builder=t,r._paramIdx=n,r}values(e){let t=Object.entries(e),n=t.map(([e])=>e),r=t.map(([e,t])=>{let n=_(this._paramIdx,t);return this._paramIdx++,n}),i=this._builder;return i.build().columns.length===0&&(i=i.columns(...n)),i=new E({...i.build(),values:[...i.build().values,r]},this._paramIdx),this._withBuilder(i,this._paramIdx)}returning(...e){let t=e.map(e=>({type:`column_ref`,column:e}));return new K(new E({...this._builder.build(),returning:t},this._paramIdx))}returningAll(){return new K(new E({...this._builder.build(),returning:[g()]},this._paramIdx))}onConflictDoNothing(...e){return this._withBuilder(this._builder.onConflictDoNothing(...e),this._paramIdx)}onConflictDoUpdate(e,t){return this._withBuilder(this._builder.onConflictDoUpdate(e,t.map(e=>({column:e.column,value:H(e.value)}))),this._paramIdx)}build(){return this._builder.build()}compile(e){return e.print(this.build())}},K=class{_builder;constructor(e){this._builder=e}build(){return this._builder.build()}compile(e){return e.print(this.build())}},q=class e{_builder;_paramIdx;constructor(e,t=0){this._builder=new D().table(e),this._paramIdx=t}_with(t,n){let r=new e(``);return r._builder=t,r._paramIdx=n,r}set(e){let t=this._builder,n=this._paramIdx;for(let[r,i]of Object.entries(e))i!==void 0&&(t=t.set(r,_(n,i)),n++);return this._with(t,n)}setExpr(e,t){return this._with(this._builder.set(e,H(t)),this._paramIdx)}where(e){if(typeof e==`function`){L();let t=e(V(this._table));return this._with(this._builder.where(H(t)),this._paramIdx)}return this._with(this._builder.where(H(e)),this._paramIdx)}get _table(){return this._builder.build().table.name}returning(...e){let t=e.map(e=>({type:`column_ref`,column:e}));return new J(new D({...this._builder.build(),returning:t}))}returningAll(){return new J(new D({...this._builder.build(),returning:[g()]}))}build(){return this._builder.build()}compile(e){return e.print(this.build())}},J=class{_builder;constructor(e){this._builder=e}build(){return this._builder.build()}compile(e){return e.print(this.build())}},Y=class e{_builder;constructor(e){this._builder=new O().from(e)}_with(t){let n=new e(``);return n._builder=t,n}where(e){if(typeof e==`function`){L();let t=this._builder.build().table.name,n=e(V(t));return this._with(this._builder.where(H(n)))}return this._with(this._builder.where(H(e)))}returning(...e){let t=e.map(e=>({type:`column_ref`,column:e}));return new X(new O({...this._builder.build(),returning:t}))}returningAll(){return new X(new O({...this._builder.build(),returning:[g()]}))}build(){return this._builder.build()}compile(e){return e.print(this.build())}},X=class{_builder;constructor(e){this._builder=e}build(){return this._builder.build()}compile(e){return e.print(this.build())}},Z=class{plugins;constructor(e){this.plugins=Object.freeze([...e])}transformNode(e){let t=e;for(let e of this.plugins)e.transformNode&&(t=e.transformNode(t));return t}transformQuery(e){let t=e;for(let e of this.plugins)e.transformQuery&&(t=e.transformQuery(t));return t}transformResult(e){let t=e;for(let e of this.plugins)e.transformResult&&(t=e.transformResult(t));return t}},Q=class{_hooks=new Map;hook(e,t){return this._hooks.has(e)||this._hooks.set(e,[]),this._hooks.get(e).push(t),()=>{let n=this._hooks.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}callHook(e,...t){let n=this._hooks.get(e);if(!n||n.length===0)return;let r;for(let i of n){let n=i(...t);n!==void 0&&(r=n,e!==`result:transform`&&t[0]&&typeof t[0]==`object`&&`node`in t[0]&&(t[0].node=n))}return r}hasHook(e){let t=this._hooks.get(e);return t!==void 0&&t.length>0}removeHook(e){this._hooks.delete(e)}removeAllHooks(){this._hooks.clear()}};function ct(e){return new $(e.dialect,e.plugins??[])}var $=class{_dialect;_plugins;_hooks;constructor(e,t=[]){this._dialect=e,this._plugins=new Z(t),this._hooks=new Q}hook(e,t){return this._hooks.hook(e,t)}selectFrom(e,t){return new U(new T().from(e,t),e)}insertInto(e){return new G(e)}update(e){return new q(e)}deleteFrom(e){return new Y(e)}compile(e){let t=this._plugins.transformNode(e),n=this._extractTableName(t);switch(t.type){case`select`:{let e=this._hooks.callHook(`select:before`,{node:t,table:n});e&&(t=e);break}case`insert`:{let e=this._hooks.callHook(`insert:before`,{node:t,table:n});e&&(t=e);break}case`update`:{let e=this._hooks.callHook(`update:before`,{node:t,table:n});e&&(t=e);break}case`delete`:{let e=this._hooks.callHook(`delete:before`,{node:t,table:n});e&&(t=e);break}}let r=this._hooks.callHook(`query:before`,{node:t,table:n});r&&(t=r);let i=this._dialect.createPrinter().print(t);i=this._plugins.transformQuery(i);let a=this._hooks.callHook(`query:after`,{node:t,table:n,query:i});return a&&(i=a),i}transformResult(e){let t=this._plugins.transformResult(e),n=this._hooks.callHook(`result:transform`,t);return n&&(t=n),t}printer(){return this._dialect.createPrinter()}_extractTableName(e){switch(e.type){case`select`:return e.from?.type===`table_ref`?e.from.name:void 0;case`insert`:return e.table.name;case`update`:return e.table.name;case`delete`:return e.table.name;default:return}}},lt=class{name=`with-schema`;schema;constructor(e){this.schema=e}transformNode(e){switch(e.type){case`select`:return this.transformSelect(e);case`insert`:return this.transformInsert(e);case`update`:return this.transformUpdate(e);case`delete`:return this.transformDelete(e);default:return e}}addSchema(e){return e.schema?e:{...e,schema:this.schema}}transformSelect(e){return{...e,from:e.from?e.from.type===`table_ref`?this.addSchema(e.from):e.from:void 0,joins:e.joins.map(e=>({...e,table:e.table.type===`table_ref`?this.addSchema(e.table):e.table}))}}transformInsert(e){return{...e,table:this.addSchema(e.table)}}transformUpdate(e){return{...e,table:this.addSchema(e.table),from:e.from?this.addSchema(e.from):void 0}}transformDelete(e){return{...e,table:this.addSchema(e.table)}}},ut=class{name=`soft-delete`;tables;column;constructor(e){this.tables=new Set(e.tables),this.column=e.column??`deleted_at`}transformNode(e){switch(e.type){case`select`:return this.transformSelect(e);case`update`:return this.transformUpdate(e);case`delete`:return this.transformDelete(e);default:return e}}isTargetTable(e){return this.tables.has(e)}softDeleteCondition(){return w(m(this.column))}addCondition(e){let t=this.softDeleteCondition();return e?x(e,t):t}transformSelect(e){return!e.from||e.from.type!==`table_ref`||!this.isTargetTable(e.from.name)?e:{...e,where:this.addCondition(e.where)}}transformUpdate(e){return this.isTargetTable(e.table.name)?{...e,where:this.addCondition(e.where)}:e}transformDelete(e){return this.isTargetTable(e.table.name)?{...e,where:this.addCondition(e.where)}:e}},dt=class{name=`camel-case`;transformResult(e){return e.map(e=>{let t={};for(let n of Object.keys(e))t[ft(n)]=e[n];return t})}};function ft(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}export{He as ASTTransformer,r as BasePrinter,dt as CamelCasePlugin,F as Col,ve as ColumnBuilder,O as DeleteBuilder,te as EmptyQueryError,Q as Hookable,E as InsertBuilder,s as InvalidExpressionError,ne as MysqlPrinter,$ as Pamuk,ee as PamukError,i as PgPrinter,Z as PluginManager,T as SelectBuilder,ut as SoftDeletePlugin,ie as SqlitePrinter,Y as TypedDeleteBuilder,X as TypedDeleteReturningBuilder,G as TypedInsertBuilder,K as TypedInsertReturningBuilder,U as TypedSelectBuilder,q as TypedUpdateBuilder,J as TypedUpdateReturningBuilder,o as UnsupportedDialectFeatureError,D as UpdateBuilder,lt as WithSchemaPlugin,nt as and,Le as between,xe as bigint,he as bigserial,y as binOp,le as boolean,ye as bytea,ze as cast,Se as char,m as col,Oe as colAs,ot as count,p as createDeleteNode,d as createInsertNode,u as createSelectNode,f as createUpdateNode,de as date,Ce as defineTable,qe as deleteFrom,P as docConcat,j as docEmpty,Ze as docGroup,Qe as docJoin,N as docLine,Xe as docNest,et as docRender,M as docText,$e as docTextLine,ge as doublePrecision,we as enumType,C as eq,Be as exists,v as fn,t as formatParam,Je as formatSQL,Me as gt,Ne as gte,Re as inList,Ge as insert,fe as integer,w as isNull,c as json,be as jsonb,Ie as like,h as lit,Pe as lt,Fe as lte,re as mysqlDialect,je as neq,Ve as not,_e as numeric,rt as or,ct as pamuk,_ as param,a as pgDialect,n as quoteIdentifier,e as quoteTableRef,ke as raw,me as real,L as resetParams,We as select,pe as serial,ce as smallint,at as sqlFn,ae as sqliteDialect,g as star,Ae as subquery,l as tableRef,Te as text,De as time,ue as timestamp,Ee as timestamptz,b as unaryOp,Ke as update,se as uuid,it as val,oe as varchar,Ue as visitNode};
@@ -0,0 +1,2 @@
1
+ import { n as MysqlPrinter, t as mysqlDialect } from "./_chunks/mysql.mjs";
2
+ export { MysqlPrinter, mysqlDialect };
package/dist/mysql.mjs ADDED
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./_chunks/mysql.mjs";export{e as MysqlPrinter,t as mysqlDialect};
package/dist/pg.d.mts ADDED
@@ -0,0 +1,2 @@
1
+ import { n as PgPrinter, t as pgDialect } from "./_chunks/pg.mjs";
2
+ export { PgPrinter, pgDialect };
package/dist/pg.mjs ADDED
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./_chunks/pg.mjs";export{e as PgPrinter,t as pgDialect};
@@ -0,0 +1,2 @@
1
+ import { A as GeneratedAlways, C as time, D as varchar, E as uuid, F as Selectable, I as UpdateType, L as Updateable, M as Insertable, O as ColumnType, P as SelectType, S as text, T as timestamptz, _ as jsonb, a as ColumnBuilder, b as serial, c as bigserial, d as char, f as date, g as json, h as integer, i as defineTable, j as InsertType, k as Generated, l as boolean, m as enumType, n as InferTable, o as ColumnDef, p as doublePrecision, r as TableDefinition, s as bigint, t as Nullable, u as bytea, v as numeric, w as timestamp, x as smallint, y as real } from "./_chunks/index.mjs";
2
+ export { ColumnBuilder, type ColumnDef, type ColumnType, type Generated, type GeneratedAlways, type InferTable, type InsertType, type Insertable, type Nullable, type SelectType, type Selectable, type TableDefinition, type UpdateType, type Updateable, bigint, bigserial, boolean, bytea, char, date, defineTable, doublePrecision, enumType, integer, json, jsonb, numeric, real, serial, smallint, text, time, timestamp, timestamptz, uuid, varchar };
@@ -0,0 +1 @@
1
+ import{C as e,S as t,_ as n,a as r,b as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,x,y as S}from"./_chunks/schema.mjs";export{p as ColumnBuilder,g as bigint,u as bigserial,r as boolean,m as bytea,_ as char,a as date,v as defineTable,d as doublePrecision,y as enumType,o as integer,s as json,h as jsonb,f as numeric,l as real,c as serial,n as smallint,b as text,S as time,i as timestamp,x as timestamptz,t as uuid,e as varchar};
@@ -0,0 +1,2 @@
1
+ import { n as SqlitePrinter, t as sqliteDialect } from "./_chunks/sqlite.mjs";
2
+ export { SqlitePrinter, sqliteDialect };
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./_chunks/sqlite.mjs";export{e as SqlitePrinter,t as sqliteDialect};
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "sumak",
3
+ "version": "0.0.1",
4
+ "description": "Type-safe SQL query builder with powerful SQL printers. Zero dependencies, tree-shakeable. Pure TypeScript.",
5
+ "keywords": [
6
+ "database",
7
+ "esm",
8
+ "mysql",
9
+ "orm",
10
+ "postgresql",
11
+ "query-builder",
12
+ "sql",
13
+ "sqlite",
14
+ "tree-shakeable",
15
+ "type-safe",
16
+ "typescript",
17
+ "zero-dependency"
18
+ ],
19
+ "homepage": "https://github.com/productdevbook/pamuk",
20
+ "bugs": {
21
+ "url": "https://github.com/productdevbook/pamuk/issues"
22
+ },
23
+ "license": "MIT",
24
+ "author": "productdevbook",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/productdevbook/pamuk.git"
28
+ },
29
+ "funding": "https://github.com/sponsors/productdevbook",
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "type": "module",
34
+ "module": "./dist/index.mjs",
35
+ "types": "./dist/index.d.mts",
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.mts",
39
+ "default": "./dist/index.mjs"
40
+ },
41
+ "./pg": {
42
+ "types": "./dist/pg.d.mts",
43
+ "default": "./dist/pg.mjs"
44
+ },
45
+ "./mysql": {
46
+ "types": "./dist/mysql.d.mts",
47
+ "default": "./dist/mysql.mjs"
48
+ },
49
+ "./sqlite": {
50
+ "types": "./dist/sqlite.d.mts",
51
+ "default": "./dist/sqlite.mjs"
52
+ },
53
+ "./schema": {
54
+ "types": "./dist/schema.d.mts",
55
+ "default": "./dist/schema.mjs"
56
+ }
57
+ },
58
+ "scripts": {
59
+ "build": "obuild",
60
+ "dev": "vitest",
61
+ "lint": "oxlint . && oxfmt --check .",
62
+ "lint:fix": "oxlint . --fix && oxfmt .",
63
+ "fmt": "oxfmt .",
64
+ "test": "pnpm lint && pnpm typecheck && vitest run",
65
+ "typecheck": "tsgo --noEmit",
66
+ "release": "pnpm test && pnpm build && bumpp --commit --tag --push --all",
67
+ "prepack": "pnpm build"
68
+ },
69
+ "devDependencies": {
70
+ "@typescript/native-preview": "7.0.0-dev.20260316.1",
71
+ "@vitest/coverage-v8": "^4.1.1",
72
+ "bumpp": "^11.0.1",
73
+ "obuild": "^0.4.32",
74
+ "oxfmt": "^0.42.0",
75
+ "oxlint": "^1.57.0",
76
+ "typescript": "^6.0.2",
77
+ "vitest": "^4.1.1"
78
+ }
79
+ }