@kyro-cms/core 0.12.70 → 0.13.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 (232) hide show
  1. package/README.md +6 -0
  2. package/dist/{WebhookService-CGNSlclW.d.ts → WebhookService-BLi5Rz2m.d.ts} +1 -1
  3. package/dist/{WebhookService-CIQPD1We.d.cts → WebhookService-BcuD8tnn.d.cts} +1 -1
  4. package/dist/WebhookService-D5PSI5t6.d.cts +143 -0
  5. package/dist/WebhookService-DPCCn_12.d.ts +143 -0
  6. package/dist/WebhookService-Dncnbgm9.d.cts +143 -0
  7. package/dist/WebhookService-UY5p89Bj.d.ts +143 -0
  8. package/dist/WebhookService-YZXBCRXA.d.ts +143 -0
  9. package/dist/WebhookService-zrDmAx7L.d.cts +143 -0
  10. package/dist/api-handler-graphql.cjs +1 -1
  11. package/dist/api-handler-graphql.js +1 -1
  12. package/dist/api-handler-trpc.cjs +1 -1
  13. package/dist/api-handler-trpc.js +1 -1
  14. package/dist/api-handler.cjs +1 -1
  15. package/dist/api-handler.js +1 -1
  16. package/dist/base-B--L0lCn.d.cts +218 -0
  17. package/dist/base-BVoDPNjJ.d.cts +218 -0
  18. package/dist/{types-CpjuXbe7.d.cts → base-CAb9EYQs.d.ts} +69 -1
  19. package/dist/base-CyG7aF1e.d.cts +218 -0
  20. package/dist/{types-CpjuXbe7.d.ts → base-DOImeJ-F.d.ts} +69 -1
  21. package/dist/base-DbnwE42-.d.cts +218 -0
  22. package/dist/base-NyiSsD-n.d.ts +218 -0
  23. package/dist/base-xflndGDO.d.ts +218 -0
  24. package/dist/bootstrap-E24SGUJP.cjs +1 -0
  25. package/dist/bootstrap-QQ6D3OYG.js +1 -0
  26. package/dist/bootstrap-QVKSKXJF.cjs +1 -0
  27. package/dist/bootstrap-RILR44UM.cjs +1 -0
  28. package/dist/{bootstrap-WB6FDH2T.js → bootstrap-YFVE7MRG.js} +1 -1
  29. package/dist/bootstrap-ZRRUPRUR.js +1 -0
  30. package/dist/chunk-262YP5XA.cjs +1 -0
  31. package/dist/chunk-2FSOHXOU.cjs +56 -0
  32. package/dist/chunk-2OS5Y4LE.cjs +1 -0
  33. package/dist/chunk-2PXXQKN3.cjs +3 -0
  34. package/dist/chunk-355R4LS5.cjs +56 -0
  35. package/dist/chunk-35IVNLMA.js +122 -0
  36. package/dist/{chunk-XVPTVTQC.js → chunk-3GXLOYM3.js} +2 -2
  37. package/dist/chunk-3KZXF4US.js +2 -0
  38. package/dist/{chunk-Z552BTXA.cjs → chunk-3LAWUINR.cjs} +1 -1
  39. package/dist/chunk-3O3AVMWM.cjs +1 -0
  40. package/dist/{chunk-637PTUHF.js → chunk-3TAUNYEM.js} +1 -1
  41. package/dist/chunk-3U6MKWET.cjs +120 -0
  42. package/dist/chunk-4BMWWGJN.js +384 -0
  43. package/dist/chunk-5A7E7N4B.cjs +431 -0
  44. package/dist/chunk-6DD4J7LI.js +2 -0
  45. package/dist/chunk-6GGPY7U2.js +4 -0
  46. package/dist/chunk-6MNLRAKM.cjs +121 -0
  47. package/dist/chunk-6NBZDW53.js +133 -0
  48. package/dist/chunk-73Y63IPP.js +57 -0
  49. package/dist/chunk-7K6ZUNJM.js +4 -0
  50. package/dist/chunk-7NKNSRCB.cjs +448 -0
  51. package/dist/{chunk-IL2TMAHB.cjs → chunk-A35ZP72D.cjs} +3 -3
  52. package/dist/chunk-A3IOQOV6.js +2 -0
  53. package/dist/chunk-A3XVL6ED.cjs +3 -0
  54. package/dist/{chunk-OBH6EEAO.cjs → chunk-APDQ6ZTG.cjs} +5 -5
  55. package/dist/chunk-ATI2UZ7U.js +2 -0
  56. package/dist/chunk-B4AC23SG.js +122 -0
  57. package/dist/chunk-BD6XHMMM.cjs +2 -0
  58. package/dist/chunk-CH4TZZI5.js +449 -0
  59. package/dist/{chunk-TBTQXIHP.js → chunk-CHYVUWZ3.js} +1 -1
  60. package/dist/{chunk-6USPOWA4.js → chunk-CNHUCCQJ.js} +10 -10
  61. package/dist/chunk-CRP6PSCE.js +2 -0
  62. package/dist/chunk-DI6TCZSE.js +122 -0
  63. package/dist/chunk-DORUYZQV.cjs +1 -0
  64. package/dist/chunk-EFKEVWAD.js +4 -0
  65. package/dist/chunk-EI7FRSNY.js +57 -0
  66. package/dist/chunk-EON4XLKQ.cjs +1 -0
  67. package/dist/chunk-EUQAOYEO.cjs +121 -0
  68. package/dist/chunk-EVAUBT7H.js +57 -0
  69. package/dist/chunk-EYHD7HZE.cjs +1 -0
  70. package/dist/chunk-EYYIPA5N.js +432 -0
  71. package/dist/chunk-F2O4QO5N.cjs +383 -0
  72. package/dist/chunk-FBWLSWZ4.js +122 -0
  73. package/dist/{chunk-3XLXKGEU.cjs → chunk-FG3IFGJP.cjs} +1 -1
  74. package/dist/chunk-FGN6IMPY.cjs +3 -0
  75. package/dist/chunk-FK2BG4HU.js +3 -0
  76. package/dist/{chunk-MVZSSTCV.js → chunk-FUFS65Q5.js} +2 -2
  77. package/dist/chunk-GWIZT2P5.js +57 -0
  78. package/dist/chunk-H3FJ54KB.cjs +121 -0
  79. package/dist/chunk-HY3EAWB2.js +4 -0
  80. package/dist/chunk-I6UJVO2P.js +57 -0
  81. package/dist/chunk-IQSF6XRV.js +57 -0
  82. package/dist/chunk-IXGDTAES.js +4 -0
  83. package/dist/chunk-JA44K75G.js +2 -0
  84. package/dist/chunk-K5XGP57D.cjs +19 -0
  85. package/dist/chunk-KEITOXIP.js +2 -0
  86. package/dist/chunk-LPFRMQFQ.js +121 -0
  87. package/dist/chunk-LYU44UNN.cjs +56 -0
  88. package/dist/chunk-MDLJTZLV.cjs +1 -0
  89. package/dist/chunk-MJAODEFC.cjs +121 -0
  90. package/dist/chunk-MYHNTJLR.cjs +56 -0
  91. package/dist/chunk-N2YHO2WI.cjs +3 -0
  92. package/dist/chunk-N4FXLQE3.cjs +132 -0
  93. package/dist/chunk-NPBXLPOP.js +3 -0
  94. package/dist/chunk-ON5XJEPO.cjs +3 -0
  95. package/dist/chunk-OT2Z4XBD.cjs +1 -0
  96. package/dist/chunk-PFTBTWSC.cjs +1 -0
  97. package/dist/chunk-PTPVFLET.js +20 -0
  98. package/dist/chunk-PZDLPRJF.js +4 -0
  99. package/dist/chunk-Q5TFO66G.cjs +1 -0
  100. package/dist/chunk-QUTYCUST.js +4 -0
  101. package/dist/chunk-REKKBAQX.cjs +56 -0
  102. package/dist/chunk-REQ622YC.js +3 -0
  103. package/dist/chunk-RTNQP6BV.js +2 -0
  104. package/dist/chunk-RUJW47ZJ.js +2 -0
  105. package/dist/{chunk-SOCBJPYB.cjs → chunk-RVBSJ4UQ.cjs} +1 -1
  106. package/dist/chunk-RXYCFZJC.cjs +121 -0
  107. package/dist/chunk-RYHOWZLK.js +2 -0
  108. package/dist/chunk-S2MZNEBQ.cjs +1 -0
  109. package/dist/chunk-S73YERS2.js +57 -0
  110. package/dist/chunk-SBNMXQNO.cjs +2 -0
  111. package/dist/chunk-T3DJ3UTP.cjs +121 -0
  112. package/dist/{chunk-ZQETJ4T4.cjs → chunk-TCFL3UWT.cjs} +1 -1
  113. package/dist/chunk-TJZO7ZSX.cjs +3 -0
  114. package/dist/chunk-TKUNRCRH.js +4 -0
  115. package/dist/chunk-TQLCOMKC.js +4 -0
  116. package/dist/chunk-TRXYDWGE.cjs +1 -0
  117. package/dist/chunk-TS55CUNJ.js +57 -0
  118. package/dist/chunk-UFBJ3WOZ.js +2 -0
  119. package/dist/chunk-UQRVQUVR.js +2 -0
  120. package/dist/chunk-UW5W35NP.js +122 -0
  121. package/dist/chunk-VI7WCO2J.cjs +3 -0
  122. package/dist/chunk-W2GPP6RB.js +122 -0
  123. package/dist/chunk-WHOA7YJU.cjs +1 -0
  124. package/dist/chunk-WNRUPL26.js +2 -0
  125. package/dist/chunk-WXT2XW7T.js +13 -0
  126. package/dist/chunk-XFYSADHV.cjs +2 -0
  127. package/dist/chunk-XIAJQLGS.js +2 -0
  128. package/dist/chunk-XK6UB77Q.js +4 -0
  129. package/dist/chunk-Y2VHO66Q.cjs +3 -0
  130. package/dist/chunk-Y5O2OD7J.cjs +3 -0
  131. package/dist/chunk-YARB43JG.cjs +56 -0
  132. package/dist/chunk-YLCEMVYY.cjs +56 -0
  133. package/dist/chunk-YSOM57GK.cjs +3 -0
  134. package/dist/chunk-Z3UVDGYS.cjs +56 -0
  135. package/dist/{chunk-4OMQURN7.js → chunk-ZAKYTBEN.js} +1 -1
  136. package/dist/chunk-ZTLGK6R4.cjs +12 -0
  137. package/dist/chunk-ZUBJ6RLQ.cjs +1 -0
  138. package/dist/cli/index.cjs +1 -1
  139. package/dist/cli/index.js +1 -1
  140. package/dist/client.cjs +109 -1
  141. package/dist/client.d.cts +1242 -6
  142. package/dist/client.d.ts +1242 -6
  143. package/dist/client.js +109 -2
  144. package/dist/drizzle/index.cjs +1 -1
  145. package/dist/drizzle/index.d.cts +3 -4
  146. package/dist/drizzle/index.d.ts +3 -4
  147. package/dist/drizzle/index.js +1 -1
  148. package/dist/fields/index.cjs +1 -1
  149. package/dist/fields/index.d.cts +2 -2
  150. package/dist/fields/index.d.ts +2 -2
  151. package/dist/fields/index.js +1 -1
  152. package/dist/graphql/index.d.cts +3 -3
  153. package/dist/graphql/index.d.ts +3 -3
  154. package/dist/{index-BHYGO3yF.d.cts → index-B9BFNOHd.d.cts} +2 -2
  155. package/dist/index-BMcYFpTv.d.cts +105 -0
  156. package/dist/{index-DTy4k1oU.d.ts → index-BttsFZDa.d.ts} +2 -2
  157. package/dist/index-CxA9uOv0.d.ts +105 -0
  158. package/dist/index-D6AXbuPI.d.ts +105 -0
  159. package/dist/index-DF0KDBaM.d.cts +105 -0
  160. package/dist/index-DG4Xu7gA.d.cts +105 -0
  161. package/dist/index-eHex8Iwj.d.ts +105 -0
  162. package/dist/index.cjs +43 -24
  163. package/dist/index.d.cts +167 -13
  164. package/dist/index.d.ts +167 -13
  165. package/dist/index.js +44 -25
  166. package/dist/lib-A2D63VXD.cjs +1 -0
  167. package/dist/lib-JQD2JAOO.js +2 -0
  168. package/dist/local-KR3AIGVA.cjs +1 -0
  169. package/dist/local-T7GISZBL.js +1 -0
  170. package/dist/mongo-auth-adapter-GR2CFFEA.js +1 -0
  171. package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +1 -0
  172. package/dist/mongodb/index.cjs +1 -1
  173. package/dist/mongodb/index.d.cts +4 -4
  174. package/dist/mongodb/index.d.ts +4 -4
  175. package/dist/mongodb/index.js +1 -1
  176. package/dist/nodemailer-transport-3VWVUBM5.cjs +1 -0
  177. package/dist/nodemailer-transport-7RHATUKL.js +1 -0
  178. package/dist/nodemailer-transport-CHO2WKIY.js +1 -0
  179. package/dist/nodemailer-transport-ED2IXNGW.cjs +1 -0
  180. package/dist/postgres-auth-adapter-SK3N3OSS.js +1 -1
  181. package/dist/postgres-auth-adapter-ZO6HK5AK.cjs +1 -1
  182. package/dist/postgres-js-7YBZKGXG.cjs +1 -0
  183. package/dist/{postgres-js-WE3NBRFO.js → postgres-js-JLFIWOBH.js} +1 -1
  184. package/dist/rest/index.cjs +1 -1
  185. package/dist/rest/index.d.cts +4 -4
  186. package/dist/rest/index.d.ts +4 -4
  187. package/dist/rest/index.js +1 -1
  188. package/dist/templates/index.cjs +1 -1
  189. package/dist/templates/index.d.cts +2 -2
  190. package/dist/templates/index.d.ts +2 -2
  191. package/dist/templates/index.js +1 -1
  192. package/dist/trpc/index.cjs +1 -1
  193. package/dist/trpc/index.d.cts +3 -3
  194. package/dist/trpc/index.d.ts +3 -3
  195. package/dist/trpc/index.js +1 -1
  196. package/dist/types-B5Qz1svz.d.cts +822 -0
  197. package/dist/types-Bii0bhUV.d.cts +329 -0
  198. package/dist/types-Bii0bhUV.d.ts +329 -0
  199. package/dist/{types-CeAQSR87.d.cts → types-Bt2_ycUO.d.ts} +37 -2
  200. package/dist/types-C4wXHImf.d.ts +822 -0
  201. package/dist/types-DCWgPFmi.d.cts +822 -0
  202. package/dist/types-DROqAsr0.d.cts +330 -0
  203. package/dist/types-DROqAsr0.d.ts +330 -0
  204. package/dist/{types-BKPEavuy.d.cts → types-DlGSbh7I.d.cts} +1 -1
  205. package/dist/{types-BKPEavuy.d.ts → types-DlGSbh7I.d.ts} +1 -1
  206. package/dist/types-DsF64Wrc.d.cts +811 -0
  207. package/dist/{types-BWJx6zzm.d.ts → types-ZrjEVWfi.d.ts} +37 -2
  208. package/dist/types-dEy5JxvN.d.ts +822 -0
  209. package/dist/types-tVJc9YbX.d.cts +811 -0
  210. package/dist/ws/index.cjs +1 -1
  211. package/dist/ws/index.d.cts +121 -1
  212. package/dist/ws/index.d.ts +121 -1
  213. package/dist/ws/index.js +1 -1
  214. package/package.json +2 -2
  215. package/dist/base-Ds06wMo9.d.cts +0 -69
  216. package/dist/base-DxDXLyWe.d.ts +0 -69
  217. package/dist/bootstrap-XDT4MRML.cjs +0 -1
  218. package/dist/chunk-5M3FKE2V.js +0 -2
  219. package/dist/chunk-7FXEXHK6.js +0 -21
  220. package/dist/chunk-JSTDCK3Z.js +0 -2
  221. package/dist/chunk-JT36FTHY.cjs +0 -20
  222. package/dist/chunk-L2QXP26Q.js +0 -2
  223. package/dist/chunk-MRR7OTRX.js +0 -57
  224. package/dist/chunk-MVX2PYJJ.cjs +0 -1
  225. package/dist/chunk-MYGHZQMO.cjs +0 -1
  226. package/dist/chunk-OUAR4ZCU.cjs +0 -56
  227. package/dist/chunk-WCFHS7EZ.cjs +0 -1
  228. package/dist/index-D7kt5jT_.d.ts +0 -97
  229. package/dist/index-DPtCjn94.d.cts +0 -97
  230. package/dist/postgres-js-GXZX3AGZ.cjs +0 -1
  231. /package/dist/{chunk-XTTGHN3D.cjs → chunk-FLS2FJM6.cjs} +0 -0
  232. /package/dist/{chunk-KWGB3YNI.js → chunk-PFKVHUOT.js} +0 -0
