@kyro-cms/core 0.11.5 → 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
@@ -1,4 +1,4 @@
1
- import { B as BaseAdapter } from './types-CGQSckv0.cjs';
1
+ import { B as BaseAdapter } from './types-Dlbz_JRA.cjs';
2
2
 
3
3
  declare const WEBHOOK_EVENTS: {
4
4
  readonly COLLECTION_CREATE: "collection.create";
@@ -16,6 +16,16 @@ declare const WEBHOOK_EVENTS: {
16
16
  };
17
17
  type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
18
18
  declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
19
+ type WebhookActionType = "generic" | "github-dispatch" | "dokploy-deploy" | "coolify-deploy";
20
+ interface WebhookActionConfig {
21
+ githubOwner?: string;
22
+ githubRepo?: string;
23
+ githubEventType?: string;
24
+ dokployProjectId?: string;
25
+ dokployBranch?: string;
26
+ coolifyProjectUuid?: string;
27
+ coolifyEnvironmentName?: string;
28
+ }
19
29
  interface WebhookConfig {
20
30
  id: string;
21
31
  name: string;
@@ -25,6 +35,8 @@ interface WebhookConfig {
25
35
  status: "active" | "inactive" | "error";
26
36
  secret?: string;
27
37
  headers?: Record<string, string>;
38
+ action?: WebhookActionType;
39
+ config?: WebhookActionConfig;
28
40
  lastTriggered?: string;
29
41
  lastError?: string;
30
42
  createdAt: string;
@@ -38,6 +50,8 @@ interface CreateWebhookData {
38
50
  status?: "active" | "inactive";
39
51
  secret?: string;
40
52
  headers?: Record<string, string>;
53
+ action?: WebhookActionType;
54
+ config?: WebhookActionConfig;
41
55
  }
42
56
  interface UpdateWebhookData {
43
57
  name?: string;
@@ -47,6 +61,8 @@ interface UpdateWebhookData {
47
61
  status?: "active" | "inactive" | "error";
48
62
  secret?: string;
49
63
  headers?: Record<string, string>;
64
+ action?: WebhookActionType;
65
+ config?: WebhookActionConfig;
50
66
  lastTriggered?: string | null;
51
67
  lastError?: string | null;
52
68
  }
@@ -92,6 +108,22 @@ interface WebhookTriggerResult {
92
108
  }
93
109
  declare const WEBHOOK_COLLECTION = "_webhooks";
94
110
  declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
111
+ interface DeliveryResult {
112
+ success: boolean;
113
+ status: number;
114
+ statusText?: string;
115
+ body?: string;
116
+ duration: number;
117
+ error?: string;
118
+ }
119
+ interface DeliveryOptions {
120
+ timeout?: number;
121
+ maxRetries?: number;
122
+ retryDelay?: number;
123
+ onRetry?: (attempt: number, error: string) => void;
124
+ onSuccess?: (result: DeliveryResult) => void;
125
+ onFailure?: (error: string) => void;
126
+ }
95
127
 
96
128
  declare class WebhookService {
97
129
  private db;
@@ -112,4 +144,4 @@ declare class WebhookService {
112
144
  }
113
145
  declare function createWebhookService(db: BaseAdapter): WebhookService;
114
146
 
115
- export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, WebhookService as c, WEBHOOK_COLLECTION as d, WEBHOOK_DELIVERY_COLLECTION as e, WEBHOOK_EVENTS as f, type WebhookEvent as g, type WebhookTriggerResult as h, createWebhookService as i };
147
+ export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type DeliveryResult as D, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, type DeliveryOptions as c, WebhookService as d, WEBHOOK_COLLECTION as e, WEBHOOK_DELIVERY_COLLECTION as f, WEBHOOK_EVENTS as g, type WebhookEvent as h, type WebhookTriggerResult as i, createWebhookService as j };
@@ -1,4 +1,4 @@
1
- import { B as BaseAdapter } from './types-Cxb3Ukwl.js';
1
+ import { B as BaseAdapter } from './types-HgePo7uw.js';
2
2
 
3
3
  declare const WEBHOOK_EVENTS: {
4
4
  readonly COLLECTION_CREATE: "collection.create";
@@ -16,6 +16,16 @@ declare const WEBHOOK_EVENTS: {
16
16
  };
17
17
  type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
18
18
  declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
19
+ type WebhookActionType = "generic" | "github-dispatch" | "dokploy-deploy" | "coolify-deploy";
20
+ interface WebhookActionConfig {
21
+ githubOwner?: string;
22
+ githubRepo?: string;
23
+ githubEventType?: string;
24
+ dokployProjectId?: string;
25
+ dokployBranch?: string;
26
+ coolifyProjectUuid?: string;
27
+ coolifyEnvironmentName?: string;
28
+ }
19
29
  interface WebhookConfig {
20
30
  id: string;
21
31
  name: string;
@@ -25,6 +35,8 @@ interface WebhookConfig {
25
35
  status: "active" | "inactive" | "error";
26
36
  secret?: string;
27
37
  headers?: Record<string, string>;
38
+ action?: WebhookActionType;
39
+ config?: WebhookActionConfig;
28
40
  lastTriggered?: string;
29
41
  lastError?: string;
30
42
  createdAt: string;
@@ -38,6 +50,8 @@ interface CreateWebhookData {
38
50
  status?: "active" | "inactive";
39
51
  secret?: string;
40
52
  headers?: Record<string, string>;
53
+ action?: WebhookActionType;
54
+ config?: WebhookActionConfig;
41
55
  }
42
56
  interface UpdateWebhookData {
43
57
  name?: string;
@@ -47,6 +61,8 @@ interface UpdateWebhookData {
47
61
  status?: "active" | "inactive" | "error";
48
62
  secret?: string;
49
63
  headers?: Record<string, string>;
64
+ action?: WebhookActionType;
65
+ config?: WebhookActionConfig;
50
66
  lastTriggered?: string | null;
51
67
  lastError?: string | null;
52
68
  }
@@ -92,6 +108,22 @@ interface WebhookTriggerResult {
92
108
  }
93
109
  declare const WEBHOOK_COLLECTION = "_webhooks";
94
110
  declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
111
+ interface DeliveryResult {
112
+ success: boolean;
113
+ status: number;
114
+ statusText?: string;
115
+ body?: string;
116
+ duration: number;
117
+ error?: string;
118
+ }
119
+ interface DeliveryOptions {
120
+ timeout?: number;
121
+ maxRetries?: number;
122
+ retryDelay?: number;
123
+ onRetry?: (attempt: number, error: string) => void;
124
+ onSuccess?: (result: DeliveryResult) => void;
125
+ onFailure?: (error: string) => void;
126
+ }
95
127
 
96
128
  declare class WebhookService {
97
129
  private db;
@@ -112,4 +144,4 @@ declare class WebhookService {
112
144
  }
113
145
  declare function createWebhookService(db: BaseAdapter): WebhookService;
114
146
 
115
- export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, WebhookService as c, WEBHOOK_COLLECTION as d, WEBHOOK_DELIVERY_COLLECTION as e, WEBHOOK_EVENTS as f, type WebhookEvent as g, type WebhookTriggerResult as h, createWebhookService as i };
147
+ export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type DeliveryResult as D, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, type DeliveryOptions as c, WebhookService as d, WEBHOOK_COLLECTION as e, WEBHOOK_DELIVERY_COLLECTION as f, WEBHOOK_EVENTS as g, type WebhookEvent as h, type WebhookTriggerResult as i, createWebhookService as j };
@@ -1 +1 @@
1
- 'use strict';var chunkMOMALAYX_cjs=require('./chunk-MOMALAYX.cjs');require('./chunk-QEKTGNUJ.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-KD7LUCFY.cjs'),require('./chunk-BDBN4RN6.cjs'),require('./chunk-O7FYIPJW.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-F7SR5IDT.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-QAJS4EXW.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-DNLO7PK6.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-W4ZDETHA.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-AHSFSERC.cjs');function n(e){return new Response(e.body,e)}var p={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function r(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function o(){try{return (await chunkMOMALAYX_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??p.graphqlEnabled}catch{return true}}var l=async e=>{if(await chunkMOMALAYX_cjs.b(),!await o())return r();let t=await chunkMOMALAYX_cjs.a.getGraphQL().fetch(e.request,e.locals);return n(t)},u=async e=>{if(await chunkMOMALAYX_cjs.b(),!await o())return r();let t=await chunkMOMALAYX_cjs.a.getGraphQL().fetch(e.request,e.locals);return n(t)};exports.GET=u;exports.POST=l;
1
+ 'use strict';var chunk2MRO4YLX_cjs=require('./chunk-2MRO4YLX.cjs');require('./chunk-KY3Q7LFE.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-KD7LUCFY.cjs'),require('./chunk-ER2PUSHG.cjs'),require('./chunk-HS2KNFAB.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-G3J2EU5D.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-IC7UOIHY.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-UCCFT5OO.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-EJDIR56C.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-AHSFSERC.cjs');function n(e){return new Response(e.body,e)}var p={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function r(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function o(){try{return (await chunk2MRO4YLX_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??p.graphqlEnabled}catch{return true}}var l=async e=>{if(await chunk2MRO4YLX_cjs.b(),!await o())return r();let t=await chunk2MRO4YLX_cjs.a.getGraphQL().fetch(e.request,e.locals);return n(t)},u=async e=>{if(await chunk2MRO4YLX_cjs.b(),!await o())return r();let t=await chunk2MRO4YLX_cjs.a.getGraphQL().fetch(e.request,e.locals);return n(t)};exports.GET=u;exports.POST=l;
@@ -1 +1 @@
1
- import {b,a}from'./chunk-CAD6VWL5.js';import'./chunk-HM2Y4R77.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-5SEHX7ON.js';import'./chunk-GJQH6NV7.js';import'./chunk-XQPYBNIT.js';import'./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-SL3LZQCF.js';import'./chunk-PP5S2UBV.js';import'./chunk-MTFJDAPX.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-7ORSLR3S.js';import'./chunk-P7CESLDJ.js';import'./chunk-4YYBWCDJ.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';function n(e){return new Response(e.body,e)}var p={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function r(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function o(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??p.graphqlEnabled}catch{return true}}var l=async e=>{if(await b(),!await o())return r();let t=await a.getGraphQL().fetch(e.request,e.locals);return n(t)},u=async e=>{if(await b(),!await o())return r();let t=await a.getGraphQL().fetch(e.request,e.locals);return n(t)};export{u as GET,l as POST};
1
+ import {b,a}from'./chunk-JLIXKA4D.js';import'./chunk-YKQG6NBC.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-5SEHX7ON.js';import'./chunk-5BPMMIAQ.js';import'./chunk-PP7W5UKL.js';import'./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-GKYEJ2UF.js';import'./chunk-PP5S2UBV.js';import'./chunk-MRVECVMR.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-YPDRUVWG.js';import'./chunk-P7CESLDJ.js';import'./chunk-TQNM4C7H.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';function n(e){return new Response(e.body,e)}var p={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function r(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function o(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??p.graphqlEnabled}catch{return true}}var l=async e=>{if(await b(),!await o())return r();let t=await a.getGraphQL().fetch(e.request,e.locals);return n(t)},u=async e=>{if(await b(),!await o())return r();let t=await a.getGraphQL().fetch(e.request,e.locals);return n(t)};export{u as GET,l as POST};
@@ -1 +1 @@
1
- 'use strict';var chunkMOMALAYX_cjs=require('./chunk-MOMALAYX.cjs');require('./chunk-QEKTGNUJ.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-KD7LUCFY.cjs'),require('./chunk-BDBN4RN6.cjs'),require('./chunk-O7FYIPJW.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-F7SR5IDT.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-QAJS4EXW.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-DNLO7PK6.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-W4ZDETHA.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-AHSFSERC.cjs');function n(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var r={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function s(){try{return (await chunkMOMALAYX_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??r.trpcEnabled}catch{return true}}var i=async e=>(await chunkMOMALAYX_cjs.b(),await s()?chunkMOMALAYX_cjs.a.getTRPC().fetch(e.request,e.locals):n());exports.ALL=i;
1
+ 'use strict';var chunk2MRO4YLX_cjs=require('./chunk-2MRO4YLX.cjs');require('./chunk-KY3Q7LFE.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-KD7LUCFY.cjs'),require('./chunk-ER2PUSHG.cjs'),require('./chunk-HS2KNFAB.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-G3J2EU5D.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-IC7UOIHY.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-UCCFT5OO.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-EJDIR56C.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-AHSFSERC.cjs');function n(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var r={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function s(){try{return (await chunk2MRO4YLX_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??r.trpcEnabled}catch{return true}}var i=async e=>(await chunk2MRO4YLX_cjs.b(),await s()?chunk2MRO4YLX_cjs.a.getTRPC().fetch(e.request,e.locals):n());exports.ALL=i;
@@ -1 +1 @@
1
- import {b,a}from'./chunk-CAD6VWL5.js';import'./chunk-HM2Y4R77.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-5SEHX7ON.js';import'./chunk-GJQH6NV7.js';import'./chunk-XQPYBNIT.js';import'./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-SL3LZQCF.js';import'./chunk-PP5S2UBV.js';import'./chunk-MTFJDAPX.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-7ORSLR3S.js';import'./chunk-P7CESLDJ.js';import'./chunk-4YYBWCDJ.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';function n(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var r={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function s(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??r.trpcEnabled}catch{return true}}var i=async e=>(await b(),await s()?a.getTRPC().fetch(e.request,e.locals):n());export{i as ALL};
1
+ import {b,a}from'./chunk-JLIXKA4D.js';import'./chunk-YKQG6NBC.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-5SEHX7ON.js';import'./chunk-5BPMMIAQ.js';import'./chunk-PP7W5UKL.js';import'./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-GKYEJ2UF.js';import'./chunk-PP5S2UBV.js';import'./chunk-MRVECVMR.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-YPDRUVWG.js';import'./chunk-P7CESLDJ.js';import'./chunk-TQNM4C7H.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';function n(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var r={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function s(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??r.trpcEnabled}catch{return true}}var i=async e=>(await b(),await s()?a.getTRPC().fetch(e.request,e.locals):n());export{i as ALL};
@@ -1 +1 @@
1
- 'use strict';var chunkMOMALAYX_cjs=require('./chunk-MOMALAYX.cjs');require('./chunk-QEKTGNUJ.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-KD7LUCFY.cjs'),require('./chunk-BDBN4RN6.cjs'),require('./chunk-O7FYIPJW.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-F7SR5IDT.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-QAJS4EXW.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-DNLO7PK6.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-W4ZDETHA.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"ALL",{enumerable:true,get:function(){return chunkMOMALAYX_cjs.c}});Object.defineProperty(exports,"kyroInstance",{enumerable:true,get:function(){return chunkMOMALAYX_cjs.a}});Object.defineProperty(exports,"warmKyroInstance",{enumerable:true,get:function(){return chunkMOMALAYX_cjs.b}});
1
+ 'use strict';var chunk2MRO4YLX_cjs=require('./chunk-2MRO4YLX.cjs');require('./chunk-KY3Q7LFE.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-KD7LUCFY.cjs'),require('./chunk-ER2PUSHG.cjs'),require('./chunk-HS2KNFAB.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-G3J2EU5D.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-IC7UOIHY.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-UCCFT5OO.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-EJDIR56C.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"ALL",{enumerable:true,get:function(){return chunk2MRO4YLX_cjs.c}});Object.defineProperty(exports,"kyroInstance",{enumerable:true,get:function(){return chunk2MRO4YLX_cjs.a}});Object.defineProperty(exports,"warmKyroInstance",{enumerable:true,get:function(){return chunk2MRO4YLX_cjs.b}});
@@ -1 +1 @@
1
- export{c as ALL,a as kyroInstance,b as warmKyroInstance}from'./chunk-CAD6VWL5.js';import'./chunk-HM2Y4R77.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-5SEHX7ON.js';import'./chunk-GJQH6NV7.js';import'./chunk-XQPYBNIT.js';import'./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-SL3LZQCF.js';import'./chunk-PP5S2UBV.js';import'./chunk-MTFJDAPX.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-7ORSLR3S.js';import'./chunk-P7CESLDJ.js';import'./chunk-4YYBWCDJ.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';
1
+ export{c as ALL,a as kyroInstance,b as warmKyroInstance}from'./chunk-JLIXKA4D.js';import'./chunk-YKQG6NBC.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-5SEHX7ON.js';import'./chunk-5BPMMIAQ.js';import'./chunk-PP7W5UKL.js';import'./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-GKYEJ2UF.js';import'./chunk-PP5S2UBV.js';import'./chunk-MRVECVMR.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-YPDRUVWG.js';import'./chunk-P7CESLDJ.js';import'./chunk-TQNM4C7H.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';
@@ -1,4 +1,4 @@
1
- import { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, T as TenantContext, 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 { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, T as TenantContext, 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';
2
2
  import { F as Field, k as RelationshipField, U as UploadField } from './types-CIJsFuvf.js';
3
3
 
4
4
  declare abstract class AbstractBaseAdapter implements BaseAdapter {
@@ -19,19 +19,19 @@ declare abstract class AbstractBaseAdapter implements BaseAdapter {
19
19
  abstract count(args: {
20
20
  collection: string;
21
21
  where?: Record<string, any>;
22
- tenantID?: string;
22
+ tenantId?: string;
23
23
  }): Promise<number>;
24
24
  abstract findOne(args: {
25
25
  collection: string;
26
26
  where: Record<string, any>;
27
- tenantID?: string;
27
+ tenantId?: string;
28
28
  draft?: boolean;
29
29
  }): Promise<any>;
30
30
  abstract findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
31
31
  abstract findVersionByID(args: {
32
32
  collection: string;
33
33
  versionId: string;
34
- tenantID?: string;
34
+ tenantId?: string;
35
35
  }): Promise<VersionRecord | null>;
36
36
  abstract createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
37
37
  abstract updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
@@ -39,13 +39,13 @@ declare abstract class AbstractBaseAdapter implements BaseAdapter {
39
39
  collection: string;
40
40
  documentId: string;
41
41
  keepLatest?: number;
42
- tenantID?: string;
42
+ tenantId?: string;
43
43
  }): Promise<void>;
44
44
  migrate?(): Promise<void>;
45
45
  rollback?(): Promise<void>;
46
46
  transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
47
47
  protected getCollection(slug: string): CollectionConfig;
48
- protected applyTenantFilter(where?: Record<string, any>, tenantID?: string): Record<string, any>;
48
+ protected applyTenantFilter(where?: Record<string, any>, tenantId?: string): Record<string, any>;
49
49
  protected getTableName(slug: string): string;
50
50
  protected prepareData(data: Record<string, any>, collection: CollectionConfig): Record<string, any>;
51
51
  protected processRelationships(data: Record<string, any>, fields: Field[], depth: number): Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, T as TenantContext, 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 { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, T as TenantContext, 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';
2
2
  import { F as Field, k as RelationshipField, U as UploadField } from './types-CIJsFuvf.cjs';
3
3
 
4
4
  declare abstract class AbstractBaseAdapter implements BaseAdapter {
@@ -19,19 +19,19 @@ declare abstract class AbstractBaseAdapter implements BaseAdapter {
19
19
  abstract count(args: {
20
20
  collection: string;
21
21
  where?: Record<string, any>;
22
- tenantID?: string;
22
+ tenantId?: string;
23
23
  }): Promise<number>;
24
24
  abstract findOne(args: {
25
25
  collection: string;
26
26
  where: Record<string, any>;
27
- tenantID?: string;
27
+ tenantId?: string;
28
28
  draft?: boolean;
29
29
  }): Promise<any>;
30
30
  abstract findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
31
31
  abstract findVersionByID(args: {
32
32
  collection: string;
33
33
  versionId: string;
34
- tenantID?: string;
34
+ tenantId?: string;
35
35
  }): Promise<VersionRecord | null>;
36
36
  abstract createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
37
37
  abstract updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
@@ -39,13 +39,13 @@ declare abstract class AbstractBaseAdapter implements BaseAdapter {
39
39
  collection: string;
40
40
  documentId: string;
41
41
  keepLatest?: number;
42
- tenantID?: string;
42
+ tenantId?: string;
43
43
  }): Promise<void>;
44
44
  migrate?(): Promise<void>;
45
45
  rollback?(): Promise<void>;
46
46
  transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
47
47
  protected getCollection(slug: string): CollectionConfig;
48
- protected applyTenantFilter(where?: Record<string, any>, tenantID?: string): Record<string, any>;
48
+ protected applyTenantFilter(where?: Record<string, any>, tenantId?: string): Record<string, any>;
49
49
  protected getTableName(slug: string): string;
50
50
  protected prepareData(data: Record<string, any>, collection: CollectionConfig): Record<string, any>;
51
51
  protected processRelationships(data: Record<string, any>, fields: Field[], depth: number): Record<string, any>;
@@ -1 +1 @@
1
- 'use strict';var chunkQEKTGNUJ_cjs=require('./chunk-QEKTGNUJ.cjs'),chunkUJNSOOYZ_cjs=require('./chunk-UJNSOOYZ.cjs'),chunkET6NN2V2_cjs=require('./chunk-ET6NN2V2.cjs'),chunkQAJS4EXW_cjs=require('./chunk-QAJS4EXW.cjs'),chunkGYQMNXXW_cjs=require('./chunk-GYQMNXXW.cjs'),chunkDNLO7PK6_cjs=require('./chunk-DNLO7PK6.cjs'),chunkATLSIYRH_cjs=require('./chunk-ATLSIYRH.cjs'),A=require('kyro:config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);exports.a=null;var n=null;async function g(){if(!exports.a)try{let e=A__default.default.default||A__default.default;exports.a=chunkQEKTGNUJ_cjs.q(e),await exports.a.init(),await exports.a.loadSettings();let a=exports.a.db,r;if(a instanceof chunkQAJS4EXW_cjs.c){if(a.dialect==="postgres")r=new chunkGYQMNXXW_cjs.a({db:a.client});else if(a.dialect==="sqlite"){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new chunkET6NN2V2_cjs.a({path:s});}}else if(a instanceof chunkQEKTGNUJ_cjs.r){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new chunkET6NN2V2_cjs.a({path:s});}else a instanceof chunkDNLO7PK6_cjs.a&&(r=new chunkATLSIYRH_cjs.a({db:a.db}));r?.connect&&await r.connect(),(await chunkUJNSOOYZ_cjs.d(r))?.success,typeof exports.a.startWebSocket=="function"&&exports.a.startWebSocket().catch(s=>{console.error("[Kyro] WebSocket auto-start failed:",s);}),globalThis.__KYRO_INSTANCE__=exports.a;}catch(e){throw exports.a=null,n=null,console.error("[Kyro API] Init failed, will retry:",e),e}}async function q(){n||(n=g()),await n;}var w={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function b(e){try{return (await exports.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.[e]??w[e]??!0}catch{return true}}var v=async e=>{if(!exports.a){n||(n=g());try{await Promise.race([n,new Promise((l,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch{return new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}}let r=new URL(e.request.url).pathname,i=__KYRO_API_PATH__;if(r===`${i}/graphql`&&typeof exports.a.getGraphQL=="function"){if(!await b("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let o=await exports.a.getGraphQL().fetch(e.request,e.locals);return new Response(o.body,o)}if(r.startsWith(`${i}/trpc/`)&&typeof exports.a.getTRPC=="function"){if(!await b("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let o=await exports.a.getTRPC().fetch(e.request,e.locals);return new Response(o.body,o)}return exports.a.getREST().fetch(e.request,e.locals)};exports.b=q;exports.c=v;
1
+ 'use strict';var chunkKY3Q7LFE_cjs=require('./chunk-KY3Q7LFE.cjs'),chunkUJNSOOYZ_cjs=require('./chunk-UJNSOOYZ.cjs'),chunkET6NN2V2_cjs=require('./chunk-ET6NN2V2.cjs'),chunkIC7UOIHY_cjs=require('./chunk-IC7UOIHY.cjs'),chunkGYQMNXXW_cjs=require('./chunk-GYQMNXXW.cjs'),chunkUCCFT5OO_cjs=require('./chunk-UCCFT5OO.cjs'),chunkATLSIYRH_cjs=require('./chunk-ATLSIYRH.cjs'),A=require('kyro:config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);exports.a=null;var n=null;async function g(){if(!exports.a)try{let e=A__default.default.default||A__default.default;exports.a=chunkKY3Q7LFE_cjs.q(e),await exports.a.init(),await exports.a.loadSettings();let a=exports.a.db,r;if(a instanceof chunkIC7UOIHY_cjs.c){if(a.dialect==="postgres")r=new chunkGYQMNXXW_cjs.a({db:a.client});else if(a.dialect==="sqlite"){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new chunkET6NN2V2_cjs.a({path:s});}}else if(a instanceof chunkKY3Q7LFE_cjs.r){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new chunkET6NN2V2_cjs.a({path:s});}else a instanceof chunkUCCFT5OO_cjs.a&&(r=new chunkATLSIYRH_cjs.a({db:a.db}));r?.connect&&await r.connect(),(await chunkUJNSOOYZ_cjs.d(r))?.success,typeof exports.a.startWebSocket=="function"&&exports.a.startWebSocket().catch(s=>{console.error("[Kyro] WebSocket auto-start failed:",s);}),globalThis.__KYRO_INSTANCE__=exports.a;}catch(e){throw exports.a=null,n=null,console.error("[Kyro API] Init failed, will retry:",e),e}}async function q(){n||(n=g()),await n;}var w={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function b(e){try{return (await exports.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.[e]??w[e]??!0}catch{return true}}var v=async e=>{if(!exports.a){n||(n=g());try{await Promise.race([n,new Promise((l,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch{return new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}}let r=new URL(e.request.url).pathname,i=__KYRO_API_PATH__;if(r===`${i}/graphql`&&typeof exports.a.getGraphQL=="function"){if(!await b("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let o=await exports.a.getGraphQL().fetch(e.request,e.locals);return new Response(o.body,o)}if(r.startsWith(`${i}/trpc/`)&&typeof exports.a.getTRPC=="function"){if(!await b("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let o=await exports.a.getTRPC().fetch(e.request,e.locals);return new Response(o.body,o)}return exports.a.getREST().fetch(e.request,e.locals)};exports.b=q;exports.c=v;
@@ -1 +1 @@
1
- import {d,o,a,b,c}from'./chunk-QIP7PY2U.js';import {f,e,g}from'./chunk-HLSB2MCK.js';async function T(e$1){let a=o(e$1.db),t={db:e$1.db,registry:e$1.registry,req:e$1.req,user:e$1.user,tenantID:e$1.tenantID,webhookService:a,settings:e$1.settings},n=f(e$1.req);if(n){let r=await e(n,e$1.db,async o=>{try{return await e$1.db.findByID({collection:"users",id:o})||null}catch{return null}});r.valid&&(t.user=r.user||e$1.user,t.tenantID=r.tenantId||e$1.tenantID,t.apiKey=g(r));}return t}var W={_media:{create:d.MEDIA_UPLOAD,update:d.MEDIA_UPLOAD,delete:d.MEDIA_DELETE}};function k(e,a){let t=W[e];return t?t[a]:`collection.${a}`}async function A(e,a,t){if(e.webhookService)try{await e.webhookService.trigger(a,{collection:t.collection,operation:t.operation,data:t.data,previousData:t.previousData,user:e.user?{id:e.user.id,email:e.user.email,role:e.user.role}:void 0,tenantId:e.tenantID});}catch(n){console.error(`[Webhook] Failed to trigger ${a}:`,n);}}function D(e,a){if(!(!e||typeof e!="object"))for(let t of a){if(!t.name||!(t.name in e))continue;if(e[t.name]===""&&(t.type==="text"||t.type==="textarea"||t.type==="code"||t.type==="markdown"||t.type==="email"||t.type==="password"||t.type==="color"||(e[t.name]=null)),t.type==="tabs"&&t.name&&Array.isArray(t.tabs)&&e[t.name]&&typeof e[t.name]=="object")for(let r of t.tabs)Array.isArray(r.fields)&&D(e[t.name],r.fields);else if((t.type==="group"||t.type==="collapsible")&&t.name&&Array.isArray(t.fields)&&e[t.name]&&typeof e[t.name]=="object")D(e[t.name],t.fields);else if(t.type==="array"&&t.name&&Array.isArray(t.fields)&&Array.isArray(e[t.name]))for(let r of e[t.name])r&&typeof r=="object"&&D(r,t.fields);else if(t.type==="blocks"&&t.name&&Array.isArray(t.blocks)&&Array.isArray(e[t.name]))for(let r of e[t.name]){if(!r||typeof r!="object")continue;let o=r.type||r.blockType;if(!o)continue;let s=t.blocks.find(i=>i.slug===o);if(!s||!Array.isArray(s.fields))continue;let c=r.data&&typeof r.data=="object"?r.data:r;D(c,s.fields);}}}async function p(e,a,t){let n=await b(e,a,{user:t.user,req:t.req,tenantID:t.tenantID,apiKey:t.apiKey});if(!n.allowed)throw new Error(n.error||"Access denied");t.tenantID&&t.db.setTenantContext({tenantId:t.tenantID,userId:t.user?.id??"",role:t.user?.role,isSuperAdmin:t.user?.role==="super_admin"});}function C(e){return async a$1=>{let{collection:t,where:n,sort:r,limit:o,page:s,depth:c,select:i,draft:d}=a$1,u=e.registry.getCollection(t);if(await p(u,"read",e),u.hooks?.beforeRead)for(let f of u.hooks.beforeRead)await f({collection:t,req:e.req,user:e.user,tenantID:e.tenantID,operation:"read",where:n});let l=d??!!e.user,g=await e.db.find({collection:t,where:n||{},sort:r,limit:o||10,page:s||1,depth:c||0,tenantID:e.tenantID,select:i,draft:l});if(u.hooks?.afterRead)for(let f of g.docs)for(let I of u.hooks.afterRead)await I({collection:t,doc:f,req:e.req,user:e.user,tenantID:e.tenantID,operation:"read"});return await a(g.docs,u.fields,e.db,e.registry,1,c||0),g}}function R(e){return async a$1=>{let{collection:t,id:n,depth:r,select:o,draft:s}=a$1,c=e.registry.getCollection(t);await p(c,"read",e);let i=s??!!e.user,d=await e.db.findByID({collection:t,id:n,depth:r||0,tenantID:e.tenantID,select:o,draft:i});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(c.hooks?.afterRead)for(let u of c.hooks.afterRead)await u({collection:t,doc:d,req:e.req,user:e.user,tenantID:e.tenantID,operation:"read",id:n});return await a([d],c.fields,e.db,e.registry,1,r||0),d}}function q(e){return async a=>{let{collection:t,data:n,depth:r,select:o}=a,s=e.registry.getCollection(t);await p(s,"create",e);let i=e.registry.getCreateZodSchema(t).parse(n);if(s.tenantScoped&&e.tenantID&&(i.tenantID=e.tenantID),s.hooks?.beforeValidate)for(let u of s.hooks.beforeValidate){let l=await u({collection:t,data:i,req:e.req,user:e.user,tenantID:e.tenantID,operation:"create"});l&&Object.assign(i,l);}if(s.hooks?.beforeChange)for(let u of s.hooks.beforeChange){let l=await u({collection:t,data:i,req:e.req,user:e.user,tenantID:e.tenantID,operation:"create"});l&&Object.assign(i,l);}let d=await e.db.create({collection:t,data:i,depth:r||0,tenantID:e.tenantID,select:o});if(s.hooks?.afterChange)for(let u of s.hooks.afterChange)await u({collection:t,doc:d,data:i,req:e.req,user:e.user,tenantID:e.tenantID,operation:"create"});return await A(e,k(t,"create"),{collection:t,data:d,operation:"create"}),{doc:d}}}function P(e){return async a=>{let{collection:t,id:n,data:r,depth:o,select:s,baseUpdatedAt:c}=a,i=e.registry.getCollection(t);await p(i,"update",e);let d=await e.db.findByID({collection:t,id:n,tenantID:e.tenantID,draft:true});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(c&&d.updatedAt&&c!==d.updatedAt)throw new Error(`Revision conflict: document has changed since ${c}. Current updatedAt: ${d.updatedAt}`);D(r,i.fields);let l=e.registry.getUpdateZodSchema(t).parse(r);if(i.tenantScoped&&e.tenantID&&(l.tenantID=e.tenantID),i.hooks?.beforeValidate)for(let b of i.hooks.beforeValidate){let h=await b({collection:t,data:l,originalDoc:d,req:e.req,user:e.user,tenantID:e.tenantID,operation:"update",id:n});h&&Object.assign(l,h);}if(i.hooks?.beforeChange)for(let b of i.hooks.beforeChange){let h=await b({collection:t,data:l,originalDoc:d,req:e.req,user:e.user,tenantID:e.tenantID,operation:"update",id:n});h&&Object.assign(l,h);}let g=e.req&&typeof e.req.headers?.get=="function"&&e.req.headers.get("x-draft")==="true"||a.draft===true,f=i.versions?.drafts===true,I=e.req?.query?.autosave==="true"||e.req?.url?.includes("autosave=true")||a.autosave===true,y;if(f&&g?(await e.db.createVersion({collection:t,documentId:n,data:l,status:"draft",autosave:I,createdBy:e.user?.id,tenantID:e.tenantID}),y=await e.db.findByID({collection:t,id:n,tenantID:e.tenantID,draft:true})):f?(y=await e.db.update({collection:t,id:n,data:{...l,status:"published"},depth:o||0,tenantID:e.tenantID,select:s}),await e.db.createVersion({collection:t,documentId:n,data:l,status:"published",createdBy:e.user?.id,tenantID:e.tenantID})):y=await e.db.update({collection:t,id:n,data:l,depth:o||0,tenantID:e.tenantID,select:s}),i.hooks?.afterChange)for(let b of i.hooks.afterChange)await b({collection:t,doc:y,data:l,originalDoc:d,req:e.req,user:e.user,tenantID:e.tenantID,operation:"update",id:n});return await A(e,k(t,"update"),{collection:t,data:y,previousData:d,operation:"update"}),{doc:y}}}function v(e){return async a=>{let{collection:t,id:n}=a,r=e.registry.getCollection(t);await p(r,"delete",e);let o=await e.db.findByID({collection:t,id:n,tenantID:e.tenantID,draft:true});if(!o)throw new Error(`Document not found: ${t}/${n}`);if(r.hooks?.beforeDelete)for(let c of r.hooks.beforeDelete)await c({collection:t,doc:o,req:e.req,user:e.user,tenantID:e.tenantID,operation:"delete",id:n});let s=await e.db.delete({collection:t,id:n,tenantID:e.tenantID});if(r.hooks?.afterDelete)for(let c of r.hooks.afterDelete)await c({collection:t,doc:s,req:e.req,user:e.user,tenantID:e.tenantID,operation:"delete",id:n});return await A(e,k(t,"delete"),{collection:t,data:s,previousData:o,operation:"delete"}),{doc:s,message:"Deleted successfully"}}}function K(e){return async a=>{let{collection:t,where:n}=a,r=e.registry.getCollection(t);return await p(r,"read",e),{totalDocs:await e.db.count({collection:t,where:n||{},tenantID:e.tenantID})}}}async function U(e,a,t){let n=await c(e,a,{user:t.user,req:t.req,tenantID:t.tenantID});if(!n.allowed)throw new Error(n.error||"Access denied");t.tenantID&&t.db.setTenantContext({tenantId:t.tenantID,userId:t.user?.id??"",role:t.user?.role,isSuperAdmin:t.user?.role==="super_admin"});}function $(e){let a={},t=e.registry.getCollections();for(let r of t){let o=r.slug;a[o]={find:C(e),findByID:R(e),create:q(e),update:P(e),delete:v(e),count:K(e)};}let n=e.registry.getGlobals();for(let r of n){let o=r.slug;a[`_globals_${o}`]={get:async()=>(await U(r,"read",e),await e.db.findOne({collection:`_globals_${o}`,where:{},tenantID:e.tenantID})),update:async s=>{await U(r,"update",e);let i=e.registry.getZodSchema(o).parse(s.data),d=await e.db.findOne({collection:`_globals_${o}`,where:{},tenantID:e.tenantID,draft:true}),u;return d?u=await e.db.update({collection:`_globals_${o}`,id:d.id,data:i,tenantID:e.tenantID}):u=await e.db.create({collection:`_globals_${o}`,data:{...i,id:o},tenantID:e.tenantID}),u}};}return a}function O(e){if(e.settings?.access?.apiAccess?.trpcEnabled===false)throw new Error("tRPC API is disabled");return $(e)}export{T as a,C as b,R as c,q as d,P as e,v as f,K as g,$ as h,O as i};
1
+ import {d,o,a,b,c}from'./chunk-KG7V6O2Z.js';import {f,e,g}from'./chunk-HLSB2MCK.js';async function T(e$1){let a=o(e$1.db),t={db:e$1.db,registry:e$1.registry,req:e$1.req,user:e$1.user,tenantId:e$1.tenantId,webhookService:a,settings:e$1.settings},n=f(e$1.req);if(n){let r=await e(n,e$1.db,async o=>{try{return await e$1.db.findByID({collection:"users",id:o})||null}catch{return null}});r.valid&&(t.user=r.user||e$1.user,t.tenantId=r.tenantId||e$1.tenantId,t.apiKey=g(r));}return t}var W={_media:{create:d.MEDIA_UPLOAD,update:d.MEDIA_UPLOAD,delete:d.MEDIA_DELETE}};function A(e,a){let t=W[e];return t?t[a]:`collection.${a}`}async function C(e,a,t){if(e.webhookService)try{await e.webhookService.trigger(a,{collection:t.collection,operation:t.operation,data:t.data,previousData:t.previousData,user:e.user?{id:e.user.id,email:e.user.email,role:e.user.role}:void 0,tenantId:e.tenantId});}catch(n){console.error(`[Webhook] Failed to trigger ${a}:`,n);}}function m(e,a){if(!(!e||typeof e!="object"))for(let t of a){if(!t.name||!(t.name in e))continue;if(e[t.name]===""&&(t.type==="text"||t.type==="textarea"||t.type==="code"||t.type==="markdown"||t.type==="email"||t.type==="password"||t.type==="color"||(e[t.name]=null)),t.type==="tabs"&&t.name&&Array.isArray(t.tabs)&&e[t.name]&&typeof e[t.name]=="object")for(let r of t.tabs)Array.isArray(r.fields)&&m(e[t.name],r.fields);else if((t.type==="group"||t.type==="collapsible")&&t.name&&Array.isArray(t.fields)&&e[t.name]&&typeof e[t.name]=="object")m(e[t.name],t.fields);else if(t.type==="array"&&t.name&&Array.isArray(t.fields)&&Array.isArray(e[t.name]))for(let r of e[t.name])r&&typeof r=="object"&&m(r,t.fields);else if(t.type==="blocks"&&t.name&&Array.isArray(t.blocks)&&Array.isArray(e[t.name]))for(let r of e[t.name]){if(!r||typeof r!="object")continue;let o=r.type||r.blockType;if(!o)continue;let s=t.blocks.find(i=>i.slug===o);if(!s||!Array.isArray(s.fields))continue;let c=r.data&&typeof r.data=="object"?r.data:r;m(c,s.fields);}}}async function p(e,a,t){let n=await b(e,a,{user:t.user,req:t.req,tenantId:t.tenantId,apiKey:t.apiKey});if(!n.allowed)throw new Error(n.error||"Access denied");t.tenantId&&t.db.setTenantContext({tenantId:t.tenantId,userId:t.user?.id??"",role:t.user?.role,isSuperAdmin:t.user?.role==="super_admin"});}function D(e){return async a$1=>{let{collection:t,where:n,sort:r,limit:o,page:s,depth:c,select:i,draft:d}=a$1,u=e.registry.getCollection(t);if(await p(u,"read",e),u.hooks?.beforeRead)for(let f of u.hooks.beforeRead)await f({collection:t,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read",where:n});let l=d??!!e.user,g=await e.db.find({collection:t,where:n||{},sort:r,limit:o||10,page:s||1,depth:c||0,tenantId:e.tenantId,select:i,draft:l});if(u.hooks?.afterRead)for(let f of g.docs)for(let w of u.hooks.afterRead)await w({collection:t,doc:f,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read"});return await a(g.docs,u.fields,e.db,e.registry,1,c||0),g}}function R(e){return async a$1=>{let{collection:t,id:n,depth:r,select:o,draft:s}=a$1,c=e.registry.getCollection(t);await p(c,"read",e);let i=s??!!e.user,d=await e.db.findByID({collection:t,id:n,depth:r||0,tenantId:e.tenantId,select:o,draft:i});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(c.hooks?.afterRead)for(let u of c.hooks.afterRead)await u({collection:t,doc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read",id:n});return await a([d],c.fields,e.db,e.registry,1,r||0),d}}function q(e){return async a=>{let{collection:t,data:n,depth:r,select:o}=a,s=e.registry.getCollection(t);await p(s,"create",e);let i=e.registry.getCreateZodSchema(t).parse(n);if(s.tenantScoped&&e.tenantId&&(i.tenantId=e.tenantId),s.hooks?.beforeValidate)for(let u of s.hooks.beforeValidate){let l=await u({collection:t,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});l&&Object.assign(i,l);}if(s.hooks?.beforeChange)for(let u of s.hooks.beforeChange){let l=await u({collection:t,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});l&&Object.assign(i,l);}let d=await e.db.create({collection:t,data:i,depth:r||0,tenantId:e.tenantId,select:o});if(s.hooks?.afterChange)for(let u of s.hooks.afterChange)await u({collection:t,doc:d,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});return await C(e,A(t,"create"),{collection:t,data:d,operation:"create"}),{doc:d}}}function P(e){return async a=>{let{collection:t,id:n,data:r,depth:o,select:s,baseUpdatedAt:c}=a,i=e.registry.getCollection(t);await p(i,"update",e);let d=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(c&&d.updatedAt&&c!==d.updatedAt)throw new Error(`Revision conflict: document has changed since ${c}. Current updatedAt: ${d.updatedAt}`);m(r,i.fields);let l=e.registry.getUpdateZodSchema(t).parse(r);if(i.tenantScoped&&e.tenantId&&(l.tenantId=e.tenantId),i.hooks?.beforeValidate)for(let b of i.hooks.beforeValidate){let h=await b({collection:t,data:l,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});h&&Object.assign(l,h);}if(i.hooks?.beforeChange)for(let b of i.hooks.beforeChange){let h=await b({collection:t,data:l,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});h&&Object.assign(l,h);}let g=e.req&&typeof e.req.headers?.get=="function"&&e.req.headers.get("x-draft")==="true"||a.draft===true,f=i.versions?.drafts===true,w=e.req?.query?.autosave==="true"||e.req?.url?.includes("autosave=true")||a.autosave===true,y;if(f&&g?(await e.db.createVersion({collection:t,documentId:n,data:l,status:"draft",autosave:w,createdBy:e.user?.id,tenantId:e.tenantId}),y=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true})):f?(y=await e.db.update({collection:t,id:n,data:{...l,status:"published"},depth:o||0,tenantId:e.tenantId,select:s}),await e.db.createVersion({collection:t,documentId:n,data:l,status:"published",createdBy:e.user?.id,tenantId:e.tenantId})):y=await e.db.update({collection:t,id:n,data:l,depth:o||0,tenantId:e.tenantId,select:s}),i.hooks?.afterChange)for(let b of i.hooks.afterChange)await b({collection:t,doc:y,data:l,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});return await C(e,A(t,"update"),{collection:t,data:y,previousData:d,operation:"update"}),{doc:y}}}function v(e){return async a=>{let{collection:t,id:n}=a,r=e.registry.getCollection(t);await p(r,"delete",e);let o=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true});if(!o)throw new Error(`Document not found: ${t}/${n}`);if(r.hooks?.beforeDelete)for(let c of r.hooks.beforeDelete)await c({collection:t,doc:o,req:e.req,user:e.user,tenantId:e.tenantId,operation:"delete",id:n});let s=await e.db.delete({collection:t,id:n,tenantId:e.tenantId});if(r.hooks?.afterDelete)for(let c of r.hooks.afterDelete)await c({collection:t,doc:s,req:e.req,user:e.user,tenantId:e.tenantId,operation:"delete",id:n});return await C(e,A(t,"delete"),{collection:t,data:s,previousData:o,operation:"delete"}),{doc:s,message:"Deleted successfully"}}}function K(e){return async a=>{let{collection:t,where:n}=a,r=e.registry.getCollection(t);return await p(r,"read",e),{totalDocs:await e.db.count({collection:t,where:n||{},tenantId:e.tenantId})}}}async function U(e,a,t){let n=await c(e,a,{user:t.user,req:t.req,tenantId:t.tenantId});if(!n.allowed)throw new Error(n.error||"Access denied");t.tenantId&&t.db.setTenantContext({tenantId:t.tenantId,userId:t.user?.id??"",role:t.user?.role,isSuperAdmin:t.user?.role==="super_admin"});}function $(e){let a={},t=e.registry.getCollections();for(let r of t){let o=r.slug;a[o]={find:D(e),findByID:R(e),create:q(e),update:P(e),delete:v(e),count:K(e)};}let n=e.registry.getGlobals();for(let r of n){let o=r.slug;a[`_globals_${o}`]={get:async()=>(await U(r,"read",e),await e.db.findOne({collection:`_globals_${o}`,where:{},tenantId:e.tenantId})),update:async s=>{await U(r,"update",e);let i=e.registry.getZodSchema(o).parse(s.data),d=await e.db.findOne({collection:`_globals_${o}`,where:{},tenantId:e.tenantId,draft:true}),u;return d?u=await e.db.update({collection:`_globals_${o}`,id:d.id,data:i,tenantId:e.tenantId}):u=await e.db.create({collection:`_globals_${o}`,data:{...i,id:o},tenantId:e.tenantId}),u}};}return a}function O(e){if(e.settings?.access?.apiAccess?.trpcEnabled===false)throw new Error("tRPC API is disabled");return $(e)}export{T as a,D as b,R as c,q as d,P as e,v as f,K as g,$ as h,O as i};