viborm 1.16.0 → 1.16.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/adapters.d.mts +1 -1
- package/dist/args-7WgBFd_f.mjs +1 -1
- package/dist/batch-refs-Bd8HvwUc.mjs +1 -1
- package/dist/better-auth.d.mts +1 -1
- package/dist/bun-sql.d.mts +1 -1
- package/dist/bun-sql.mjs +1 -1
- package/dist/bun-sqlite.d.mts +1 -1
- package/dist/bun-sqlite.mjs +1 -1
- package/dist/cache/cloudflare-kv.d.mts +1 -1
- package/dist/cache/memory.d.mts +1 -1
- package/dist/cache.d.mts +2 -2
- package/dist/call-0bd_B9Vp.mjs +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/{client-Dlz3-2JC.d.mts → client-Bb2oZOzg.d.mts} +1 -1
- package/dist/{client-DEfFqv4S.mjs → client-BvAmGuYW.mjs} +5 -5
- package/dist/client-BvAmGuYW.mjs.map +1 -0
- package/dist/{client-D7sWgUt2.mjs → client-Q4zkYZbn.mjs} +2 -2
- package/dist/{client-D7sWgUt2.mjs.map → client-Q4zkYZbn.mjs.map} +1 -1
- package/dist/client.d.mts +2 -2
- package/dist/config.d.mts +1 -1
- package/dist/coordination-BxMskOgi.mjs +1 -1
- package/dist/d1.d.mts +1 -1
- package/dist/d1.mjs +1 -1
- package/dist/{database-adapter-BMjJiBFm.d.mts → database-adapter-01J6mYq5.d.mts} +1 -1
- package/dist/defaults-DAPb-tJ4.mjs +1 -1
- package/dist/{document-CHaVF7Vn.d.mts → document-DRPqjDv_.d.mts} +1 -1
- package/dist/{driver-BvTixv-m.d.mts → driver-CTjq1yxj.d.mts} +1 -1
- package/dist/driver.d.mts +1 -1
- package/dist/durable-object.d.mts +1 -1
- package/dist/durable-object.mjs +1 -1
- package/dist/error-mapping-B9rSvgG9.mjs +1 -1
- package/dist/every-CgeIFxWR.mjs +2 -0
- package/dist/{every-JpbiHdMb.mjs.map → every-CgeIFxWR.mjs.map} +1 -1
- package/dist/{exports-DYnTfvQo.d.mts → exports-nC8lsVKO.d.mts} +1 -1
- package/dist/extension-Dh1ddrlA.mjs +1 -1
- package/dist/geo-area-codec-Bti2PA2i.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/instrumentation.d.mts +1 -1
- package/dist/instrumentation.mjs +1 -1
- package/dist/{introspect-q3Rf_Xv8.mjs → introspect-rGqr93B3.mjs} +2 -2
- package/dist/{introspect-q3Rf_Xv8.mjs.map → introspect-rGqr93B3.mjs.map} +1 -1
- package/dist/judge-words-k5GCc4cV.mjs +1 -1
- package/dist/keys-DZdKAd4n.mjs +1 -1
- package/dist/{libsql-DEZ0uhK2.mjs → libsql-BZAXy5PY.mjs} +3 -3
- package/dist/{libsql-DEZ0uhK2.mjs.map → libsql-BZAXy5PY.mjs.map} +1 -1
- package/dist/libsql.d.mts +1 -1
- package/dist/libsql.mjs +1 -1
- package/dist/{memory-BaGWNdvk.mjs → memory-DgBGBQdJ.mjs} +2 -2
- package/dist/{memory-BaGWNdvk.mjs.map → memory-DgBGBQdJ.mjs.map} +1 -1
- package/dist/methods-part-BaNx3o7b.mjs +1 -1
- package/dist/migrations/mysql.d.mts +4 -4
- package/dist/migrations/mysql.mjs +1 -1
- package/dist/migrations/postgres.d.mts +4 -4
- package/dist/migrations/postgres.mjs +1 -1
- package/dist/migrations/snowflake.d.mts +4 -4
- package/dist/migrations/snowflake.mjs +1 -1
- package/dist/migrations/sqlite.d.mts +4 -4
- package/dist/migrations/sqlite.mjs +1 -1
- package/dist/migrations/surrealdb.d.mts +4 -4
- package/dist/migrations/surrealdb.mjs +1 -1
- package/dist/migrations/tenant.d.mts +2 -2
- package/dist/migrations/tenant.mjs +1 -1
- package/dist/migrations.d.mts +4 -4
- package/dist/migrations.mjs +1 -1
- package/dist/{mysql-BFPF8xyv.mjs → mysql-BjIAoFH6.mjs} +4 -4
- package/dist/{mysql-BFPF8xyv.mjs.map → mysql-BjIAoFH6.mjs.map} +1 -1
- package/dist/mysql2.d.mts +1 -1
- package/dist/mysql2.mjs +1 -1
- package/dist/named-statements-CkOOD__I.mjs +1 -1
- package/dist/native-types-1ewJXVks.mjs +1 -1
- package/dist/neon-http.d.mts +1 -1
- package/dist/neon-http.mjs +1 -1
- package/dist/{object-store-C4qmW7xf.d.mts → object-store-BBDTj8x3.d.mts} +3 -3
- package/dist/on.d.mts +1 -1
- package/dist/ordering.d.mts +1 -1
- package/dist/pending-operation-D4gUKMxD.mjs +1 -1
- package/dist/permissions.d.mts +1 -1
- package/dist/permissions.mjs +1 -1
- package/dist/pg.d.mts +1 -1
- package/dist/pg.mjs +1 -1
- package/dist/pglite.d.mts +1 -1
- package/dist/pglite.mjs +1 -1
- package/dist/pinned-session-Y7-2pRBJ.mjs +1 -1
- package/dist/planetscale.d.mts +1 -1
- package/dist/planetscale.mjs +1 -1
- package/dist/{planner-C-zjj19U.d.mts → planner-CYu6_q4w.d.mts} +1 -1
- package/dist/{postgres-DQQE2ys_.mjs → postgres-CaMB2Y4p.mjs} +13 -12
- package/dist/postgres-CaMB2Y4p.mjs.map +1 -0
- package/dist/postgres-adapter-psTVfuw7.mjs +1 -1
- package/dist/postgres.d.mts +1 -1
- package/dist/postgres.mjs +1 -1
- package/dist/provider-limits-SdI1SaJS.mjs +2 -0
- package/dist/provider-limits-SdI1SaJS.mjs.map +1 -0
- package/dist/query-BTb6iakn.mjs +1 -1
- package/dist/raw-DqEb71JZ.mjs +1 -1
- package/dist/rows-of-Bgl9GVtK.mjs +1 -1
- package/dist/rule-words-DMbQuvD2.mjs +1 -1
- package/dist/schema/introspect.d.mts +2 -2
- package/dist/schema/introspect.mjs +1 -1
- package/dist/schema/json.d.mts +2 -2
- package/dist/schema-DDkAUfOb.mjs +1 -1
- package/dist/schema.d.mts +1 -1
- package/dist/{serializer-ettLu5xG.mjs → serializer-Br9JgpQI.mjs} +16 -16
- package/dist/serializer-Br9JgpQI.mjs.map +1 -0
- package/dist/settled-DYYPcaBX.mjs +1 -1
- package/dist/{snowflake-BfF8xwfP.mjs → snowflake-B8Ei88bg.mjs} +2 -2
- package/dist/{snowflake-BfF8xwfP.mjs.map → snowflake-B8Ei88bg.mjs.map} +1 -1
- package/dist/snowflake.d.mts +1 -1
- package/dist/snowflake.mjs +1 -1
- package/dist/soft-delete.d.mts +1 -1
- package/dist/{sql-Bu63iAfT.mjs → sql-M5WsPhqr.mjs} +2 -2
- package/dist/{sql-Bu63iAfT.mjs.map → sql-M5WsPhqr.mjs.map} +1 -1
- package/dist/sqlite3.d.mts +1 -1
- package/dist/sqlite3.mjs +1 -1
- package/dist/standard-sql-Bl2OHGfi.mjs +1 -1
- package/dist/surrealdb.d.mts +1 -1
- package/dist/surrealdb.mjs +1 -1
- package/dist/{surrealql-DY74AUeD.mjs → surrealql-f2Rgu47F.mjs} +2 -2
- package/dist/{surrealql-DY74AUeD.mjs.map → surrealql-f2Rgu47F.mjs.map} +1 -1
- package/dist/unit-words-BXpLpyr2.mjs +1 -1
- package/dist/validation-BHjx13zG.mjs +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validator-DMzH5Tz0.mjs +1 -1
- package/dist/version-Bu2LCuaj.mjs +2 -0
- package/dist/{version-0BDwfy7C.mjs.map → version-Bu2LCuaj.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/client-DEfFqv4S.mjs.map +0 -1
- package/dist/every-JpbiHdMb.mjs +0 -2
- package/dist/postgres-DQQE2ys_.mjs.map +0 -1
- package/dist/provider-limits-Bcsz0EJv.mjs +0 -2
- package/dist/provider-limits-Bcsz0EJv.mjs.map +0 -1
- package/dist/serializer-ettLu5xG.mjs.map +0 -1
- package/dist/version-0BDwfy7C.mjs +0 -2
package/dist/adapters.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $r as IdRepresentation, Sa as DecimalDescriptor, Wo as NativeTypeDeclaration, a as TextMatch, c as ArithmeticTarget, i as PeriodSql, l as CastType, o as VectorOrderKey, r as GeoPointSql, s as AdapterResultParser, t as DatabaseAdapter } from "./database-adapter-
|
|
1
|
+
import { $r as IdRepresentation, Sa as DecimalDescriptor, Wo as NativeTypeDeclaration, a as TextMatch, c as ArithmeticTarget, i as PeriodSql, l as CastType, o as VectorOrderKey, r as GeoPointSql, s as AdapterResultParser, t as DatabaseAdapter } from "./database-adapter-01J6mYq5.mjs";
|
|
2
2
|
import { n as Sql } from "./sql-C4_sFNDm.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/databases/mysql/mysql-adapter.d.ts
|
package/dist/args-7WgBFd_f.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,i as t,o as n,r}from"./methods-part-BaNx3o7b.mjs";import{i}from"./on-ZkOVmE4-.mjs";function a(e){return{spec:e,default:t=>a({...e,default:t}),on:t=>a({...e,on:i(t)}),models:t=>a({...e,models:t}),required:t=>a({...e,required:t??!0}),volatile:()=>a({...e,volatile:!0})}}function o(...e){return a({oneOf:e,oz:n(e)})}function s(t){return a({oz:e(t)})}function c(n){return a({oz:e(n),bound:!0,bind:t})}const l=e=>typeof e==`object`&&!!e&&`spec`in e&&typeof e.spec==`object`&&e.spec!==null;function u(e,t){if(l(t))return t.spec;throw TypeError(`Argument "${e}" is declared with oneOf(...), accepts(schema) or bound(schema); write a Standard Schema as accepts(schema)`)}function d(e){let t=Object.keys(e),n=t.map(t=>({...u(t,e[t]),name:t}));return{declare(e){let{next:i,
|
|
1
|
+
import{a as e,i as t,o as n,r}from"./methods-part-BaNx3o7b.mjs";import{i}from"./on-ZkOVmE4-.mjs";function a(e){return{spec:e,default:t=>a({...e,default:t}),on:t=>a({...e,on:i(t)}),models:t=>a({...e,models:t}),required:t=>a({...e,required:t??!0}),volatile:()=>a({...e,volatile:!0})}}function o(...e){return a({oneOf:e,oz:n(e)})}function s(t){return a({oz:e(t)})}function c(n){return a({oz:e(n),bound:!0,bind:t})}const l=e=>typeof e==`object`&&!!e&&`spec`in e&&typeof e.spec==`object`&&e.spec!==null;function u(e,t){if(l(t))return t.spec;throw TypeError(`Argument "${e}" is declared with oneOf(...), accepts(schema) or bound(schema); write a Standard Schema as accepts(schema)`)}function d(e){let t=Object.keys(e),n=t.map(t=>({...u(t,e[t]),name:t}));return{declare(e){let{next:i,u7:a,owner:o,name:s}=e;i.args=r(i.args??a?.args,n.map(e=>({...e,extension:s}))),e.owner={name:s,args:[...o.args??[],...t]}}}}export{o as i,d as n,c as r,s as t};
|
|
2
2
|
//# sourceMappingURL=args-7WgBFd_f.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./sql-tegqTqGq.mjs";const t=`__viborm_batch_refs`;function n(t){return i({...t,store:(n,r,i)=>{let a=t.wd(i);return e`INSERT INTO ${t.table} (${t.oj}, ${t.hx}, ${t.ly}) VALUES (${n}, ${r}, ${a}) ${e.raw`ON CONFLICT`} (${t.oj}, ${t.hx}) DO UPDATE SET ${t.ly} = EXCLUDED.${t.ly}`}})}function r(t){return i({...t,store:(n,r,i)=>{let a=t.wd(i);return e`INSERT INTO ${t.table} (${t.oj}, ${t.hx}, ${t.ly}) VALUES (${n}, ${r}, ${a}) ${e.raw`ON DUPLICATE KEY UPDATE`} ${t.ly} = ${t.qh}`}})}function i(t){let n=t.lastInsertId,r=t.mc,i=r?(e,t,n,i)=>[r(e,t,n,i)]:n?(e,r,i)=>[i,t.store(e,r,n())]:void 0;return{setup:e=>[t.createTable],cleanup:n=>e`DELETE FROM ${t.table} WHERE ${t.oj} = ${n}`,store:t.store,read:(n,r)=>e`(SELECT ${t.ly} FROM ${t.table} WHERE ${t.oj} = ${n} AND ${t.hx} = ${r} ${e.raw`LIMIT 1`})`,...n?{a6:(e,r)=>t.store(e,r,n())}:{},...r?{mc:r}:{},...i?{
|
|
1
|
+
import{o as e}from"./sql-tegqTqGq.mjs";const t=`__viborm_batch_refs`;function n(t){return i({...t,store:(n,r,i)=>{let a=t.wd(i);return e`INSERT INTO ${t.table} (${t.oj}, ${t.hx}, ${t.ly}) VALUES (${n}, ${r}, ${a}) ${e.raw`ON CONFLICT`} (${t.oj}, ${t.hx}) DO UPDATE SET ${t.ly} = EXCLUDED.${t.ly}`}})}function r(t){return i({...t,store:(n,r,i)=>{let a=t.wd(i);return e`INSERT INTO ${t.table} (${t.oj}, ${t.hx}, ${t.ly}) VALUES (${n}, ${r}, ${a}) ${e.raw`ON DUPLICATE KEY UPDATE`} ${t.ly} = ${t.qh}`}})}function i(t){let n=t.lastInsertId,r=t.mc,i=r?(e,t,n,i)=>[r(e,t,n,i)]:n?(e,r,i)=>[i,t.store(e,r,n())]:void 0;return{setup:e=>[t.createTable],cleanup:n=>e`DELETE FROM ${t.table} WHERE ${t.oj} = ${n}`,store:t.store,read:(n,r)=>e`(SELECT ${t.ly} FROM ${t.table} WHERE ${t.oj} = ${n} AND ${t.hx} = ${r} ${e.raw`LIMIT 1`})`,...n?{a6:(e,r)=>t.store(e,r,n())}:{},...r?{mc:r}:{},...i?{uc:i}:{}}}export{r as n,n as r,t};
|
|
2
2
|
//# sourceMappingURL=batch-refs-Bd8HvwUc.mjs.map
|
package/dist/better-auth.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gr as Schema } from "./database-adapter-
|
|
1
|
+
import { Gr as Schema } from "./database-adapter-01J6mYq5.mjs";
|
|
2
2
|
import * as better_auth0 from "better-auth";
|
|
3
3
|
import { BetterAuthOptions } from "better-auth";
|
|
4
4
|
import { DBAdapterDebugLogOption } from "better-auth/adapters";
|
package/dist/bun-sql.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $a as QueryExecutionContext, C as DriverResultParser, Di as LinkedClientConfig, Gr as Schema, Ja as TransactionOptionSupport, S as PinnedSessionReservation, eo as QueryResult, h as Driver, pt as VibORMClient, st as DriverConfig, t as DatabaseAdapter, ut as NoExtraDriverConfigKeys, v as MigrationSessionAttestation } from "./database-adapter-
|
|
1
|
+
import { $a as QueryExecutionContext, C as DriverResultParser, Di as LinkedClientConfig, Gr as Schema, Ja as TransactionOptionSupport, S as PinnedSessionReservation, eo as QueryResult, h as Driver, pt as VibORMClient, st as DriverConfig, t as DatabaseAdapter, ut as NoExtraDriverConfigKeys, v as MigrationSessionAttestation } from "./database-adapter-01J6mYq5.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/drivers/bun-sql/index.d.ts
|
|
4
4
|
|
package/dist/bun-sql.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as e,f as t,u as n}from"./error-mapping-B9rSvgG9.mjs";import{o as r}from"./normalized-result-D7nVkF36.mjs";import{n as i}from"./client-
|
|
1
|
+
import{B as e,f as t,u as n}from"./error-mapping-B9rSvgG9.mjs";import{o as r}from"./normalized-result-D7nVkF36.mjs";import{n as i}from"./client-Q4zkYZbn.mjs";import{i as a,t as o}from"./pinned-session-Y7-2pRBJ.mjs";import{_ as s,h as c,p as l,r as u,v as d}from"./driver-lShUkDmf.mjs";import{t as f}from"./postgres-adapter-BpLizOaK.mjs";import{n as p}from"./relation-bound-CSNKLyDy.mjs";function m(e,t){let n;for(let r=0;r<t.length;r+=1){let i=t[r];Array.isArray(i)&&(n??=[...t],n[r]=e.array(i,`TEXT`).serializedValues)}return n??t}const h={parseField:(e,t,n)=>t===`int`&&e instanceof Int32Array?n(Array.from(e),t):n(e,t)},g={client:!0,databaseUrl:!0,options:!0,pgvector:!0,postgis:!0,sharedRelationBodies:!0,relationsPerStatement:!0,namespace:!0,migrationSessionAttestation:!0};var _=class extends u{static get name(){return`BunSQLDriver`}result=h;maxBindParametersPerStatement=65535;eg;eb;constructor(e={}){super(`postgresql`,`bun-sql`);let t=d(e);this.eg=e,this.eb=e.client,this.eb&&(this.client=this.eb),f(this,t,e),l(this,`migrationSessionAttestation`,s(e))}migrationSessionEndpoints(){let{databaseUrl:e,options:t}=this.eg,n=this.eb?.options;return[e,t?.hostname,n?.hostname,n?.url]}async initClient(){if(this.eb!==void 0)return this.eb;let{SQL:e}=await import(`bun`);return this.eg.databaseUrl?new e({...this.eg.options,url:this.eg.databaseUrl}):new e(this.eg.options??{})}async closeClient(e){e!==this.eb&&await e.close()}async execute(e,t,n,i){let a=i?.operation??`execute`,o=await e.unsafe(t,m(e,n)).catch(e=>{throw p(this.adapter,e),e});return{rows:o,rowCount:r(o.count,{provider:`bun-sql`,operation:a})}}async executeRaw(e,t,n,i){let a=i?.operation??`executeRaw`,o=await e.unsafe(t,n);return{rows:o,rowCount:r(o.count,{provider:`bun-sql`,operation:a})}}transactionOptionSupport(){return{isolationLevel:`post-begin`,timeout:!0,maxWait:`unsupported`,maxWaitReason:`Bun SQL acquires the connection inside sql.begin(), which VibORM cannot observe or bound — the wait would be unbounded no matter what maxWait said`}}async transaction(r,i,a){if(`savepoint`in r)throw n(this.driverName);return t({run:e=>r.begin(e),callback:i,he:e(a),close:async()=>void 0})}async pinnedSession(){let e=await this.getClient({operation:`pinnedSession`});if(`savepoint`in e)throw n(this.driverName);let t=await e.reserve();return{session:t,release:(n,r)=>a({driverName:this.driverName,discard:n,lost:r,reset:()=>t.unsafe(`SELECT pg_advisory_unlock_all()`),release:()=>t.release(),um:e===this.eb?void 0:async()=>{this.client=null,this.initPromise=null,await e.close({timeout:o/1e3})}})}}};function v(e){c(e,`bun-sql`,g);let{client:t,databaseUrl:n,options:r,pgvector:a,postgis:o}=e,l=d(e),u=s(e);return i(e,new _({client:t,databaseUrl:n,options:r,pgvector:a,postgis:o,sharedRelationBodies:e.sharedRelationBodies,relationsPerStatement:e.relationsPerStatement,namespace:l,migrationSessionAttestation:u}))}export{_ as BunSQLDriver,v as createClient};
|
|
2
2
|
//# sourceMappingURL=bun-sql.mjs.map
|
package/dist/bun-sqlite.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $a as QueryExecutionContext, C as DriverResultParser, Di as LinkedClientConfig, Gr as Schema, Ja as TransactionOptionSupport, b as SqliteMigrationCapability, eo as QueryResult, h as Driver, pt as VibORMClient, st as DriverConfig, t as DatabaseAdapter, ut as NoExtraDriverConfigKeys } from "./database-adapter-
|
|
1
|
+
import { $a as QueryExecutionContext, C as DriverResultParser, Di as LinkedClientConfig, Gr as Schema, Ja as TransactionOptionSupport, b as SqliteMigrationCapability, eo as QueryResult, h as Driver, pt as VibORMClient, st as DriverConfig, t as DatabaseAdapter, ut as NoExtraDriverConfigKeys } from "./database-adapter-01J6mYq5.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/drivers/bun-sqlite/index.d.ts
|
|
4
4
|
|
package/dist/bun-sqlite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,r as t}from"./validation-ATmgN5RE.mjs";import{n}from"./client-
|
|
1
|
+
import{a as e,r as t}from"./validation-ATmgN5RE.mjs";import{n}from"./client-Q4zkYZbn.mjs";import{t as r}from"./sqlite-adapter-Cb-SJw2f.mjs";import{h as i,i as a,o,r as s}from"./driver-lShUkDmf.mjs";import{a as c,c as l,i as u,l as d,n as f,s as p,t as m}from"./sqlite-utils-Bfmtkt1b.mjs";function h(t){if(typeof t.safeIntegers!=`function`)throw new e(`bun:sqlite`,`Statement.safeIntegers`,`This Bun build cannot read INTEGER columns as BigInt, so any value past 2^53 would come back silently rounded. Upgrade to Bun 1.1.14 or newer.`);return t}function g(e){let t;for(let n=Object.getPrototypeOf(e);n;n=Object.getPrototypeOf(n))Object.hasOwn(n,`prepare`)&&(t=n.prepare);return e.prepare===t}const _=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;function v(e){return e.map(e=>{let t=f(e);if(typeof t==`string`&&_.test(t))throw TypeError(`bun:sqlite cannot preserve unpaired UTF-16 surrogates; the parameter was refused before dispatch.`);return t instanceof Uint8Array||!u(t)?t:l(t)})}const y={client:!0,dataDir:!0,options:!0};var b=class extends s{static get name(){return`BunSQLiteDriver`}adapter=new r;maxBindParametersPerStatement=32766;result=d;sqliteMigrationCapability=a;serializeTransactions=!0;eg;eb;gg;constructor(e={}){if(super(`sqlite`,`bun-sqlite`),this.eg=e,this.gg=e.options?.timeout??5e3,!Number.isSafeInteger(this.gg)||this.gg<0)throw new t(`The bun-sqlite "timeout" option must be a non-negative integer number of milliseconds.`,{meta:{driver:`bun-sqlite`,operation:`configuration`}});if(this.eb=e.client,this.eb){let e=this.eb.query(`PRAGMA foreign_keys`).get();if(!e||typeof e!=`object`||Reflect.get(e,`foreign_keys`)!==1)throw new t(`A supplied bun:sqlite Database must enable PRAGMA foreign_keys = ON before wrapping.`,{meta:{driver:`bun-sqlite`}});this.client=this.eb,Object.defineProperty(this,`connectionQueue`,{value:o(this.eb)})}}async initClient(){if(this.eb)return this.eb;let{Database:e}=await import(`bun:sqlite`),t=this.eg.dataDir??`:memory:`,{timeout:n,...r}=this.eg.options??{},i=Object.keys(r).length===0?new e(t):new e(t,r);return i.exec(`PRAGMA foreign_keys = ON`),i.exec(`PRAGMA busy_timeout = ${this.gg}`),i}async closeClient(e){e!==this.eb&&e.close()}async execute(e,t,n,r){let i=v(n);return this.xp(e,t,i,r?.model!==`$raw`)}async executeRaw(e,t,n){let r=n?v(n):void 0;return this.xp(e,t,r,!1)}xp(e,t,n,r){let i=r&&g(e)?e.query(t):e.prepare(t);if(i.columnNames.length>0){h(i).safeIntegers(!0);let e=n?i.all(...n):i.all();return{rows:r?e:c(e),rowCount:e.length}}return{rows:[],rowCount:(n?i.run(...n):i.run()).changes}}transactionOptionSupport(){return m}async transaction(e,t,n){return p(e,t,n)}};function x(e){i(e,`bun-sqlite`,y,{databaseUrl:`pass the database file as dataDir`});let{client:t,dataDir:r,options:a}=e;return n(e,new b({client:t,dataDir:r,options:a}))}export{b as BunSQLiteDriver,x as createClient};
|
|
2
2
|
//# sourceMappingURL=bun-sqlite.mjs.map
|
package/dist/cache/memory.d.mts
CHANGED
package/dist/cache.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as Extension, L as Facts, O as AnyTarget, U as PlacedArgument, tt as CachedClientOf, zr as MutationOperations } from "./database-adapter-
|
|
2
|
-
import { a as WaitUntilFn, i as Revalidate, n as CacheEntry, o as CacheInvalidationOptions, r as CacheSetOptions, s as WithCacheOptions, t as CacheDriver } from "./driver-
|
|
1
|
+
import { I as Extension, L as Facts, O as AnyTarget, U as PlacedArgument, tt as CachedClientOf, zr as MutationOperations } from "./database-adapter-01J6mYq5.mjs";
|
|
2
|
+
import { a as WaitUntilFn, i as Revalidate, n as CacheEntry, o as CacheInvalidationOptions, r as CacheSetOptions, s as WithCacheOptions, t as CacheDriver } from "./driver-CTjq1yxj.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cache/extension.d.ts
|
|
5
5
|
interface CacheExtensionConfig {
|
package/dist/call-0bd_B9Vp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e,t}from"./base-17NSFtrA.mjs";import{p as n}from"./validation-ATmgN5RE.mjs";import{i as r,l as i,n as a}from"./coordination-BxMskOgi.mjs";import{i as o,o as s}from"./value-guards-CBVIJXlI.mjs";import{r as c}from"./extension-Dh1ddrlA.mjs";import{i as l}from"./schema-DDkAUfOb.mjs";import{s as u,t as d,u as f}from"./on-ZkOVmE4-.mjs";const p=new Set([`select`,`include`,`omit`,`_count`,`_avg`,`_sum`,`_min`,`_max`,`by`]);function m(e){let t=e.filter(e=>!e.on),n=new Map;return{n1:e,global:t,cq(r,i){if(r===void 0)return t.length>0?t:void 0;let a=l(n,`${r}.${i}`,()=>e.filter(({on:e})=>!e||e.models.has(r)&&e.operations.has(i)));return a.length>0?a:void 0}}}const h=Object.freeze({});function g({handler:r,keep:a,
|
|
1
|
+
import{b as e,t}from"./base-17NSFtrA.mjs";import{p as n}from"./validation-ATmgN5RE.mjs";import{i as r,l as i,n as a}from"./coordination-BxMskOgi.mjs";import{i as o,o as s}from"./value-guards-CBVIJXlI.mjs";import{r as c}from"./extension-Dh1ddrlA.mjs";import{i as l}from"./schema-DDkAUfOb.mjs";import{s as u,t as d,u as f}from"./on-ZkOVmE4-.mjs";const p=new Set([`select`,`include`,`omit`,`_count`,`_avg`,`_sum`,`_min`,`_max`,`by`]);function m(e){let t=e.filter(e=>!e.on),n=new Map;return{n1:e,global:t,cq(r,i){if(r===void 0)return t.length>0?t:void 0;let a=l(n,`${r}.${i}`,()=>e.filter(({on:e})=>!e||e.models.has(r)&&e.operations.has(i)));return a.length>0?a:void 0}}}const h=Object.freeze({});function g({handler:r,keep:a,m8:c,watch:l},u){let d=({extension:f,args:m},g,_,v,y,b,x)=>{let S=(t,r)=>new n(`Extension "${f}" first moment for ${g===void 0?_:`${g}.${_}`} ${t}.`,{cause:e(r),meta:{model:g,operation:_}}),C;try{C=r({kind:g===void 0?`raw`:`model`,schema:u,model:g,operation:_,get args(){return v.args},values:(m&&b?.f8(x,m))??h,set(e){if(g===void 0||!s(e))throw S(`set no model call's arguments`);for(let t of Object.keys(e)){let e=p.has(t);if(e||b?.names.has(t))throw S(e?`set "${t}", which decides the result's shape`:`set argument "${t}"`)}v.args=Object.freeze({...v.args,...e})},...g===void 0?c?.(y,f):l?.r8(y,f),[i]:g===void 0?void 0:y})}catch(e){throw e instanceof t?e:S(`threw`,e)}if(s(C)&&o(C.then))throw S(`returned a promise`);if(o(C)){if(a===void 0)throw S(`returned a function: write around()`);a(y,d,C)}};return d}function _(e,t,n,r,i,a,o){let c={args:s(t)?Object.freeze({...t}):t};for(let t of n)t.handler(t,i,e,c,r,a,o);return c.args}function v(e,t,n){(e.seconds??=new Map).set(t,n)}const y=(e,t)=>({[f]({settled:n,collect:r,tell:i}){return n===void 0?!1:((e.m8??=[]).push({extension:t,listener:n,collect:r,tell:i}),!0)}}),b=e=>(t,n)=>{let r=t.call?.seconds?.get(e);return r===void 0?n():r(n)};function x({on:e,inner:t},n,{schema:r,owner:{name:i,args:a}}){let o=(e,t)=>new Set(e.map(e=>t(e)?e:c(`Extension "${i}" target names unknown model or operation "${e}".`,i)));return{extension:i,handler:n,args:a,inner:t,on:e&&{models:o(e.models??Object.keys(r),e=>Object.hasOwn(r,e)),operations:o(e.operations??[...d],e=>d.has(e))}}}function S(e,t,n){let{next:r}=e;r.call={...m([...r.call?.n1??[],x(t,n,e)]),apply:_}}function C(e){return{join(t){e.watch&&t.wh(e.watch),S(t,e,g(e,t.schema))}}}function w(e){return{join(t){let{next:n}=t;e.watch&&t.wh(e.watch);let i=g(e,t.schema);S(t,e,i);let o=x(e,b(i),t);n.around=m([...n.around?.n1??[],o].sort((e,t)=>Number(!!e.inner)-Number(!!t.inner))),r(n,a)}}}function T(e,t){if(!o(e))throw TypeError(`call() takes a function of the call`);let n=u(t);return C({handler:e,on:n,watch:n?.watch})}function E(e,t,n){if(!o(e))throw TypeError(`around() takes a function of the call`);let r=u(t);return w({handler:e,on:r,keep:v,m8:y,watch:r?.watch,inner:n?.inner})}export{T as n,E as t};
|
|
2
2
|
//# sourceMappingURL=call-0bd_B9Vp.mjs.map
|
package/dist/cli.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{N as e}from"./model-Dtd37Sky.mjs";import{c as t}from"./time-step-DJaIhpAz.mjs";import{i as n}from"./validator-DMzH5Tz0.mjs";import{t as r}from"./version-
|
|
2
|
+
import{N as e}from"./model-Dtd37Sky.mjs";import{c as t}from"./time-step-DJaIhpAz.mjs";import{i as n}from"./validator-DMzH5Tz0.mjs";import{t as r}from"./version-Bu2LCuaj.mjs";import{b as i,i as a,n as o}from"./serializer-Br9JgpQI.mjs";import{a as s}from"./identity-CJlRQA-m.mjs";import{n as c}from"./libsql-BZAXy5PY.mjs";import{t as l}from"./mysql-BjIAoFH6.mjs";import{t as u}from"./postgres-CaMB2Y4p.mjs";import{t as d}from"./every-CgeIFxWR.mjs";import{a as f,n as p,o as m,s as h,t as g}from"./client-BvAmGuYW.mjs";import{a as _,i as v,n as y,r as b}from"./utils-BHkJsduV.mjs";import{t as x}from"./fs-estate-n-QpsFqb.mjs";import{t as S}from"./introspect-rGqr93B3.mjs";import{Command as C,InvalidArgumentError as ee}from"commander";import{existsSync as te,writeFileSync as ne}from"node:fs";import{resolve as w}from"node:path";import{loadEnvFile as T}from"node:process";import{writeFile as E}from"node:fs/promises";import{cancel as D,confirm as O,isCancel as k,note as A,outro as j}from"@clack/prompts";const M=e=>e.type===`decimal`?!e.checked:e.noncanonical!==0,N=e=>{let t=`[storage] "${e.table}"."${e.column}"`;if((e.type===`decimal`?e.declared:e.noncanonical)===null)return`${t}: the column is missing; typed queries that use it fail.\n Create it through viborm push or migrate.`;if(e.type===`decimal`)return`${t}: declared ${e.declared}, not the checked scaled-integer decimal storage VibORM writes; typed reads, filters and writes are not checked against it.\n Adopt the table through viborm push, migrate or baseline: https://viborm.dev/docs/migration/drivers/sqlite#adopting-decimal-columns-from-another-tool`;let n=e.type===`time`?`Time`:`DateTime`,r=e.list?"Rewrite each row through the typed client (`update`), which stores canonical members":`Repair with sqliteCanonical${n}Expression from viborm/migrations`;return`${t}: ${e.noncanonical} row(s) of noncanonical ${n} text compare and sort wrongly.\n ${r}: https://viborm.dev/docs/migration/drivers/sqlite#repairing-foreign-timestamp-and-time-text`},P=t=>{let n=Object.values(t).filter(t=>e(t)!==void 0).length,r=`${Object.keys(t).length-n} models`;return n===0?r:`${r}, ${n} ${n===1?`view`:`views`}`},F=e=>[`[${e.code}] ${e.message}`,e.repair].filter(Boolean).join(`
|
|
3
3
|
`),I={postgresql:()=>u.lx(),mysql:()=>l.lx(),sqlite:()=>c.lx(),surrealql:e=>i(e).lx()};function L(t,{models:n,driver:r}){let i=t.valid?I[r.dialect]:void 0;if(i===void 0)return t;let s=[...t.errors];for(let[t,o]of Object.entries(n))if(e(o)!==void 0)try{let e=i(r);e&&a(e,{schema:n},o)}catch(e){s.push({code:`W005`,message:e instanceof Error?e.message:String(e),severity:`error`,model:t})}let c=s.length===0&&R[r.dialect];if(c&&Object.values(n).some(t=>e(t)?.refresh===`auto`))try{o(n,{migrationDriver:c()})}catch(e){let t=e.meta;if(t?.model===void 0)throw e;s.push({code:`W005`,message:e.message,severity:`error`,model:Object.keys(n).find(e=>n[e][`~`].names.sql===t.model)??t.model??``})}return{...t,errors:s,valid:s.length===0}}const R={mysql:()=>l};async function z(e){await _({config:e.config,skipValidation:!0},e.json,async r=>{let{models:i}=r;t(i);let a=L(n(i),r),o=e.db?await h({$driver:r.driver,$schema:i}):void 0,s=o?.filter(M)??[];if(e.json)process.stdout.write(`${JSON.stringify(o?{...a,storage:o}:a,null,2)}\n`);else{for(let e of a.errors)process.stderr.write(`error ${F(e)}\n`);for(let e of a.warnings)process.stderr.write(`warning ${F(e)}\n`);for(let e of s)process.stderr.write(`error ${N(e)}\n`);process.stdout.write(a.valid?`Schema valid (${P(i)}).\n`:`Schema invalid: ${a.errors.length} error(s).\n`),o&&process.stdout.write(`Storage audited: ${o.length} column(s), ${s.length} need repair.\n`)}(!a.valid||s.length>0)&&(process.exitCode=1)})}function re(){return new C(`check`).description(`Validate the schema, so clients can be created with skipSchemaValidation`).option(`--config <path>`,`Path to viborm.config.ts`).option(`--json`,`Print machine-readable JSON`).option(`--db`,`Also audit SQLite storage: DateTime/Time text and decimal columns`).action(z)}const B=re(),V=/^[0-9a-f]{8,63}$/;function H(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)throw new ee(`must be a positive safe integer`);return t}function U(e){if(e)return s(e)?{id:e}:V.test(e)?{prefix:e}:{name:e}}const W=e=>e.type===`destructive`?e.proceed():void 0,G=async e=>{if(e.type!==`destructive`)return;let t=await O({message:`${e.description} — approve?`,initialValue:!1});return!k(t)&&t?e.proceed():e.reject()};function K(e,t){if(e.migrations?.resolve)return e.migrations.resolve;if(t.acceptDataLoss)return W;if(!(t.dryRun||t.json||!process.stdin.isTTY))return G}async function q(e,t,n){await _({config:e.opts().config},t.json,async e=>{let r=w(t.dir??e.migrations?.dir??`./migrations`),i=e.migrations?.storage??x(r);await n(g(e.client,{storage:i,...e.migrations?.tables===void 0?{}:{tables:e.migrations.tables}}),e,i)})}function J(){let e=new C(`migrate`).description(`Manage the authenticated migration estate`).option(`--config <path>`,`Path to viborm.config.ts`);return e.command(`generate`).description(`Publish a new estate state from the current schema`).option(`-n, --name <name>`,`Human-readable state label`).option(`-d, --dir <dir>`,`Estate directory`).option(`--from <stateId>`,`Parent state id, or empty for the virtual root`).option(`--custom <path>`,`Compile a TypeScript manual migration author`).option(`--review <path>`,`Write labelled forward/check/rollback review SQL`).option(`--dry-run`,`Preview without publishing`).option(`--low-lock`,`PostgreSQL: publish index builds and foreign keys on existing tables as recoverable steps`).option(`--accept-data-loss`,`Approve destructive changes (drops, type changes) for this generate`).option(`--adopt <table...>`,`Adopt existing listed tables without DDL; apply proves each equals its declaration`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async(e,n)=>{let r=t.from===void 0?void 0:t.from===``||t.from===`empty`?null:s(t.from)?t.from:(await e.show(U(t.from))).stateId,i;if(t.custom){let n=await b(w(t.custom)),a=(Object.hasOwn(n,`default`)?n.default:void 0)??n.migration;if(!a)throw Error(`A custom migration module must export a default migration or author function`);let o=await e.graph(),s=Object.freeze(r===void 0?o.leaves.length===0?[null]:[...o.leaves]:[r]);i=typeof a==`function`?await a(s):a}let a=K(n,t),o=await e.generate({name:t.name,from:r,dryRun:t.dryRun,...t.lowLock?{lowLock:!0}:{},...t.adopt?{adopt:t.adopt}:{},...a?{resolve:a}:{},...i?{manualMigration:i}:{}});if(t.json)v(o,!0);else{process.stdout.write(`${o.outcome}: ${o.name??`No schema changes`}${o.stateId?` (${o.stateId})`:``}\n`);for(let e of o.operationsByParent??[])process.stdout.write(`Parent ${e.fromState??`empty`}:\n${e.operations.map(f).join(`
|
|
4
4
|
`)}\n`);for(let e of o.warnings??[])process.stderr.write(`warning: ${e}\n`);(o.reviewSql||o.sql)&&process.stdout.write(`${o.reviewSql||o.sql}\n`)}t.jl&&o.reviewSql&&await E(w(t.jl),o.reviewSql,`utf8`)})}),e.command(`check`).description(`Validate estate artifacts without touching the database`).option(`-d, --dir <dir>`,`Estate directory`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{let n=await e.check();v(n,!!t.json),n.ok||(process.exitCode=1)})}),e.command(`list`).description(`List estate states`).option(`-d, --dir <dir>`,`Estate directory`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{v(await e.list(),!!t.json)})}),e.command(`show`).description(`Show one estate state`).argument(`<state>`,`State id, unambiguous prefix, or name`).option(`-d, --dir <dir>`,`Estate directory`).option(`--sql`,`Print labelled forward/check/rollback review SQL`).option(`--review <path>`,`Write review SQL to this file`).option(`--json`,`Print machine-readable output`).action(async(t,n)=>{await q(e,n,async(e,r,i)=>{let a=await e.show(U(t));if(!(n.sql||n.jl)){v(a,!!n.json);return}let o=await m(i),s=o.states.get(a.stateId),c=s&&o.sql.get(s.sqlHash);if(!(s&&c))throw Error(`The authenticated state SQL is unavailable`);let l=p(s.parents,s.destinationChecks,c);n.json?v({...a,reviewSql:l},!0):(v(a,!1),process.stdout.write(l)),n.jl&&await E(w(n.jl),l,`utf8`)})}),e.command(`graph`).description(`Print estate roots and leaves`).option(`-d, --dir <dir>`,`Estate directory`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{v(await e.graph(),!!t.json)})}),e.command(`status`).description(`Show marker, pending path, and unfinished attempts`).option(`-d, --dir <dir>`,`Estate directory`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{v(await e.status(),!!t.json)})}),e.command(`verify`).description(`Lock and compare the live schema to the marker`).option(`-d, --dir <dir>`,`Estate directory`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{let n=await e.verify();v(n,!!t.json),n.ok||(process.exitCode=1)})}),e.command(`log`).description(`Print the append-only ledger`).option(`-d, --dir <dir>`,`Estate directory`).option(`--limit <n>`,`Maximum events`,H).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{let n=await e.log();v(t.limit?n.slice(-t.limit):n,!!t.json)})}),e.command(`apply`).description(`Apply estate states to the target`).option(`-d, --dir <dir>`,`Estate directory`).option(`--to <selector>`,`Target state id, prefix, or name`).option(`--via <stateId...>`,`Force a path through these states`).option(`--dry-run`,`Plan without executing`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{v(await e.apply({to:U(t.to),via:t.via,dryRun:t.dryRun}),!!t.json)})}),e.command(`down`).description(`Roll back along the recorded arrival path`).option(`-d, --dir <dir>`,`Estate directory`).option(`--to <selector>`,`Roll back to this state`).option(`--steps <n>`,`Number of states to roll back`,H).option(`--accept-data-loss`,`Approve destructive changes the rollback makes to populated tables`).option(`--expect-revision <n>`,`Refuse unless the marker is at this revision`,H).option(`--dry-run`,`Plan without executing`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async(e,n)=>{if(t.to!==void 0&&t.steps!==void 0)throw Error(`down accepts --to or --steps, not both`);let r=K(n,t),i={dryRun:t.dryRun,...r?{resolve:r}:{},...t.expectRevision===void 0?{}:{expectRevision:t.expectRevision}},a=await e.down(t.to?{to:U(t.to),...i}:{steps:t.steps,...i});if(!a.preview||t.json)v(a,!!t.json);else{for(let e of a.edges)process.stdout.write(e.sql);a.refusal&&process.stderr.write(`down would refuse: ${a.refusal.code}: ${a.refusal.message}\n`)}a.preview&&a.refusal&&(process.exitCode=1)})}),e.command(`baseline`).description(`Adopt an existing database as a known estate state`).requiredOption(`--to <selector>`,`Existing estate state to adopt`).option(`--via <stateId...>`,`Force the recorded root path`).option(`-d, --dir <dir>`,`Estate directory`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{v(await e.baseline({to:U(t.to),via:t.via}),!!t.json)})}),e.command(`reanchor`).description(`After a restore left the history older than the database, move the marker to the state the live schema matches`).option(`--to <selector>`,`Adopt this state as the new baseline`).option(`--via <stateId...>`,`Force the recorded root path`).option(`-d, --dir <dir>`,`Estate directory`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{v(await e.reanchor({to:U(t.to),via:t.via}),!!t.json)})}),e.command(`resolve`).description(`Resolve an unfinished attempt after live proof`).option(`-d, --dir <dir>`,`Estate directory`).option(`--complete`,`Mark complete when destination proof holds`).option(`--rolled-back`,`Mark rolled back when origin proof holds`).option(`--retry`,`Retry from the first proven incomplete step`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{if([t.complete,t.rolledBack,t.retry].filter(Boolean).length!==1)throw Error(`resolve requires exactly one of --complete, --rolled-back, or --retry`);let n=t.complete?`complete`:t.rolledBack?`rolled-back`:`retry`;v(await e.resolve({outcome:n}),!!t.json)})}),e.command(`reset`).description(`Clear managed objects and replay from empty to a selected state`).option(`-d, --dir <dir>`,`Estate directory`).option(`--to <selector>`,`Target state after rebuild`).option(`--via <stateId...>`,`Force a rebuild path`).option(`--confirm`,`Confirm destructive reset (not required for dry-run)`).option(`--dry-run`,`Plan without executing`).option(`--json`,`Print machine-readable output`).action(async t=>{await q(e,t,async e=>{if(!(t.dryRun||t.confirm))throw Error(`Reset requires --confirm; inspect --dry-run first`);v(await e.reset({to:U(t.to),via:t.via,dryRun:t.dryRun}),!!t.json)})}),e}const Y=J();function X(e){return[e.table,e.name].filter(Boolean).join(`.`)}function ie(e,t){let n=[];if(e.length>0){n.push(`Not in the document (${e.length}):`);for(let t of e)n.push(` - ${t.kind} ${X(t)}: ${t.reason}`)}if(t.length>0){n.push(`Warnings (${t.length}):`);for(let e of t)n.push(` - [${e.kind}] ${X(e)}: ${e.message}`)}return n.length===0?`The document states the whole database; a push of it plans nothing.
|
|
5
5
|
`:`${n.join(`
|
|
6
6
|
`)}\n`}async function ae(e){try{if(!e.json)throw Error(`viborm pull writes a JSON schema document: pass --json. A TypeScript schema is not generated yet.`);let t=w(process.cwd(),`.env`);te(t)&&T(t);let n=e.url??process.env.DATABASE_URL;if(!n)throw Error(`viborm pull needs a connection string: pass --url or set DATABASE_URL.`);let r=await S({url:n,...e.tables===void 0?{}:{tables:e.tables},...e.light?{light:!0}:{}}),i=`${JSON.stringify(r.document,null,2)}\n`;e.out===void 0?process.stdout.write(i):ne(w(process.cwd(),e.out),i),process.stderr.write(ie(r.skipped,r.warnings))}catch(t){y(t,e.json===!0)}}function oe(){return new C(`pull`).description(`Read an existing database into a schema document (viborm/schema/json)`).option(`--json`,`Write the JSON schema document`).option(`--url <url>`,`Connection string (postgres://, mysql://, file:, libsql://); defaults to DATABASE_URL`).option(`--out <path>`,`Write the document to this file instead of stdout`).option(`--light`,`Only what a client needs (no indexes); migrations refuse the document`).option(`--tables <names...>`,`Only these tables (exact physical names, space- or comma-separated)`,(e,t)=>[...t??[],...e.split(`,`).map(e=>e.trim()).filter(Boolean)]).action(ae)}const se=oe();function Z(e){let t=e.operations.length===0?[`No schema changes.`]:e.operations.map(e=>`[${e.risk}] ${e.label} (${e.id})`),n=e.statements.map((e,t)=>`${t+1}. ${e.sql}${e.parameters.length===0?``:`\n parameters: ${JSON.stringify(e.parameters)}`}`);A([`Target: ${JSON.stringify(e.target)}`,`Plan: ${e.planHash}`,...t,...n.length===0?[]:[``,`SQL:`,...n]].join(`
|
|
7
7
|
`),`Push plan`)}async function Q(e){await _({config:e.config},e.json,async t=>{let n=t.migrations?.tables===void 0?g(t.client):g(t.client,{tables:t.migrations.tables}),r=await n.push({dryRun:!0,...e.forceReset===!0?{forceReset:!0}:{},...t.migrations?.resolve?{resolve:t.migrations.resolve}:{}});if(!e.json&&t.driver?.dialect===`sqlite`&&[`sqlite3`,`bun-sqlite`,`bun-sql`].includes(t.driver.driverName)&&(await t.driver._executeRaw(`PRAGMA database_list`)).rows.some(e=>e.name===`main`&&e.file===``)&&process.stderr.write(`warning: SQLite reports an in-memory main database. Use a persistent target for durable schema changes.
|
|
8
|
-
`),e.dryRun){e.json?v(r,!0):Z(r);return}if(e.json||Z(r),r.destructive&&!e.acceptDataLoss&&(e.
|
|
8
|
+
`),e.dryRun){e.json?v(r,!0):Z(r);return}if(e.json||Z(r),r.destructive&&!e.acceptDataLoss&&(e.p8||e.json||!process.stdin.isTTY))throw Error(`Destructive push requires --accept-data-loss; --yes does not authorize data loss. Inspect --dry-run first.`);if(r.outcome!==`noop`&&!e.p8&&!e.acceptDataLoss&&!e.json&&process.stdin.isTTY){let e=await O({message:r.destructive?`Apply this destructive push plan?`:`Apply this push plan?`,initialValue:!r.destructive});if(k(e)||!e){D(`Push cancelled.`);return}}let i=await n.push({consent:r.consent});e.json?v(i,!0):j(i.outcome===`noop`?`Schema is up to date.`:`Push applied.`)})}function ce(){return new C(`push`).description(`Synchronize the schema directly without migration history`).option(`--config <path>`,`Path to viborm.config.ts`).option(`--dry-run`,`Preview without changing the database`).option(`--force-reset`,`Plan a rebuild from an empty database`).option(`-y, --yes`,`Skip prompts for non-destructive plans`).option(`--accept-data-loss`,`Explicitly accept the previewed destructive plan`).option(`--json`,`Print machine-readable JSON`).action(Q)}const le=ce();d();const $=new C;$.name(`viborm`).description(`VibORM - Type-safe ORM for PostgreSQL, MySQL and SQLite`).version(r),$.addCommand(B),$.addCommand(le),$.addCommand(Y),$.addCommand(se);try{await $.parseAsync()}catch(e){process.stderr.write(`${e instanceof Error?e.message:`CLI failed`}\n`),process.exitCode=1}for(let e of[process.stdout,process.stderr])e.writableLength>0&&await new Promise(t=>e.write(``,()=>t()));process.exit();export{};
|
|
9
9
|
//# sourceMappingURL=cli.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as Sql } from "./sql-C4_sFNDm.mjs";
|
|
2
|
-
import { i as ResolveCallback, n as DiffOperation, r as MigrationTarget, s as MigrationLimits, t as MigrationClient } from "./planner-
|
|
2
|
+
import { i as ResolveCallback, n as DiffOperation, r as MigrationTarget, s as MigrationLimits, t as MigrationClient } from "./planner-CYu6_q4w.mjs";
|
|
3
3
|
import { i as Sha256, n as MigrationStorageWriter, t as MigrationStorageReader } from "./contract-CxJn0_cV.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/migrations/v1-types.d.ts
|