@kyro-cms/core 0.11.6 → 0.12.0

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.
Files changed (84) hide show
  1. package/dist/{WebhookService-BoHm8roq.d.cts → WebhookService-CE2BzNb_.d.cts} +34 -2
  2. package/dist/{WebhookService-0D8rBDOw.d.ts → WebhookService-DIUUnBqL.d.ts} +34 -2
  3. package/dist/api-handler-graphql.cjs +1 -1
  4. package/dist/api-handler-graphql.js +1 -1
  5. package/dist/api-handler-trpc.cjs +1 -1
  6. package/dist/api-handler-trpc.js +1 -1
  7. package/dist/api-handler.cjs +1 -1
  8. package/dist/api-handler.js +1 -1
  9. package/dist/{base-D_gWzhL1.d.ts → base-BbqmiS-x.d.ts} +6 -6
  10. package/dist/{base-m1Y9PVG6.d.cts → base-BvTw4t8l.d.cts} +6 -6
  11. package/dist/{chunk-MOMALAYX.cjs → chunk-2MRO4YLX.cjs} +1 -1
  12. package/dist/{chunk-GJQH6NV7.js → chunk-5BPMMIAQ.js} +1 -1
  13. package/dist/chunk-BYTGJJK6.js +86 -0
  14. package/dist/{chunk-W4ZDETHA.cjs → chunk-EJDIR56C.cjs} +1 -1
  15. package/dist/{chunk-BDBN4RN6.cjs → chunk-ER2PUSHG.cjs} +1 -1
  16. package/dist/{chunk-F7SR5IDT.cjs → chunk-G3J2EU5D.cjs} +1 -1
  17. package/dist/{chunk-SL3LZQCF.js → chunk-GKYEJ2UF.js} +1 -1
  18. package/dist/chunk-GM63MQNE.cjs +3 -0
  19. package/dist/chunk-HS2KNFAB.cjs +2 -0
  20. package/dist/chunk-IC7UOIHY.cjs +133 -0
  21. package/dist/{chunk-CAD6VWL5.js → chunk-JLIXKA4D.js} +1 -1
  22. package/dist/chunk-KG7V6O2Z.js +2 -0
  23. package/dist/chunk-KHQGO3U3.cjs +86 -0
  24. package/dist/chunk-KY3Q7LFE.cjs +21 -0
  25. package/dist/chunk-MRVECVMR.js +133 -0
  26. package/dist/chunk-PNA36LJ6.js +3 -0
  27. package/dist/chunk-PP7W5UKL.js +2 -0
  28. package/dist/{chunk-4YYBWCDJ.js → chunk-TQNM4C7H.js} +1 -1
  29. package/dist/{chunk-DNLO7PK6.cjs → chunk-UCCFT5OO.cjs} +1 -1
  30. package/dist/chunk-WE46GGL4.cjs +2 -0
  31. package/dist/chunk-YKQG6NBC.js +21 -0
  32. package/dist/chunk-YPDRUVWG.js +2 -0
  33. package/dist/client.d.cts +1 -1
  34. package/dist/client.d.ts +1 -1
  35. package/dist/drizzle/index.cjs +1 -1
  36. package/dist/drizzle/index.d.cts +6 -6
  37. package/dist/drizzle/index.d.ts +6 -6
  38. package/dist/drizzle/index.js +1 -1
  39. package/dist/graphql/index.cjs +1 -1
  40. package/dist/graphql/index.d.cts +7 -7
  41. package/dist/graphql/index.d.ts +7 -7
  42. package/dist/graphql/index.js +1 -1
  43. package/dist/{index-DpuTMOei.d.cts → index-B70yBGlO.d.cts} +1 -1
  44. package/dist/{index-wsdh-ul-.d.ts → index-BJMk6wAL.d.ts} +1 -1
  45. package/dist/index.cjs +2 -2
  46. package/dist/index.d.cts +17 -33
  47. package/dist/index.d.ts +17 -33
  48. package/dist/index.js +2 -2
  49. package/dist/mongodb/index.cjs +1 -1
  50. package/dist/mongodb/index.d.cts +6 -6
  51. package/dist/mongodb/index.d.ts +6 -6
  52. package/dist/mongodb/index.js +1 -1
  53. package/dist/rest/index.cjs +1 -1
  54. package/dist/rest/index.d.cts +5 -5
  55. package/dist/rest/index.d.ts +5 -5
  56. package/dist/rest/index.js +1 -1
  57. package/dist/templates/index.cjs +1 -1
  58. package/dist/templates/index.d.cts +1 -1
  59. package/dist/templates/index.d.ts +1 -1
  60. package/dist/templates/index.js +1 -1
  61. package/dist/trpc/index.cjs +1 -1
  62. package/dist/trpc/index.d.cts +4 -4
  63. package/dist/trpc/index.d.ts +4 -4
  64. package/dist/trpc/index.js +1 -1
  65. package/dist/{types-CGQSckv0.d.cts → types-Dlbz_JRA.d.cts} +14 -14
  66. package/dist/{types-Cxb3Ukwl.d.ts → types-HgePo7uw.d.ts} +14 -14
  67. package/dist/ws/index.cjs +1 -1
  68. package/dist/ws/index.d.cts +4 -4
  69. package/dist/ws/index.d.ts +4 -4
  70. package/dist/ws/index.js +1 -1
  71. package/package.json +1 -1
  72. package/dist/chunk-43U2NBVS.cjs +0 -86
  73. package/dist/chunk-4FV3HQBI.cjs +0 -1
  74. package/dist/chunk-7ORSLR3S.js +0 -2
  75. package/dist/chunk-FCPFEHTM.cjs +0 -3
  76. package/dist/chunk-FU5JJVYA.js +0 -3
  77. package/dist/chunk-HM2Y4R77.js +0 -21
  78. package/dist/chunk-MTFJDAPX.js +0 -133
  79. package/dist/chunk-O7FYIPJW.cjs +0 -2
  80. package/dist/chunk-QAJS4EXW.cjs +0 -133
  81. package/dist/chunk-QEKTGNUJ.cjs +0 -21
  82. package/dist/chunk-QIP7PY2U.js +0 -1
  83. package/dist/chunk-V465K673.js +0 -86
  84. package/dist/chunk-XQPYBNIT.js +0 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export{a as RedisAuthAdapter}from'./chunk-AU6IWTBO.js';export{N as allSettingsGlobals,c as blogCollections,d as blogGlobals,O as coreSettingsGlobals,S as createTemplateConfig,e as ecommerceCollections,f as ecommerceGlobals,g as kitchenSinkCollections,i as mediaCollections,a as minimalCollections,R as templateCollections}from'./chunk-FU5JJVYA.js';export{a as kyro}from'./chunk-PTS33SK5.js';export{a as ConfigValidationError,p as Kyro,r as LocalAdapter,l as Registry,h as collectionToCreateZod,i as collectionToUpdateZod,j as collectionToWhereZod,g as collectionToZod,q as createKyro,s as createLocalAdapter,o as createRegistry,f as fieldToZod,m as getRegistry,k as globalToZod,n as resetRegistry,b as validateCollection,e as validateConfig,d as validateFields,c as validateGlobal}from'./chunk-HM2Y4R77.js';export{d as autoBootstrap,a as bootstrapAdmin,e as bootstrapWithRetry,c as getBootstrapFromEnv}from'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';export{a as CSSGenerator,g as createAdminStyling,d as defaultDarkTheme,h as defaultFieldStyling,c as defaultLightTheme,e as ecommerce2026Theme,f as generateCSSVariables,b as generateTailwindConfig}from'./chunk-UHFDH3PG.js';export{p as ALL_FIELD_TYPES,m as COMPLEX_FIELD_TYPES,o as LAYOUT_FIELD_TYPES,l as PRIMITIVE_FIELD_TYPES,n as RELATIONAL_FIELD_TYPES,d as isArrayField,f as isBlocksField,e as isGroupField,h as isImageField,k as isLayoutField,b as isNumberField,c as isRelationshipField,i as isRichTextField,j as isSelectField,a as isTextField,g as isUploadField,s as normalizeRichTextValue,t as renderRichText,r as richTextStyles}from'./chunk-PFT4OMNK.js';import'./chunk-5SEHX7ON.js';export{a as createContext,g as createCountProcedure,d as createCreateProcedure,f as createDeleteProcedure,h as createDynamicRouter,c as createFindByIDProcedure,b as createFindProcedure,i as createKyroServer,e as createUpdateProcedure}from'./chunk-GJQH6NV7.js';export{c as buildGraphQLSchema,d as createGraphQLSchema}from'./chunk-XQPYBNIT.js';import {l,n,m,p as p$1,q}from'./chunk-V465K673.js';export{n as AuditLogger,p as InMemoryAuditLogger,m as InMemoryRateLimiter,r as MediaService,o as createAuditContext,s as createHonoApp,e as createLocalStorage,t as createRESTAPI,i as getAppSecret,j as getEncryptionKey,k as getSessionConfig,h as loadSecrets,d as resolveProvider,g as setDbAdapter}from'./chunk-V465K673.js';import {b as b$1,c}from'./chunk-7WOX27LK.js';export{a as ConfigService,b as EmailTransport,c as PasswordPolicy}from'./chunk-7WOX27LK.js';import'./chunk-K6WUOU6P.js';import'./chunk-AE6GXUT7.js';import {a as a$1}from'./chunk-2W4FK6CJ.js';export{a as SQLiteAuthAdapter}from'./chunk-2W4FK6CJ.js';import'./chunk-NRLIGDYF.js';export{e as ALL_WEBHOOK_EVENTS,f as WEBHOOK_COLLECTION,g as WEBHOOK_DELIVERY_COLLECTION,d as WEBHOOK_EVENTS,n as WebhookService,l as buildDeliveryRecord,m as createTestPayload,o as createWebhookService,j as deliverWebhook,k as deliverWithRetry,i as generateWebhookSecret,h as signPayload}from'./chunk-QIP7PY2U.js';export{a as evaluateAccess,c as getWhereClause,b as mergeWhereClauses}from'./chunk-HLSB2MCK.js';export{b as KyroPubSub,c as KyroWSServer,a as PubSub,d as createWSServer}from'./chunk-SL3LZQCF.js';import'./chunk-PP5S2UBV.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-MTFJDAPX.js';import {a as a$2}from'./chunk-RHCWCG3O.js';export{a as PostgresAuthAdapter}from'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';export{a as MongoDBAdapter,b as createMongoDBAdapter}from'./chunk-7ORSLR3S.js';import {a}from'./chunk-P7CESLDJ.js';export{a as MongoDBAuthAdapter}from'./chunk-P7CESLDJ.js';export{a as AbstractBaseAdapter}from'./chunk-4YYBWCDJ.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';import q$1,{randomBytes}from'crypto';import {readFileSync}from'fs';import Me,{join,resolve}from'path';export{z}from'zod';import {createStorage}from'unstorage';import $r from'unstorage/drivers/indexedb';import zr from'unstorage/drivers/fs';async function Ie(s,e){let t=e.data;for(let r of s){let o=await r({...e,data:t});o!==void 0&&(t=o);}return t}async function br(s,e){return Ie(s,e)}var b=class{name;version;description;hooks={};collections=[];globals=[];fields=[];extensions={collections:[],globals:[]};adminComponents={};adminStyles=[];serverMiddleware;clientMiddleware;constructor(e){this.name=e;}async init(e){}async beforeInit(e){}async afterInit(e){}getCollections(){return this.collections}getGlobals(){return this.globals}getHooks(){return this.hooks}},$=class{plugins=new Map;hooks=new Map;register(e){if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);this.plugins.set(e.name,e);let t=e.getHooks?.()||{};for(let[r,o]of Object.entries(t))if(Array.isArray(o))for(let i of o)this.registerHook(r,i);}unregister(e){let t=this.plugins.get(e);if(!t)return;let r=t.getHooks?.()||{};for(let[o,i]of Object.entries(r))if(Array.isArray(i))for(let n of i)this.unregisterHook(o,n);this.plugins.delete(e);}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}registerHook(e,t){this.hooks.has(e)||this.hooks.set(e,[]),this.hooks.get(e).push(t);}unregisterHook(e,t){let r=this.hooks.get(e);if(r){let o=r.indexOf(t);o>-1&&r.splice(o,1);}}async executeHook(e,t){let r=this.hooks.get(e)||[],o=t;for(let i of r)try{let n=await i({...t,data:o});n!==void 0&&(o=n);}catch(n){console.error(`[PluginManager] Error in hook "${e}":`,n);}return o}getAllCollections(){let e=[];for(let t of this.plugins.values()){let r=t.getCollections?.()||[];e.push(...r);}return e}getAllGlobals(){let e=[];for(let t of this.plugins.values()){let r=t.getGlobals?.()||[];e.push(...r);}return e}getAllFields(){let e=[];for(let t of this.plugins.values())e.push(...t.fields);return e}getAdminComponents(){let e={};for(let t of this.plugins.values())Object.assign(e,t.adminComponents);return e}getAdminStyles(){let e=[];for(let t of this.plugins.values())e.push(...t.adminStyles);return e}},L=class extends b{constructor(){super("seo"),this.description="Advanced SEO features including sitemaps, robots.txt, and structured data",this.collections.push({slug:"seo-settings",label:"SEO Settings",fields:[{name:"sitemap",type:"checkbox",label:"Enable Sitemap",defaultValue:true},{name:"robotsTxt",type:"richtext",label:"robots.txt Content"},{name:"canonicalUrl",type:"text",variant:"url",label:"Canonical URL"},{name:"ogImage",type:"text",label:"Default OG Image URL"}]});}},E=class extends b{constructor(){super("analytics"),this.description="Analytics integration for tracking page views and events",this.collections.push({slug:"analytics-events",label:"Analytics Events",fields:[{name:"name",type:"text",required:true},{name:"properties",type:"json",label:"Event Properties"},{name:"timestamp",type:"date",required:true},{name:"userId",type:"text",label:"User ID"},{name:"sessionId",type:"text",label:"Session ID"}]}),this.adminComponents.AnalyticsDashboard={};}},U=class extends b{constructor(){super("comments"),this.description="Commenting system for products and posts",this.collections.push({slug:"comments",label:"Comments",fields:[{name:"content",type:"richtext",required:true},{name:"author",type:"text",required:true},{name:"email",type:"email"},{name:"approved",type:"checkbox",defaultValue:false},{name:"parent",type:"text",label:"Parent Comment ID"},{name:"resourceType",type:"text",required:true},{name:"resourceId",type:"text",required:true}]}),this.adminComponents.CommentModeration={};}},V=class extends b{constructor(){super("reviews"),this.description="Product reviews and ratings",this.collections.push({slug:"reviews",label:"Reviews",fields:[{name:"rating",type:"number",required:true,min:1,max:5},{name:"title",type:"text"},{name:"content",type:"richtext",required:true},{name:"author",type:"relationship",relationTo:"customers"},{name:"product",type:"relationship",relationTo:"products",required:true},{name:"approved",type:"checkbox",defaultValue:false},{name:"verified",type:"checkbox",label:"Verified Purchase"},{name:"helpful",type:"number",label:"Helpful Count",defaultValue:0}]}),this.adminComponents.ReviewModeration={};}},O=class extends b{constructor(){super("wishlist"),this.description="Customer wishlists",this.collections.push({slug:"wishlists",label:"Wishlists",fields:[{name:"customer",type:"relationship",relationTo:"customers",required:true},{name:"name",type:"text",label:"Wishlist Name",defaultValue:"My Wishlist"},{name:"items",type:"blocks",label:"Items",blocks:[{slug:"wishlist-item",label:"Item",fields:[{name:"product",type:"relationship",relationTo:"products"},{name:"quantity",type:"number",defaultValue:1},{name:"addedAt",type:"date"},{name:"priority",type:"select",options:[{label:"Low",value:"low"},{label:"Medium",value:"medium"},{label:"High",value:"high"}]}]}]}]});}},Ar={SEO:L,Analytics:E,Comments:U,Reviews:V,Wishlist:O};var wr={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3},x=class{redis;prefix;config;constructor(e,t={},r="kyro:lockout:"){this.redis=e,this.prefix=r,this.config={...wr,...t};}lockKey(e){return `${this.prefix}${e}`}historyKey(e){return `${this.prefix}${e}:history`}async checkLockout(e){let t=this.lockKey(e),r=await this.redis.hgetall(t);if(!r||Object.keys(r).length===0)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let o=parseInt(r.attempts,10),i=r.lockedUntil?new Date(parseInt(r.lockedUntil,10)):void 0;return i&&i>new Date?{locked:true,attemptsRemaining:0,lockedUntil:i,totalAttempts:o}:i&&i<=new Date?(await this.unlockAccount(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0}):{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-o),totalAttempts:o}}async recordFailedAttempt(e){let t=this.lockKey(e),r=this.historyKey(e),o=Date.now(),i=await this.redis.hincrby(t,"attempts",1);if(await this.redis.hset(t,"lastAttempt",o.toString()),await this.redis.lpush(r,o.toString()),await this.redis.ltrim(r,0,99),i>=this.config.maxAttempts){let n=new Date(o+this.config.lockDuration);return await this.redis.hset(t,{lockedAt:o.toString(),lockedUntil:n.getTime().toString()}),await this.redis.expire(t,Math.ceil(this.config.lockDuration/1e3)+3600),{locked:true,attemptsRemaining:0,lockedUntil:n,totalAttempts:i}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-i),totalAttempts:i}}async lockAccount(e,t){let r=this.lockKey(e),o=Date.now(),i=t||this.config.lockDuration,n=new Date(o+i),a=this.redis.pipeline();a.hset(r,{attempts:this.config.maxAttempts.toString(),lockedAt:o.toString(),lockedUntil:n.getTime().toString()}),a.expire(r,Math.ceil(i/1e3)+3600),await a.exec();}async unlockAccount(e){let t=this.lockKey(e);await this.redis.del(t);}async resetAttempts(e){let t=this.lockKey(e);(await this.redis.hgetall(t)).lockedAt?await this.redis.hset(t,{attempts:"0",lockedAt:"",lockedUntil:""}):await this.redis.del(t);}async getLockoutHistory(e,t=10){let r=this.historyKey(e);return (await this.redis.lrange(r,0,t-1)).map(i=>new Date(parseInt(i,10)))}async getLockoutStats(e){let t=this.historyKey(e),r=await this.redis.lrange(t,0,-1),o=r.filter((n,a)=>(a+1)%this.config.maxAttempts===0).length,i=await this.redis.hget(this.lockKey(e),"lockedAt");return {totalFailedAttempts:r.length,lockoutCount:o,lastLockout:i?new Date(parseInt(i,10)):null,averageAttemptsBeforeLockout:o>0?this.config.maxAttempts:0}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};var kr={"auth:login":{window:9e5,max:5},"auth:register":{window:36e5,max:3},"auth:forgot":{window:36e5,max:3},"auth:reset":{window:36e5,max:5},"auth:verify":{window:36e5,max:5},"api:general":{window:6e4,max:100},"api:authenticated":{window:6e4,max:200}},S=class{redis;prefix;limits;userLimits;constructor(e,t,r,o="kyro:ratelimit:"){this.redis=e,this.prefix=o,this.limits={...kr,...t},this.userLimits=r||{"user:api":{window:6e4,max:500},"user:write":{window:36e5,max:100}};}getKey(e,t){return `${this.prefix}${e}:${t}`}async check(e,t){let r=this.limits[e]||this.limits["api:general"],o=this.getKey(e,t),i=Date.now(),n=i-r.window,a=this.redis.pipeline();a.zremrangebyscore(o,0,n),a.zcard(o),a.zadd(o,i,`${i}:${Math.random()}`),a.expire(o,Math.ceil(r.window/1e3)+1);let c=(await a.exec())?.[1]?.[1]||0;if(c>=r.max){let g=await this.redis.zrange(o,0,0,"WITHSCORES"),d=g.length>1?parseInt(g[1],10)+r.window:i+r.window;return {allowed:false,remaining:0,resetAt:d,retryAfter:Math.ceil((d-i)/1e3)}}return {allowed:true,remaining:r.max-c-1,resetAt:i+r.window}}async checkUser(e,t,r){let o=this.userLimits[e]||this.userLimits["user:api"],i=this.getKey(`user:${e}:${t}`,r),n=Date.now(),a=n-o.window,l=this.redis.pipeline();l.zremrangebyscore(i,0,a),l.zcard(i),l.zadd(i,n,`${n}:${Math.random()}`),l.expire(i,Math.ceil(o.window/1e3)+1);let g=(await l.exec())?.[1]?.[1]||0;if(g>=o.max){let d=await this.redis.zrange(i,0,0,"WITHSCORES"),u=d.length>1?parseInt(d[1],10)+o.window:n+o.window;return {allowed:false,remaining:0,resetAt:u,retryAfter:Math.ceil((u-n)/1e3)}}return {allowed:true,remaining:o.max-g-1,resetAt:n+o.window}}async reset(e,t){let r=this.getKey(e,t);await this.redis.del(r);}async resetUser(e,t,r){let o=this.getKey(`user:${e}:${t}`,r);await this.redis.del(o);}async getStatus(e,t){let r=this.limits[e]||this.limits["api:general"],o=this.getKey(e,t),i=Date.now(),n=i-r.window;await this.redis.zremrangebyscore(o,0,n);let a=await this.redis.zcard(o);return {count:a,limit:r.max,remaining:Math.max(0,r.max-a),resetAt:i+r.window}}setLimit(e,t){this.limits[e]=t;}setUserLimit(e,t){this.userLimits[e]=t;}};var P=class{users=new Map;sessions=new Map;refreshTokens=new Map;emailToUserId=new Map;passwordHistory=new Map;emailVerificationTokens=new Map;passwordResetTokens=new Map;auditLogs=[];externalDb=false;constructor(){}async connect(){}async disconnect(){this.users.clear(),this.sessions.clear(),this.refreshTokens.clear(),this.emailToUserId.clear(),this.passwordHistory.clear();}async createUser(e){let t=randomBytes(16).toString("hex"),r=new Date().toISOString(),o=await this.hashPassword(e.password),i={id:t,email:e.email.toLowerCase(),passwordHash:o,role:e.role||"customer",tenantId:e.tenantId,createdAt:r,updatedAt:r};return this.users.set(t,i),this.emailToUserId.set(e.email.toLowerCase(),t),this.passwordHistory.set(t,[]),i}async findUserByEmail(e){let t=this.emailToUserId.get(e.toLowerCase());return t?this.findUserById(t):null}async findUserById(e){return this.users.get(e)||null}async updateUser(e,t){let r=await this.findUserById(e);if(!r)return null;let o={...r,...t,id:e,updatedAt:new Date().toISOString()};return t.email&&t.email!==r.email&&(this.emailToUserId.delete(r.email.toLowerCase()),this.emailToUserId.set(t.email.toLowerCase(),e)),this.users.set(e,o),o}async deleteUser(e){let t=await this.findUserById(e);return t?(this.users.delete(e),this.emailToUserId.delete(t.email.toLowerCase()),this.refreshTokens.forEach((r,o)=>{this.sessions.get(r)?.userId===e&&(this.refreshTokens.delete(o),this.sessions.delete(r));}),this.passwordHistory.delete(e),this.sessions.forEach((r,o)=>{r.userId===e&&this.sessions.delete(o);}),true):false}async hashPassword(e){return (await import('bcryptjs')).default.hash(e,12)}async verifyPassword(e,t){let r=await this.findUserByEmail(e);return !r||!r.passwordHash?null:await(await import('bcryptjs')).default.compare(t,r.passwordHash)?r:null}async createSession(e,t={}){let r=randomBytes(32).toString("hex"),o=randomBytes(32).toString("base64url"),i=randomBytes(32).toString("base64url"),n=new Date,a={id:r,userId:e,token:o,refreshToken:i,expiresAt:new Date(n.getTime()+86400*1e3).toISOString(),createdAt:n.toISOString(),ipAddress:t.ipAddress,userAgent:t.userAgent};return this.sessions.set(r,a),this.refreshTokens.set(i,r),a}async findSessionByToken(e){return this.sessions.get(e)||null}async findSessionByRefreshToken(e){let t=this.refreshTokens.get(e);return t&&this.sessions.get(t)||null}async deleteSession(e){let t=this.sessions.get(e);return t?(t.refreshToken&&this.refreshTokens.delete(t.refreshToken),this.sessions.delete(e),true):false}async deleteUserSessions(e){let t=0;return this.sessions.forEach((r,o)=>{r.userId===e&&(r.refreshToken&&this.refreshTokens.delete(r.refreshToken),this.sessions.delete(o),t++);}),t}async addPasswordToHistory(e,t){let r=this.passwordHistory.get(e)||[];r.push(t),r.length>5&&r.splice(0,r.length-5),this.passwordHistory.set(e,r);}async getPasswordHistory(e,t=5){return this.passwordHistory.get(e)||[]}async isPasswordInHistory(e,t,r=5){let o=await this.getPasswordHistory(t,r),i=(await import('bcryptjs')).default;for(let n of o)if(await i.compare(e,n))return true;return false}async createEmailVerificationToken(e){let t=randomBytes(32).toString("hex"),r=new Date(Date.now()+1440*60*1e3);return this.emailVerificationTokens.set(t,{userId:e,expiresAt:r}),{token:t,expiresAt:r}}async verifyEmailToken(e){let t=this.emailVerificationTokens.get(e);return !t||t.expiresAt<new Date?(this.emailVerificationTokens.delete(e),{success:false,error:"Invalid or expired token"}):(this.emailVerificationTokens.delete(e),{success:true,userId:t.userId})}async createPasswordResetToken(e){let t=await this.findUserByEmail(e);if(!t)return {token:"",expiresAt:new Date,error:"User not found"};let r=randomBytes(32).toString("hex"),o=new Date(Date.now()+3600*1e3);return this.passwordResetTokens.set(r,{userId:t.id,expiresAt:o}),{token:r,expiresAt:o}}async resetPasswordWithToken(e,t){let r=this.passwordResetTokens.get(e);if(!r||r.expiresAt<new Date)return this.passwordResetTokens.delete(e),{success:false,error:"Invalid or expired token"};let o=await this.hashPassword(t);return await this.updateUser(r.userId,{passwordHash:o}),this.passwordResetTokens.delete(e),{success:true}}async hasAnyUsers(){return this.users.size>0}async findAuditLogs(e){let{limit:t=50,offset:r=0}=e,o=this.auditLogs.slice().reverse();return e.userId&&(o=o.filter(i=>i.userId===e.userId)),e.action&&(Array.isArray(e.action)?o=o.filter(i=>e.action.includes(String(i.action))):o=o.filter(i=>i.action===e.action)),e.resource&&(o=o.filter(i=>i.resource===e.resource)),e.success!==void 0&&(o=o.filter(i=>i.success===e.success)),{logs:o.slice(r,r+t),total:o.length}}async createAuditLog(e){let t=randomBytes(16).toString("hex"),o={...e,id:t,timestamp:new Date};return this.auditLogs.push(o),o}};var C=class{storage=new Map;history=new Map;config;constructor(e={}){this.config={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3,...e};}async checkLockout(e){let t=Date.now(),r=this.storage.get(e);if(r&&r.lockedUntil!==null&&r.lockedUntil<=t)return await this.resetAttempts(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};if(!r)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let{attempts:o,lockedUntil:i}=r;return i!==null&&i>t?{locked:true,attemptsRemaining:0,lockedUntil:new Date(i),totalAttempts:o}:{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-o),totalAttempts:o}}async recordFailedAttempt(e){let t=Date.now(),r=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};r.attempts+=1,r.lastAttempt=t;let o=this.history.get(e)||[];if(o.push(t),o.length>100&&o.splice(0,o.length-100),this.history.set(e,o),this.storage.set(e,r),r.attempts>=this.config.maxAttempts){let i=new Date(t+this.config.lockDuration);return r.lockedAt=t,r.lockedUntil=i.getTime(),this.storage.set(e,r),{locked:true,attemptsRemaining:0,lockedUntil:i,totalAttempts:r.attempts}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-r.attempts),totalAttempts:r.attempts}}async lockAccount(e,t){let r=Date.now(),o=t||this.config.lockDuration,i=new Date(r+o),n=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};n.attempts=this.config.maxAttempts,n.lockedAt=r,n.lockedUntil=i.getTime(),this.storage.set(e,n);}async unlockAccount(e){await this.resetAttempts(e);}async resetAttempts(e){let t=this.storage.get(e);t&&(t.attempts=0,t.lockedAt=null,t.lockedUntil=null,this.storage.set(e,t)),this.history.delete(e);}async getLockoutHistory(e,t=10){return (this.history.get(e)||[]).slice(-t).reverse().map(o=>new Date(o))}async getLockoutStats(e){let r=(this.history.get(e)||[]).length,o=Math.floor(r/this.config.maxAttempts),i=null,n=this.storage.get(e);n&&n.lockedAt!==null&&(i=new Date(n.lockedAt));let a=o>0?this.config.maxAttempts:0;return {totalFailedAttempts:r,lockoutCount:o,lastLockout:i,averageAttemptsBeforeLockout:a}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};function h(s,e=""){return process.env[s]||e}function A(s,e=false){let t=process.env[s];return t?t.toLowerCase()==="true":e}function p(s,e=0){let t=process.env[s];return t?parseInt(t,10):e}function Le(){let s=process.env.KYRO_AUTH_DATABASE?.toLowerCase();if(s&&["sqlite","postgres","mongodb","memory"].includes(s))return s;try{let e=join(process.cwd(),"kyro.config.ts"),t=readFileSync(e,"utf8");if(t.includes("createLocalAdapter"))return "sqlite";if(t.includes("createDrizzleAdapter"))return t.includes("postgres")||t.includes("postgresql"),"postgres";if(t.includes("createMongoDBAdapter"))return "mongodb"}catch{}return "memory"}async function Pr(s){let e=process.cwd(),t=e.endsWith("admin")?join(e,".."):e,r=resolve(t,"data","auth.db");switch(s){case "sqlite":return new a$1({path:h("KYRO_AUTH_DB_PATH",r)});case "postgres":{try{let o=h("DATABASE_URL","");if(o){let{drizzle:i}=await import('drizzle-orm/postgres-js'),a=(await import('postgres')).default(o,{onnotice:()=>{}}),l=i(a);return new a$2({db:l})}}catch{console.warn("[Auth] Could not create PostgresAuthAdapter, falling back to SQLite auth adapter.");}return new a$1({path:h("KYRO_AUTH_DB_PATH",r)})}case "mongodb":{try{let o=h("MONGODB_URI","");if(o){let{MongoClient:i}=await import('mongodb'),n=new i(o);await n.connect();let l=new URL(o).pathname.replace(/^\//,"")||"kyro_cms",c=n.db(l);return new a({db:c})}}catch{console.warn("[Auth] Could not create MongoDBAuthAdapter, falling back to SQLite auth adapter.");}return new a$1({path:h("KYRO_AUTH_DB_PATH",r)})}default:return new P}}async function W(s,e){let t=A("KYRO_DISTRIBUTED",false),r;if(t){let{RedisAuthAdapter:d}=await import('./redis-adapter-VAXP43GR.js'),u=h("REDIS_URL","redis://localhost:6379"),y=A("REDIS_TLS",false),f=new d({url:u,tls:y});await f.connect?.(),r=f;}else {let d=s||Le();r=await Pr(d),r.connect&&await r.connect();}let o=e?await b$1.fromConfig(e).catch(()=>null)||b$1.fromEnv()||void 0:b$1.fromEnv()||void 0,i=new c({minLength:p("PASSWORD_MIN_LENGTH",12),requireUppercase:A("PASSWORD_REQUIRE_UPPERCASE",true),requireLowercase:A("PASSWORD_REQUIRE_LOWERCASE",true),requireNumbers:A("PASSWORD_REQUIRE_NUMBERS",true),requireSpecialChars:A("PASSWORD_REQUIRE_SPECIAL",true),preventReuse:p("PASSWORD_PREVENT_REUSE",5),maxLength:p("PASSWORD_MAX_LENGTH",128)}),n$1,a,l;if(t){let u=r.redis;n$1=new x(u,{maxAttempts:p("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:p("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),a=new S(u,{"auth:login":{window:p("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:p("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:p("RATE_LIMIT_WINDOW_MS",6e4),max:p("RATE_LIMIT_MAX_REQUESTS",100)}}),l=new n(u,p("AUDIT_LOG_RETENTION_DAYS",30));}else n$1=new C({maxAttempts:p("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:p("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),a=new m({"auth:login":{window:p("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:p("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:p("RATE_LIMIT_WINDOW_MS",6e4),max:p("RATE_LIMIT_MAX_REQUESTS",100)}}),l=A("AUDIT_LOG_ENABLED",true)?new p$1(p("AUDIT_LOG_RETENTION_DAYS",30)):void 0;let c$1=new q({redis:r,email:o,jwtSecret:h("APP_SECRET","change-me"),jwtExpiresIn:h("JWT_EXPIRES_IN","24h"),jwtIssuer:h("JWT_ISSUER","kyro-cms"),jwtAudience:h("JWT_AUDIENCE","kyro-cms-client"),passwordPolicy:i,lockout:n$1,rateLimiter:a,auditLogger:l,baseUrl:h("EMAIL_BASE_URL","http://localhost:4321"),emailVerificationRequired:A("EMAIL_VERIFICATION_REQUIRED",true)}),g=t?"distributed":s||Le();return {authAdapter:r,databaseType:g,email:o,passwordPolicy:i,lockout:n$1,rateLimiter:a,auditLogger:l,routes:c$1}}var Ue=W().catch(s=>(console.warn("[AuthConfig] Failed to initialize auth config:",s.message),null));var Cr=12,Tr="24h",vr="7d",H=class{adapter;config;constructor(e,t){this.adapter=e,this.config={secret:t.secret,expiresIn:t.expiresIn??Tr,refreshExpiresIn:t.refreshExpiresIn??vr,issuer:t.issuer??"kyro-cms",audience:t.audience??[],saltRounds:t.saltRounds??Cr};}async register(e){try{if(await this.adapter.findUserByEmail(e.email))return {success:!1,error:"Email already registered"};let r=await this.adapter.createUser({email:e.email,password:e.password,role:e.role??"customer",tenantId:e.tenantId});return this.createSessionForUser(r)}catch(t){return {success:false,error:String(t)}}}async login(e){try{let t=await this.adapter.verifyPassword(e.email,e.password);return t?this.createSessionForUser(t):{success:!1,error:"Invalid credentials"}}catch(t){return {success:false,error:String(t)}}}async logout(e){await this.adapter.deleteSession(e);}async refreshToken(e){try{let t=await this.adapter.findSessionByToken(e);if(!t||new Date(t.expiresAt)<new Date)return {success:!1,error:"Invalid or expired refresh token"};let r=await this.adapter.findUserById(t.userId);return r?(await this.adapter.deleteSession(e),this.createSessionForUser(r)):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async verifyToken(e){try{let{default:t}=await import('jsonwebtoken');return t.verify(e,this.config.secret,{issuer:this.config.issuer,audience:this.config.audience.length>0?this.config.audience[0]:void 0})}catch{return null}}async getUserFromToken(e){let t=await this.verifyToken(e);return t?this.adapter.findUserById(t.sub):null}async changePassword(e,t,r){try{let o=await this.adapter.findUserById(e);return o?await this.adapter.verifyPassword(o.email,t)?(await this.adapter.updateUser(e,{password:r}),await this.adapter.deleteUserSessions(e),{success:!0,user:o}):{success:!1,error:"Current password is incorrect"}:{success:!1,error:"User not found"}}catch(o){return {success:false,error:String(o)}}}async resetPassword(e,t){try{let r=await this.adapter.findUserByEmail(e);return r?(await this.adapter.updateUser(r.id,{password:t}),await this.adapter.deleteUserSessions(r.id),{success:!0,user:r}):{success:!1,error:"User not found"}}catch(r){return {success:false,error:String(r)}}}async sendEmailVerification(e){try{let{token:t,expiresAt:r}=await this.adapter.createEmailVerificationToken(e);return {success:!0}}catch(t){return {success:false,error:String(t)}}}async verifyEmail(e){try{return await this.adapter.verifyEmailToken(e)}catch(t){return {success:false,error:String(t)}}}async requestPasswordReset(e){try{let t=await this.adapter.createPasswordResetToken(e);return t.error?{success:!1,error:t.error}:{success:!0}}catch(t){return {success:false,error:String(t)}}}async resetPasswordWithToken(e,t){try{return await this.adapter.resetPasswordWithToken(e,t)}catch(r){return {success:false,error:String(r)}}}async deleteAccount(e){try{return await this.adapter.findUserById(e)?(await this.adapter.deleteUserSessions(e),await this.adapter.deleteUser(e),{success:!0}):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async createSessionForUser(e){let t=await this.generateToken(e),r=await this.adapter.createSession(e.id);return {success:true,user:e,session:r,token:t}}async generateToken(e){let{default:t}=await import('jsonwebtoken'),r={sub:e.id,email:e.email,role:e.role,tenantId:e.tenantId},o={expiresIn:this.parseExpiresIn(this.config.expiresIn)/1e3,issuer:this.config.issuer};return this.config.audience.length>0&&(o.audience=this.config.audience[0]),t.sign(r,this.config.secret,o)}async hashPassword(e){let{default:t}=await import('bcryptjs');return t.hash(e,this.config.saltRounds)}parseExpiresIn(e){if(typeof e=="number")return e;let t=e.match(/^(\d+)([smhd])$/);if(!t)return 864e5;let r=parseInt(t[1],10);switch(t[2]){case "s":return r*1e3;case "m":return r*6e4;case "h":return r*36e5;case "d":return r*864e5;default:return 864e5}}};function Rr(s,e){return new H(s,e)}function _(){return {enabled:true,draftsEnabled:true,publishEnabled:true,scheduleEnabled:false,versioningEnabled:true,maxVersionsPerDocument:50,autoPublish:false,requirePublishPermission:true}}var M=class{adapter;config;constructor(e,t){this.adapter=e,this.config={..._(),...t};}async createVersion(e){let r=((await this.adapter.getLatestVersion(e.collection,e.documentId))?.version??0)+1,o={...e,version:r},i=await this.adapter.createVersion(o);return this.config.maxVersionsPerDocument>0&&await this.pruneOldVersions(e.collection,e.documentId),i}async publishVersion(e){let t=await this.adapter.getVersion(e.collection,e.versionId);if(!t)throw new Error("Version not found");if(t.status==="published")throw new Error("Version is already published");await this.adapter.publishVersion(e);}async unpublishDocument(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:1e3});for(let o of r)if(o.status==="published"){await this.createVersion({collection:e,documentId:t,data:o.data,status:"draft",createdBy:"system",changeDescription:"Unpublished document"});break}}async revertToVersion(e,t,r,o){if(!await this.adapter.getVersion(e,r))throw new Error("Version not found");return await this.adapter.revertToVersion({collection:e,documentId:t,versionId:r,userId:o})}async getVersionHistory(e,t,r=20,o=0){return this.adapter.getVersions({collection:e,documentId:t,limit:r,offset:o})}async compareTwoVersions(e,t,r,o){return this.adapter.compareVersions({collection:e,documentId:t,versionA:r,versionB:o})}async getLatestDraft(e,t){return this.adapter.getLatestVersion(e,t)}async getPublishedVersion(e,t){return this.adapter.getPublishedVersion(e,t)}async getVersion(e,t){return this.adapter.getVersion(e,t)}async schedulePublish(e,t,r,o){if(!this.config.scheduleEnabled)throw new Error("Scheduled publishing is not enabled");if(!await this.adapter.getVersion(e,r))throw new Error("Version not found")}async deleteVersionHistory(e,t){await this.adapter.deleteVersions(e,t);}async pruneOldVersions(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:this.config.maxVersionsPerDocument+100});if(r.length<=this.config.maxVersionsPerDocument)return;r.slice(0,this.config.maxVersionsPerDocument);let i=r.slice(this.config.maxVersionsPerDocument);for(let n of i)if(n.status!=="published"){await this.adapter.deleteVersions(e,t);break}}};function Dr(s,e){return new M(s,e)}function Ir(s){return s==="published"}function Lr(s){return s==="draft"}function Er(s){return s==="archived"}function Ur(s){return s?Array.isArray(s)?s:Object.values(s):[]}function Vr(s){return s?Array.isArray(s)?s:Object.values(s):[]}function Ve(s){return {collections:Ur(s.collections),globals:Vr(s.globals),adapter:s.adapter,plugins:s.plugins,auth:s.auth,cors:s.cors,admin:s.admin,upload:s.upload,graphQL:s.graphQL,typescript:s.typescript,localization:s.localization,rateLimit:s.rateLimit,debug:s.debug}}var Or=Ve;function Hr(s){let{siteSettings:e,seoSettings:t,title:r,description:o,image:i,url:n}=s;if(!e)return "";let a=e.siteName||"",l=r||t?.defaultTitle||a,c=t?.titleTemplate,g=t?.separator||" | ",d=t?.siteNameInTitle!==false,u=c?c.replace(/\{\{title\}\}/g,l).replace(/\{\{siteName\}\}/g,d?a:"").replace(/\{\{separator\}\}/g,g).replace(/\s+/g," ").trim():l,y=o||t?.defaultDescription||e.siteDescription||"",f=i||e.siteOgImage?.url||"",F=n||e.siteUrl||"",m=`
1
+ export{a as RedisAuthAdapter}from'./chunk-AU6IWTBO.js';export{N as allSettingsGlobals,c as blogCollections,d as blogGlobals,O as coreSettingsGlobals,S as createTemplateConfig,e as ecommerceCollections,f as ecommerceGlobals,g as kitchenSinkCollections,i as mediaCollections,a as minimalCollections,R as templateCollections}from'./chunk-PNA36LJ6.js';export{a as kyro}from'./chunk-PTS33SK5.js';export{a as ConfigValidationError,p as Kyro,r as LocalAdapter,l as Registry,h as collectionToCreateZod,i as collectionToUpdateZod,j as collectionToWhereZod,g as collectionToZod,q as createKyro,s as createLocalAdapter,o as createRegistry,f as fieldToZod,m as getRegistry,k as globalToZod,n as resetRegistry,b as validateCollection,e as validateConfig,d as validateFields,c as validateGlobal}from'./chunk-YKQG6NBC.js';export{d as autoBootstrap,a as bootstrapAdmin,e as bootstrapWithRetry,c as getBootstrapFromEnv}from'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';export{a as CSSGenerator,g as createAdminStyling,d as defaultDarkTheme,h as defaultFieldStyling,c as defaultLightTheme,e as ecommerce2026Theme,f as generateCSSVariables,b as generateTailwindConfig}from'./chunk-UHFDH3PG.js';export{p as ALL_FIELD_TYPES,m as COMPLEX_FIELD_TYPES,o as LAYOUT_FIELD_TYPES,l as PRIMITIVE_FIELD_TYPES,n as RELATIONAL_FIELD_TYPES,d as isArrayField,f as isBlocksField,e as isGroupField,h as isImageField,k as isLayoutField,b as isNumberField,c as isRelationshipField,i as isRichTextField,j as isSelectField,a as isTextField,g as isUploadField,s as normalizeRichTextValue,t as renderRichText,r as richTextStyles}from'./chunk-PFT4OMNK.js';import'./chunk-5SEHX7ON.js';export{a as createContext,g as createCountProcedure,d as createCreateProcedure,f as createDeleteProcedure,h as createDynamicRouter,c as createFindByIDProcedure,b as createFindProcedure,i as createKyroServer,e as createUpdateProcedure}from'./chunk-5BPMMIAQ.js';export{c as buildGraphQLSchema,d as createGraphQLSchema}from'./chunk-PP7W5UKL.js';import {l,n,m,p as p$1,q}from'./chunk-BYTGJJK6.js';export{n as AuditLogger,p as InMemoryAuditLogger,m as InMemoryRateLimiter,r as MediaService,o as createAuditContext,s as createHonoApp,e as createLocalStorage,t as createRESTAPI,i as getAppSecret,j as getEncryptionKey,k as getSessionConfig,h as loadSecrets,d as resolveProvider,g as setDbAdapter}from'./chunk-BYTGJJK6.js';import {b as b$1,c}from'./chunk-7WOX27LK.js';export{a as ConfigService,b as EmailTransport,c as PasswordPolicy}from'./chunk-7WOX27LK.js';import'./chunk-K6WUOU6P.js';import'./chunk-AE6GXUT7.js';import {a as a$1}from'./chunk-2W4FK6CJ.js';export{a as SQLiteAuthAdapter}from'./chunk-2W4FK6CJ.js';import'./chunk-NRLIGDYF.js';export{e as ALL_WEBHOOK_EVENTS,f as WEBHOOK_COLLECTION,g as WEBHOOK_DELIVERY_COLLECTION,d as WEBHOOK_EVENTS,n as WebhookService,l as buildDeliveryRecord,m as createTestPayload,o as createWebhookService,j as deliverWebhook,k as deliverWithRetry,i as generateWebhookSecret,h as signPayload}from'./chunk-KG7V6O2Z.js';export{a as evaluateAccess,c as getWhereClause,b as mergeWhereClauses}from'./chunk-HLSB2MCK.js';export{b as KyroPubSub,c as KyroWSServer,a as PubSub,d as createWSServer}from'./chunk-GKYEJ2UF.js';import'./chunk-PP5S2UBV.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-MRVECVMR.js';import {a as a$2}from'./chunk-RHCWCG3O.js';export{a as PostgresAuthAdapter}from'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';export{a as MongoDBAdapter,b as createMongoDBAdapter}from'./chunk-YPDRUVWG.js';import {a}from'./chunk-P7CESLDJ.js';export{a as MongoDBAuthAdapter}from'./chunk-P7CESLDJ.js';export{a as AbstractBaseAdapter}from'./chunk-TQNM4C7H.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';import q$1,{randomBytes}from'crypto';import {readFileSync}from'fs';import Me,{join,resolve}from'path';export{z}from'zod';import {createStorage}from'unstorage';import $r from'unstorage/drivers/indexedb';import zr from'unstorage/drivers/fs';async function Ie(s,e){let t=e.data;for(let r of s){let o=await r({...e,data:t});o!==void 0&&(t=o);}return t}async function br(s,e){return Ie(s,e)}var b=class{name;version;description;hooks={};collections=[];globals=[];fields=[];extensions={collections:[],globals:[]};adminComponents={};adminStyles=[];serverMiddleware;clientMiddleware;constructor(e){this.name=e;}async init(e){}async beforeInit(e){}async afterInit(e){}getCollections(){return this.collections}getGlobals(){return this.globals}getHooks(){return this.hooks}},$=class{plugins=new Map;hooks=new Map;register(e){if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);this.plugins.set(e.name,e);let t=e.getHooks?.()||{};for(let[r,o]of Object.entries(t))if(Array.isArray(o))for(let i of o)this.registerHook(r,i);}unregister(e){let t=this.plugins.get(e);if(!t)return;let r=t.getHooks?.()||{};for(let[o,i]of Object.entries(r))if(Array.isArray(i))for(let n of i)this.unregisterHook(o,n);this.plugins.delete(e);}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}registerHook(e,t){this.hooks.has(e)||this.hooks.set(e,[]),this.hooks.get(e).push(t);}unregisterHook(e,t){let r=this.hooks.get(e);if(r){let o=r.indexOf(t);o>-1&&r.splice(o,1);}}async executeHook(e,t){let r=this.hooks.get(e)||[],o=t;for(let i of r)try{let n=await i({...t,data:o});n!==void 0&&(o=n);}catch(n){console.error(`[PluginManager] Error in hook "${e}":`,n);}return o}getAllCollections(){let e=[];for(let t of this.plugins.values()){let r=t.getCollections?.()||[];e.push(...r);}return e}getAllGlobals(){let e=[];for(let t of this.plugins.values()){let r=t.getGlobals?.()||[];e.push(...r);}return e}getAllFields(){let e=[];for(let t of this.plugins.values())e.push(...t.fields);return e}getAdminComponents(){let e={};for(let t of this.plugins.values())Object.assign(e,t.adminComponents);return e}getAdminStyles(){let e=[];for(let t of this.plugins.values())e.push(...t.adminStyles);return e}},L=class extends b{constructor(){super("seo"),this.description="Advanced SEO features including sitemaps, robots.txt, and structured data",this.collections.push({slug:"seo-settings",label:"SEO Settings",fields:[{name:"sitemap",type:"checkbox",label:"Enable Sitemap",defaultValue:true},{name:"robotsTxt",type:"richtext",label:"robots.txt Content"},{name:"canonicalUrl",type:"text",variant:"url",label:"Canonical URL"},{name:"ogImage",type:"text",label:"Default OG Image URL"}]});}},E=class extends b{constructor(){super("analytics"),this.description="Analytics integration for tracking page views and events",this.collections.push({slug:"analytics-events",label:"Analytics Events",fields:[{name:"name",type:"text",required:true},{name:"properties",type:"json",label:"Event Properties"},{name:"timestamp",type:"date",required:true},{name:"userId",type:"text",label:"User ID"},{name:"sessionId",type:"text",label:"Session ID"}]}),this.adminComponents.AnalyticsDashboard={};}},U=class extends b{constructor(){super("comments"),this.description="Commenting system for products and posts",this.collections.push({slug:"comments",label:"Comments",fields:[{name:"content",type:"richtext",required:true},{name:"author",type:"text",required:true},{name:"email",type:"email"},{name:"approved",type:"checkbox",defaultValue:false},{name:"parent",type:"text",label:"Parent Comment ID"},{name:"resourceType",type:"text",required:true},{name:"resourceId",type:"text",required:true}]}),this.adminComponents.CommentModeration={};}},V=class extends b{constructor(){super("reviews"),this.description="Product reviews and ratings",this.collections.push({slug:"reviews",label:"Reviews",fields:[{name:"rating",type:"number",required:true,min:1,max:5},{name:"title",type:"text"},{name:"content",type:"richtext",required:true},{name:"author",type:"relationship",relationTo:"customers"},{name:"product",type:"relationship",relationTo:"products",required:true},{name:"approved",type:"checkbox",defaultValue:false},{name:"verified",type:"checkbox",label:"Verified Purchase"},{name:"helpful",type:"number",label:"Helpful Count",defaultValue:0}]}),this.adminComponents.ReviewModeration={};}},O=class extends b{constructor(){super("wishlist"),this.description="Customer wishlists",this.collections.push({slug:"wishlists",label:"Wishlists",fields:[{name:"customer",type:"relationship",relationTo:"customers",required:true},{name:"name",type:"text",label:"Wishlist Name",defaultValue:"My Wishlist"},{name:"items",type:"blocks",label:"Items",blocks:[{slug:"wishlist-item",label:"Item",fields:[{name:"product",type:"relationship",relationTo:"products"},{name:"quantity",type:"number",defaultValue:1},{name:"addedAt",type:"date"},{name:"priority",type:"select",options:[{label:"Low",value:"low"},{label:"Medium",value:"medium"},{label:"High",value:"high"}]}]}]}]});}},Ar={SEO:L,Analytics:E,Comments:U,Reviews:V,Wishlist:O};var wr={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3},x=class{redis;prefix;config;constructor(e,t={},r="kyro:lockout:"){this.redis=e,this.prefix=r,this.config={...wr,...t};}lockKey(e){return `${this.prefix}${e}`}historyKey(e){return `${this.prefix}${e}:history`}async checkLockout(e){let t=this.lockKey(e),r=await this.redis.hgetall(t);if(!r||Object.keys(r).length===0)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let o=parseInt(r.attempts,10),i=r.lockedUntil?new Date(parseInt(r.lockedUntil,10)):void 0;return i&&i>new Date?{locked:true,attemptsRemaining:0,lockedUntil:i,totalAttempts:o}:i&&i<=new Date?(await this.unlockAccount(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0}):{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-o),totalAttempts:o}}async recordFailedAttempt(e){let t=this.lockKey(e),r=this.historyKey(e),o=Date.now(),i=await this.redis.hincrby(t,"attempts",1);if(await this.redis.hset(t,"lastAttempt",o.toString()),await this.redis.lpush(r,o.toString()),await this.redis.ltrim(r,0,99),i>=this.config.maxAttempts){let n=new Date(o+this.config.lockDuration);return await this.redis.hset(t,{lockedAt:o.toString(),lockedUntil:n.getTime().toString()}),await this.redis.expire(t,Math.ceil(this.config.lockDuration/1e3)+3600),{locked:true,attemptsRemaining:0,lockedUntil:n,totalAttempts:i}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-i),totalAttempts:i}}async lockAccount(e,t){let r=this.lockKey(e),o=Date.now(),i=t||this.config.lockDuration,n=new Date(o+i),a=this.redis.pipeline();a.hset(r,{attempts:this.config.maxAttempts.toString(),lockedAt:o.toString(),lockedUntil:n.getTime().toString()}),a.expire(r,Math.ceil(i/1e3)+3600),await a.exec();}async unlockAccount(e){let t=this.lockKey(e);await this.redis.del(t);}async resetAttempts(e){let t=this.lockKey(e);(await this.redis.hgetall(t)).lockedAt?await this.redis.hset(t,{attempts:"0",lockedAt:"",lockedUntil:""}):await this.redis.del(t);}async getLockoutHistory(e,t=10){let r=this.historyKey(e);return (await this.redis.lrange(r,0,t-1)).map(i=>new Date(parseInt(i,10)))}async getLockoutStats(e){let t=this.historyKey(e),r=await this.redis.lrange(t,0,-1),o=r.filter((n,a)=>(a+1)%this.config.maxAttempts===0).length,i=await this.redis.hget(this.lockKey(e),"lockedAt");return {totalFailedAttempts:r.length,lockoutCount:o,lastLockout:i?new Date(parseInt(i,10)):null,averageAttemptsBeforeLockout:o>0?this.config.maxAttempts:0}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};var kr={"auth:login":{window:9e5,max:5},"auth:register":{window:36e5,max:3},"auth:forgot":{window:36e5,max:3},"auth:reset":{window:36e5,max:5},"auth:verify":{window:36e5,max:5},"api:general":{window:6e4,max:100},"api:authenticated":{window:6e4,max:200}},S=class{redis;prefix;limits;userLimits;constructor(e,t,r,o="kyro:ratelimit:"){this.redis=e,this.prefix=o,this.limits={...kr,...t},this.userLimits=r||{"user:api":{window:6e4,max:500},"user:write":{window:36e5,max:100}};}getKey(e,t){return `${this.prefix}${e}:${t}`}async check(e,t){let r=this.limits[e]||this.limits["api:general"],o=this.getKey(e,t),i=Date.now(),n=i-r.window,a=this.redis.pipeline();a.zremrangebyscore(o,0,n),a.zcard(o),a.zadd(o,i,`${i}:${Math.random()}`),a.expire(o,Math.ceil(r.window/1e3)+1);let c=(await a.exec())?.[1]?.[1]||0;if(c>=r.max){let g=await this.redis.zrange(o,0,0,"WITHSCORES"),d=g.length>1?parseInt(g[1],10)+r.window:i+r.window;return {allowed:false,remaining:0,resetAt:d,retryAfter:Math.ceil((d-i)/1e3)}}return {allowed:true,remaining:r.max-c-1,resetAt:i+r.window}}async checkUser(e,t,r){let o=this.userLimits[e]||this.userLimits["user:api"],i=this.getKey(`user:${e}:${t}`,r),n=Date.now(),a=n-o.window,l=this.redis.pipeline();l.zremrangebyscore(i,0,a),l.zcard(i),l.zadd(i,n,`${n}:${Math.random()}`),l.expire(i,Math.ceil(o.window/1e3)+1);let g=(await l.exec())?.[1]?.[1]||0;if(g>=o.max){let d=await this.redis.zrange(i,0,0,"WITHSCORES"),u=d.length>1?parseInt(d[1],10)+o.window:n+o.window;return {allowed:false,remaining:0,resetAt:u,retryAfter:Math.ceil((u-n)/1e3)}}return {allowed:true,remaining:o.max-g-1,resetAt:n+o.window}}async reset(e,t){let r=this.getKey(e,t);await this.redis.del(r);}async resetUser(e,t,r){let o=this.getKey(`user:${e}:${t}`,r);await this.redis.del(o);}async getStatus(e,t){let r=this.limits[e]||this.limits["api:general"],o=this.getKey(e,t),i=Date.now(),n=i-r.window;await this.redis.zremrangebyscore(o,0,n);let a=await this.redis.zcard(o);return {count:a,limit:r.max,remaining:Math.max(0,r.max-a),resetAt:i+r.window}}setLimit(e,t){this.limits[e]=t;}setUserLimit(e,t){this.userLimits[e]=t;}};var P=class{users=new Map;sessions=new Map;refreshTokens=new Map;emailToUserId=new Map;passwordHistory=new Map;emailVerificationTokens=new Map;passwordResetTokens=new Map;auditLogs=[];externalDb=false;constructor(){}async connect(){}async disconnect(){this.users.clear(),this.sessions.clear(),this.refreshTokens.clear(),this.emailToUserId.clear(),this.passwordHistory.clear();}async createUser(e){let t=randomBytes(16).toString("hex"),r=new Date().toISOString(),o=await this.hashPassword(e.password),i={id:t,email:e.email.toLowerCase(),passwordHash:o,role:e.role||"customer",tenantId:e.tenantId,createdAt:r,updatedAt:r};return this.users.set(t,i),this.emailToUserId.set(e.email.toLowerCase(),t),this.passwordHistory.set(t,[]),i}async findUserByEmail(e){let t=this.emailToUserId.get(e.toLowerCase());return t?this.findUserById(t):null}async findUserById(e){return this.users.get(e)||null}async updateUser(e,t){let r=await this.findUserById(e);if(!r)return null;let o={...r,...t,id:e,updatedAt:new Date().toISOString()};return t.email&&t.email!==r.email&&(this.emailToUserId.delete(r.email.toLowerCase()),this.emailToUserId.set(t.email.toLowerCase(),e)),this.users.set(e,o),o}async deleteUser(e){let t=await this.findUserById(e);return t?(this.users.delete(e),this.emailToUserId.delete(t.email.toLowerCase()),this.refreshTokens.forEach((r,o)=>{this.sessions.get(r)?.userId===e&&(this.refreshTokens.delete(o),this.sessions.delete(r));}),this.passwordHistory.delete(e),this.sessions.forEach((r,o)=>{r.userId===e&&this.sessions.delete(o);}),true):false}async hashPassword(e){return (await import('bcryptjs')).default.hash(e,12)}async verifyPassword(e,t){let r=await this.findUserByEmail(e);return !r||!r.passwordHash?null:await(await import('bcryptjs')).default.compare(t,r.passwordHash)?r:null}async createSession(e,t={}){let r=randomBytes(32).toString("hex"),o=randomBytes(32).toString("base64url"),i=randomBytes(32).toString("base64url"),n=new Date,a={id:r,userId:e,token:o,refreshToken:i,expiresAt:new Date(n.getTime()+86400*1e3).toISOString(),createdAt:n.toISOString(),ipAddress:t.ipAddress,userAgent:t.userAgent};return this.sessions.set(r,a),this.refreshTokens.set(i,r),a}async findSessionByToken(e){return this.sessions.get(e)||null}async findSessionByRefreshToken(e){let t=this.refreshTokens.get(e);return t&&this.sessions.get(t)||null}async deleteSession(e){let t=this.sessions.get(e);return t?(t.refreshToken&&this.refreshTokens.delete(t.refreshToken),this.sessions.delete(e),true):false}async deleteUserSessions(e){let t=0;return this.sessions.forEach((r,o)=>{r.userId===e&&(r.refreshToken&&this.refreshTokens.delete(r.refreshToken),this.sessions.delete(o),t++);}),t}async addPasswordToHistory(e,t){let r=this.passwordHistory.get(e)||[];r.push(t),r.length>5&&r.splice(0,r.length-5),this.passwordHistory.set(e,r);}async getPasswordHistory(e,t=5){return this.passwordHistory.get(e)||[]}async isPasswordInHistory(e,t,r=5){let o=await this.getPasswordHistory(t,r),i=(await import('bcryptjs')).default;for(let n of o)if(await i.compare(e,n))return true;return false}async createEmailVerificationToken(e){let t=randomBytes(32).toString("hex"),r=new Date(Date.now()+1440*60*1e3);return this.emailVerificationTokens.set(t,{userId:e,expiresAt:r}),{token:t,expiresAt:r}}async verifyEmailToken(e){let t=this.emailVerificationTokens.get(e);return !t||t.expiresAt<new Date?(this.emailVerificationTokens.delete(e),{success:false,error:"Invalid or expired token"}):(this.emailVerificationTokens.delete(e),{success:true,userId:t.userId})}async createPasswordResetToken(e){let t=await this.findUserByEmail(e);if(!t)return {token:"",expiresAt:new Date,error:"User not found"};let r=randomBytes(32).toString("hex"),o=new Date(Date.now()+3600*1e3);return this.passwordResetTokens.set(r,{userId:t.id,expiresAt:o}),{token:r,expiresAt:o}}async resetPasswordWithToken(e,t){let r=this.passwordResetTokens.get(e);if(!r||r.expiresAt<new Date)return this.passwordResetTokens.delete(e),{success:false,error:"Invalid or expired token"};let o=await this.hashPassword(t);return await this.updateUser(r.userId,{passwordHash:o}),this.passwordResetTokens.delete(e),{success:true}}async hasAnyUsers(){return this.users.size>0}async findAuditLogs(e){let{limit:t=50,offset:r=0}=e,o=this.auditLogs.slice().reverse();return e.userId&&(o=o.filter(i=>i.userId===e.userId)),e.action&&(Array.isArray(e.action)?o=o.filter(i=>e.action.includes(String(i.action))):o=o.filter(i=>i.action===e.action)),e.resource&&(o=o.filter(i=>i.resource===e.resource)),e.success!==void 0&&(o=o.filter(i=>i.success===e.success)),{logs:o.slice(r,r+t),total:o.length}}async createAuditLog(e){let t=randomBytes(16).toString("hex"),o={...e,id:t,timestamp:new Date};return this.auditLogs.push(o),o}};var C=class{storage=new Map;history=new Map;config;constructor(e={}){this.config={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3,...e};}async checkLockout(e){let t=Date.now(),r=this.storage.get(e);if(r&&r.lockedUntil!==null&&r.lockedUntil<=t)return await this.resetAttempts(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};if(!r)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let{attempts:o,lockedUntil:i}=r;return i!==null&&i>t?{locked:true,attemptsRemaining:0,lockedUntil:new Date(i),totalAttempts:o}:{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-o),totalAttempts:o}}async recordFailedAttempt(e){let t=Date.now(),r=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};r.attempts+=1,r.lastAttempt=t;let o=this.history.get(e)||[];if(o.push(t),o.length>100&&o.splice(0,o.length-100),this.history.set(e,o),this.storage.set(e,r),r.attempts>=this.config.maxAttempts){let i=new Date(t+this.config.lockDuration);return r.lockedAt=t,r.lockedUntil=i.getTime(),this.storage.set(e,r),{locked:true,attemptsRemaining:0,lockedUntil:i,totalAttempts:r.attempts}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-r.attempts),totalAttempts:r.attempts}}async lockAccount(e,t){let r=Date.now(),o=t||this.config.lockDuration,i=new Date(r+o),n=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};n.attempts=this.config.maxAttempts,n.lockedAt=r,n.lockedUntil=i.getTime(),this.storage.set(e,n);}async unlockAccount(e){await this.resetAttempts(e);}async resetAttempts(e){let t=this.storage.get(e);t&&(t.attempts=0,t.lockedAt=null,t.lockedUntil=null,this.storage.set(e,t)),this.history.delete(e);}async getLockoutHistory(e,t=10){return (this.history.get(e)||[]).slice(-t).reverse().map(o=>new Date(o))}async getLockoutStats(e){let r=(this.history.get(e)||[]).length,o=Math.floor(r/this.config.maxAttempts),i=null,n=this.storage.get(e);n&&n.lockedAt!==null&&(i=new Date(n.lockedAt));let a=o>0?this.config.maxAttempts:0;return {totalFailedAttempts:r,lockoutCount:o,lastLockout:i,averageAttemptsBeforeLockout:a}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};function h(s,e=""){return process.env[s]||e}function A(s,e=false){let t=process.env[s];return t?t.toLowerCase()==="true":e}function p(s,e=0){let t=process.env[s];return t?parseInt(t,10):e}function Le(){let s=process.env.KYRO_AUTH_DATABASE?.toLowerCase();if(s&&["sqlite","postgres","mongodb","memory"].includes(s))return s;try{let e=join(process.cwd(),"kyro.config.ts"),t=readFileSync(e,"utf8");if(t.includes("createLocalAdapter"))return "sqlite";if(t.includes("createDrizzleAdapter"))return t.includes("postgres")||t.includes("postgresql"),"postgres";if(t.includes("createMongoDBAdapter"))return "mongodb"}catch{}return "memory"}async function Pr(s){let e=process.cwd(),t=e.endsWith("admin")?join(e,".."):e,r=resolve(t,"data","auth.db");switch(s){case "sqlite":return new a$1({path:h("KYRO_AUTH_DB_PATH",r)});case "postgres":{try{let o=h("DATABASE_URL","");if(o){let{drizzle:i}=await import('drizzle-orm/postgres-js'),a=(await import('postgres')).default(o,{onnotice:()=>{}}),l=i(a);return new a$2({db:l})}}catch{console.warn("[Auth] Could not create PostgresAuthAdapter, falling back to SQLite auth adapter.");}return new a$1({path:h("KYRO_AUTH_DB_PATH",r)})}case "mongodb":{try{let o=h("MONGODB_URI","");if(o){let{MongoClient:i}=await import('mongodb'),n=new i(o);await n.connect();let l=new URL(o).pathname.replace(/^\//,"")||"kyro_cms",c=n.db(l);return new a({db:c})}}catch{console.warn("[Auth] Could not create MongoDBAuthAdapter, falling back to SQLite auth adapter.");}return new a$1({path:h("KYRO_AUTH_DB_PATH",r)})}default:return new P}}async function W(s,e){let t=A("KYRO_DISTRIBUTED",false),r;if(t){let{RedisAuthAdapter:d}=await import('./redis-adapter-VAXP43GR.js'),u=h("REDIS_URL","redis://localhost:6379"),y=A("REDIS_TLS",false),f=new d({url:u,tls:y});await f.connect?.(),r=f;}else {let d=s||Le();r=await Pr(d),r.connect&&await r.connect();}let o=e?await b$1.fromConfig(e).catch(()=>null)||b$1.fromEnv()||void 0:b$1.fromEnv()||void 0,i=new c({minLength:p("PASSWORD_MIN_LENGTH",12),requireUppercase:A("PASSWORD_REQUIRE_UPPERCASE",true),requireLowercase:A("PASSWORD_REQUIRE_LOWERCASE",true),requireNumbers:A("PASSWORD_REQUIRE_NUMBERS",true),requireSpecialChars:A("PASSWORD_REQUIRE_SPECIAL",true),preventReuse:p("PASSWORD_PREVENT_REUSE",5),maxLength:p("PASSWORD_MAX_LENGTH",128)}),n$1,a,l;if(t){let u=r.redis;n$1=new x(u,{maxAttempts:p("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:p("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),a=new S(u,{"auth:login":{window:p("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:p("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:p("RATE_LIMIT_WINDOW_MS",6e4),max:p("RATE_LIMIT_MAX_REQUESTS",100)}}),l=new n(u,p("AUDIT_LOG_RETENTION_DAYS",30));}else n$1=new C({maxAttempts:p("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:p("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),a=new m({"auth:login":{window:p("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:p("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:p("RATE_LIMIT_WINDOW_MS",6e4),max:p("RATE_LIMIT_MAX_REQUESTS",100)}}),l=A("AUDIT_LOG_ENABLED",true)?new p$1(p("AUDIT_LOG_RETENTION_DAYS",30)):void 0;let c$1=new q({redis:r,email:o,jwtSecret:h("APP_SECRET","change-me"),jwtExpiresIn:h("JWT_EXPIRES_IN","24h"),jwtIssuer:h("JWT_ISSUER","kyro-cms"),jwtAudience:h("JWT_AUDIENCE","kyro-cms-client"),passwordPolicy:i,lockout:n$1,rateLimiter:a,auditLogger:l,baseUrl:h("EMAIL_BASE_URL","http://localhost:4321"),emailVerificationRequired:A("EMAIL_VERIFICATION_REQUIRED",true)}),g=t?"distributed":s||Le();return {authAdapter:r,databaseType:g,email:o,passwordPolicy:i,lockout:n$1,rateLimiter:a,auditLogger:l,routes:c$1}}var Ue=W().catch(s=>(console.warn("[AuthConfig] Failed to initialize auth config:",s.message),null));var Cr=12,Tr="24h",vr="7d",H=class{adapter;config;constructor(e,t){this.adapter=e,this.config={secret:t.secret,expiresIn:t.expiresIn??Tr,refreshExpiresIn:t.refreshExpiresIn??vr,issuer:t.issuer??"kyro-cms",audience:t.audience??[],saltRounds:t.saltRounds??Cr};}async register(e){try{if(await this.adapter.findUserByEmail(e.email))return {success:!1,error:"Email already registered"};let r=await this.adapter.createUser({email:e.email,password:e.password,role:e.role??"customer",tenantId:e.tenantId});return this.createSessionForUser(r)}catch(t){return {success:false,error:String(t)}}}async login(e){try{let t=await this.adapter.verifyPassword(e.email,e.password);return t?this.createSessionForUser(t):{success:!1,error:"Invalid credentials"}}catch(t){return {success:false,error:String(t)}}}async logout(e){await this.adapter.deleteSession(e);}async refreshToken(e){try{let t=await this.adapter.findSessionByToken(e);if(!t||new Date(t.expiresAt)<new Date)return {success:!1,error:"Invalid or expired refresh token"};let r=await this.adapter.findUserById(t.userId);return r?(await this.adapter.deleteSession(e),this.createSessionForUser(r)):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async verifyToken(e){try{let{default:t}=await import('jsonwebtoken');return t.verify(e,this.config.secret,{issuer:this.config.issuer,audience:this.config.audience.length>0?this.config.audience[0]:void 0})}catch{return null}}async getUserFromToken(e){let t=await this.verifyToken(e);return t?this.adapter.findUserById(t.sub):null}async changePassword(e,t,r){try{let o=await this.adapter.findUserById(e);return o?await this.adapter.verifyPassword(o.email,t)?(await this.adapter.updateUser(e,{password:r}),await this.adapter.deleteUserSessions(e),{success:!0,user:o}):{success:!1,error:"Current password is incorrect"}:{success:!1,error:"User not found"}}catch(o){return {success:false,error:String(o)}}}async resetPassword(e,t){try{let r=await this.adapter.findUserByEmail(e);return r?(await this.adapter.updateUser(r.id,{password:t}),await this.adapter.deleteUserSessions(r.id),{success:!0,user:r}):{success:!1,error:"User not found"}}catch(r){return {success:false,error:String(r)}}}async sendEmailVerification(e){try{let{token:t,expiresAt:r}=await this.adapter.createEmailVerificationToken(e);return {success:!0}}catch(t){return {success:false,error:String(t)}}}async verifyEmail(e){try{return await this.adapter.verifyEmailToken(e)}catch(t){return {success:false,error:String(t)}}}async requestPasswordReset(e){try{let t=await this.adapter.createPasswordResetToken(e);return t.error?{success:!1,error:t.error}:{success:!0}}catch(t){return {success:false,error:String(t)}}}async resetPasswordWithToken(e,t){try{return await this.adapter.resetPasswordWithToken(e,t)}catch(r){return {success:false,error:String(r)}}}async deleteAccount(e){try{return await this.adapter.findUserById(e)?(await this.adapter.deleteUserSessions(e),await this.adapter.deleteUser(e),{success:!0}):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async createSessionForUser(e){let t=await this.generateToken(e),r=await this.adapter.createSession(e.id);return {success:true,user:e,session:r,token:t}}async generateToken(e){let{default:t}=await import('jsonwebtoken'),r={sub:e.id,email:e.email,role:e.role,tenantId:e.tenantId},o={expiresIn:this.parseExpiresIn(this.config.expiresIn)/1e3,issuer:this.config.issuer};return this.config.audience.length>0&&(o.audience=this.config.audience[0]),t.sign(r,this.config.secret,o)}async hashPassword(e){let{default:t}=await import('bcryptjs');return t.hash(e,this.config.saltRounds)}parseExpiresIn(e){if(typeof e=="number")return e;let t=e.match(/^(\d+)([smhd])$/);if(!t)return 864e5;let r=parseInt(t[1],10);switch(t[2]){case "s":return r*1e3;case "m":return r*6e4;case "h":return r*36e5;case "d":return r*864e5;default:return 864e5}}};function Rr(s,e){return new H(s,e)}function _(){return {enabled:true,draftsEnabled:true,publishEnabled:true,scheduleEnabled:false,versioningEnabled:true,maxVersionsPerDocument:50,autoPublish:false,requirePublishPermission:true}}var M=class{adapter;config;constructor(e,t){this.adapter=e,this.config={..._(),...t};}async createVersion(e){let r=((await this.adapter.getLatestVersion(e.collection,e.documentId))?.version??0)+1,o={...e,version:r},i=await this.adapter.createVersion(o);return this.config.maxVersionsPerDocument>0&&await this.pruneOldVersions(e.collection,e.documentId),i}async publishVersion(e){let t=await this.adapter.getVersion(e.collection,e.versionId);if(!t)throw new Error("Version not found");if(t.status==="published")throw new Error("Version is already published");await this.adapter.publishVersion(e);}async unpublishDocument(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:1e3});for(let o of r)if(o.status==="published"){await this.createVersion({collection:e,documentId:t,data:o.data,status:"draft",createdBy:"system",changeDescription:"Unpublished document"});break}}async revertToVersion(e,t,r,o){if(!await this.adapter.getVersion(e,r))throw new Error("Version not found");return await this.adapter.revertToVersion({collection:e,documentId:t,versionId:r,userId:o})}async getVersionHistory(e,t,r=20,o=0){return this.adapter.getVersions({collection:e,documentId:t,limit:r,offset:o})}async compareTwoVersions(e,t,r,o){return this.adapter.compareVersions({collection:e,documentId:t,versionA:r,versionB:o})}async getLatestDraft(e,t){return this.adapter.getLatestVersion(e,t)}async getPublishedVersion(e,t){return this.adapter.getPublishedVersion(e,t)}async getVersion(e,t){return this.adapter.getVersion(e,t)}async schedulePublish(e,t,r,o){if(!this.config.scheduleEnabled)throw new Error("Scheduled publishing is not enabled");if(!await this.adapter.getVersion(e,r))throw new Error("Version not found")}async deleteVersionHistory(e,t){await this.adapter.deleteVersions(e,t);}async pruneOldVersions(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:this.config.maxVersionsPerDocument+100});if(r.length<=this.config.maxVersionsPerDocument)return;r.slice(0,this.config.maxVersionsPerDocument);let i=r.slice(this.config.maxVersionsPerDocument);for(let n of i)if(n.status!=="published"){await this.adapter.deleteVersions(e,t);break}}};function Dr(s,e){return new M(s,e)}function Ir(s){return s==="published"}function Lr(s){return s==="draft"}function Er(s){return s==="archived"}function Ur(s){return s?Array.isArray(s)?s:Object.values(s):[]}function Vr(s){return s?Array.isArray(s)?s:Object.values(s):[]}function Ve(s){return {collections:Ur(s.collections),globals:Vr(s.globals),adapter:s.adapter,plugins:s.plugins,auth:s.auth,cors:s.cors,admin:s.admin,upload:s.upload,graphQL:s.graphQL,typescript:s.typescript,localization:s.localization,rateLimit:s.rateLimit,debug:s.debug}}var Or=Ve;function Hr(s){let{siteSettings:e,seoSettings:t,title:r,description:o,image:i,url:n}=s;if(!e)return "";let a=e.siteName||"",l=r||t?.defaultTitle||a,c=t?.titleTemplate,g=t?.separator||" | ",d=t?.siteNameInTitle!==false,u=c?c.replace(/\{\{title\}\}/g,l).replace(/\{\{siteName\}\}/g,d?a:"").replace(/\{\{separator\}\}/g,g).replace(/\s+/g," ").trim():l,y=o||t?.defaultDescription||e.siteDescription||"",f=i||e.siteOgImage?.url||"",F=n||e.siteUrl||"",m=`
2
2
  <title>${u}</title>
3
3
  <meta name="description" content="${y}">
4
4
  `;e.siteFavicon?.url&&(m+=`
@@ -40,4 +40,4 @@ export{a as RedisAuthAdapter}from'./chunk-AU6IWTBO.js';export{N as allSettingsGl
40
40
  `),r&&(o+=`
41
41
  <!-- Plausible Analytics -->
42
42
  <script defer data-domain="${r}" src="https://plausible.io/js/script.js"></script>
43
- `),o}var Mr={facebook:{label:"Facebook"},twitter:{label:"Twitter / X"},instagram:{label:"Instagram"},linkedin:{label:"LinkedIn"},youtube:{label:"YouTube"},tiktok:{label:"TikTok"},pinterest:{label:"Pinterest"},discord:{label:"Discord"},twitch:{label:"Twitch"},github:{label:"GitHub"},mastodon:{label:"Mastodon"}},Fr=["facebook","twitter","instagram","linkedin","youtube","tiktok","pinterest","discord","twitch","github","mastodon"];function Oe(s){if(!s)return [];let e=s.showAll===true,t=[];for(let r of Fr){let o=s[r];if(!o||["tiktok","pinterest","discord","twitch","github","mastodon"].includes(r)&&!e)continue;let n=Mr[r];t.push({platform:r,url:o,label:n?.label||r});}return t}async function Br(s,e){try{let t=await s.findOne({collection:"_globals_social-settings",where:{},draft:e?.draft??!1});return Oe(t)}catch{return []}}function He(s){return s?{storeName:s.storeName,storeEmail:s.storeEmail,storePhone:s.storePhone,address:s.address,currency:s.currency,tax:s.tax,shipping:s.shipping,orders:s.orders}:{}}async function Nr(s,e){try{let t=await s.findOne({collection:"_globals_store-settings",where:{},draft:e?.draft??!1});return He(t)}catch{return {}}}function _e(s){return s?{testMode:s.testMode,provider:s.provider,stripe:s.stripe,paypal:s.paypal,square:s.square,methods:s.methods,bankTransfer:s.bankTransfer}:{}}async function Kr(s,e){try{let t=await s.findOne({collection:"_globals_payment-settings",where:{},draft:e?.draft??!1});return _e(t)}catch{return {}}}async function G(s={}){let{namespace:e="kyro",ttl:t}=s,r=createStorage({driver:$r({dbName:"kyro-cms",storeName:e})}),o=e?`${e}:`:"";return {storage:{getItem:async n=>{let a=`${o}${n}`,l=await r.getItem(a);if(l==null)return null;try{let c=JSON.parse(l);return c.expiry&&Date.now()>c.expiry?(await r.removeItem(a),null):c.value}catch{return l}},setItem:async(n,a)=>{let l=`${o}${n}`,c=JSON.stringify(t?{value:a,expiry:Date.now()+t}:{value:a});await r.setItem(l,c);},removeItem:async n=>{await r.removeItem(`${o}${n}`);}},cleanup:async()=>{await r.dispose?.();}}}function z(s){let e=s||process.env.APP_SECRET||process.env.AUTH_SECRET||"development-secret-key";return q$1.createHash("sha256").update(e).digest("hex")}function qr(s,e){let t=q$1.randomBytes(16),r=q$1.createCipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),t),o=r.update(s,"utf8","hex");o+=r.final("hex");let i=r.getAuthTag().toString("hex");return `${t.toString("hex")}:${i}:${o}`}function Qr(s,e){let[t,r,o]=s.split(":"),i=Buffer.from(t,"hex"),n=Buffer.from(r,"hex"),a=q$1.createDecipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),i);a.setAuthTag(n);let l=a.update(o,"hex","utf8");return l+=a.final("utf8"),l}async function Q(s={}){let{namespace:e="kyro",ttl:t,encryption:r=true,secret:o,basePath:i}=s,n=i?Me.join(i,".astro","kyro.json"):Me.join(process.cwd(),".astro","kyro.json"),a=createStorage({driver:zr({base:n})}),l=r?z(o):null,c=e?`${e}:`:"";return {storage:{getItem:async g=>{let d=`${c}${g}`,u=await a.getItem(d);if(u==null)return null;try{let y=l?Qr(u,l):u,f=JSON.parse(y);return f.expiry&&Date.now()>f.expiry?(await a.removeItem(d),null):f.value}catch{return u}},setItem:async(g,d)=>{let u=`${c}${g}`,y=JSON.stringify(t?{value:d,expiry:Date.now()+t}:{value:d});await a.setItem(u,l?qr(y,l):y);},removeItem:async g=>{await a.removeItem(`${c}${g}`);}},cleanup:async()=>{await a.dispose?.();}}}async function Y(s){let{environment:e,adapter:t,connectionString:r,encryption:o}=s,i=process.env.APP_SECRET||process.env.AUTH_SECRET,n={enabled:o?.enabled??true,algorithm:o?.algorithm};return e==="browser"?G({namespace:"kyro"}):Q({namespace:"kyro",encryption:n.enabled,secret:i})}async function Fe(s){let e={...s,encryption:{enabled:true,algorithm:s.encryption?.algorithm}};return Y(e)}l();export{x as AccountLockout,E as AnalyticsPlugin,H as Auth,U as CommentsPlugin,C as InMemoryAccountLockout,P as InMemoryAuthAdapter,b as KyroPlugin,$ as PluginManager,S as RateLimiter,V as ReviewsPlugin,L as SEOPLugin,M as VersionManager,O as WishlistPlugin,Ue as authConfig,Rr as createAuth,W as createAuthConfig,Fe as createAuthStorage,Y as createStorage,Dr as createVersionManager,Ve as defineConfig,Or as defineKyroConfig,_r as generateAnalyticsTags,Hr as generateSeoTags,_ as getDefaultDraftPublishConfig,Kr as getPaymentConfig,_e as getPaymentConfigFromSettings,Br as getSocialLinks,Oe as getSocialLinksFromSettings,Nr as getStoreConfig,He as getStoreConfigFromSettings,Er as isArchived,Lr as isDraft,Ir as isPublished,Ar as presetPlugins,br as runFieldHooks,Ie as runHooks};
43
+ `),o}var Mr={facebook:{label:"Facebook"},twitter:{label:"Twitter / X"},instagram:{label:"Instagram"},linkedin:{label:"LinkedIn"},youtube:{label:"YouTube"},tiktok:{label:"TikTok"},pinterest:{label:"Pinterest"},discord:{label:"Discord"},twitch:{label:"Twitch"},github:{label:"GitHub"},mastodon:{label:"Mastodon"}},Fr=["facebook","twitter","instagram","linkedin","youtube","tiktok","pinterest","discord","twitch","github","mastodon"];function Oe(s){if(!s)return [];let e=s.showAll===true,t=[];for(let r of Fr){let o=s[r];if(!o||["tiktok","pinterest","discord","twitch","github","mastodon"].includes(r)&&!e)continue;let n=Mr[r];t.push({platform:r,url:o,label:n?.label||r});}return t}async function Br(s,e){try{let t=await s.findOne({collection:"_globals_social-settings",where:{},draft:e?.draft??!1});return Oe(t)}catch{return []}}function He(s){return s?{storeName:s.storeName,storeEmail:s.storeEmail,storePhone:s.storePhone,address:s.address,currency:s.currency,tax:s.tax,shipping:s.shipping,orders:s.orders}:{}}async function Nr(s,e){try{let t=await s.findOne({collection:"_globals_store-settings",where:{},draft:e?.draft??!1});return He(t)}catch{return {}}}function _e(s){return s?{testMode:s.testMode,provider:s.provider,stripe:s.stripe,paypal:s.paypal,square:s.square,methods:s.methods,bankTransfer:s.bankTransfer}:{}}async function Kr(s,e){try{let t=await s.findOne({collection:"_globals_payment-settings",where:{},draft:e?.draft??!1});return _e(t)}catch{return {}}}async function G(s={}){let{namespace:e="kyro",ttl:t}=s,r=createStorage({driver:$r({dbName:"kyro-cms",storeName:e})}),o=e?`${e}:`:"";return {storage:{getItem:async n=>{let a=`${o}${n}`,l=await r.getItem(a);if(l==null)return null;try{let c=JSON.parse(l);return c.expiry&&Date.now()>c.expiry?(await r.removeItem(a),null):c.value}catch{return l}},setItem:async(n,a)=>{let l=`${o}${n}`,c=JSON.stringify(t?{value:a,expiry:Date.now()+t}:{value:a});await r.setItem(l,c);},removeItem:async n=>{await r.removeItem(`${o}${n}`);}},cleanup:async()=>{await r.dispose?.();}}}function z(s){let e=s||process.env.APP_SECRET||process.env.AUTH_SECRET||"development-secret-key";return q$1.createHash("sha256").update(e).digest("hex")}function qr(s,e){let t=q$1.randomBytes(16),r=q$1.createCipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),t),o=r.update(s,"utf8","hex");o+=r.final("hex");let i=r.getAuthTag().toString("hex");return `${t.toString("hex")}:${i}:${o}`}function Qr(s,e){let[t,r,o]=s.split(":"),i=Buffer.from(t,"hex"),n=Buffer.from(r,"hex"),a=q$1.createDecipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),i);a.setAuthTag(n);let l=a.update(o,"hex","utf8");return l+=a.final("utf8"),l}async function Q(s={}){let{namespace:e="kyro",ttl:t,encryption:r=true,secret:o,basePath:i}=s,n=i?Me.join(i,".astro","kyro.json"):Me.join(process.cwd(),".astro","kyro.json"),a=createStorage({driver:zr({base:n})}),l=r?z(o):null,c=e?`${e}:`:"";return {storage:{getItem:async g=>{let d=`${c}${g}`,u=await a.getItem(d);if(u==null)return null;try{let y=l?Qr(u,l):u,f=JSON.parse(y);return f.expiry&&Date.now()>f.expiry?(await a.removeItem(d),null):f.value}catch{return u}},setItem:async(g,d)=>{let u=`${c}${g}`,y=JSON.stringify(t?{value:d,expiry:Date.now()+t}:{value:d});await a.setItem(u,l?qr(y,l):y);},removeItem:async g=>{await a.removeItem(`${c}${g}`);}},cleanup:async()=>{await a.dispose?.();}}}async function Y(s){let{environment:e,adapter:t,connectionString:r,encryption:o}=s,i=process.env.APP_SECRET||process.env.AUTH_SECRET,n={enabled:o?.enabled??true,algorithm:o?.algorithm};return e==="browser"?G({namespace:"kyro"}):Q({namespace:"kyro",encryption:n.enabled,secret:i})}async function Fe(s){let e={...s,encryption:{enabled:true,algorithm:s.encryption?.algorithm}};return Y(e)}l();export{x as AccountLockout,E as AnalyticsPlugin,H as Auth,U as CommentsPlugin,C as InMemoryAccountLockout,P as InMemoryAuthAdapter,b as KyroPlugin,$ as PluginManager,S as RateLimiter,V as ReviewsPlugin,L as SEOPlugin,M as VersionManager,O as WishlistPlugin,Ue as authConfig,Rr as createAuth,W as createAuthConfig,Fe as createAuthStorage,Y as createStorage,Dr as createVersionManager,Ve as defineConfig,Or as defineKyroConfig,_r as generateAnalyticsTags,Hr as generateSeoTags,_ as getDefaultDraftPublishConfig,Kr as getPaymentConfig,_e as getPaymentConfigFromSettings,Br as getSocialLinks,Oe as getSocialLinksFromSettings,Nr as getStoreConfig,He as getStoreConfigFromSettings,Er as isArchived,Lr as isDraft,Ir as isPublished,Ar as presetPlugins,br as runFieldHooks,Ie as runHooks};
@@ -1 +1 @@
1
- 'use strict';require('../chunk-UBHFUFD4.cjs');var chunkDNLO7PK6_cjs=require('../chunk-DNLO7PK6.cjs'),chunkATLSIYRH_cjs=require('../chunk-ATLSIYRH.cjs');require('../chunk-W4ZDETHA.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"MongoDBAdapter",{enumerable:true,get:function(){return chunkDNLO7PK6_cjs.a}});Object.defineProperty(exports,"createMongoDBAdapter",{enumerable:true,get:function(){return chunkDNLO7PK6_cjs.b}});Object.defineProperty(exports,"MongoDBAuthAdapter",{enumerable:true,get:function(){return chunkATLSIYRH_cjs.a}});
1
+ 'use strict';require('../chunk-UBHFUFD4.cjs');var chunkUCCFT5OO_cjs=require('../chunk-UCCFT5OO.cjs'),chunkATLSIYRH_cjs=require('../chunk-ATLSIYRH.cjs');require('../chunk-EJDIR56C.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"MongoDBAdapter",{enumerable:true,get:function(){return chunkUCCFT5OO_cjs.a}});Object.defineProperty(exports,"createMongoDBAdapter",{enumerable:true,get:function(){return chunkUCCFT5OO_cjs.b}});Object.defineProperty(exports,"MongoDBAuthAdapter",{enumerable:true,get:function(){return chunkATLSIYRH_cjs.a}});
@@ -1,5 +1,5 @@
1
- import { A as AbstractBaseAdapter } from '../base-m1Y9PVG6.cjs';
2
- import { F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs } from '../types-CGQSckv0.cjs';
1
+ import { A as AbstractBaseAdapter } from '../base-BvTw4t8l.cjs';
2
+ import { F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs } from '../types-Dlbz_JRA.cjs';
3
3
  import { A as AuthAdapter, U as UserRole, c as AuthUser, S as Session, e as AuditLogFilter, d as AuditLog } from '../types-CpjuXbe7.cjs';
4
4
  import '../types-CIJsFuvf.cjs';
5
5
 
@@ -24,19 +24,19 @@ declare class MongoDBAdapter extends AbstractBaseAdapter {
24
24
  count(args: {
25
25
  collection: string;
26
26
  where?: Record<string, any>;
27
- tenantID?: string;
27
+ tenantId?: string;
28
28
  }): Promise<number>;
29
29
  findOne(args: {
30
30
  collection: string;
31
31
  where: Record<string, any>;
32
- tenantID?: string;
32
+ tenantId?: string;
33
33
  draft?: boolean;
34
34
  }): Promise<any>;
35
35
  findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
36
36
  findVersionByID(args: {
37
37
  collection: string;
38
38
  versionId: string;
39
- tenantID?: string;
39
+ tenantId?: string;
40
40
  }): Promise<VersionRecord | null>;
41
41
  createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
42
42
  updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
@@ -44,7 +44,7 @@ declare class MongoDBAdapter extends AbstractBaseAdapter {
44
44
  collection: string;
45
45
  documentId: string;
46
46
  keepLatest?: number;
47
- tenantID?: string;
47
+ tenantId?: string;
48
48
  }): Promise<void>;
49
49
  migrate?(): Promise<void>;
50
50
  private getCollectionConfig;
@@ -1,5 +1,5 @@
1
- import { A as AbstractBaseAdapter } from '../base-D_gWzhL1.js';
2
- import { F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs } from '../types-Cxb3Ukwl.js';
1
+ import { A as AbstractBaseAdapter } from '../base-BbqmiS-x.js';
2
+ import { F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs } from '../types-HgePo7uw.js';
3
3
  import { A as AuthAdapter, U as UserRole, c as AuthUser, S as Session, e as AuditLogFilter, d as AuditLog } from '../types-CpjuXbe7.js';
4
4
  import '../types-CIJsFuvf.js';
5
5
 
@@ -24,19 +24,19 @@ declare class MongoDBAdapter extends AbstractBaseAdapter {
24
24
  count(args: {
25
25
  collection: string;
26
26
  where?: Record<string, any>;
27
- tenantID?: string;
27
+ tenantId?: string;
28
28
  }): Promise<number>;
29
29
  findOne(args: {
30
30
  collection: string;
31
31
  where: Record<string, any>;
32
- tenantID?: string;
32
+ tenantId?: string;
33
33
  draft?: boolean;
34
34
  }): Promise<any>;
35
35
  findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
36
36
  findVersionByID(args: {
37
37
  collection: string;
38
38
  versionId: string;
39
- tenantID?: string;
39
+ tenantId?: string;
40
40
  }): Promise<VersionRecord | null>;
41
41
  createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
42
42
  updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
@@ -44,7 +44,7 @@ declare class MongoDBAdapter extends AbstractBaseAdapter {
44
44
  collection: string;
45
45
  documentId: string;
46
46
  keepLatest?: number;
47
- tenantID?: string;
47
+ tenantId?: string;
48
48
  }): Promise<void>;
49
49
  migrate?(): Promise<void>;
50
50
  private getCollectionConfig;
@@ -1 +1 @@
1
- import'../chunk-QRXDCV6K.js';export{a as MongoDBAdapter,b as createMongoDBAdapter}from'../chunk-7ORSLR3S.js';export{a as MongoDBAuthAdapter}from'../chunk-P7CESLDJ.js';import'../chunk-4YYBWCDJ.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
1
+ import'../chunk-QRXDCV6K.js';export{a as MongoDBAdapter,b as createMongoDBAdapter}from'../chunk-YPDRUVWG.js';export{a as MongoDBAuthAdapter}from'../chunk-P7CESLDJ.js';import'../chunk-TQNM4C7H.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
@@ -1 +1 @@
1
- 'use strict';var chunk43U2NBVS_cjs=require('../chunk-43U2NBVS.cjs');require('../chunk-AJAZ7D3W.cjs'),require('../chunk-WIZ6C5QZ.cjs'),require('../chunk-GFU7AOI3.cjs'),require('../chunk-ET6NN2V2.cjs'),require('../chunk-HVXO3OFB.cjs'),require('../chunk-4FV3HQBI.cjs'),require('../chunk-NY47CFVP.cjs'),require('../chunk-QAJS4EXW.cjs'),require('../chunk-GYQMNXXW.cjs'),require('../chunk-MIOMMB23.cjs'),require('../chunk-DNLO7PK6.cjs'),require('../chunk-ATLSIYRH.cjs'),require('../chunk-W4ZDETHA.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"createHonoApp",{enumerable:true,get:function(){return chunk43U2NBVS_cjs.s}});Object.defineProperty(exports,"createRESTAPI",{enumerable:true,get:function(){return chunk43U2NBVS_cjs.t}});
1
+ 'use strict';var chunkKHQGO3U3_cjs=require('../chunk-KHQGO3U3.cjs');require('../chunk-AJAZ7D3W.cjs'),require('../chunk-WIZ6C5QZ.cjs'),require('../chunk-GFU7AOI3.cjs'),require('../chunk-ET6NN2V2.cjs'),require('../chunk-HVXO3OFB.cjs'),require('../chunk-WE46GGL4.cjs'),require('../chunk-NY47CFVP.cjs'),require('../chunk-IC7UOIHY.cjs'),require('../chunk-GYQMNXXW.cjs'),require('../chunk-MIOMMB23.cjs'),require('../chunk-UCCFT5OO.cjs'),require('../chunk-ATLSIYRH.cjs'),require('../chunk-EJDIR56C.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"createHonoApp",{enumerable:true,get:function(){return chunkKHQGO3U3_cjs.s}});Object.defineProperty(exports,"createRESTAPI",{enumerable:true,get:function(){return chunkKHQGO3U3_cjs.t}});
@@ -1,7 +1,7 @@
1
1
  import { Hono } from 'hono';
2
- import { B as BaseAdapter, i as User } from '../types-CGQSckv0.cjs';
3
- import { R as Registry } from '../index-DpuTMOei.cjs';
4
- import { i as createWebhookService } from '../WebhookService-BoHm8roq.cjs';
2
+ import { B as BaseAdapter, i as User } from '../types-Dlbz_JRA.cjs';
3
+ import { R as Registry } from '../index-B70yBGlO.cjs';
4
+ import { j as createWebhookService } from '../WebhookService-CE2BzNb_.cjs';
5
5
  import '../types-CIJsFuvf.cjs';
6
6
  import 'zod';
7
7
 
@@ -13,7 +13,7 @@ interface HonoAppOptions {
13
13
  checkSession?: boolean;
14
14
  user?: User;
15
15
  req?: any;
16
- tenantID?: string;
16
+ tenantId?: string;
17
17
  cors?: {
18
18
  origins?: string[];
19
19
  credentials?: boolean;
@@ -45,7 +45,7 @@ declare function createRESTAPI(registry: Registry, db: BaseAdapter, options?: {
45
45
  authSecret?: string;
46
46
  user?: User;
47
47
  req?: Request;
48
- tenantID?: string;
48
+ tenantId?: string;
49
49
  cors?: {
50
50
  origins?: string[];
51
51
  credentials?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { Hono } from 'hono';
2
- import { B as BaseAdapter, i as User } from '../types-Cxb3Ukwl.js';
3
- import { R as Registry } from '../index-wsdh-ul-.js';
4
- import { i as createWebhookService } from '../WebhookService-0D8rBDOw.js';
2
+ import { B as BaseAdapter, i as User } from '../types-HgePo7uw.js';
3
+ import { R as Registry } from '../index-BJMk6wAL.js';
4
+ import { j as createWebhookService } from '../WebhookService-DIUUnBqL.js';
5
5
  import '../types-CIJsFuvf.js';
6
6
  import 'zod';
7
7
 
@@ -13,7 +13,7 @@ interface HonoAppOptions {
13
13
  checkSession?: boolean;
14
14
  user?: User;
15
15
  req?: any;
16
- tenantID?: string;
16
+ tenantId?: string;
17
17
  cors?: {
18
18
  origins?: string[];
19
19
  credentials?: boolean;
@@ -45,7 +45,7 @@ declare function createRESTAPI(registry: Registry, db: BaseAdapter, options?: {
45
45
  authSecret?: string;
46
46
  user?: User;
47
47
  req?: Request;
48
- tenantID?: string;
48
+ tenantId?: string;
49
49
  cors?: {
50
50
  origins?: string[];
51
51
  credentials?: boolean;
@@ -1 +1 @@
1
- export{s as createHonoApp,t as createRESTAPI}from'../chunk-V465K673.js';import'../chunk-7WOX27LK.js';import'../chunk-K6WUOU6P.js';import'../chunk-AE6GXUT7.js';import'../chunk-2W4FK6CJ.js';import'../chunk-NRLIGDYF.js';import'../chunk-QIP7PY2U.js';import'../chunk-HLSB2MCK.js';import'../chunk-MTFJDAPX.js';import'../chunk-RHCWCG3O.js';import'../chunk-OG7CNQGU.js';import'../chunk-7ORSLR3S.js';import'../chunk-P7CESLDJ.js';import'../chunk-4YYBWCDJ.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
1
+ export{s as createHonoApp,t as createRESTAPI}from'../chunk-BYTGJJK6.js';import'../chunk-7WOX27LK.js';import'../chunk-K6WUOU6P.js';import'../chunk-AE6GXUT7.js';import'../chunk-2W4FK6CJ.js';import'../chunk-NRLIGDYF.js';import'../chunk-KG7V6O2Z.js';import'../chunk-HLSB2MCK.js';import'../chunk-MRVECVMR.js';import'../chunk-RHCWCG3O.js';import'../chunk-OG7CNQGU.js';import'../chunk-YPDRUVWG.js';import'../chunk-P7CESLDJ.js';import'../chunk-TQNM4C7H.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
@@ -1 +1 @@
1
- 'use strict';var chunkFCPFEHTM_cjs=require('../chunk-FCPFEHTM.cjs'),chunk65G73T7Z_cjs=require('../chunk-65G73T7Z.cjs'),chunkGFU7AOI3_cjs=require('../chunk-GFU7AOI3.cjs');require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"accessSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.J}});Object.defineProperty(exports,"allSettingsGlobals",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.N}});Object.defineProperty(exports,"blogCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.c}});Object.defineProperty(exports,"blogGlobals",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.d}});Object.defineProperty(exports,"brandSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.H}});Object.defineProperty(exports,"categoriesCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.p}});Object.defineProperty(exports,"categoriesCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.q}});Object.defineProperty(exports,"coreSettingsGlobals",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.O}});Object.defineProperty(exports,"couponsCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.z}});Object.defineProperty(exports,"couponsCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.A}});Object.defineProperty(exports,"createTemplateConfig",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.S}});Object.defineProperty(exports,"customersCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.v}});Object.defineProperty(exports,"customersCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.w}});Object.defineProperty(exports,"ecommerceCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.e}});Object.defineProperty(exports,"ecommerceGlobals",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.f}});Object.defineProperty(exports,"emailSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.I}});Object.defineProperty(exports,"formEntriesCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.D}});Object.defineProperty(exports,"formEntriesCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.E}});Object.defineProperty(exports,"formsCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.B}});Object.defineProperty(exports,"formsCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.C}});Object.defineProperty(exports,"getSettingsForTemplate",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.Q}});Object.defineProperty(exports,"kitchenSinkCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.g}});Object.defineProperty(exports,"mediaCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.h}});Object.defineProperty(exports,"mediaCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.i}});Object.defineProperty(exports,"menuCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.j}});Object.defineProperty(exports,"menuCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.k}});Object.defineProperty(exports,"minimalCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.a}});Object.defineProperty(exports,"ordersCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.x}});Object.defineProperty(exports,"ordersCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.y}});Object.defineProperty(exports,"pageCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.n}});Object.defineProperty(exports,"pageCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.o}});Object.defineProperty(exports,"paymentSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.L}});Object.defineProperty(exports,"postsCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.l}});Object.defineProperty(exports,"postsCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.m}});Object.defineProperty(exports,"productCategoriesCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.r}});Object.defineProperty(exports,"productCategoriesCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.s}});Object.defineProperty(exports,"productsCollection",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.t}});Object.defineProperty(exports,"productsCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.u}});Object.defineProperty(exports,"seoSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.G}});Object.defineProperty(exports,"settingsBySlug",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.P}});Object.defineProperty(exports,"siteSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.F}});Object.defineProperty(exports,"starterCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.b}});Object.defineProperty(exports,"storeSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.K}});Object.defineProperty(exports,"systemSettingsGlobal",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.M}});Object.defineProperty(exports,"templateCollections",{enumerable:true,get:function(){return chunkFCPFEHTM_cjs.R}});Object.defineProperty(exports,"storageSettingsGlobal",{enumerable:true,get:function(){return chunk65G73T7Z_cjs.a}});Object.defineProperty(exports,"authCollections",{enumerable:true,get:function(){return chunkGFU7AOI3_cjs.b}});
1
+ 'use strict';var chunkGM63MQNE_cjs=require('../chunk-GM63MQNE.cjs'),chunk65G73T7Z_cjs=require('../chunk-65G73T7Z.cjs'),chunkGFU7AOI3_cjs=require('../chunk-GFU7AOI3.cjs');require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"accessSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.J}});Object.defineProperty(exports,"allSettingsGlobals",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.N}});Object.defineProperty(exports,"blogCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.c}});Object.defineProperty(exports,"blogGlobals",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.d}});Object.defineProperty(exports,"brandSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.H}});Object.defineProperty(exports,"categoriesCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.p}});Object.defineProperty(exports,"categoriesCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.q}});Object.defineProperty(exports,"coreSettingsGlobals",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.O}});Object.defineProperty(exports,"couponsCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.z}});Object.defineProperty(exports,"couponsCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.A}});Object.defineProperty(exports,"createTemplateConfig",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.S}});Object.defineProperty(exports,"customersCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.v}});Object.defineProperty(exports,"customersCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.w}});Object.defineProperty(exports,"ecommerceCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.e}});Object.defineProperty(exports,"ecommerceGlobals",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.f}});Object.defineProperty(exports,"emailSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.I}});Object.defineProperty(exports,"formEntriesCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.D}});Object.defineProperty(exports,"formEntriesCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.E}});Object.defineProperty(exports,"formsCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.B}});Object.defineProperty(exports,"formsCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.C}});Object.defineProperty(exports,"getSettingsForTemplate",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.Q}});Object.defineProperty(exports,"kitchenSinkCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.g}});Object.defineProperty(exports,"mediaCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.h}});Object.defineProperty(exports,"mediaCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.i}});Object.defineProperty(exports,"menuCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.j}});Object.defineProperty(exports,"menuCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.k}});Object.defineProperty(exports,"minimalCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.a}});Object.defineProperty(exports,"ordersCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.x}});Object.defineProperty(exports,"ordersCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.y}});Object.defineProperty(exports,"pageCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.n}});Object.defineProperty(exports,"pageCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.o}});Object.defineProperty(exports,"paymentSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.L}});Object.defineProperty(exports,"postsCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.l}});Object.defineProperty(exports,"postsCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.m}});Object.defineProperty(exports,"productCategoriesCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.r}});Object.defineProperty(exports,"productCategoriesCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.s}});Object.defineProperty(exports,"productsCollection",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.t}});Object.defineProperty(exports,"productsCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.u}});Object.defineProperty(exports,"seoSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.G}});Object.defineProperty(exports,"settingsBySlug",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.P}});Object.defineProperty(exports,"siteSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.F}});Object.defineProperty(exports,"starterCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.b}});Object.defineProperty(exports,"storeSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.K}});Object.defineProperty(exports,"systemSettingsGlobal",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.M}});Object.defineProperty(exports,"templateCollections",{enumerable:true,get:function(){return chunkGM63MQNE_cjs.R}});Object.defineProperty(exports,"storageSettingsGlobal",{enumerable:true,get:function(){return chunk65G73T7Z_cjs.a}});Object.defineProperty(exports,"authCollections",{enumerable:true,get:function(){return chunkGFU7AOI3_cjs.b}});
@@ -1,4 +1,4 @@
1
- import { G as GlobalConfig, C as CollectionConfig } from '../types-CGQSckv0.cjs';
1
+ import { G as GlobalConfig, C as CollectionConfig } from '../types-Dlbz_JRA.cjs';
2
2
  import '../types-CIJsFuvf.cjs';
3
3
 
4
4
  declare const minimalCollections: Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { G as GlobalConfig, C as CollectionConfig } from '../types-Cxb3Ukwl.js';
1
+ import { G as GlobalConfig, C as CollectionConfig } from '../types-HgePo7uw.js';
2
2
  import '../types-CIJsFuvf.js';
3
3
 
4
4
  declare const minimalCollections: Record<string, any>;
@@ -1 +1 @@
1
- export{J as accessSettingsGlobal,N as allSettingsGlobals,c as blogCollections,d as blogGlobals,H as brandSettingsGlobal,p as categoriesCollection,q as categoriesCollections,O as coreSettingsGlobals,z as couponsCollection,A as couponsCollections,S as createTemplateConfig,v as customersCollection,w as customersCollections,e as ecommerceCollections,f as ecommerceGlobals,I as emailSettingsGlobal,D as formEntriesCollection,E as formEntriesCollections,B as formsCollection,C as formsCollections,Q as getSettingsForTemplate,g as kitchenSinkCollections,h as mediaCollection,i as mediaCollections,j as menuCollection,k as menuCollections,a as minimalCollections,x as ordersCollection,y as ordersCollections,n as pageCollection,o as pageCollections,L as paymentSettingsGlobal,l as postsCollection,m as postsCollections,r as productCategoriesCollection,s as productCategoriesCollections,t as productsCollection,u as productsCollections,G as seoSettingsGlobal,P as settingsBySlug,F as siteSettingsGlobal,b as starterCollections,K as storeSettingsGlobal,M as systemSettingsGlobal,R as templateCollections}from'../chunk-FU5JJVYA.js';export{a as storageSettingsGlobal}from'../chunk-NZ35PV5R.js';export{b as authCollections}from'../chunk-AE6GXUT7.js';import'../chunk-5J6HXUF6.js';
1
+ export{J as accessSettingsGlobal,N as allSettingsGlobals,c as blogCollections,d as blogGlobals,H as brandSettingsGlobal,p as categoriesCollection,q as categoriesCollections,O as coreSettingsGlobals,z as couponsCollection,A as couponsCollections,S as createTemplateConfig,v as customersCollection,w as customersCollections,e as ecommerceCollections,f as ecommerceGlobals,I as emailSettingsGlobal,D as formEntriesCollection,E as formEntriesCollections,B as formsCollection,C as formsCollections,Q as getSettingsForTemplate,g as kitchenSinkCollections,h as mediaCollection,i as mediaCollections,j as menuCollection,k as menuCollections,a as minimalCollections,x as ordersCollection,y as ordersCollections,n as pageCollection,o as pageCollections,L as paymentSettingsGlobal,l as postsCollection,m as postsCollections,r as productCategoriesCollection,s as productCategoriesCollections,t as productsCollection,u as productsCollections,G as seoSettingsGlobal,P as settingsBySlug,F as siteSettingsGlobal,b as starterCollections,K as storeSettingsGlobal,M as systemSettingsGlobal,R as templateCollections}from'../chunk-PNA36LJ6.js';export{a as storageSettingsGlobal}from'../chunk-NZ35PV5R.js';export{b as authCollections}from'../chunk-AE6GXUT7.js';import'../chunk-5J6HXUF6.js';
@@ -1 +1 @@
1
- 'use strict';var chunkBDBN4RN6_cjs=require('../chunk-BDBN4RN6.cjs');require('../chunk-4FV3HQBI.cjs'),require('../chunk-NY47CFVP.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"createContext",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.a}});Object.defineProperty(exports,"createCountProcedure",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.g}});Object.defineProperty(exports,"createCreateProcedure",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.d}});Object.defineProperty(exports,"createDeleteProcedure",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.f}});Object.defineProperty(exports,"createDynamicRouter",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.h}});Object.defineProperty(exports,"createFindByIDProcedure",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.c}});Object.defineProperty(exports,"createFindProcedure",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.b}});Object.defineProperty(exports,"createKyroServer",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.i}});Object.defineProperty(exports,"createUpdateProcedure",{enumerable:true,get:function(){return chunkBDBN4RN6_cjs.e}});
1
+ 'use strict';var chunkER2PUSHG_cjs=require('../chunk-ER2PUSHG.cjs');require('../chunk-WE46GGL4.cjs'),require('../chunk-NY47CFVP.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"createContext",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.a}});Object.defineProperty(exports,"createCountProcedure",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.g}});Object.defineProperty(exports,"createCreateProcedure",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.d}});Object.defineProperty(exports,"createDeleteProcedure",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.f}});Object.defineProperty(exports,"createDynamicRouter",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.h}});Object.defineProperty(exports,"createFindByIDProcedure",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.c}});Object.defineProperty(exports,"createFindProcedure",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.b}});Object.defineProperty(exports,"createKyroServer",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.i}});Object.defineProperty(exports,"createUpdateProcedure",{enumerable:true,get:function(){return chunkER2PUSHG_cjs.e}});
@@ -1,5 +1,5 @@
1
- import { B as BaseAdapter, R as Request, i as User, b as FindResult } from '../types-CGQSckv0.cjs';
2
- import { i as createWebhookService } from '../WebhookService-BoHm8roq.cjs';
1
+ import { B as BaseAdapter, R as Request, i as User, b as FindResult } from '../types-Dlbz_JRA.cjs';
2
+ import { j as createWebhookService } from '../WebhookService-CE2BzNb_.cjs';
3
3
  import '../types-CIJsFuvf.cjs';
4
4
 
5
5
  interface ApiKeyContext {
@@ -14,7 +14,7 @@ interface KyroContext {
14
14
  db: BaseAdapter;
15
15
  registry: any;
16
16
  user?: User;
17
- tenantID?: string;
17
+ tenantId?: string;
18
18
  req: Request;
19
19
  apiKey?: ApiKeyContext;
20
20
  webhookService?: ReturnType<typeof createWebhookService>;
@@ -26,7 +26,7 @@ declare function createContext(options: {
26
26
  registry: any;
27
27
  req: Request;
28
28
  user?: User;
29
- tenantID?: string;
29
+ tenantId?: string;
30
30
  settings?: Record<string, any>;
31
31
  }): Promise<KyroContext>;
32
32
 
@@ -1,5 +1,5 @@
1
- import { B as BaseAdapter, R as Request, i as User, b as FindResult } from '../types-Cxb3Ukwl.js';
2
- import { i as createWebhookService } from '../WebhookService-0D8rBDOw.js';
1
+ import { B as BaseAdapter, R as Request, i as User, b as FindResult } from '../types-HgePo7uw.js';
2
+ import { j as createWebhookService } from '../WebhookService-DIUUnBqL.js';
3
3
  import '../types-CIJsFuvf.js';
4
4
 
5
5
  interface ApiKeyContext {
@@ -14,7 +14,7 @@ interface KyroContext {
14
14
  db: BaseAdapter;
15
15
  registry: any;
16
16
  user?: User;
17
- tenantID?: string;
17
+ tenantId?: string;
18
18
  req: Request;
19
19
  apiKey?: ApiKeyContext;
20
20
  webhookService?: ReturnType<typeof createWebhookService>;
@@ -26,7 +26,7 @@ declare function createContext(options: {
26
26
  registry: any;
27
27
  req: Request;
28
28
  user?: User;
29
- tenantID?: string;
29
+ tenantId?: string;
30
30
  settings?: Record<string, any>;
31
31
  }): Promise<KyroContext>;
32
32
 
@@ -1 +1 @@
1
- export{a as createContext,g as createCountProcedure,d as createCreateProcedure,f as createDeleteProcedure,h as createDynamicRouter,c as createFindByIDProcedure,b as createFindProcedure,i as createKyroServer,e as createUpdateProcedure}from'../chunk-GJQH6NV7.js';import'../chunk-QIP7PY2U.js';import'../chunk-HLSB2MCK.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
1
+ export{a as createContext,g as createCountProcedure,d as createCreateProcedure,f as createDeleteProcedure,h as createDynamicRouter,c as createFindByIDProcedure,b as createFindProcedure,i as createKyroServer,e as createUpdateProcedure}from'../chunk-5BPMMIAQ.js';import'../chunk-KG7V6O2Z.js';import'../chunk-HLSB2MCK.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
@@ -12,7 +12,7 @@ interface User {
12
12
  id: string;
13
13
  email: string;
14
14
  role: string;
15
- tenantID?: string;
15
+ tenantId?: string;
16
16
  [key: string]: any;
17
17
  }
18
18
  interface HookArgs<T = any> {
@@ -24,7 +24,7 @@ interface HookArgs<T = any> {
24
24
  req: Request;
25
25
  user?: User;
26
26
  operation: 'create' | 'read' | 'update' | 'delete';
27
- tenantID?: string;
27
+ tenantId?: string;
28
28
  field?: string;
29
29
  siblingData?: Record<string, any>;
30
30
  value?: any;
@@ -71,7 +71,7 @@ interface AccessArgs {
71
71
  data?: unknown;
72
72
  doc?: unknown;
73
73
  id?: string;
74
- tenantID?: string;
74
+ tenantId?: string;
75
75
  context?: Record<string, unknown>;
76
76
  }
77
77
  type AccessControl = boolean | ((args: AccessArgs) => Promise<boolean | WhereClause> | boolean | WhereClause);
@@ -247,7 +247,7 @@ interface FindArgs {
247
247
  limit?: number;
248
248
  page?: number;
249
249
  depth?: number;
250
- tenantID?: string;
250
+ tenantId?: string;
251
251
  select?: string[];
252
252
  user?: any;
253
253
  context?: Record<string, any>;
@@ -259,7 +259,7 @@ interface FindByIDArgs {
259
259
  collection: string;
260
260
  id: string;
261
261
  depth?: number;
262
- tenantID?: string;
262
+ tenantId?: string;
263
263
  select?: string[];
264
264
  user?: any;
265
265
  context?: Record<string, any>;
@@ -271,7 +271,7 @@ interface CreateArgs {
271
271
  collection: string;
272
272
  data: Record<string, any>;
273
273
  depth?: number;
274
- tenantID?: string;
274
+ tenantId?: string;
275
275
  select?: string[];
276
276
  user?: any;
277
277
  context?: Record<string, any>;
@@ -282,7 +282,7 @@ interface UpdateArgs {
282
282
  id: string;
283
283
  data: Record<string, any>;
284
284
  depth?: number;
285
- tenantID?: string;
285
+ tenantId?: string;
286
286
  select?: string[];
287
287
  user?: any;
288
288
  context?: Record<string, any>;
@@ -291,7 +291,7 @@ interface UpdateArgs {
291
291
  interface DeleteArgs {
292
292
  collection: string;
293
293
  id: string;
294
- tenantID?: string;
294
+ tenantId?: string;
295
295
  user?: any;
296
296
  context?: Record<string, any>;
297
297
  overrideAccess?: boolean;
@@ -336,14 +336,14 @@ interface CreateVersionArgs<T = Record<string, any>> {
336
336
  status: DocumentStatus;
337
337
  createdBy?: string;
338
338
  changeDescription?: string;
339
- tenantID?: string;
339
+ tenantId?: string;
340
340
  /** When true, reuses a single version slot (find existing + update) */
341
341
  autosave?: boolean;
342
342
  }
343
343
  interface FindVersionsArgs {
344
344
  collection: string;
345
345
  documentId: string;
346
- tenantID?: string;
346
+ tenantId?: string;
347
347
  limit?: number;
348
348
  page?: number;
349
349
  sort?: string;
@@ -358,26 +358,26 @@ interface BaseAdapter {
358
358
  count(args: {
359
359
  collection: string;
360
360
  where?: Record<string, any>;
361
- tenantID?: string;
361
+ tenantId?: string;
362
362
  }): Promise<number>;
363
363
  findOne(args: {
364
364
  collection: string;
365
365
  where: Record<string, any>;
366
- tenantID?: string;
366
+ tenantId?: string;
367
367
  draft?: boolean;
368
368
  }): Promise<any>;
369
369
  findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
370
370
  findVersionByID(args: {
371
371
  collection: string;
372
372
  versionId: string;
373
- tenantID?: string;
373
+ tenantId?: string;
374
374
  }): Promise<VersionRecord | null>;
375
375
  createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
376
376
  deleteVersions(args: {
377
377
  collection: string;
378
378
  documentId: string;
379
379
  keepLatest?: number;
380
- tenantID?: string;
380
+ tenantId?: string;
381
381
  }): Promise<void>;
382
382
  updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
383
383
  migrate?(): Promise<void>;