package/README.md CHANGED
@@ -32,6 +32,11 @@ Kyro turns a single TypeScript config into a full CMS backend for Astro, includi
32
32
 
33
33
  ```bash
34
34
  pnpm create @kyro-cms@latest my-project
35
+ # or
36
+ npm create @kyro-cms@latest my-project
37
+ # or
38
+ bun create @kyro-cms@latest my-project
39
+
35
40
  cd my-project
36
41
  pnpm install
37
42
  pnpm dev
@@ -182,6 +187,7 @@ const posts = await api["posts"].find.query({ page: 1, limit: 10 });
182
187
  - `docs/architecture.md` — how Kyro works under the hood
183
188
  - `docs/api.md` — API protocols and usage patterns
184
189
  - `docs/database.md` — supported adapters and configuration
190
+ - [ROADMAP.md](file:///Users/macbook/Dev/Web/Astro/kyro-cms/ROADMAP.md) — product & innovation roadmap
185
191
 
186
192
  ---
187
193
 
@@ -1,4 +1,4 @@
1
- import { B as BaseAdapter } from './types-BWJx6zzm.js';
1
+ import { B as BaseAdapter } from './types-ZrjEVWfi.js';
2
2
 
3
3
  declare const WEBHOOK_EVENTS: {
4
4
  readonly COLLECTION_CREATE: "collection.create";
@@ -1,4 +1,4 @@
1
- import { B as BaseAdapter } from './types-CeAQSR87.cjs';
1
+ import { B as BaseAdapter } from './types-DCWgPFmi.cjs';
2
2
 
3
3
  declare const WEBHOOK_EVENTS: {
4
4
  readonly COLLECTION_CREATE: "collection.create";
@@ -0,0 +1,143 @@
1
+ import { B as BaseAdapter } from './types-B5Qz1svz.cjs';
2
+
3
+ declare const WEBHOOK_EVENTS: {
4
+ readonly COLLECTION_CREATE: "collection.create";
5
+ readonly COLLECTION_UPDATE: "collection.update";
6
+ readonly COLLECTION_DELETE: "collection.delete";
7
+ readonly MEDIA_UPLOAD: "media.upload";
8
+ readonly MEDIA_DELETE: "media.delete";
9
+ readonly AUTH_LOGIN: "auth.login";
10
+ readonly AUTH_REGISTER: "auth.register";
11
+ readonly AUTH_LOGOUT: "auth.logout";
12
+ readonly ORDER_CREATED: "order.created";
13
+ readonly ORDER_PAID: "order.paid";
14
+ readonly ORDER_SHIPPED: "order.shipped";
15
+ readonly ORDER_DELIVERED: "order.delivered";
16
+ };
17
+ type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
18
+ declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
19
+ type WebhookActionType = "generic" | "github-push";
20
+ interface WebhookActionConfig {
21
+ githubOwner?: string;
22
+ githubRepo?: string;
23
+ githubBranch?: string;
24
+ }
25
+ interface WebhookConfig {
26
+ id: string;
27
+ name: string;
28
+ url: string;
29
+ events: WebhookEvent[];
30
+ collections?: string[];
31
+ status: "active" | "inactive" | "error";
32
+ secret?: string;
33
+ headers?: Record<string, string>;
34
+ action?: WebhookActionType;
35
+ config?: WebhookActionConfig;
36
+ lastTriggered?: string;
37
+ lastError?: string;
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ }
41
+ interface CreateWebhookData {
42
+ name: string;
43
+ url: string;
44
+ events: (WebhookEvent | "create" | "update" | "delete")[];
45
+ collections?: string[];
46
+ status?: "active" | "inactive";
47
+ secret?: string;
48
+ headers?: Record<string, string>;
49
+ action?: WebhookActionType;
50
+ config?: WebhookActionConfig;
51
+ }
52
+ interface UpdateWebhookData {
53
+ name?: string;
54
+ url?: string;
55
+ events?: (WebhookEvent | "create" | "update" | "delete")[];
56
+ collections?: string[];
57
+ status?: "active" | "inactive" | "error";
58
+ secret?: string;
59
+ headers?: Record<string, string>;
60
+ action?: WebhookActionType;
61
+ config?: WebhookActionConfig;
62
+ lastTriggered?: string | null;
63
+ lastError?: string | null;
64
+ }
65
+ interface WebhookPayload {
66
+ id: string;
67
+ event: WebhookEvent;
68
+ timestamp: string;
69
+ collection?: string;
70
+ operation?: "create" | "update" | "delete";
71
+ data?: unknown;
72
+ previousData?: unknown;
73
+ user?: {
74
+ id: string;
75
+ email?: string;
76
+ role?: string;
77
+ };
78
+ tenantId?: string;
79
+ metadata?: Record<string, unknown>;
80
+ }
81
+ interface WebhookDelivery {
82
+ id: string;
83
+ webhookId: string;
84
+ event: WebhookEvent;
85
+ payload: WebhookPayload;
86
+ attempt: number;
87
+ status: "pending" | "success" | "failed" | "retrying";
88
+ responseStatus?: number;
89
+ responseBody?: string;
90
+ error?: string;
91
+ duration?: number;
92
+ createdAt: string;
93
+ deliveredAt?: string;
94
+ nextRetryAt?: string;
95
+ }
96
+ interface WebhookTriggerResult {
97
+ deliveryId: string;
98
+ webhookId: string;
99
+ event: WebhookEvent;
100
+ status: "queued" | "success" | "failed";
101
+ responseStatus?: number;
102
+ duration?: number;
103
+ error?: string;
104
+ }
105
+ declare const WEBHOOK_COLLECTION = "_webhooks";
106
+ declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
107
+ interface DeliveryResult {
108
+ success: boolean;
109
+ status: number;
110
+ statusText?: string;
111
+ body?: string;
112
+ duration: number;
113
+ error?: string;
114
+ }
115
+ interface DeliveryOptions {
116
+ timeout?: number;
117
+ maxRetries?: number;
118
+ retryDelay?: number;
119
+ onRetry?: (attempt: number, error: string) => void;
120
+ onSuccess?: (result: DeliveryResult) => void;
121
+ onFailure?: (error: string) => void;
122
+ }
123
+
124
+ declare class WebhookService {
125
+ private db;
126
+ constructor(db: BaseAdapter);
127
+ getWebhooks(filters?: {
128
+ status?: string;
129
+ event?: WebhookEvent;
130
+ }): Promise<WebhookConfig[]>;
131
+ getWebhookById(id: string): Promise<WebhookConfig | null>;
132
+ createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
133
+ updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
134
+ deleteWebhook(id: string): Promise<void>;
135
+ trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
136
+ triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
137
+ testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
138
+ getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
139
+ retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
140
+ }
141
+ declare function createWebhookService(db: BaseAdapter): WebhookService;
142
+
143
+ 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 };
@@ -0,0 +1,143 @@
1
+ import { B as BaseAdapter } from './types-C4wXHImf.js';
2
+
3
+ declare const WEBHOOK_EVENTS: {
4
+ readonly COLLECTION_CREATE: "collection.create";
5
+ readonly COLLECTION_UPDATE: "collection.update";
6
+ readonly COLLECTION_DELETE: "collection.delete";
7
+ readonly MEDIA_UPLOAD: "media.upload";
8
+ readonly MEDIA_DELETE: "media.delete";
9
+ readonly AUTH_LOGIN: "auth.login";
10
+ readonly AUTH_REGISTER: "auth.register";
11
+ readonly AUTH_LOGOUT: "auth.logout";
12
+ readonly ORDER_CREATED: "order.created";
13
+ readonly ORDER_PAID: "order.paid";
14
+ readonly ORDER_SHIPPED: "order.shipped";
15
+ readonly ORDER_DELIVERED: "order.delivered";
16
+ };
17
+ type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
18
+ declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
19
+ type WebhookActionType = "generic" | "github-push";
20
+ interface WebhookActionConfig {
21
+ githubOwner?: string;
22
+ githubRepo?: string;
23
+ githubBranch?: string;
24
+ }
25
+ interface WebhookConfig {
26
+ id: string;
27
+ name: string;
28
+ url: string;
29
+ events: WebhookEvent[];
30
+ collections?: string[];
31
+ status: "active" | "inactive" | "error";
32
+ secret?: string;
33
+ headers?: Record<string, string>;
34
+ action?: WebhookActionType;
35
+ config?: WebhookActionConfig;
36
+ lastTriggered?: string;
37
+ lastError?: string;
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ }
41
+ interface CreateWebhookData {
42
+ name: string;
43
+ url: string;
44
+ events: (WebhookEvent | "create" | "update" | "delete")[];
45
+ collections?: string[];
46
+ status?: "active" | "inactive";
47
+ secret?: string;
48
+ headers?: Record<string, string>;
49
+ action?: WebhookActionType;
50
+ config?: WebhookActionConfig;
51
+ }
52
+ interface UpdateWebhookData {
53
+ name?: string;
54
+ url?: string;
55
+ events?: (WebhookEvent | "create" | "update" | "delete")[];
56
+ collections?: string[];
57
+ status?: "active" | "inactive" | "error";
58
+ secret?: string;
59
+ headers?: Record<string, string>;
60
+ action?: WebhookActionType;
61
+ config?: WebhookActionConfig;
62
+ lastTriggered?: string | null;
63
+ lastError?: string | null;
64
+ }
65
+ interface WebhookPayload {
66
+ id: string;
67
+ event: WebhookEvent;
68
+ timestamp: string;
69
+ collection?: string;
70
+ operation?: "create" | "update" | "delete";
71
+ data?: unknown;
72
+ previousData?: unknown;
73
+ user?: {
74
+ id: string;
75
+ email?: string;
76
+ role?: string;
77
+ };
78
+ tenantId?: string;
79
+ metadata?: Record<string, unknown>;
80
+ }
81
+ interface WebhookDelivery {
82
+ id: string;
83
+ webhookId: string;
84
+ event: WebhookEvent;
85
+ payload: WebhookPayload;
86
+ attempt: number;
87
+ status: "pending" | "success" | "failed" | "retrying";
88
+ responseStatus?: number;
89
+ responseBody?: string;
90
+ error?: string;
91
+ duration?: number;
92
+ createdAt: string;
93
+ deliveredAt?: string;
94
+ nextRetryAt?: string;
95
+ }
96
+ interface WebhookTriggerResult {
97
+ deliveryId: string;
98
+ webhookId: string;
99
+ event: WebhookEvent;
100
+ status: "queued" | "success" | "failed";
101
+ responseStatus?: number;
102
+ duration?: number;
103
+ error?: string;
104
+ }
105
+ declare const WEBHOOK_COLLECTION = "_webhooks";
106
+ declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
107
+ interface DeliveryResult {
108
+ success: boolean;
109
+ status: number;
110
+ statusText?: string;
111
+ body?: string;
112
+ duration: number;
113
+ error?: string;
114
+ }
115
+ interface DeliveryOptions {
116
+ timeout?: number;
117
+ maxRetries?: number;
118
+ retryDelay?: number;
119
+ onRetry?: (attempt: number, error: string) => void;
120
+ onSuccess?: (result: DeliveryResult) => void;
121
+ onFailure?: (error: string) => void;
122
+ }
123
+
124
+ declare class WebhookService {
125
+ private db;
126
+ constructor(db: BaseAdapter);
127
+ getWebhooks(filters?: {
128
+ status?: string;
129
+ event?: WebhookEvent;
130
+ }): Promise<WebhookConfig[]>;
131
+ getWebhookById(id: string): Promise<WebhookConfig | null>;
132
+ createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
133
+ updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
134
+ deleteWebhook(id: string): Promise<void>;
135
+ trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
136
+ triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
137
+ testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
138
+ getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
139
+ retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
140
+ }
141
+ declare function createWebhookService(db: BaseAdapter): WebhookService;
142
+
143
+ 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 };
@@ -0,0 +1,143 @@
1
+ import { B as BaseAdapter } from './types-DsF64Wrc.cjs';
2
+
3
+ declare const WEBHOOK_EVENTS: {
4
+ readonly COLLECTION_CREATE: "collection.create";
5
+ readonly COLLECTION_UPDATE: "collection.update";
6
+ readonly COLLECTION_DELETE: "collection.delete";
7
+ readonly MEDIA_UPLOAD: "media.upload";
8
+ readonly MEDIA_DELETE: "media.delete";
9
+ readonly AUTH_LOGIN: "auth.login";
10
+ readonly AUTH_REGISTER: "auth.register";
11
+ readonly AUTH_LOGOUT: "auth.logout";
12
+ readonly ORDER_CREATED: "order.created";
13
+ readonly ORDER_PAID: "order.paid";
14
+ readonly ORDER_SHIPPED: "order.shipped";
15
+ readonly ORDER_DELIVERED: "order.delivered";
16
+ };
17
+ type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
18
+ declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
19
+ type WebhookActionType = "generic" | "github-push";
20
+ interface WebhookActionConfig {
21
+ githubOwner?: string;
22
+ githubRepo?: string;
23
+ githubBranch?: string;
24
+ }
25
+ interface WebhookConfig {
26
+ id: string;
27
+ name: string;
28
+ url: string;
29
+ events: WebhookEvent[];
30
+ collections?: string[];
31
+ status: "active" | "inactive" | "error";
32
+ secret?: string;
33
+ headers?: Record<string, string>;
34
+ action?: WebhookActionType;
35
+ config?: WebhookActionConfig;
36
+ lastTriggered?: string;
37
+ lastError?: string;
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ }
41
+ interface CreateWebhookData {
42
+ name: string;
43
+ url: string;
44
+ events: (WebhookEvent | "create" | "update" | "delete")[];
45
+ collections?: string[];
46
+ status?: "active" | "inactive";
47
+ secret?: string;
48
+ headers?: Record<string, string>;
49
+ action?: WebhookActionType;
50
+ config?: WebhookActionConfig;
51
+ }
52
+ interface UpdateWebhookData {
53
+ name?: string;
54
+ url?: string;
55
+ events?: (WebhookEvent | "create" | "update" | "delete")[];
56
+ collections?: string[];
57
+ status?: "active" | "inactive" | "error";
58
+ secret?: string;
59
+ headers?: Record<string, string>;
60
+ action?: WebhookActionType;
61
+ config?: WebhookActionConfig;
62
+ lastTriggered?: string | null;
63
+ lastError?: string | null;
64
+ }
65
+ interface WebhookPayload {
66
+ id: string;
67
+ event: WebhookEvent;
68
+ timestamp: string;
69
+ collection?: string;
70
+ operation?: "create" | "update" | "delete";
71
+ data?: unknown;
72
+ previousData?: unknown;
73
+ user?: {
74
+ id: string;
75
+ email?: string;
76
+ role?: string;
77
+ };
78
+ tenantId?: string;
79
+ metadata?: Record<string, unknown>;
80
+ }
81
+ interface WebhookDelivery {
82
+ id: string;
83
+ webhookId: string;
84
+ event: WebhookEvent;
85
+ payload: WebhookPayload;
86
+ attempt: number;
87
+ status: "pending" | "success" | "failed" | "retrying";
88
+ responseStatus?: number;
89
+ responseBody?: string;
90
+ error?: string;
91
+ duration?: number;
92
+ createdAt: string;
93
+ deliveredAt?: string;
94
+ nextRetryAt?: string;
95
+ }
96
+ interface WebhookTriggerResult {
97
+ deliveryId: string;
98
+ webhookId: string;
99
+ event: WebhookEvent;
100
+ status: "queued" | "success" | "failed";
101
+ responseStatus?: number;
102
+ duration?: number;
103
+ error?: string;
104
+ }
105
+ declare const WEBHOOK_COLLECTION = "_webhooks";
106
+ declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
107
+ interface DeliveryResult {
108
+ success: boolean;
109
+ status: number;
110
+ statusText?: string;
111
+ body?: string;
112
+ duration: number;
113
+ error?: string;
114
+ }
115
+ interface DeliveryOptions {
116
+ timeout?: number;
117
+ maxRetries?: number;
118
+ retryDelay?: number;
119
+ onRetry?: (attempt: number, error: string) => void;
120
+ onSuccess?: (result: DeliveryResult) => void;
121
+ onFailure?: (error: string) => void;
122
+ }
123
+
124
+ declare class WebhookService {
125
+ private db;
126
+ constructor(db: BaseAdapter);
127
+ getWebhooks(filters?: {
128
+ status?: string;
129
+ event?: WebhookEvent;
130
+ }): Promise<WebhookConfig[]>;
131
+ getWebhookById(id: string): Promise<WebhookConfig | null>;
132
+ createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
133
+ updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
134
+ deleteWebhook(id: string): Promise<void>;
135
+ trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
136
+ triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
137
+ testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
138
+ getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
139
+ retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
140
+ }
141
+ declare function createWebhookService(db: BaseAdapter): WebhookService;
142
+
143
+ 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 };
@@ -0,0 +1,143 @@
1
+ import { B as BaseAdapter } from './types-dEy5JxvN.js';
2
+
3
+ declare const WEBHOOK_EVENTS: {
4
+ readonly COLLECTION_CREATE: "collection.create";
5
+ readonly COLLECTION_UPDATE: "collection.update";
6
+ readonly COLLECTION_DELETE: "collection.delete";
7
+ readonly MEDIA_UPLOAD: "media.upload";
8
+ readonly MEDIA_DELETE: "media.delete";
9
+ readonly AUTH_LOGIN: "auth.login";
10
+ readonly AUTH_REGISTER: "auth.register";
11
+ readonly AUTH_LOGOUT: "auth.logout";
12
+ readonly ORDER_CREATED: "order.created";
13
+ readonly ORDER_PAID: "order.paid";
14
+ readonly ORDER_SHIPPED: "order.shipped";
15
+ readonly ORDER_DELIVERED: "order.delivered";
16
+ };
17
+ type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
18
+ declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
19
+ type WebhookActionType = "generic" | "github-push";
20
+ interface WebhookActionConfig {
21
+ githubOwner?: string;
22
+ githubRepo?: string;
23
+ githubBranch?: string;
24
+ }
25
+ interface WebhookConfig {
26
+ id: string;
27
+ name: string;
28
+ url: string;
29
+ events: WebhookEvent[];
30
+ collections?: string[];
31
+ status: "active" | "inactive" | "error";
32
+ secret?: string;
33
+ headers?: Record<string, string>;
34
+ action?: WebhookActionType;
35
+ config?: WebhookActionConfig;
36
+ lastTriggered?: string;
37
+ lastError?: string;
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ }
41
+ interface CreateWebhookData {
42
+ name: string;
43
+ url: string;
44
+ events: (WebhookEvent | "create" | "update" | "delete")[];
45
+ collections?: string[];
46
+ status?: "active" | "inactive";
47
+ secret?: string;
48
+ headers?: Record<string, string>;
49
+ action?: WebhookActionType;
50
+ config?: WebhookActionConfig;
51
+ }
52
+ interface UpdateWebhookData {
53
+ name?: string;
54
+ url?: string;
55
+ events?: (WebhookEvent | "create" | "update" | "delete")[];
56
+ collections?: string[];
57
+ status?: "active" | "inactive" | "error";
58
+ secret?: string;
59
+ headers?: Record<string, string>;
60
+ action?: WebhookActionType;
61
+ config?: WebhookActionConfig;
62
+ lastTriggered?: string | null;
63
+ lastError?: string | null;
64
+ }
65
+ interface WebhookPayload {
66
+ id: string;
67
+ event: WebhookEvent;
68
+ timestamp: string;
69
+ collection?: string;
70
+ operation?: "create" | "update" | "delete";
71
+ data?: unknown;
72
+ previousData?: unknown;
73
+ user?: {
74
+ id: string;
75
+ email?: string;
76
+ role?: string;
77
+ };
78
+ tenantId?: string;
79
+ metadata?: Record<string, unknown>;
80
+ }
81
+ interface WebhookDelivery {
82
+ id: string;
83
+ webhookId: string;
84
+ event: WebhookEvent;
85
+ payload: WebhookPayload;
86
+ attempt: number;
87
+ status: "pending" | "success" | "failed" | "retrying";
88
+ responseStatus?: number;
89
+ responseBody?: string;
90
+ error?: string;
91
+ duration?: number;
92
+ createdAt: string;
93
+ deliveredAt?: string;
94
+ nextRetryAt?: string;
95
+ }
96
+ interface WebhookTriggerResult {
97
+ deliveryId: string;
98
+ webhookId: string;
99
+ event: WebhookEvent;
100
+ status: "queued" | "success" | "failed";
101
+ responseStatus?: number;
102
+ duration?: number;
103
+ error?: string;
104
+ }
105
+ declare const WEBHOOK_COLLECTION = "_webhooks";
106
+ declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
107
+ interface DeliveryResult {
108
+ success: boolean;
109
+ status: number;
110
+ statusText?: string;
111
+ body?: string;
112
+ duration: number;
113
+ error?: string;
114
+ }
115
+ interface DeliveryOptions {
116
+ timeout?: number;
117
+ maxRetries?: number;
118
+ retryDelay?: number;
119
+ onRetry?: (attempt: number, error: string) => void;
120
+ onSuccess?: (result: DeliveryResult) => void;
121
+ onFailure?: (error: string) => void;
122
+ }
123
+
124
+ declare class WebhookService {
125
+ private db;
126
+ constructor(db: BaseAdapter);
127
+ getWebhooks(filters?: {
128
+ status?: string;
129
+ event?: WebhookEvent;
130
+ }): Promise<WebhookConfig[]>;
131
+ getWebhookById(id: string): Promise<WebhookConfig | null>;
132
+ createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
133
+ updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
134
+ deleteWebhook(id: string): Promise<void>;
135
+ trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
136
+ triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
137
+ testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
138
+ getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
139
+ retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
140
+ }
141
+ declare function createWebhookService(db: BaseAdapter): WebhookService;
142
+
143
+ 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 };