@kyro-cms/core 0.12.55 → 0.12.57
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/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{chunk-5YQ2HVHD.js → chunk-5VGYVQPY.js} +10 -10
- package/dist/chunk-5ZEYOFAK.js +2 -0
- package/dist/chunk-6KERPHAL.cjs +2 -0
- package/dist/chunk-72VOOMJI.js +20 -0
- package/dist/chunk-7DUKWHRN.cjs +1 -0
- package/dist/chunk-FJPY42VZ.cjs +20 -0
- package/dist/{chunk-BU6O3TP7.js → chunk-KNOFTUQV.js} +24 -24
- package/dist/{chunk-4MVLIR77.cjs → chunk-LBYY3W2D.cjs} +9 -9
- package/dist/chunk-LVHWORV4.js +3 -0
- package/dist/chunk-PCN6QV3Z.js +21 -0
- package/dist/chunk-PCVQNVSU.cjs +19 -0
- package/dist/{chunk-QEZKIR5V.cjs → chunk-Q4B2IRX7.cjs} +1 -1
- package/dist/{chunk-M645XO2L.js → chunk-R3KFYDRS.js} +1 -1
- package/dist/{chunk-V65273ZG.cjs → chunk-T63QLFLZ.cjs} +3 -3
- package/dist/{chunk-6KUL2BSA.cjs → chunk-TDGSIF5H.cjs} +24 -24
- package/dist/{chunk-AIE7BKVY.js → chunk-WDDKRBSY.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -14
- package/dist/index.d.ts +1 -14
- package/dist/index.js +8 -8
- package/dist/integration.cjs +1 -1
- package/dist/integration.js +1 -1
- package/dist/{local-3V3XEQUY.js → local-2IFOTHAA.js} +1 -1
- package/dist/{local-YCWBUF3R.cjs → local-UESCNPQP.cjs} +1 -1
- package/dist/{mongo-auth-adapter-W3HLB7OR.cjs → mongo-auth-adapter-EUHAYWJ6.cjs} +1 -1
- package/dist/{mongo-auth-adapter-QDXVHREJ.js → mongo-auth-adapter-FW7ATYQ6.js} +1 -1
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-CMQYYIGC.js +0 -21
- package/dist/chunk-LELK3TYX.js +0 -3
- package/dist/chunk-OW3HFVPX.cjs +0 -20
- package/dist/chunk-PRMILS4Y.js +0 -20
- package/dist/chunk-UT7RGIYS.js +0 -2
- package/dist/chunk-WJBQ2NBD.cjs +0 -1
- package/dist/chunk-XDE7CFV6.cjs +0 -19
- package/dist/chunk-ZKHTFR5S.cjs +0 -2
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
'use strict';var chunkKCHPADCH_cjs=require('./chunk-KCHPADCH.cjs'),chunkLY7N3UHH_cjs=require('./chunk-LY7N3UHH.cjs'),chunk7ACHOBWY_cjs=require('./chunk-7ACHOBWY.cjs'),chunkBCEE4NBZ_cjs=require('./chunk-BCEE4NBZ.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkVQ53TFYA_cjs=require('./chunk-VQ53TFYA.cjs'),chunkF4ITQ6XQ_cjs=require('./chunk-F4ITQ6XQ.cjs'),chunkZOVH6QT5_cjs=require('./chunk-ZOVH6QT5.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto=require('crypto'),promises=require('fs/promises'),path=require('path'),module$1=require('module');chunkBUNLC3II_cjs.h();function D(f){if(typeof f!="string")return f;let t=f.replace(/-/g,"").toLowerCase();return t.length===32?`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`:f}function L(f,t="postgres"){switch(f.type){case "text":case "email":case "password":case "color":case "icon":return t==="sqlite"?"text":"varchar";case "textarea":case "code":case "markdown":case "secret":return "text";case "number":return f.integer?"integer":"decimal";case "checkbox":return "boolean";case "date":return "timestamp";case "select":case "radio":return t==="sqlite"?"text":"varchar";case "richtext":case "json":case "array":case "group":case "blocks":case "row":case "collapsible":case "tabs":return "jsonb";case "relationship":return t==="sqlite"?"text":"varchar";case "upload":return "jsonb";default:return "jsonb"}}function Se(f,t="postgres"){let i=f.slug.replace(/-/g,"_"),e=[];e.push(`export const ${i} = pgTable('${i}', {`),e.push(" id: uuid('id').primaryKey().defaultRandom(),");for(let s of f.fields){if(s.name==="id"||s.type==="password")continue;let
|
|
2
|
-
`)}function le(f,t){return Array.isArray(f)?f.map(i=>{if(!i||typeof i!="object")return i;let e=i.data?{...i.data}:void 0;if(!e)return i;let s=t.find(
|
|
3
|
-
CREATE TABLE IF NOT EXISTS "${
|
|
1
|
+
'use strict';var chunkKCHPADCH_cjs=require('./chunk-KCHPADCH.cjs'),chunkLY7N3UHH_cjs=require('./chunk-LY7N3UHH.cjs'),chunk7ACHOBWY_cjs=require('./chunk-7ACHOBWY.cjs'),chunkBCEE4NBZ_cjs=require('./chunk-BCEE4NBZ.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkVQ53TFYA_cjs=require('./chunk-VQ53TFYA.cjs'),chunkF4ITQ6XQ_cjs=require('./chunk-F4ITQ6XQ.cjs'),chunkZOVH6QT5_cjs=require('./chunk-ZOVH6QT5.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto=require('crypto'),promises=require('fs/promises'),path=require('path'),module$1=require('module');chunkBUNLC3II_cjs.h();function D(f){if(typeof f!="string")return f;let t=f.replace(/-/g,"").toLowerCase();return t.length===32?`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`:f}function L(f,t="postgres"){switch(f.type){case "text":case "email":case "password":case "color":case "icon":return t==="sqlite"?"text":"varchar";case "textarea":case "code":case "markdown":case "secret":return "text";case "number":return f.integer?"integer":"decimal";case "checkbox":return "boolean";case "date":return "timestamp";case "select":case "radio":return t==="sqlite"?"text":"varchar";case "richtext":case "json":case "array":case "group":case "blocks":case "row":case "collapsible":case "tabs":return "jsonb";case "relationship":return t==="sqlite"?"text":"varchar";case "upload":return "jsonb";default:return "jsonb"}}function Se(f,t="postgres"){let i=f.slug.replace(/-/g,"_"),e=[];e.push(`export const ${i} = pgTable('${i}', {`),e.push(" id: uuid('id').primaryKey().defaultRandom(),");for(let s of f.fields){if(s.name==="id"||s.type==="password")continue;let n=L(s,t),r=s.required,a=` ${s.name}: pg.${n}('${s.name}')`;s.unique&&(a+=".unique()"),r||(a+=".nullable()"),s.defaultValue!==void 0&&(typeof s.defaultValue=="string"?a+=`.default('${s.defaultValue}')`:typeof s.defaultValue=="boolean"?a+=`.default(${s.defaultValue})`:a+=`.default(sql\`${JSON.stringify(s.defaultValue)}\`)`),a+=",",e.push(a);}return f.timestamps&&(e.push(" createdAt: pg.timestamp('created_at').defaultNow(),"),e.push(" updatedAt: pg.timestamp('updated_at').defaultNow(),")),e.push(` status: ${t==="sqlite"?"sqlite":"pg"}.varchar('status').default('draft'),`),e.push(` hasDraft: ${t==="sqlite"?"sqlite":"pg"}.boolean('hasDraft').default(false),`),e.push("});"),e.join(`
|
|
2
|
+
`)}function le(f,t){return Array.isArray(f)?f.map(i=>{if(!i||typeof i!="object")return i;let e=i.data?{...i.data}:void 0;if(!e)return i;let s=t.find(n=>n.slug===i.type||n.slug===i.slug);if(!s||!Array.isArray(s.fields))return i;for(let n of s.fields){if(n.name&&(n.type==="upload"||n.type==="image")&&e[n.name]){let r=e[n.name];Array.isArray(r)?e[n.name]=r.map(a=>typeof a=="string"?{id:a}:a):typeof r=="string"&&(e[n.name]={id:r});}if(n.type==="blocks"&&n.name&&e[n.name]){let r=n.blocks||[];e[n.name]=le(e[n.name],r);}}return {...i,data:e}}):f}var M=class extends chunkVQ53TFYA_cjs.a{client;schema;_schemaEnsured=false;dialect;connectionString;versionsTableReady=false;rawClient;constructor(t){if(super(),this.schema=t.schema||{},t.connectionString){this.connectionString=t.connectionString;let i=t.connectionString.toLowerCase();i.startsWith("postgres://")||i.startsWith("postgresql://")?this.dialect="postgres":i.includes(".db")||i.includes("sqlite")||i.includes("file:")?this.dialect="sqlite":this.dialect=t.type||"postgres";}else this.rawClient=t.client,this.client=t.client,this.dialect=t.type||"sqlite";}prepareData(t,i){let e=super.prepareData(t,i);e.createdAt&&typeof e.createdAt=="string"&&(e.createdAt=new Date(e.createdAt)),e.updatedAt&&typeof e.updatedAt=="string"&&(e.updatedAt=new Date(e.updatedAt));for(let s of i.fields)if(s.type==="date"&&s.name){let n=e[s.name];n&&typeof n=="string"&&(e[s.name]=new Date(n));}for(let s of i.fields){let r=L(s,this.dialect)==="jsonb";if(s.type==="tabs"&&"tabs"in s&&s.name){let a=t[s.name];if(a&&typeof a=="object"){let o={};for(let[c,d]of Object.entries(a)){let u=s.tabs.flatMap(g=>g.fields).find(g=>g.name===c);(u?.type==="upload"||u?.type==="image"||u?.type==="list"||u?.type==="relationship-block")&&d?o[c]=Array.isArray(d)||typeof d=="object"?JSON.stringify(d):d:o[c]=d;}e[s.name]=this.dialect==="sqlite"||!r?JSON.stringify(o):o;}}else if(r&&s.name&&t[s.name]!==void 0&&t[s.name]!==null)e[s.name]=this.dialect==="sqlite"?JSON.stringify(t[s.name]):t[s.name];else if((s.type==="upload"||s.type==="image"||s.type==="list"||s.type==="relationship-block")&&s.name){let a=t[s.name];a!=null&&(e[s.name]=this.dialect==="sqlite"||!r?typeof a=="string"?a:JSON.stringify(a):a);}}for(let s of i.fields)if(s.name&&e[s.name]===""){let n=L(s,this.dialect);(n==="timestamp"||n==="jsonb"||n==="decimal"||n==="integer"||n==="numeric"||n==="boolean")&&(e[s.name]=null);}return e}async connect(){if(this.connectionString&&!this.client){if(this.dialect==="postgres"){let t,i;try{t=(await import('./src-6LAUXXDM.cjs')).default,i=(await import('./postgres-js-3Y54EXVQ.cjs')).drizzle;}catch{chunkF4ITQ6XQ_cjs.a(["postgres","drizzle-orm"]),t=(await import('./src-6LAUXXDM.cjs')).default,i=(await import('./postgres-js-3Y54EXVQ.cjs')).drizzle;}let e=t(this.connectionString,{onnotice:()=>{}});this.client=i(e,{schema:this.schema});}else if(this.dialect==="sqlite"){let t,i;try{t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-5IISPX34.cjs')).drizzle;}catch{chunkF4ITQ6XQ_cjs.a(["better-sqlite3","drizzle-orm"]),t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-5IISPX34.cjs')).drizzle;}let e=new t(this.connectionString.replace("file:",""));this.client=i(e,{schema:this.schema});}}if(this.rawClient&&typeof this.rawClient.prepare=="function"&&typeof this.client?.select!="function"){let{drizzle:t}=await import('./d1-5ZQJOFDX.cjs');this.client=t(this.rawClient,{schema:this.schema});}this.connected=true;}async init(t,i=[]){if(await super.init(t,i),(this.connectionString&&!this.client||this.rawClient&&typeof this.client?.select!="function")&&await this.connect(),this.client&&!this._schemaEnsured){for(let s of t){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s));}await this.ensureCollectionTables(t);let e=i.map(s=>({slug:`_globals_${s.slug}`,fields:s.fields,label:s.label}));for(let s of e){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s,true)),this.collections.has(s.slug)||this.collections.set(s.slug,s);}await this.ensureCollectionTables(e),this._schemaEnsured=true;}}createTableFromConfig(t,i=false){let e=this.getTableName(t.slug),s={id:i?chunkVRZC4TTF_cjs.ia("id").primaryKey():chunkVRZC4TTF_cjs.oa("id").primaryKey().defaultRandom()};for(let n of t.fields){if(!n.name||n.name==="id"||n.type==="password")continue;let r=L(n,this.dialect),a=n.name.replace(/-/g,"_"),o=a.replace(/([A-Z])/g,"_$1").toLowerCase(),c;if(this.dialect==="sqlite")switch(r){case "varchar":case "text":c=chunk7ACHOBWY_cjs.c(o);break;case "integer":c=chunk7ACHOBWY_cjs.a(o);break;case "decimal":case "numeric":c=chunk7ACHOBWY_cjs.b(o);break;case "boolean":c=chunk7ACHOBWY_cjs.a(o,{mode:"boolean"});break;case "timestamp":c=chunk7ACHOBWY_cjs.c(o);break;case "jsonb":c=chunk7ACHOBWY_cjs.c(o);break;default:c=chunk7ACHOBWY_cjs.c(o);}else switch(r){case "varchar":c=chunkVRZC4TTF_cjs.pa(o,{length:255});break;case "integer":c=chunkVRZC4TTF_cjs.ca(o);break;case "decimal":c=chunkVRZC4TTF_cjs.ha(o);break;case "boolean":c=chunkVRZC4TTF_cjs.$(o);break;case "timestamp":c=chunkVRZC4TTF_cjs.ma(o);break;case "jsonb":c=chunkVRZC4TTF_cjs.fa(o);break;default:c=chunkVRZC4TTF_cjs.ia(o);}n.required||(c=c.default(null)),s[a]=c;}return s.createdAt||(s.createdAt=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("created_at").default(new Date().toISOString()):chunkVRZC4TTF_cjs.ma("created_at").defaultNow()),s.updatedAt||(s.updatedAt=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("updated_at").default(new Date().toISOString()):chunkVRZC4TTF_cjs.ma("updated_at").defaultNow()),e!=="users"&&e!=="audit_logs"&&(s.status||(s.status=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.c("status").default("draft"):chunkVRZC4TTF_cjs.pa("status",{length:20}).default("draft")),s.hasDraft||(s.hasDraft=this.dialect==="sqlite"?chunk7ACHOBWY_cjs.a("hasDraft",{mode:"boolean"}).default(false):chunkVRZC4TTF_cjs.$("hasDraft").default(false))),this.dialect==="sqlite"?chunk7ACHOBWY_cjs.e(e,s):chunkVRZC4TTF_cjs.ra(e,s)}async ensureCollectionTables(t){let i=[];for(let e of t){let s=e.slug.startsWith("_globals_"),n=this.getTableName(e.slug),r=this.generateCreateColumns(e),a=e.fields.some(u=>u.name==="createdAt"),o=e.fields.some(u=>u.name==="updatedAt"),c=e.fields.some(u=>u.name==="status"),d=e.fields.some(u=>u.name==="hasDraft");if(this.dialect==="postgres"){let u=s?'"id" TEXT PRIMARY KEY':'"id" UUID PRIMARY KEY DEFAULT gen_random_uuid()';i.push(`
|
|
3
|
+
CREATE TABLE IF NOT EXISTS "${n}" (
|
|
4
4
|
${u},
|
|
5
5
|
${r}
|
|
6
|
-
${
|
|
6
|
+
${a?"":'"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),'}
|
|
7
7
|
${o?"":'"updated_at" TIMESTAMP NOT NULL DEFAULT NOW(),'}
|
|
8
8
|
${c?"":`"status" VARCHAR(20) DEFAULT 'draft',`}
|
|
9
9
|
${d?"":'"hasDraft" BOOLEAN DEFAULT false'}
|
|
10
10
|
)
|
|
11
11
|
`);}else i.push(`
|
|
12
|
-
CREATE TABLE IF NOT EXISTS "${
|
|
12
|
+
CREATE TABLE IF NOT EXISTS "${n}" (
|
|
13
13
|
"id" TEXT PRIMARY KEY,
|
|
14
14
|
${r}
|
|
15
|
-
${
|
|
15
|
+
${a?"":`"created_at" TEXT NOT NULL DEFAULT (datetime('now')),`}
|
|
16
16
|
${o?"":`"updated_at" TEXT NOT NULL DEFAULT (datetime('now')),`}
|
|
17
17
|
${c?"":`"status" TEXT DEFAULT 'draft',`}
|
|
18
18
|
${d?"":'"hasDraft" INTEGER DEFAULT 0'}
|
|
19
19
|
)
|
|
20
20
|
`);}if(i.length>0)if(this.dialect==="postgres")await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(i.join(`;
|
|
21
|
-
`)));else for(let e of i)await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(e));for(let e of t){let s=this.getTableName(e.slug);s==="users"||s==="audit_logs"||await this.syncTableColumns(e,s);}}getColumnSqlDefinition(t,i){let e=L(t,i),s=t.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase(),
|
|
22
|
-
`)));}if(this.dialect==="postgres")for(let r of t.fields){if(!r.name||r.name==="id")continue;let
|
|
23
|
-
`)+(i.length>0?",":"")}async disconnect(){this.connected=false;}async find(t){let{collection:i,where:e={},sort:s,limit:
|
|
21
|
+
`)));else for(let e of i)await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(e));for(let e of t){let s=this.getTableName(e.slug);s==="users"||s==="audit_logs"||await this.syncTableColumns(e,s);}}getColumnSqlDefinition(t,i){let e=L(t,i),s=t.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase(),n=this.columnSqlType(e,i);return `"${s}" ${n} DEFAULT NULL`}columnSqlType(t,i){if(i==="sqlite")switch(t){case "varchar":return "TEXT";case "text":return "TEXT";case "integer":return "INTEGER";case "decimal":case "numeric":return "NUMERIC";case "boolean":return "INTEGER";case "timestamp":return "TEXT";case "jsonb":return "TEXT";default:return "TEXT"}switch(t){case "varchar":return "VARCHAR(255)";case "text":return "TEXT";case "integer":return "INTEGER";case "decimal":case "numeric":return "DECIMAL";case "boolean":return "BOOLEAN";case "timestamp":return "TIMESTAMP";case "jsonb":return "JSONB";default:return "TEXT"}}getExpectedColumnDefs(t,i){let e={},s=t.slug.startsWith("_globals_"),n=t.fields.some(c=>c.name==="createdAt"),r=t.fields.some(c=>c.name==="updatedAt"),a=t.fields.some(c=>c.name==="status"),o=t.fields.some(c=>c.name==="hasDraft");this.dialect==="postgres"?(e.id=s?'"id" TEXT PRIMARY KEY':'"id" UUID PRIMARY KEY DEFAULT gen_random_uuid()',n||(e.created_at='"created_at" TIMESTAMP DEFAULT NULL'),r||(e.updated_at='"updated_at" TIMESTAMP DEFAULT NULL'),a||(e.status='"status" VARCHAR(20) DEFAULT NULL'),o||(e.hasDraft='"hasDraft" BOOLEAN DEFAULT NULL')):(e.id='"id" TEXT PRIMARY KEY',n||(e.created_at='"created_at" TEXT DEFAULT NULL'),r||(e.updated_at='"updated_at" TEXT DEFAULT NULL'),a||(e.status='"status" TEXT DEFAULT NULL'),o||(e.hasDraft='"hasDraft" INTEGER DEFAULT NULL'));for(let c of t.fields){if(!c.name||c.name==="id")continue;let d=this.getColumnSqlDefinition(c,this.dialect),u=c.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase();e[u]=d;}return e}async syncTableColumns(t,i){let e;try{if(this.dialect==="postgres"){let r=await this.executeRaw(chunkVRZC4TTF_cjs.J`SELECT column_name, data_type, character_maximum_length FROM information_schema.columns WHERE table_name = ${i}`);e=new Map(r.map(a=>[a.column_name,{type:a.data_type,maxLen:a.character_maximum_length}]));}else {let r=await this.executeRaw(chunkVRZC4TTF_cjs.J`PRAGMA table_info("${chunkVRZC4TTF_cjs.J.raw(i)}")`);e=new Map(r.map(a=>[a.name,{type:a.type,maxLen:null}]));}}catch{return}let s=this.getExpectedColumnDefs(t,i),n=Object.keys(s).filter(r=>!e.has(r));if(n.length>0){let r=n.map(a=>`ALTER TABLE "${i}" ADD COLUMN ${s[a]}`);await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(r.join(`;
|
|
22
|
+
`)));}if(this.dialect==="postgres")for(let r of t.fields){if(!r.name||r.name==="id")continue;let a=L(r,this.dialect),o=r.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase(),c=e.get(o);!c||c.type!=="character varying"||(a==="text"?await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(`ALTER TABLE "${i}" ALTER COLUMN "${o}" TYPE TEXT`)):a==="jsonb"&&(await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(`ALTER TABLE "${i}" ALTER COLUMN "${o}" DROP DEFAULT`)),await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(`ALTER TABLE "${i}" ALTER COLUMN "${o}" TYPE JSONB USING (CASE WHEN "${o}" IS NULL THEN NULL WHEN "${o}"::text ~ '^\\s*\\{' THEN "${o}"::jsonb ELSE jsonb_build_object('id', "${o}"::text) END)`))));}}generateCreateColumns(t){let i=[];for(let e of t.fields){if(!e.name||e.name==="id")continue;let s=L(e,this.dialect),n=e.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase(),r=e.required?"NOT NULL":"DEFAULT NULL",a;if(this.dialect==="sqlite")switch(s){case "varchar":case "text":a=`TEXT ${r}`;break;case "integer":a=`INTEGER ${r}`;break;case "decimal":case "numeric":a=`NUMERIC ${r}`;break;case "boolean":a=`INTEGER ${r}`;break;case "timestamp":a=`TEXT ${r}`;break;case "jsonb":a=`TEXT ${r}`;break;default:a=`TEXT ${r}`;}else switch(s){case "varchar":a=`VARCHAR(255) ${r}`;break;case "integer":a=`INTEGER ${r}`;break;case "decimal":a=`DECIMAL ${r}`;break;case "boolean":a=`BOOLEAN ${r}`;break;case "timestamp":a=`TIMESTAMP ${r}`;break;case "jsonb":a=`JSONB ${r}`;break;default:a=`TEXT ${r}`;}i.push(`"${n}" ${a}`);}return i.join(`,
|
|
23
|
+
`)+(i.length>0?",":"")}async disconnect(){this.connected=false;}async find(t){let{collection:i,where:e={},sort:s,limit:n=10,page:r=1,tenantId:a,select:o,draft:c}=t,d=this.getCollection(i),u=this.getTable(i),m={...e};this.tenantContext&&d.tenantScoped&&(m=chunkVQ53TFYA_cjs.c({where:m},i,this.tenantContext,chunkVQ53TFYA_cjs.b).where||{});let g=this.buildWhereClause(m,d,u,a),y=d.fields.find(h=>h.name==="status"),p=y?.type==="select"&&Array.isArray(y.options)&&y.options.some(h=>h.value==="published");!c&&u.status&&p&&g.push(chunkBCEE4NBZ_cjs.n(u.status,"published"));let b=this.parseSort(s),_=!c&&u.status&&p?{...m,status:"published"}:m,ue=await this.count({collection:i,where:_,tenantId:a}),fe=(r-1)*n,P=[];try{let h=u[b.field]||u.createdAt||u.id,R=b.direction==="asc"?h:chunkBCEE4NBZ_cjs.M(h),A=this.client.select().from(u);g.length>0&&(A=A.where(chunkBCEE4NBZ_cjs.p(...g))),P=await A.orderBy(R).limit(n).offset(fe);}catch(h){console.error("[DrizzleAdapter] Query error:",h);}let N=P.map(h=>this.processResult(h,d));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(N=N.filter(h=>chunkVQ53TFYA_cjs.d(h,i,this.tenantContext,chunkVQ53TFYA_cjs.b))),c&&(N=await Promise.all(N.map(async h=>{let R=await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
24
24
|
SELECT * FROM kyro_versions
|
|
25
25
|
WHERE collection_slug = ${i}
|
|
26
26
|
AND document_id = ${h.id}
|
|
27
27
|
ORDER BY created_at DESC
|
|
28
28
|
LIMIT 1
|
|
29
|
-
`);if(R.length>0){let
|
|
29
|
+
`);if(R.length>0){let A=R[0],pe=typeof A.data=="string"?JSON.parse(A.data):A.data;return {...h,...pe,status:h.status,_hasUnpublishedChanges:A.status==="draft"}}return h}))),{docs:N,...this.calculatePagination(r,n,ue)}}async findByID(t){let{collection:i,id:e,tenantId:s,draft:n}=t,r=this.getCollection(i),a=this.getTable(i),o=this.dialect==="postgres"&&typeof e=="string"?D(e):e;if(this.tenantContext&&r.tenantScoped){let p={id:o,tenantId:this.tenantContext.tenantId};if(!chunkVQ53TFYA_cjs.d(p,i,this.tenantContext,chunkVQ53TFYA_cjs.b))return null}let c=[chunkBCEE4NBZ_cjs.n(a.id,o)];s&&a.tenantId&&c.push(chunkBCEE4NBZ_cjs.n(a.tenantId,s));let d=r.fields.find(p=>p.name==="status"),u=d?.type==="select"&&Array.isArray(d.options)&&d.options.some(p=>p.value==="published");!n&&a.status&&u&&c.push(chunkBCEE4NBZ_cjs.n(a.status,"published"));let m=c.length>1?chunkBCEE4NBZ_cjs.p(...c):c[0],g=await this.client.select().from(a).where(m);if(g.length===0)return null;let y=this.processResult(g[0],r);if(n){let p=await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
30
30
|
SELECT * FROM kyro_versions
|
|
31
31
|
WHERE collection_slug = ${i}
|
|
32
32
|
AND document_id = ${y.id}
|
|
33
33
|
ORDER BY created_at DESC
|
|
34
34
|
LIMIT 1
|
|
35
|
-
`);if(p.length>0){let
|
|
35
|
+
`);if(p.length>0){let b=p[0],_=typeof b.data=="string"?JSON.parse(b.data):b.data;y={...y,..._,status:y.status,_hasUnpublishedChanges:b.status==="draft"};}}return y}async create(t){let{collection:i,data:e,tenantId:s}=t,n=this.getCollection(i),r=this.getTable(i),a=this.prepareData(e,n);s&&n.tenantScoped&&(a.tenantId=s);let o=await this.client.insert(r).values(a).returning();return this.processResult(o[0],n)}async update(t){let{collection:i,id:e,data:s,tenantId:n}=t,r=this.getCollection(i),a=this.getTable(i),o=this.prepareData(s,r),c=this.dialect==="postgres"&&typeof e=="string"?D(e):e,d=[chunkBCEE4NBZ_cjs.n(a.id,c)];n&&a.tenantId&&d.push(chunkBCEE4NBZ_cjs.n(a.tenantId,n));let u=await this.client.update(a).set(o).where(chunkBCEE4NBZ_cjs.p(...d)).returning();if(u.length===0)throw new Error(`Document not found: ${i}/${e}`);return this.processResult(u[0],r)}async delete(t){let{collection:i,id:e,tenantId:s}=t,n=this.getCollection(i),r=this.getTable(i),a=this.dialect==="postgres"&&typeof e=="string"?D(e):e,o=[chunkBCEE4NBZ_cjs.n(r.id,a)];s&&r.tenantId&&o.push(chunkBCEE4NBZ_cjs.n(r.tenantId,s));let c=await this.client.delete(r).where(chunkBCEE4NBZ_cjs.p(...o)).returning();if(c.length===0)throw new Error(`Document not found: ${i}/${e}`);return this.processResult(c[0],n)}async count(t){let{collection:i,where:e={},tenantId:s}=t,n=this.getCollection(i),r=this.getTable(i),a=this.buildWhereClause(e,n,r,s);try{let o=this.client.select({count:chunkVRZC4TTF_cjs.J`count(*)`}).from(r);a.length>0&&(o=o.where(chunkBCEE4NBZ_cjs.p(...a)));let c=await o;return Number(c[0]?.count||0)}catch{return 0}}async findOne(t){let{collection:i,where:e={},tenantId:s,draft:n}=t;if(i.startsWith("_globals_")){let a=i.replace("_globals_",""),o=this.globals.get(a);if(!o)throw new Error(`Global "${a}" not found`);let c=this.getTable(i),d=this.client.select().from(c),u=o.fields.find(p=>p.name==="status"),m=u?.type==="select"&&Array.isArray(u.options)&&u.options.some(p=>p.value==="published");!n&&c.status&&m&&(d=d.where(chunkBCEE4NBZ_cjs.n(c.status,"published")));let g=await d.limit(1);if(g.length===0)return null;let y=this.processResult(g[0],o);if(n){let p=await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
36
36
|
SELECT * FROM kyro_versions
|
|
37
37
|
WHERE collection_slug = ${i}
|
|
38
|
-
AND document_id = ${
|
|
38
|
+
AND document_id = ${a}
|
|
39
39
|
ORDER BY created_at DESC
|
|
40
40
|
LIMIT 1
|
|
41
|
-
`);if(p.length>0){let
|
|
41
|
+
`);if(p.length>0){let b=p[0],_=typeof b.data=="string"?JSON.parse(b.data):b.data;y={...y,..._,status:y.status,_hasUnpublishedChanges:b.status==="draft"};}}return y}return (await this.find({...t,limit:1})).docs[0]||null}async findVersions(t){await this.ensureVersionsTable();let{collection:i,documentId:e,limit:s=10,page:n=1,tenantId:r}=t,a=(n-1)*s,o=this.getCollection(i),c=await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
42
42
|
SELECT count(*) as count
|
|
43
43
|
FROM kyro_versions
|
|
44
44
|
WHERE collection_slug = ${i}
|
|
@@ -54,27 +54,27 @@
|
|
|
54
54
|
${r&&o.tenantScoped?chunkVRZC4TTF_cjs.J`AND tenant_id = ${r}`:chunkVRZC4TTF_cjs.J``}
|
|
55
55
|
ORDER BY created_at DESC
|
|
56
56
|
LIMIT ${s}
|
|
57
|
-
OFFSET ${
|
|
58
|
-
`)).map(m=>({...m,data:typeof m.data=="string"?JSON.parse(m.data):m.data})),...this.calculatePagination(
|
|
57
|
+
OFFSET ${a}
|
|
58
|
+
`)).map(m=>({...m,data:typeof m.data=="string"?JSON.parse(m.data):m.data})),...this.calculatePagination(n,s,d)}}async findVersionByID(t){await this.ensureVersionsTable();let i=this.getCollection(t.collection),e=await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
59
59
|
SELECT * FROM kyro_versions
|
|
60
60
|
WHERE id = ${t.versionId}
|
|
61
61
|
AND collection_slug = ${t.collection}
|
|
62
62
|
${t.tenantId&&i.tenantScoped?chunkVRZC4TTF_cjs.J`AND tenant_id = ${t.tenantId}`:chunkVRZC4TTF_cjs.J``}
|
|
63
63
|
LIMIT 1
|
|
64
|
-
`);if(e.length===0)return null;let s=e[0];return {...s,data:typeof s.data=="string"?JSON.parse(s.data):s.data}}async createVersion(t){await this.ensureVersionsTable();let i=this.getCollection(t.collection),e=new Date().toISOString();if(t.autosave){let
|
|
64
|
+
`);if(e.length===0)return null;let s=e[0];return {...s,data:typeof s.data=="string"?JSON.parse(s.data):s.data}}async createVersion(t){await this.ensureVersionsTable();let i=this.getCollection(t.collection),e=new Date().toISOString();if(t.autosave){let n=await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
65
65
|
SELECT * FROM kyro_versions
|
|
66
66
|
WHERE collection_slug = ${t.collection}
|
|
67
67
|
AND document_id = ${t.documentId}
|
|
68
68
|
AND autosave = 1
|
|
69
69
|
${t.tenantId&&i.tenantScoped?chunkVRZC4TTF_cjs.J`AND tenant_id = ${t.tenantId}`:chunkVRZC4TTF_cjs.J``}
|
|
70
70
|
LIMIT 1
|
|
71
|
-
`);if(
|
|
71
|
+
`);if(n.length>0)return await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
72
72
|
UPDATE kyro_versions
|
|
73
73
|
SET data = ${JSON.stringify(t.data)},
|
|
74
74
|
status = ${t.status},
|
|
75
75
|
updated_at = ${e}
|
|
76
|
-
WHERE id = ${
|
|
77
|
-
`),this.findVersionByID({collection:t.collection,versionId:
|
|
76
|
+
WHERE id = ${n[0].id}
|
|
77
|
+
`),this.findVersionByID({collection:t.collection,versionId:n[0].id,tenantId:t.tenantId})}let s=Math.random().toString(36).substring(2,15);if(await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
78
78
|
INSERT INTO kyro_versions (
|
|
79
79
|
id, collection_slug, document_id, tenant_id, data, status, autosave, created_by, change_description, created_at, updated_at
|
|
80
80
|
) VALUES (
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
${JSON.stringify(t.data)}, ${t.status}, ${t.autosave?1:0}, ${t.createdBy||null},
|
|
83
83
|
${t.changeDescription||null}, ${e}, ${e}
|
|
84
84
|
)
|
|
85
|
-
`),!t.autosave){let
|
|
85
|
+
`),!t.autosave){let n=this.getCollection(t.collection);n.versions?.maxPerDoc&&await this.deleteVersions({collection:t.collection,documentId:t.documentId,keepLatest:n.versions.maxPerDoc,tenantId:t.tenantId});}return this.findVersionByID({collection:t.collection,versionId:s,tenantId:t.tenantId})}async updateLatestVersion(t){return this.createVersion({...t,autosave:true})}async deleteVersions(t){await this.ensureVersionsTable();let i=this.getCollection(t.collection);if(t.keepLatest){let s=(await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
86
86
|
SELECT id FROM kyro_versions
|
|
87
87
|
WHERE collection_slug = ${t.collection}
|
|
88
88
|
AND document_id = ${t.documentId}
|
|
@@ -90,18 +90,18 @@
|
|
|
90
90
|
${t.tenantId&&i.tenantScoped?chunkVRZC4TTF_cjs.J`AND tenant_id = ${t.tenantId}`:chunkVRZC4TTF_cjs.J``}
|
|
91
91
|
ORDER BY created_at DESC
|
|
92
92
|
LIMIT ${t.keepLatest}
|
|
93
|
-
`)).map(
|
|
93
|
+
`)).map(n=>n.id);s.length>0&&await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
94
94
|
DELETE FROM kyro_versions
|
|
95
95
|
WHERE collection_slug = ${t.collection}
|
|
96
96
|
AND document_id = ${t.documentId}
|
|
97
97
|
AND autosave = 0
|
|
98
|
-
AND id NOT IN (${chunkVRZC4TTF_cjs.J.join(s.map(
|
|
98
|
+
AND id NOT IN (${chunkVRZC4TTF_cjs.J.join(s.map(n=>chunkVRZC4TTF_cjs.J`${n}`),chunkVRZC4TTF_cjs.J`, `)})
|
|
99
99
|
`);}else await this.executeRaw(chunkVRZC4TTF_cjs.J`
|
|
100
100
|
DELETE FROM kyro_versions
|
|
101
101
|
WHERE collection_slug = ${t.collection}
|
|
102
102
|
AND document_id = ${t.documentId}
|
|
103
103
|
${t.tenantId&&i.tenantScoped?chunkVRZC4TTF_cjs.J`AND tenant_id = ${t.tenantId}`:chunkVRZC4TTF_cjs.J``}
|
|
104
|
-
`);}getTable(t){let i=this.getTableName(t),e=this.schema[i];if(!e)throw new Error(`Table "${i}" not found in schema`);return e}buildWhereClause(t,i,e,s){let
|
|
104
|
+
`);}getTable(t){let i=this.getTableName(t),e=this.schema[i];if(!e)throw new Error(`Table "${i}" not found in schema`);return e}buildWhereClause(t,i,e,s){let n=[];s&&i.tenantScoped&&e.tenantId&&n.push(chunkBCEE4NBZ_cjs.n(e.tenantId,s));for(let[r,a]of Object.entries(t))if(r==="id"&&this.dialect==="postgres"&&(typeof a=="string"?a=D(a):a&&typeof a=="object"&&(a.equals!==void 0&&typeof a.equals=="string"&&(a={...a,equals:D(a.equals)}),a.in&&Array.isArray(a.in)&&(a={...a,in:a.in.map(o=>typeof o=="string"?D(o):o)}))),r==="AND"&&Array.isArray(a)){let o=a.map(c=>this.buildWhereClause(c,i,e)).flat().filter(Boolean);o.length>0&&n.push(chunkBCEE4NBZ_cjs.p(...o));}else if(r==="OR"&&Array.isArray(a)){let o=a.map(c=>this.buildWhereClause(c,i,e)).flat().filter(Boolean);o.length>0&&n.push(chunkBCEE4NBZ_cjs.q(...o));}else if(typeof a=="object"&&a!==null&&!Array.isArray(a)){let o=e[r];if(!o)continue;a.equals!==void 0&&n.push(chunkBCEE4NBZ_cjs.n(o,a.equals)),a.not_equals!==void 0&&n.push(chunkBCEE4NBZ_cjs.o(o,a.not_equals)),a.in&&Array.isArray(a.in)&&n.push(chunkBCEE4NBZ_cjs.w(o,a.in)),a.like!==void 0&&n.push(chunkBCEE4NBZ_cjs.E(o,a.like)),a.contains!==void 0&&n.push(chunkBCEE4NBZ_cjs.E(o,`%${a.contains}%`)),a.greater_than!==void 0&&n.push(chunkBCEE4NBZ_cjs.s(o,a.greater_than)),a.greater_than_equal!==void 0&&n.push(chunkBCEE4NBZ_cjs.t(o,a.greater_than_equal)),a.less_than!==void 0&&n.push(chunkBCEE4NBZ_cjs.u(o,a.less_than)),a.less_than_equal!==void 0&&n.push(chunkBCEE4NBZ_cjs.v(o,a.less_than_equal));}else {let o=e[r];o&&n.push(chunkBCEE4NBZ_cjs.n(o,a));}return n}processResult(t,i){if(!t)return null;let e={...t};for(let s of Object.keys(e))/^\d+$/.test(s)&&delete e[s];t.id&&(e.id=String(t.id));for(let s of i.fields){if(!s.name)continue;let n=s.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase();n!==s.name&&e[n]!==void 0&&e[s.name]===void 0&&(e[s.name]=e[n],delete e[n]);}for(let s of i.fields){if(["json","richtext","array","group","blocks","upload","image","list","relationship-block"].includes(s.type)){let n=s;if(e[n.name]&&typeof e[n.name]=="string")try{let r=JSON.parse(e[n.name]);e[n.name]=r;}catch{}if(s.type==="blocks"&&e[n.name]&&Array.isArray(e[n.name])){let r=n.blocks||[];e[n.name]=le(e[n.name],r);}}if(s.type==="tabs"&&"tabs"in s&&s.name){if(typeof e[s.name]=="object"&&e[s.name]!==null&&!Array.isArray(e[s.name])){for(let r of s.tabs)for(let a of r.fields)if((a.type==="upload"||a.type==="image")&&a.name){let o=e[s.name][a.name];if(typeof o=="string")try{let c=JSON.parse(o);e[s.name][a.name]=Array.isArray(c)?c.map(d=>d&&typeof d=="object"&&typeof d.id=="string"?d.id:String(d||"")):typeof c.id=="string"?c.id:String(c.id||"");}catch{}else o&&typeof o=="object"&&(e[s.name][a.name]=Array.isArray(o)?o.map(c=>c&&typeof c=="object"&&typeof c.id=="string"?c.id:String(c||"")):typeof o.id=="string"?o.id:String(o.id||""));}continue}if(typeof e[s.name]=="string")try{let r=JSON.parse(e[s.name]);if(typeof r=="object"&&r!==null){e[s.name]=r;continue}}catch{}let n={};for(let r of s.tabs)for(let a of r.fields)if(a.name&&e[a.name]!==void 0){let o=e[a.name];if(["json","richtext","array","group","blocks","upload","image","list","relationship-block"].includes(a.type)){if(o&&typeof o=="string")try{o=JSON.parse(o);}catch{}(a.type==="upload"||a.type==="image")&&o&&typeof o=="object"&&(o=Array.isArray(o)?o.map(c=>c&&typeof c=="object"&&typeof c.id=="string"?c.id:String(c||"")):typeof o.id=="string"?o.id:String(o.id||""));}n[a.name]=o,delete e[a.name];}e[s.name]=n;}}return e.createdAt&&(e.createdAt=new Date(e.createdAt).toISOString()),e.updatedAt&&(e.updatedAt=new Date(e.updatedAt).toISOString()),chunkZOVH6QT5_cjs.a(e)}async ensureVersionsTable(){if(this.versionsTableReady)return;let t;this.dialect==="sqlite"?t=`
|
|
105
105
|
CREATE TABLE IF NOT EXISTS kyro_versions (
|
|
106
106
|
id text PRIMARY KEY,
|
|
107
107
|
collection_slug text NOT NULL,
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
created_at text NOT NULL,
|
|
130
130
|
updated_at text NOT NULL
|
|
131
131
|
)
|
|
132
|
-
`,await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(t));try{this.dialect==="postgres"?await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN IF NOT EXISTS autosave integer NOT NULL DEFAULT 0")):await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN autosave integer NOT NULL DEFAULT 0"));}catch{}this.versionsTableReady=true;}async execute(t){return this.executeRaw(t)}async executeRaw(t){let i="",e=[];if(typeof t=="string")i=t;else if(t&&(t.queryChunks||t.decoder))if(this.dialect==="postgres"){let
|
|
132
|
+
`,await this.executeRaw(chunkVRZC4TTF_cjs.J.raw(t));try{this.dialect==="postgres"?await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN IF NOT EXISTS autosave integer NOT NULL DEFAULT 0")):await this.executeRaw(chunkVRZC4TTF_cjs.J.raw("ALTER TABLE kyro_versions ADD COLUMN autosave integer NOT NULL DEFAULT 0"));}catch{}this.versionsTableReady=true;}async execute(t){return this.executeRaw(t)}async executeRaw(t){let i="",e=[];if(typeof t=="string")i=t;else if(t&&(t.queryChunks||t.decoder))if(this.dialect==="postgres"){let n=new chunkKCHPADCH_cjs.a().sqlToQuery(t);i=n.sql,e=n.params;}else {let n=new chunk7ACHOBWY_cjs.h().sqlToQuery(t);i=n.sql,e=n.params;}else if(t&&typeof t.toSQL=="function"){let n=t.toSQL();i=n.sql,e=n.params||[];}else i=String(t);let s=this.rawClient||this.client;if(s?.prepare&&typeof s.prepare=="function"){let n=s.prepare(i);return (e.length>0?await n.bind(...e).all():await n.all()).results||[]}if(typeof this.client?.execute=="function"){let n=await this.client.execute(t);return Array.isArray(n)?n:Array.isArray(n?.rows)?n.rows:Array.isArray(n?.[0])?n[0]:[]}return []}};function Ie(f){return new M(f)}chunkBUNLC3II_cjs.h();var x;function Ae(){return x||(x=module$1.createRequire("file:///")("node:sqlite").DatabaseSync,x)}function Ee(){return process.env.DB_TYPE==="postgres"?"postgres":"sqlite"}function de(){return crypto.randomBytes(16).toString("hex")}async function Me(){let f=Ee();if(f==="sqlite"){let r=path.resolve(process.cwd(),"data","kyro.db");await promises.mkdir(path.dirname(r),{recursive:true});let a=new(Ae())(r);return a.exec("PRAGMA journal_mode = WAL"),{db:a,dialect:f,genId:de}}let t=process.env.DATABASE_URL||"postgresql://postgres:postgres@localhost:5432/kyro_cms",i=parseInt(process.env.DB_POOL_MAX||"10",10),e=process.env.DB_SSL==="true",s=chunkLY7N3UHH_cjs.a(t,{max:i,ssl:e?"require":false,onnotice:()=>{}});return {db:chunkKCHPADCH_cjs.f(s),dialect:f,genId:de}}async function Pe(f,t){}async function je(f){let{roles:t}=await import('./schema-RT6WSUYC.cjs');await f.insert(t).values({name:"super_admin",level:100,inherits:[],description:"Full system access across all tenants",isSystem:true}).onConflictDoNothing();}
|
|
133
133
|
exports.a=L;exports.b=Se;exports.c=M;exports.d=Ie;exports.e=de;exports.f=Me;exports.g=Pe;exports.h=je;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {D,A}from'./chunk-
|
|
1
|
+
import {D,A}from'./chunk-R3KFYDRS.js';import {e}from'./chunk-BAXBE4JD.js';import {fb}from'./chunk-5VGYVQPY.js';import {a as a$1}from'./chunk-R25WLKX4.js';import {c}from'./chunk-KNOFTUQV.js';import {a}from'./chunk-ZWDBPEXL.js';import {a as a$2}from'./chunk-5ZEYOFAK.js';import {g}from'./chunk-Y2YAKDEQ.js';import w from'kyro:config';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();var r=null,l=null;async function b(){if(!r){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let e$1=w.default||w,t=e$1.adapter,o=t&&!t.dialect&&typeof t.connect=="function";if(globalThis.DB&&(!t||o)){let s=globalThis.DB;e$1.adapter=new c({type:"sqlite",client:s}),D.info("Hot-swapped to D1 DrizzleAdapter");}r=A(e$1),await r.init();let a$3=e$1.adapter,p=a$3&&a$3.dialect&&(a$3.dialect==="postgres"||a$3.dialect==="sqlite"),c$1=a$3&&a$3.dialect==="mongodb",n;if(p)a$3.dialect==="postgres"?n=new a({db:a$3.client}):a$3.dialect==="sqlite"&&(n=new fb({db:a$3.rawClient||a$3.client}));else if(o&&!globalThis.DB){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";n=new a$1({path:s});}else c$1&&(n=new a$2({adapter:a$3}));if(n?.connect)try{await n.connect();}catch(s){D.warn("Auth connect warning:",s);}try{await r.loadSettings();}catch(s){D.warn("loadSettings warning:",s);}try{await e(n);}catch(s){D.warn("autoBootstrap warning:",s);}globalThis.__KYRO_INSTANCE__=r;}catch(e){throw r=null,l=null,D.error("Init failed, will retry:",e),e}}}async function E(e){let t=globalThis.DB?globalThis:null;try{let{env:o}=await import('cloudflare:workers');o&&(t=o);}catch{}if(e)try{t=e.locals?.cfContext?.env||e?.env||t;}catch{}if(!t)try{t=process.env;}catch{}t?.DB&&(globalThis.DB=t.DB),t?.STORAGE_BUCKET&&(globalThis.STORAGE_BUCKET=t.STORAGE_BUCKET),l||(l=b()),await l;}var _={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function T(e){return r?r.settings?.access?.apiAccess?.[e]??_[e]??true:_[e]??true}var R=async e=>{if(!r)try{await Promise.race([E(e),new Promise((t,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch(t){return console.error("[Kyro API] Warm error:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}try{let o=new URL(e.request.url).pathname,a=__KYRO_API_PATH__;if(o===`${a}/graphql`&&typeof r.getGraphQL=="function"){if(!T("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getGraphQL().fetch(e.request,e.locals);return new Response(n.body,n)}if(o.startsWith(`${a}/trpc/`)&&typeof r.getTRPC=="function"){if(!T("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getTRPC().fetch(e.request,e.locals);return new Response(n.body,n)}return await(await r.getREST()).fetch(e.request,e.locals)}catch(t){return console.error("[Kyro API Execution Error]:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Internal Server Error",message:t?.message||String(t),stack:t?.stack}),{status:500,headers:{"Content-Type":"application/json"}})}},N=R;export{r as a,E as b,R as c,N as d};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -390,4 +390,4 @@ bucket_name = "${u}"
|
|
|
390
390
|
`);}catch(x){let _=x?.stdout?.toString?.()||"",L=x?.stderr?.toString?.()||"";ee.fail("Deployment failed"),_&&process.stdout.write(_),L&&process.stdout.write(L),console.log(`
|
|
391
391
|
${C.red.bold("\u2716 Deployment Failed!")}`),console.log(` ${C.dim("See the Wrangler error above.")}
|
|
392
392
|
`),f&&process.stdout.write(JSON.stringify({ok:false,error:"Deployment failed"})+`
|
|
393
|
-
`),process.exit(1);}}),i}var ng=url.fileURLToPath(chunkBUNLC3II_cjs.g),og=Gt.dirname(ng),Gl="0.1.0";try{Gl=JSON.parse(et.readFileSync(Gt.join(og,"../../package.json"),"utf-8")).version;}catch{}var jt=new ie;jt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(Gl);jt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});jt.addCommand(Bo());jt.addCommand(Vl());var ts=jt.command("db").description("Database management commands");ts.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});ts.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});ts.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});ts.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});ts.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ug=jt.command("auth").description("Authentication management commands");ug.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-FTVBJ47D.cjs'),e=process.env.DATABASE_URL||"",s=e.toLowerCase().startsWith("postgres://")||e.toLowerCase().startsWith("postgresql://"),r=e.toLowerCase().startsWith("mongodb://")||e.toLowerCase().startsWith("mongodb+srv://"),n=!e||e.includes(".db")||e.includes("sqlite")||e.includes("file:"),o;if(s){let{PostgresAuthAdapter:a}=await import('../postgres-auth-adapter-ZO6HK5AK.cjs'),{drizzle:h}=await import('../postgres-js-3Y54EXVQ.cjs'),{default:d}=await import('../src-6LAUXXDM.cjs'),c=d(e,{max:1,onnotice:()=>{}}),f=h(c);o=new a({db:f});}else if(r){let{MongoDBAuthAdapter:a}=await import('../mongo-auth-adapter-
|
|
393
|
+
`),process.exit(1);}}),i}var ng=url.fileURLToPath(chunkBUNLC3II_cjs.g),og=Gt.dirname(ng),Gl="0.1.0";try{Gl=JSON.parse(et.readFileSync(Gt.join(og,"../../package.json"),"utf-8")).version;}catch{}var jt=new ie;jt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(Gl);jt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});jt.addCommand(Bo());jt.addCommand(Vl());var ts=jt.command("db").description("Database management commands");ts.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});ts.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});ts.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});ts.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});ts.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ug=jt.command("auth").description("Authentication management commands");ug.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-FTVBJ47D.cjs'),e=process.env.DATABASE_URL||"",s=e.toLowerCase().startsWith("postgres://")||e.toLowerCase().startsWith("postgresql://"),r=e.toLowerCase().startsWith("mongodb://")||e.toLowerCase().startsWith("mongodb+srv://"),n=!e||e.includes(".db")||e.includes("sqlite")||e.includes("file:"),o;if(s){let{PostgresAuthAdapter:a}=await import('../postgres-auth-adapter-ZO6HK5AK.cjs'),{drizzle:h}=await import('../postgres-js-3Y54EXVQ.cjs'),{default:d}=await import('../src-6LAUXXDM.cjs'),c=d(e,{max:1,onnotice:()=>{}}),f=h(c);o=new a({db:f});}else if(r){let{MongoDBAuthAdapter:a}=await import('../mongo-auth-adapter-EUHAYWJ6.cjs'),h=await import('../lib-5QYYN6ML.cjs'),d=h.MongoClient??h.default?.MongoClient,c=new d(e);await c.connect();let f=c.db();o=new a({db:f});}else {let{SQLiteAuthAdapter:a}=await import('../sqlite-adapter-ZTABLT2X.cjs'),h=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";o=new a({path:h});}o.connect&&await o.connect();let u=await t({authAdapter:o,adminEmail:i.email,adminPassword:i.password,adminRole:i.role});o.disconnect&&await o.disconnect(),u.success||(console.error("\u274C Failed to create admin:",u.error),process.exit(1));}catch(t){console.error("\u274C Bootstrap failed:",t),process.exit(1);}});jt.command("health").description("Check system health").action(async()=>{let i=process.env.DATABASE_URL||"",t=i.toLowerCase().startsWith("postgres://")||i.toLowerCase().startsWith("postgresql://"),e=i.toLowerCase().startsWith("mongodb://")||i.toLowerCase().startsWith("mongodb+srv://"),s=!i||i.includes(".db")||i.includes("sqlite")||i.includes("file:");if(t)try{let{default:r}=await import('../src-6LAUXXDM.cjs'),n=r(i,{max:1,onnotice:()=>{}});await n.unsafe("SELECT 1"),await n.end();}catch{}else if(e)try{let r=await import('../lib-5QYYN6ML.cjs'),n=r.MongoClient??r.default?.MongoClient,o=new n(i);await o.connect(),await o.db().admin().ping(),await o.close();}catch{}else if(s)try{let r=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db",{existsSync:n}=await import('fs');n(r);}catch{}});jt.parse();process.argv.slice(2).length||jt.outputHelp();
|
package/dist/cli/index.js
CHANGED
|
@@ -391,4 +391,4 @@ bucket_name = "${u}"
|
|
|
391
391
|
`);}catch(v){let S=v?.stdout?.toString?.()||"",W=v?.stderr?.toString?.()||"";se.fail("Deployment failed"),S&&process.stdout.write(S),W&&process.stdout.write(W),console.log(`
|
|
392
392
|
${E.red.bold("\u2716 Deployment Failed!")}`),console.log(` ${E.dim("See the Wrangler error above.")}
|
|
393
393
|
`),f&&process.stdout.write(JSON.stringify({ok:false,error:"Deployment failed"})+`
|
|
394
|
-
`),process.exit(1);}}),i}var og=fileURLToPath(import.meta.url),ug=dirname(og),zl="0.1.0";try{zl=JSON.parse(readFileSync(join(ug,"../../package.json"),"utf-8")).version;}catch{}var Nt=new re;Nt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(zl);Nt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});Nt.addCommand(Mo());Nt.addCommand(Gl());var es=Nt.command("db").description("Database management commands");es.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});es.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});es.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});es.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});es.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ag=Nt.command("auth").description("Authentication management commands");ag.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-IGHJFNYG.js'),e=process.env.DATABASE_URL||"",s=e.toLowerCase().startsWith("postgres://")||e.toLowerCase().startsWith("postgresql://"),r=e.toLowerCase().startsWith("mongodb://")||e.toLowerCase().startsWith("mongodb+srv://"),n=!e||e.includes(".db")||e.includes("sqlite")||e.includes("file:"),o;if(s){let{PostgresAuthAdapter:a}=await import('../postgres-auth-adapter-SK3N3OSS.js'),{drizzle:h}=await import('../postgres-js-4CI7FMYS.js'),{default:d}=await import('../src-QBADSZV4.js'),c=d(e,{max:1,onnotice:()=>{}}),f=h(c);o=new a({db:f});}else if(r){let{MongoDBAuthAdapter:a}=await import('../mongo-auth-adapter-
|
|
394
|
+
`),process.exit(1);}}),i}var og=fileURLToPath(import.meta.url),ug=dirname(og),zl="0.1.0";try{zl=JSON.parse(readFileSync(join(ug,"../../package.json"),"utf-8")).version;}catch{}var Nt=new re;Nt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(zl);Nt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});Nt.addCommand(Mo());Nt.addCommand(Gl());var es=Nt.command("db").description("Database management commands");es.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});es.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});es.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});es.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});es.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ag=Nt.command("auth").description("Authentication management commands");ag.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-IGHJFNYG.js'),e=process.env.DATABASE_URL||"",s=e.toLowerCase().startsWith("postgres://")||e.toLowerCase().startsWith("postgresql://"),r=e.toLowerCase().startsWith("mongodb://")||e.toLowerCase().startsWith("mongodb+srv://"),n=!e||e.includes(".db")||e.includes("sqlite")||e.includes("file:"),o;if(s){let{PostgresAuthAdapter:a}=await import('../postgres-auth-adapter-SK3N3OSS.js'),{drizzle:h}=await import('../postgres-js-4CI7FMYS.js'),{default:d}=await import('../src-QBADSZV4.js'),c=d(e,{max:1,onnotice:()=>{}}),f=h(c);o=new a({db:f});}else if(r){let{MongoDBAuthAdapter:a}=await import('../mongo-auth-adapter-FW7ATYQ6.js'),h=await import('../lib-XXYYUPMW.js'),d=h.MongoClient??h.default?.MongoClient,c=new d(e);await c.connect();let f=c.db();o=new a({db:f});}else {let{SQLiteAuthAdapter:a}=await import('../sqlite-adapter-4TPNROJK.js'),h=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";o=new a({path:h});}o.connect&&await o.connect();let u=await t({authAdapter:o,adminEmail:i.email,adminPassword:i.password,adminRole:i.role});o.disconnect&&await o.disconnect(),u.success||(console.error("\u274C Failed to create admin:",u.error),process.exit(1));}catch(t){console.error("\u274C Bootstrap failed:",t),process.exit(1);}});Nt.command("health").description("Check system health").action(async()=>{let i=process.env.DATABASE_URL||"",t=i.toLowerCase().startsWith("postgres://")||i.toLowerCase().startsWith("postgresql://"),e=i.toLowerCase().startsWith("mongodb://")||i.toLowerCase().startsWith("mongodb+srv://"),s=!i||i.includes(".db")||i.includes("sqlite")||i.includes("file:");if(t)try{let{default:r}=await import('../src-QBADSZV4.js'),n=r(i,{max:1,onnotice:()=>{}});await n.unsafe("SELECT 1"),await n.end();}catch{}else if(e)try{let r=await import('../lib-XXYYUPMW.js'),n=r.MongoClient??r.default?.MongoClient,o=new n(i);await o.connect(),await o.db().admin().ping(),await o.close();}catch{}else if(s)try{let r=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db",{existsSync:n}=await import('fs');n(r);}catch{}});Nt.parse();process.argv.slice(2).length||Nt.outputHelp();
|
package/dist/drizzle/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('../chunk-AMGJ5AFH.cjs');var
|
|
1
|
+
'use strict';require('../chunk-AMGJ5AFH.cjs');var chunkTDGSIF5H_cjs=require('../chunk-TDGSIF5H.cjs'),chunkXBQ6HV3T_cjs=require('../chunk-XBQ6HV3T.cjs');require('../chunk-7JWQ2PZP.cjs'),require('../chunk-NGNJSUGL.cjs'),require('../chunk-KCHPADCH.cjs'),require('../chunk-BAVN7VDR.cjs'),require('../chunk-LY7N3UHH.cjs'),require('../chunk-7ACHOBWY.cjs'),require('../chunk-GNOSG3PK.cjs'),require('../chunk-BCEE4NBZ.cjs'),require('../chunk-VRZC4TTF.cjs'),require('../chunk-VQ53TFYA.cjs'),require('../chunk-F4ITQ6XQ.cjs'),require('../chunk-HTYVI2HK.cjs'),require('../chunk-ZOVH6QT5.cjs'),require('../chunk-7WMMKGEO.cjs'),require('../chunk-BUNLC3II.cjs');Object.defineProperty(exports,"DrizzleAdapter",{enumerable:true,get:function(){return chunkTDGSIF5H_cjs.c}});Object.defineProperty(exports,"collectionToDrizzleSchema",{enumerable:true,get:function(){return chunkTDGSIF5H_cjs.b}});Object.defineProperty(exports,"createDatabase",{enumerable:true,get:function(){return chunkTDGSIF5H_cjs.f}});Object.defineProperty(exports,"createDrizzleAdapter",{enumerable:true,get:function(){return chunkTDGSIF5H_cjs.d}});Object.defineProperty(exports,"fieldToDrizzleType",{enumerable:true,get:function(){return chunkTDGSIF5H_cjs.a}});Object.defineProperty(exports,"runMigrations",{enumerable:true,get:function(){return chunkTDGSIF5H_cjs.g}});Object.defineProperty(exports,"seedDefaultRoles",{enumerable:true,get:function(){return chunkTDGSIF5H_cjs.h}});Object.defineProperty(exports,"PostgresAuthAdapter",{enumerable:true,get:function(){return chunkXBQ6HV3T_cjs.a}});
|
package/dist/drizzle/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'../chunk-QDBGBDCT.js';export{c as DrizzleAdapter,b as collectionToDrizzleSchema,f as createDatabase,d as createDrizzleAdapter,a as fieldToDrizzleType,g as runMigrations,h as seedDefaultRoles}from'../chunk-
|
|
1
|
+
import'../chunk-QDBGBDCT.js';export{c as DrizzleAdapter,b as collectionToDrizzleSchema,f as createDatabase,d as createDrizzleAdapter,a as fieldToDrizzleType,g as runMigrations,h as seedDefaultRoles}from'../chunk-KNOFTUQV.js';export{a as PostgresAuthAdapter}from'../chunk-ZWDBPEXL.js';import'../chunk-47CXBWMA.js';import'../chunk-EML5FDUU.js';import'../chunk-OXGJOYEO.js';import'../chunk-FLMUMPDE.js';import'../chunk-2HA6EKXX.js';import'../chunk-JV4HJBXW.js';import'../chunk-N5POANYV.js';import'../chunk-HRAY65XH.js';import'../chunk-3NSZZCOJ.js';import'../chunk-SLMIYECU.js';import'../chunk-P6JITOFF.js';import'../chunk-7NH7H3WA.js';import'../chunk-VVVCCB6R.js';import'../chunk-TBHNE4VV.js';import'../chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|