@kyro-cms/core 0.12.71 → 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 (200) hide show
  1. package/README.md +6 -0
  2. package/dist/{WebhookService-DQyM9fVo.d.ts → WebhookService-BLi5Rz2m.d.ts} +1 -1
  3. package/dist/{WebhookService-bo1NrgBW.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-urWvrsX8.d.cts → base-B--L0lCn.d.cts} +1 -1
  17. package/dist/base-BVoDPNjJ.d.cts +218 -0
  18. package/dist/base-CAb9EYQs.d.ts +218 -0
  19. package/dist/base-CyG7aF1e.d.cts +218 -0
  20. package/dist/{base-BcfNgOqZ.d.ts → base-DOImeJ-F.d.ts} +1 -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-QQ6D3OYG.js +1 -0
  25. package/dist/bootstrap-QVKSKXJF.cjs +1 -0
  26. package/dist/bootstrap-RILR44UM.cjs +1 -0
  27. package/dist/bootstrap-ZRRUPRUR.js +1 -0
  28. package/dist/chunk-262YP5XA.cjs +1 -0
  29. package/dist/chunk-2FSOHXOU.cjs +56 -0
  30. package/dist/chunk-2OS5Y4LE.cjs +1 -0
  31. package/dist/chunk-2PXXQKN3.cjs +3 -0
  32. package/dist/{chunk-K6ZW5M6S.cjs → chunk-355R4LS5.cjs} +3 -3
  33. package/dist/chunk-35IVNLMA.js +122 -0
  34. package/dist/{chunk-FSWDDVLA.js → chunk-3GXLOYM3.js} +1 -1
  35. package/dist/chunk-3KZXF4US.js +2 -0
  36. package/dist/{chunk-H7PC2ENZ.cjs → chunk-3LAWUINR.cjs} +1 -1
  37. package/dist/chunk-3O3AVMWM.cjs +1 -0
  38. package/dist/chunk-3U6MKWET.cjs +120 -0
  39. package/dist/chunk-4BMWWGJN.js +384 -0
  40. package/dist/chunk-5A7E7N4B.cjs +431 -0
  41. package/dist/chunk-6DD4J7LI.js +2 -0
  42. package/dist/chunk-6GGPY7U2.js +4 -0
  43. package/dist/chunk-6MNLRAKM.cjs +121 -0
  44. package/dist/chunk-6NBZDW53.js +133 -0
  45. package/dist/{chunk-2HATK4C5.js → chunk-73Y63IPP.js} +4 -4
  46. package/dist/chunk-7K6ZUNJM.js +4 -0
  47. package/dist/chunk-7NKNSRCB.cjs +448 -0
  48. package/dist/chunk-A3IOQOV6.js +2 -0
  49. package/dist/chunk-A3XVL6ED.cjs +3 -0
  50. package/dist/{chunk-LKQHIOPW.cjs → chunk-APDQ6ZTG.cjs} +1 -1
  51. package/dist/chunk-ATI2UZ7U.js +2 -0
  52. package/dist/chunk-B4AC23SG.js +122 -0
  53. package/dist/chunk-BD6XHMMM.cjs +2 -0
  54. package/dist/chunk-CH4TZZI5.js +449 -0
  55. package/dist/{chunk-26KFM3P6.js → chunk-CNHUCCQJ.js} +1 -1
  56. package/dist/chunk-CRP6PSCE.js +2 -0
  57. package/dist/chunk-DI6TCZSE.js +122 -0
  58. package/dist/chunk-DORUYZQV.cjs +1 -0
  59. package/dist/chunk-EFKEVWAD.js +4 -0
  60. package/dist/chunk-EI7FRSNY.js +57 -0
  61. package/dist/chunk-EON4XLKQ.cjs +1 -0
  62. package/dist/chunk-EUQAOYEO.cjs +121 -0
  63. package/dist/chunk-EVAUBT7H.js +57 -0
  64. package/dist/chunk-EYHD7HZE.cjs +1 -0
  65. package/dist/chunk-EYYIPA5N.js +432 -0
  66. package/dist/chunk-F2O4QO5N.cjs +383 -0
  67. package/dist/chunk-FBWLSWZ4.js +122 -0
  68. package/dist/chunk-FGN6IMPY.cjs +3 -0
  69. package/dist/chunk-FK2BG4HU.js +3 -0
  70. package/dist/chunk-GWIZT2P5.js +57 -0
  71. package/dist/chunk-H3FJ54KB.cjs +121 -0
  72. package/dist/chunk-HY3EAWB2.js +4 -0
  73. package/dist/chunk-I6UJVO2P.js +57 -0
  74. package/dist/chunk-IQSF6XRV.js +57 -0
  75. package/dist/chunk-IXGDTAES.js +4 -0
  76. package/dist/chunk-JA44K75G.js +2 -0
  77. package/dist/chunk-K5XGP57D.cjs +19 -0
  78. package/dist/chunk-KEITOXIP.js +2 -0
  79. package/dist/chunk-LPFRMQFQ.js +121 -0
  80. package/dist/chunk-LYU44UNN.cjs +56 -0
  81. package/dist/chunk-MDLJTZLV.cjs +1 -0
  82. package/dist/chunk-MJAODEFC.cjs +121 -0
  83. package/dist/chunk-MYHNTJLR.cjs +56 -0
  84. package/dist/chunk-N2YHO2WI.cjs +3 -0
  85. package/dist/chunk-N4FXLQE3.cjs +132 -0
  86. package/dist/chunk-NPBXLPOP.js +3 -0
  87. package/dist/chunk-ON5XJEPO.cjs +3 -0
  88. package/dist/chunk-OT2Z4XBD.cjs +1 -0
  89. package/dist/chunk-PFTBTWSC.cjs +1 -0
  90. package/dist/chunk-PTPVFLET.js +20 -0
  91. package/dist/chunk-PZDLPRJF.js +4 -0
  92. package/dist/chunk-Q5TFO66G.cjs +1 -0
  93. package/dist/chunk-QUTYCUST.js +4 -0
  94. package/dist/chunk-REKKBAQX.cjs +56 -0
  95. package/dist/chunk-REQ622YC.js +3 -0
  96. package/dist/chunk-RTNQP6BV.js +2 -0
  97. package/dist/chunk-RUJW47ZJ.js +2 -0
  98. package/dist/chunk-RXYCFZJC.cjs +121 -0
  99. package/dist/chunk-RYHOWZLK.js +2 -0
  100. package/dist/chunk-S2MZNEBQ.cjs +1 -0
  101. package/dist/chunk-S73YERS2.js +57 -0
  102. package/dist/chunk-SBNMXQNO.cjs +2 -0
  103. package/dist/chunk-T3DJ3UTP.cjs +121 -0
  104. package/dist/chunk-TJZO7ZSX.cjs +3 -0
  105. package/dist/chunk-TKUNRCRH.js +4 -0
  106. package/dist/chunk-TQLCOMKC.js +4 -0
  107. package/dist/chunk-TRXYDWGE.cjs +1 -0
  108. package/dist/chunk-TS55CUNJ.js +57 -0
  109. package/dist/chunk-UFBJ3WOZ.js +2 -0
  110. package/dist/chunk-UQRVQUVR.js +2 -0
  111. package/dist/chunk-UW5W35NP.js +122 -0
  112. package/dist/chunk-VI7WCO2J.cjs +3 -0
  113. package/dist/chunk-W2GPP6RB.js +122 -0
  114. package/dist/chunk-WHOA7YJU.cjs +1 -0
  115. package/dist/chunk-WNRUPL26.js +2 -0
  116. package/dist/chunk-WXT2XW7T.js +13 -0
  117. package/dist/chunk-XFYSADHV.cjs +2 -0
  118. package/dist/chunk-XIAJQLGS.js +2 -0
  119. package/dist/chunk-XK6UB77Q.js +4 -0
  120. package/dist/chunk-Y2VHO66Q.cjs +3 -0
  121. package/dist/chunk-Y5O2OD7J.cjs +3 -0
  122. package/dist/chunk-YARB43JG.cjs +56 -0
  123. package/dist/chunk-YLCEMVYY.cjs +56 -0
  124. package/dist/chunk-YSOM57GK.cjs +3 -0
  125. package/dist/chunk-Z3UVDGYS.cjs +56 -0
  126. package/dist/chunk-ZTLGK6R4.cjs +12 -0
  127. package/dist/chunk-ZUBJ6RLQ.cjs +1 -0
  128. package/dist/cli/index.cjs +1 -1
  129. package/dist/cli/index.js +1 -1
  130. package/dist/client.cjs +8 -8
  131. package/dist/client.d.cts +1248 -0
  132. package/dist/client.d.ts +1248 -0
  133. package/dist/client.js +8 -8
  134. package/dist/drizzle/index.cjs +1 -1
  135. package/dist/drizzle/index.d.cts +3 -3
  136. package/dist/drizzle/index.d.ts +3 -3
  137. package/dist/drizzle/index.js +1 -1
  138. package/dist/fields/index.cjs +1 -1
  139. package/dist/fields/index.d.cts +2 -2
  140. package/dist/fields/index.d.ts +2 -2
  141. package/dist/fields/index.js +1 -1
  142. package/dist/graphql/index.d.cts +3 -3
  143. package/dist/graphql/index.d.ts +3 -3
  144. package/dist/{index-d1m_oup7.d.cts → index-B9BFNOHd.d.cts} +1 -1
  145. package/dist/index-BMcYFpTv.d.cts +105 -0
  146. package/dist/index-BttsFZDa.d.ts +105 -0
  147. package/dist/index-CxA9uOv0.d.ts +105 -0
  148. package/dist/{index-4cH-BjtP.d.ts → index-D6AXbuPI.d.ts} +1 -1
  149. package/dist/index-DF0KDBaM.d.cts +105 -0
  150. package/dist/index-DG4Xu7gA.d.cts +105 -0
  151. package/dist/index-eHex8Iwj.d.ts +105 -0
  152. package/dist/index.cjs +32 -32
  153. package/dist/index.d.cts +73 -11
  154. package/dist/index.d.ts +73 -11
  155. package/dist/index.js +32 -32
  156. package/dist/lib-A2D63VXD.cjs +1 -0
  157. package/dist/lib-JQD2JAOO.js +2 -0
  158. package/dist/local-KR3AIGVA.cjs +1 -0
  159. package/dist/local-T7GISZBL.js +1 -0
  160. package/dist/mongo-auth-adapter-GR2CFFEA.js +1 -0
  161. package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +1 -0
  162. package/dist/mongodb/index.cjs +1 -1
  163. package/dist/mongodb/index.d.cts +4 -3
  164. package/dist/mongodb/index.d.ts +4 -3
  165. package/dist/mongodb/index.js +1 -1
  166. package/dist/nodemailer-transport-3VWVUBM5.cjs +1 -0
  167. package/dist/nodemailer-transport-7RHATUKL.js +1 -0
  168. package/dist/nodemailer-transport-CHO2WKIY.js +1 -0
  169. package/dist/nodemailer-transport-ED2IXNGW.cjs +1 -0
  170. package/dist/rest/index.cjs +1 -1
  171. package/dist/rest/index.d.cts +4 -4
  172. package/dist/rest/index.d.ts +4 -4
  173. package/dist/rest/index.js +1 -1
  174. package/dist/templates/index.cjs +1 -1
  175. package/dist/templates/index.d.cts +2 -2
  176. package/dist/templates/index.d.ts +2 -2
  177. package/dist/templates/index.js +1 -1
  178. package/dist/trpc/index.cjs +1 -1
  179. package/dist/trpc/index.d.cts +3 -3
  180. package/dist/trpc/index.d.ts +3 -3
  181. package/dist/trpc/index.js +1 -1
  182. package/dist/types-B5Qz1svz.d.cts +822 -0
  183. package/dist/types-Bii0bhUV.d.cts +329 -0
  184. package/dist/types-Bii0bhUV.d.ts +329 -0
  185. package/dist/{types-BADIMVGF.d.ts → types-Bt2_ycUO.d.ts} +36 -1
  186. package/dist/types-C4wXHImf.d.ts +822 -0
  187. package/dist/types-DCWgPFmi.d.cts +822 -0
  188. package/dist/types-DROqAsr0.d.cts +330 -0
  189. package/dist/types-DROqAsr0.d.ts +330 -0
  190. package/dist/{types-YAVR0H9Z.d.cts → types-DsF64Wrc.d.cts} +36 -1
  191. package/dist/types-ZrjEVWfi.d.ts +811 -0
  192. package/dist/types-dEy5JxvN.d.ts +822 -0
  193. package/dist/types-tVJc9YbX.d.cts +811 -0
  194. package/dist/ws/index.cjs +1 -1
  195. package/dist/ws/index.d.cts +121 -1
  196. package/dist/ws/index.d.ts +121 -1
  197. package/dist/ws/index.js +1 -1
  198. package/package.json +2 -2
  199. package/dist/chunk-5M3FKE2V.js +0 -2
  200. package/dist/chunk-WCFHS7EZ.cjs +0 -1
@@ -0,0 +1,1248 @@
1
+ /**
2
+ * Serializable condition for conditional field visibility.
3
+ * Unlike function conditions, these survive JSON serialization
4
+ * and can be used in admin configs that are built at compile time.
5
+ */
6
+ type DeclarativeCondition = {
7
+ /** The field name to evaluate (resolved from root form data, supports dot-notation) */
8
+ field: string;
9
+ /** Show the field when the target field equals this value */
10
+ equals?: string | number | boolean;
11
+ /** Show the field when the target field does NOT equal this value */
12
+ notEquals?: string | number | boolean;
13
+ /** Show the field when the target field's value is one of these */
14
+ in?: (string | number | boolean)[];
15
+ /** Show the field when the target field's value is greater than this */
16
+ greaterThan?: number;
17
+ } | {
18
+ and: DeclarativeCondition[];
19
+ } | {
20
+ or: DeclarativeCondition[];
21
+ };
22
+ interface FieldAdmin {
23
+ description?: string;
24
+ placeholder?: string;
25
+ readOnly?: boolean | ((data: Record<string, unknown>, siblingData: Record<string, unknown>) => boolean);
26
+ hidden?: boolean | ((data: Record<string, unknown>, siblingData: Record<string, unknown>) => boolean);
27
+ width?: string;
28
+ position?: "sidebar" | "main";
29
+ autoGenerate?: string;
30
+ action?: string;
31
+ method?: string;
32
+ inline?: boolean;
33
+ compact?: boolean;
34
+ display?: "receipt" | "table" | "default";
35
+ collapsible?: boolean;
36
+ initCollapsed?: boolean;
37
+ pickerMode?: "drawer" | "dropdown";
38
+ condition?: ((data: Record<string, unknown>, siblingData: Record<string, unknown>) => boolean) | DeclarativeCondition;
39
+ }
40
+ interface FieldAccess {
41
+ read?: (args: {
42
+ user: any;
43
+ req?: Request;
44
+ doc?: any;
45
+ data?: any;
46
+ siblingData?: any;
47
+ }) => boolean | Promise<boolean>;
48
+ update?: (args: {
49
+ user: any;
50
+ req?: Request;
51
+ doc?: any;
52
+ data?: any;
53
+ siblingData?: any;
54
+ }) => boolean | Promise<boolean>;
55
+ create?: (args: {
56
+ user: any;
57
+ req?: Request;
58
+ doc?: any;
59
+ data?: any;
60
+ siblingData?: any;
61
+ }) => boolean | Promise<boolean>;
62
+ }
63
+ interface BaseField {
64
+ name: string;
65
+ label?: string;
66
+ required?: boolean;
67
+ unique?: boolean;
68
+ indexed?: boolean;
69
+ defaultValue?: any;
70
+ admin?: FieldAdmin;
71
+ access?: FieldAccess;
72
+ validate?: (value: any, options: ValidateOptions) => string | true | Promise<string | true>;
73
+ hooks?: {
74
+ beforeValidate?: Hook$1[];
75
+ beforeChange?: Hook$1[];
76
+ afterChange?: Hook$1[];
77
+ afterRead?: Hook$1[];
78
+ };
79
+ }
80
+ interface ValidateOptions {
81
+ data?: Record<string, any>;
82
+ siblingData?: Record<string, any>;
83
+ user?: unknown;
84
+ operation?: string;
85
+ required?: boolean;
86
+ }
87
+ type Hook$1 = (args: any) => Promise<any> | any;
88
+ type TextFieldVariant = "text" | "email" | "password" | "url" | "id";
89
+ interface TextField extends BaseField {
90
+ type: "text";
91
+ variant?: TextFieldVariant;
92
+ minLength?: number;
93
+ maxLength?: number;
94
+ pattern?: string;
95
+ hasMany?: boolean;
96
+ localized?: boolean;
97
+ }
98
+ interface NumberField extends BaseField {
99
+ type: "number";
100
+ min?: number;
101
+ max?: number;
102
+ step?: number;
103
+ integer?: boolean;
104
+ hasMany?: boolean;
105
+ }
106
+ interface CheckboxField extends BaseField {
107
+ type: "checkbox";
108
+ }
109
+ interface DateField extends BaseField {
110
+ type: "date";
111
+ minDate?: string;
112
+ maxDate?: string;
113
+ time?: boolean;
114
+ }
115
+ interface EmailField extends BaseField {
116
+ type: "email";
117
+ }
118
+ interface PasswordField extends BaseField {
119
+ type: "password";
120
+ }
121
+ interface TextareaField extends BaseField {
122
+ type: "textarea";
123
+ minLength?: number;
124
+ maxLength?: number;
125
+ rows?: number;
126
+ localized?: boolean;
127
+ }
128
+ interface SelectField extends BaseField {
129
+ type: "select";
130
+ options?: Array<{
131
+ label: string;
132
+ value: string;
133
+ }> | ((args: {
134
+ data: any;
135
+ siblingData: any;
136
+ }) => Array<{
137
+ label: string;
138
+ value: string;
139
+ }>);
140
+ dynamicOptions?: string;
141
+ hasMany?: boolean;
142
+ defaultValue?: string | string[];
143
+ }
144
+ interface RadioField extends BaseField {
145
+ type: "radio";
146
+ options: Array<{
147
+ label: string;
148
+ value: string;
149
+ }> | ((args: {
150
+ data: any;
151
+ siblingData: any;
152
+ }) => Array<{
153
+ label: string;
154
+ value: string;
155
+ }>);
156
+ defaultValue?: string;
157
+ }
158
+ interface ColorField extends BaseField {
159
+ type: "color";
160
+ format?: "hex" | "rgb" | "hsl";
161
+ defaultValue?: string;
162
+ }
163
+ interface ImageField extends BaseField {
164
+ type: "image";
165
+ minCount?: number;
166
+ maxCount?: number;
167
+ allowedTypes?: string[];
168
+ maxSize?: number;
169
+ }
170
+ type RichTextBlock = Record<string, any>;
171
+ interface RichTextField extends BaseField {
172
+ type: "richtext";
173
+ defaultValue?: Record<string, any>;
174
+ localized?: boolean;
175
+ }
176
+ interface JSONField extends BaseField {
177
+ type: "json";
178
+ defaultValue?: Record<string, any>;
179
+ }
180
+ interface CodeField extends BaseField {
181
+ type: "code";
182
+ language?: string;
183
+ defaultValue?: string;
184
+ }
185
+ interface UploadField extends BaseField {
186
+ type: "upload";
187
+ relationTo: string;
188
+ hasMany?: boolean;
189
+ maxDepth?: number;
190
+ defaultValue?: string;
191
+ }
192
+ interface MarkdownField extends BaseField {
193
+ type: "markdown";
194
+ localized?: boolean;
195
+ defaultValue?: string;
196
+ }
197
+ interface RelationshipField extends BaseField {
198
+ type: "relationship";
199
+ /**
200
+ * The collection slug(s) to relate to.
201
+ * Use "*" to allow relating to ANY registered collection.
202
+ */
203
+ relationTo: string | string[];
204
+ hasMany?: boolean;
205
+ maxDepth?: number;
206
+ filterOptions?: (args: {
207
+ data: any;
208
+ user: any;
209
+ }) => Record<string, any>;
210
+ defaultValue?: string | string[];
211
+ }
212
+ interface ArrayField extends BaseField {
213
+ type: "array";
214
+ fields: Field[];
215
+ minRows?: number;
216
+ maxRows?: number;
217
+ labels?: {
218
+ singular?: string;
219
+ plural?: string;
220
+ };
221
+ defaultValue?: Record<string, any>[];
222
+ }
223
+ interface ListField extends BaseField {
224
+ type: "list";
225
+ defaultValue?: string[];
226
+ }
227
+ interface GroupField extends BaseField {
228
+ type: "group";
229
+ fields: Field[];
230
+ defaultValue?: Record<string, any>;
231
+ }
232
+ interface BlockImage {
233
+ url: string;
234
+ alt?: string;
235
+ }
236
+ interface BlockAdmin {
237
+ group?: string;
238
+ description?: string;
239
+ images?: {
240
+ icon?: BlockImage | string;
241
+ thumbnail?: BlockImage | string;
242
+ };
243
+ }
244
+ interface Block {
245
+ slug: string;
246
+ label: string;
247
+ fields: Field[];
248
+ imageURL?: string;
249
+ admin?: BlockAdmin;
250
+ }
251
+ interface BlocksField extends BaseField {
252
+ type: "blocks";
253
+ blocks?: Block[];
254
+ minRows?: number;
255
+ maxRows?: number;
256
+ defaultValue?: Array<{
257
+ blockType: string;
258
+ [key: string]: any;
259
+ }>;
260
+ }
261
+ interface RowField extends Omit<BaseField, "name"> {
262
+ type: "row";
263
+ fields: Field[];
264
+ name?: string;
265
+ }
266
+ interface CollapsibleField extends Omit<BaseField, "name"> {
267
+ type: "collapsible";
268
+ fields: Field[];
269
+ label: string;
270
+ name?: string;
271
+ }
272
+ interface TabsField extends Omit<BaseField, "name"> {
273
+ type: "tabs";
274
+ tabs: Array<{
275
+ label: string;
276
+ fields: Field[];
277
+ name?: string;
278
+ }>;
279
+ name?: string;
280
+ }
281
+ interface ButtonField extends BaseField {
282
+ type: "button";
283
+ label: string;
284
+ action?: string;
285
+ method?: string;
286
+ inline?: boolean;
287
+ }
288
+ interface ActionField extends BaseField {
289
+ type: "action";
290
+ label: string;
291
+ action?: string;
292
+ method?: string;
293
+ inline?: boolean;
294
+ }
295
+ interface SecretField extends BaseField {
296
+ type: "secret";
297
+ }
298
+ interface IconField extends BaseField {
299
+ type: "icon";
300
+ }
301
+ interface EmbeddingField extends BaseField {
302
+ type: "embedding";
303
+ sourceField: string;
304
+ provider?: "openai" | "cohere" | "groq" | "local-fastembed";
305
+ model?: string;
306
+ dimensions?: number;
307
+ }
308
+ type Field = TextField | NumberField | CheckboxField | DateField | EmailField | PasswordField | TextareaField | SelectField | RadioField | ColorField | ImageField | RichTextField | JSONField | CodeField | UploadField | MarkdownField | RelationshipField | ArrayField | ListField | GroupField | BlocksField | RowField | CollapsibleField | TabsField | ButtonField | ActionField | SecretField | IconField | EmbeddingField;
309
+ type FieldType = Field["type"];
310
+ declare const ALL_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "icon", "richtext", "json", "code", "upload", "image", "markdown", "embedding", "relationship", "array", "group", "blocks", "row", "collapsible", "tabs"];
311
+
312
+ interface Request$1 {
313
+ body?: any;
314
+ headers: Record<string, string>;
315
+ method?: string;
316
+ url?: string;
317
+ cookies?: Record<string, string>;
318
+ query?: Record<string, any>;
319
+ }
320
+ interface User {
321
+ id: string;
322
+ email: string;
323
+ role: string;
324
+ tenantId?: string;
325
+ [key: string]: any;
326
+ }
327
+ interface HookArgs<T = any> {
328
+ collection?: string;
329
+ global?: string;
330
+ data?: T;
331
+ originalDoc?: T;
332
+ doc?: T;
333
+ req: Request$1;
334
+ user?: User;
335
+ operation: 'create' | 'read' | 'update' | 'delete';
336
+ tenantId?: string;
337
+ field?: string;
338
+ siblingData?: Record<string, any>;
339
+ value?: any;
340
+ previousValue?: any;
341
+ context?: Record<string, any>;
342
+ }
343
+ type Hook<T = any> = (args: HookArgs<T>) => Promise<T | void> | T | void;
344
+ interface CollectionHooks {
345
+ beforeValidate?: Hook[];
346
+ beforeChange?: Hook[];
347
+ afterChange?: Hook[];
348
+ beforeRead?: Hook[];
349
+ afterRead?: Hook[];
350
+ beforeDelete?: Hook[];
351
+ afterDelete?: Hook[];
352
+ beforeLogin?: Hook[];
353
+ afterLogin?: Hook[];
354
+ afterLogout?: Hook[];
355
+ afterRefresh?: Hook[];
356
+ afterForgotPassword?: Hook[];
357
+ }
358
+ interface GlobalHooks {
359
+ beforeValidate?: Hook[];
360
+ beforeChange?: Hook[];
361
+ afterChange?: Hook[];
362
+ beforeRead?: Hook[];
363
+ afterRead?: Hook[];
364
+ }
365
+
366
+ interface PluginHooks {
367
+ beforeInit?: Hook[];
368
+ afterInit?: Hook[];
369
+ beforeRegisterCollections?: Hook[];
370
+ afterRegisterCollections?: Hook[];
371
+ beforeRegisterGlobals?: Hook[];
372
+ afterRegisterGlobals?: Hook[];
373
+ beforeServerStart?: Hook[];
374
+ afterServerStart?: Hook[];
375
+ beforeServerStop?: Hook[];
376
+ afterServerStop?: Hook[];
377
+ }
378
+ interface PluginCollectionExtension {
379
+ slug: string;
380
+ config: Partial<CollectionConfig>;
381
+ }
382
+ interface PluginGlobalExtension {
383
+ slug: string;
384
+ config: Partial<GlobalConfig>;
385
+ }
386
+ interface PluginFieldExtension {
387
+ collectionSlug: string;
388
+ field: Field;
389
+ }
390
+ interface PluginAPI {
391
+ registry: {
392
+ getCollection: (slug: string) => CollectionConfig | undefined;
393
+ getCollections: () => CollectionConfig[];
394
+ getGlobal: (slug: string) => GlobalConfig | undefined;
395
+ addCollection: (config: CollectionConfig) => void;
396
+ addGlobal: (config: GlobalConfig) => void;
397
+ extendCollection: (slug: string, extension: Partial<CollectionConfig>) => void;
398
+ extendGlobal: (slug: string, extension: Partial<GlobalConfig>) => void;
399
+ addField: (collectionSlug: string, field: Field, position?: number) => void;
400
+ };
401
+ hooks: {
402
+ register: (event: string, handler: Hook) => void;
403
+ unregister: (event: string, handler: Hook) => void;
404
+ };
405
+ config: {
406
+ get: (key: string) => any;
407
+ set: (key: string, value: any) => void;
408
+ };
409
+ db: any;
410
+ }
411
+ declare abstract class KyroPlugin {
412
+ name: string;
413
+ displayName?: string;
414
+ adminEntry?: string;
415
+ version?: string;
416
+ description?: string;
417
+ hooks: PluginHooks;
418
+ collections: Partial<CollectionConfig>[];
419
+ globals: Partial<GlobalConfig>[];
420
+ fields: PluginFieldExtension[];
421
+ extensions: {
422
+ collections: PluginCollectionExtension[];
423
+ globals: PluginGlobalExtension[];
424
+ };
425
+ adminComponents: Record<string, any>;
426
+ adminStyles: string[];
427
+ serverMiddleware?: (app: any) => void;
428
+ clientMiddleware?: (req: any) => any;
429
+ constructor(name: string);
430
+ init?(api: PluginAPI): Promise<void>;
431
+ beforeInit?(api: PluginAPI): Promise<void>;
432
+ afterInit?(api: PluginAPI): Promise<void>;
433
+ getCollections?(): Partial<CollectionConfig>[];
434
+ getGlobals?(): Partial<GlobalConfig>[];
435
+ getHooks?(): PluginHooks;
436
+ }
437
+
438
+ interface WhereClause {
439
+ [field: string]: any;
440
+ }
441
+ interface AccessArgs {
442
+ req: Request$1;
443
+ user?: User;
444
+ data?: unknown;
445
+ doc?: unknown;
446
+ id?: string;
447
+ tenantId?: string;
448
+ context?: Record<string, unknown>;
449
+ }
450
+ type AccessControl = boolean | ((args: AccessArgs) => Promise<boolean | WhereClause> | boolean | WhereClause);
451
+ interface CollectionAccess {
452
+ create?: AccessControl;
453
+ read?: AccessControl;
454
+ update?: AccessControl;
455
+ delete?: AccessControl;
456
+ admin?: AccessControl;
457
+ unlock?: AccessControl;
458
+ readVersions?: AccessControl;
459
+ }
460
+ interface GlobalAccess {
461
+ read?: AccessControl;
462
+ update?: AccessControl;
463
+ }
464
+
465
+ type AuditAction = "login" | "logout" | "login_failed" | "register" | "verify_email" | "password_change" | "password_reset" | "password_reset_request" | "role_change" | "permission_change" | "document_create" | "document_update" | "document_delete" | "settings_change" | "user_lockout" | "user_unlock" | "user_create" | "user_update" | "user_delete" | "api_request" | "api_key_create" | "api_key_update" | "api_key_rotate" | "api_key_delete" | "tenant_create" | "tenant_delete";
466
+ interface AuditLog {
467
+ id: string;
468
+ timestamp: Date;
469
+ action: AuditAction;
470
+ userId?: string;
471
+ userEmail?: string;
472
+ role?: string;
473
+ resource: string;
474
+ resourceId?: string;
475
+ changes?: {
476
+ field: string;
477
+ old: any;
478
+ new: any;
479
+ }[];
480
+ ipAddress?: string;
481
+ userAgent?: string;
482
+ success: boolean;
483
+ error?: string;
484
+ metadata?: Record<string, any>;
485
+ }
486
+ interface AuditLogFilter {
487
+ userId?: string;
488
+ action?: AuditAction | AuditAction[];
489
+ resource?: string;
490
+ resourceId?: string;
491
+ success?: boolean;
492
+ startDate?: Date;
493
+ endDate?: Date;
494
+ limit?: number;
495
+ offset?: number;
496
+ }
497
+
498
+ interface AuthUser {
499
+ id: string;
500
+ name?: string;
501
+ email: string;
502
+ passwordHash?: string;
503
+ role: UserRole;
504
+ avatar?: string;
505
+ tenantId?: string;
506
+ emailVerified?: boolean;
507
+ locked?: boolean;
508
+ lastLogin?: string;
509
+ failedLoginAttempts?: number;
510
+ createdAt: string;
511
+ updatedAt: string;
512
+ }
513
+ type UserRole = "super_admin" | "admin" | "editor" | "author" | "customer" | "guest";
514
+ interface Session {
515
+ id: string;
516
+ userId: string;
517
+ token: string;
518
+ refreshToken?: string;
519
+ expiresAt: string;
520
+ createdAt: string;
521
+ ipAddress?: string;
522
+ userAgent?: string;
523
+ }
524
+ interface JWTPayload {
525
+ sub: string;
526
+ email: string;
527
+ role: UserRole;
528
+ tenantId?: string;
529
+ iat?: number;
530
+ exp?: number;
531
+ sid?: string;
532
+ }
533
+ interface AuthTokenConfig {
534
+ secret: string;
535
+ expiresIn?: string | number;
536
+ refreshExpiresIn?: string | number;
537
+ issuer?: string;
538
+ audience?: string[];
539
+ saltRounds?: number;
540
+ }
541
+ interface LoginCredentials {
542
+ email: string;
543
+ password: string;
544
+ }
545
+ interface RegisterData {
546
+ email: string;
547
+ password: string;
548
+ role?: UserRole;
549
+ tenantId?: string;
550
+ }
551
+ interface AuthResult {
552
+ success: boolean;
553
+ user?: AuthUser;
554
+ session?: Session;
555
+ token?: string;
556
+ error?: string;
557
+ }
558
+ interface AuthAdapter {
559
+ createUser(data: {
560
+ email: string;
561
+ password: string;
562
+ name?: string;
563
+ role?: UserRole;
564
+ avatar?: string;
565
+ tenantId?: string;
566
+ }): Promise<AuthUser>;
567
+ findUserByEmail(email: string): Promise<AuthUser | null>;
568
+ findUserById(id: string): Promise<AuthUser | null>;
569
+ updateUser(id: string, data: Partial<AuthUser> & {
570
+ password?: string;
571
+ }): Promise<AuthUser | null>;
572
+ deleteUser(id: string): Promise<boolean>;
573
+ verifyPassword(email: string, password: string): Promise<AuthUser | null>;
574
+ hashPassword(password: string): Promise<string>;
575
+ createSession(userId: string, data?: {
576
+ ipAddress?: string;
577
+ userAgent?: string;
578
+ }): Promise<Session>;
579
+ findSessionByToken(token: string): Promise<Session | null>;
580
+ findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
581
+ deleteSession(sessionId: string): Promise<boolean>;
582
+ deleteUserSessions(userId: string): Promise<number>;
583
+ createEmailVerificationToken(userId: string): Promise<{
584
+ token: string;
585
+ expiresAt: Date;
586
+ }>;
587
+ verifyEmailToken(token: string): Promise<{
588
+ success: boolean;
589
+ userId?: string;
590
+ error?: string;
591
+ }>;
592
+ createPasswordResetToken(email: string): Promise<{
593
+ token: string;
594
+ expiresAt: Date;
595
+ error?: string;
596
+ }>;
597
+ resetPasswordWithToken(token: string, newPassword: string): Promise<{
598
+ success: boolean;
599
+ error?: string;
600
+ }>;
601
+ hasAnyUsers?(): Promise<boolean>;
602
+ connect?(): Promise<void>;
603
+ disconnect?(): Promise<void>;
604
+ addPasswordToHistory?(userId: string, passwordHash: string): Promise<void>;
605
+ getPasswordHistory?(userId: string, count?: number): Promise<string[]>;
606
+ isPasswordInHistory?(password: string, userId: string, historyCount?: number): Promise<boolean>;
607
+ findAuditLogs(filter: AuditLogFilter): Promise<{
608
+ logs: AuditLog[];
609
+ total: number;
610
+ }>;
611
+ createAuditLog(data: Omit<AuditLog, "id" | "timestamp">): Promise<AuditLog>;
612
+ }
613
+
614
+ interface TenantContext {
615
+ tenantId: string;
616
+ userId: string;
617
+ role?: string;
618
+ roles?: string[];
619
+ permissions?: string[];
620
+ isSuperAdmin?: boolean;
621
+ }
622
+
623
+ interface UploadOptions {
624
+ folder?: string;
625
+ filename?: string;
626
+ mimeType?: string;
627
+ metadata?: Record<string, unknown>;
628
+ }
629
+ interface UploadedFile {
630
+ id: string;
631
+ filename: string;
632
+ originalName: string;
633
+ mimeType: string;
634
+ size: number;
635
+ url: string;
636
+ thumbnailUrl?: string;
637
+ width?: number;
638
+ height?: number;
639
+ folder?: string;
640
+ provider: string;
641
+ metadata?: Record<string, unknown>;
642
+ createdAt: string;
643
+ }
644
+ interface ImageTransforms {
645
+ width?: number;
646
+ height?: number;
647
+ fit?: "clip" | "crop" | "fill" | "fillmax" | "scale" | "max" | "min";
648
+ format?: "webp" | "avif" | "jpeg" | "jpg" | "png" | "gif";
649
+ quality?: number;
650
+ blur?: number;
651
+ sharpen?: number;
652
+ /** Crop region as percentages (0-100) of the original image */
653
+ cropX?: number;
654
+ cropY?: number;
655
+ cropWidth?: number;
656
+ cropHeight?: number;
657
+ }
658
+ interface StorageProvider {
659
+ name: string;
660
+ displayName: string;
661
+ supportsDynamicResize: boolean;
662
+ upload(file: File, options?: UploadOptions): Promise<UploadedFile>;
663
+ uploadFromUrl(url: string, options?: UploadOptions): Promise<UploadedFile>;
664
+ delete(url: string): Promise<void>;
665
+ rename(oldUrl: string, newKey: string): Promise<string>;
666
+ getImageUrl(url: string, transforms?: ImageTransforms): string;
667
+ generateThumbnail(file: UploadedFile, size: {
668
+ width: number;
669
+ height: number;
670
+ }): Promise<string>;
671
+ list(prefix?: string): Promise<UploadedFile[]>;
672
+ exists(url: string): Promise<boolean>;
673
+ createFolder?(folder: string): Promise<void>;
674
+ deleteFolder?(folder: string): Promise<void>;
675
+ }
676
+
677
+ interface AdminConfig {
678
+ useAsTitle?: string;
679
+ defaultColumns?: string[];
680
+ hidden?: boolean;
681
+ description?: string;
682
+ hideAPIURL?: boolean;
683
+ group?: string;
684
+ folder?: string;
685
+ parentFolder?: string;
686
+ treeHierarchy?: boolean;
687
+ icon?: string;
688
+ order?: number;
689
+ preview?: (doc: Record<string, unknown>, options: {
690
+ req: unknown;
691
+ token?: string;
692
+ }) => string | Promise<string>;
693
+ disableDuplicate?: boolean;
694
+ disablePreview?: boolean;
695
+ pagination?: {
696
+ defaultLimit?: number;
697
+ limits?: number[];
698
+ };
699
+ layout?: "split" | "single";
700
+ smartViews?: SmartViewConfig[];
701
+ }
702
+ interface HierarchyConfig {
703
+ parentField?: string;
704
+ maxDepth?: number;
705
+ slugPrefix?: boolean;
706
+ }
707
+ interface ProjectConfig {
708
+ id: string;
709
+ name: string;
710
+ slug: string;
711
+ description?: string;
712
+ environment?: 'development' | 'staging' | 'production' | string;
713
+ collections?: string[];
714
+ globals?: string[];
715
+ settings?: Record<string, unknown>;
716
+ }
717
+ interface SmartViewConfig {
718
+ id: string;
719
+ name: string;
720
+ icon?: string;
721
+ color?: string;
722
+ filter: Record<string, any>;
723
+ collections?: string[];
724
+ description?: string;
725
+ }
726
+ interface OrganizationConfig {
727
+ id: string;
728
+ name: string;
729
+ slug: string;
730
+ billingEmail?: string;
731
+ projects?: ProjectConfig[];
732
+ roles?: Array<{
733
+ name: string;
734
+ description?: string;
735
+ permissions?: string[];
736
+ }>;
737
+ }
738
+ interface FieldOverrides {
739
+ [fieldPath: string]: any;
740
+ }
741
+ interface CollectionOverrideConfig extends Partial<AdminConfig> {
742
+ label?: string;
743
+ singularLabel?: string;
744
+ labelPlural?: string;
745
+ labels?: {
746
+ singular?: string;
747
+ plural?: string;
748
+ };
749
+ hidden?: boolean;
750
+ timestamps?: boolean;
751
+ versions?: {
752
+ drafts?: boolean;
753
+ maxPerDoc?: number;
754
+ autosave?: boolean;
755
+ };
756
+ seo?: boolean | Record<string, any>;
757
+ access?: CollectionAccess;
758
+ hooks?: CollectionHooks;
759
+ fields?: FieldOverrides;
760
+ blocks?: Record<string, any> | any[];
761
+ tabs?: Record<string, any> | any[];
762
+ [key: string]: any;
763
+ }
764
+ interface GlobalOverrideConfig extends Partial<AdminConfig> {
765
+ label?: string;
766
+ hidden?: boolean;
767
+ access?: GlobalAccess;
768
+ hooks?: GlobalHooks;
769
+ fields?: FieldOverrides;
770
+ blocks?: Record<string, any> | any[];
771
+ tabs?: Record<string, any> | any[];
772
+ [key: string]: any;
773
+ }
774
+ interface UploadConfig {
775
+ staticDir?: string;
776
+ staticURL?: string;
777
+ mimeTypes?: string[];
778
+ fileSize?: number;
779
+ imageSizes?: ImageSize[];
780
+ crop?: boolean;
781
+ focalPoint?: boolean;
782
+ formatOptions?: {
783
+ format: "webp" | "png" | "jpg" | "avif";
784
+ options?: Record<string, unknown>;
785
+ };
786
+ resizeOptions?: Record<string, any>;
787
+ adminThumbnail?: string;
788
+ }
789
+ interface ImageSize {
790
+ name: string;
791
+ width?: number;
792
+ height?: number;
793
+ crop?: string;
794
+ position?: string;
795
+ formatOptions?: {
796
+ format: "webp" | "png" | "jpg" | "avif";
797
+ };
798
+ generateImageName?: (doc: any) => string;
799
+ }
800
+ interface VersionConfig {
801
+ maxPerDoc?: number;
802
+ drafts?: boolean;
803
+ retainDeleted?: boolean;
804
+ }
805
+ type DocumentStatus = 'draft' | 'published' | 'archived';
806
+ interface AuthConfig {
807
+ tokenExpiration?: number;
808
+ verify?: boolean | {
809
+ generateEmailHTML?: (args: any) => string;
810
+ };
811
+ maxLoginAttempts?: number;
812
+ lockTime?: number;
813
+ cookies?: {
814
+ secure?: boolean;
815
+ sameSite?: "strict" | "lax" | "none";
816
+ domain?: string;
817
+ };
818
+ forgotPassword?: {
819
+ generateEmailHTML?: (args: any) => string;
820
+ generateEmailSubject?: (args: any) => string;
821
+ };
822
+ strategies?: Array<{
823
+ name: string;
824
+ authenticate: (args: any) => Promise<any>;
825
+ }>;
826
+ }
827
+ interface CollectionConfig {
828
+ slug: string;
829
+ label?: string;
830
+ labelPlural?: string;
831
+ singularLabel?: string;
832
+ admin?: AdminConfig;
833
+ fields: Field[];
834
+ access?: CollectionAccess;
835
+ hooks?: CollectionHooks;
836
+ timestamps?: boolean;
837
+ tenantScoped?: boolean;
838
+ tenantField?: string;
839
+ upload?: UploadConfig;
840
+ versions?: VersionConfig;
841
+ folder?: string;
842
+ hierarchy?: HierarchyConfig;
843
+ auth?: boolean | AuthConfig;
844
+ graphQL?: {
845
+ singularName?: string;
846
+ pluralName?: string;
847
+ };
848
+ indexes?: Array<{
849
+ fields: Record<string, number | "text">;
850
+ options?: Record<string, any>;
851
+ }>;
852
+ seo?: boolean | Record<string, any>;
853
+ custom?: Record<string, any>;
854
+ tabs?: Array<{
855
+ label: string;
856
+ fields: Field[];
857
+ name?: string;
858
+ }>;
859
+ }
860
+ interface GlobalConfig {
861
+ slug: string;
862
+ label?: string;
863
+ folder?: string;
864
+ admin?: AdminConfig;
865
+ fields: Field[];
866
+ access?: GlobalAccess;
867
+ hooks?: GlobalHooks;
868
+ versions?: VersionConfig;
869
+ graphQL?: {
870
+ name?: string;
871
+ };
872
+ typescript?: {
873
+ interface?: string;
874
+ };
875
+ custom?: Record<string, any>;
876
+ tabs?: Array<{
877
+ label: string;
878
+ fields: Field[];
879
+ name?: string;
880
+ }>;
881
+ }
882
+ interface FindArgs {
883
+ collection: string;
884
+ where?: Record<string, any>;
885
+ sort?: string;
886
+ limit?: number;
887
+ page?: number;
888
+ depth?: number;
889
+ tenantId?: string;
890
+ select?: string[];
891
+ user?: any;
892
+ context?: Record<string, any>;
893
+ overrideAccess?: boolean;
894
+ /** If true, returns draft docs (admin view). If false/omitted, only published docs are returned (public API). */
895
+ draft?: boolean;
896
+ }
897
+ interface FindOneArgs {
898
+ collection: string;
899
+ where: Record<string, any>;
900
+ tenantId?: string;
901
+ draft?: boolean;
902
+ depth?: number;
903
+ select?: string[];
904
+ }
905
+ interface FindByIDArgs {
906
+ collection: string;
907
+ id: string;
908
+ depth?: number;
909
+ tenantId?: string;
910
+ select?: string[];
911
+ user?: any;
912
+ context?: Record<string, any>;
913
+ overrideAccess?: boolean;
914
+ /** If true, returns document regardless of status (admin view). */
915
+ draft?: boolean;
916
+ }
917
+ interface CreateArgs {
918
+ collection: string;
919
+ data: Record<string, any>;
920
+ depth?: number;
921
+ tenantId?: string;
922
+ select?: string[];
923
+ user?: any;
924
+ context?: Record<string, any>;
925
+ overrideAccess?: boolean;
926
+ }
927
+ interface UpdateArgs {
928
+ collection: string;
929
+ id: string;
930
+ data: Record<string, any>;
931
+ depth?: number;
932
+ tenantId?: string;
933
+ select?: string[];
934
+ user?: any;
935
+ context?: Record<string, any>;
936
+ overrideAccess?: boolean;
937
+ }
938
+ interface DeleteArgs {
939
+ collection: string;
940
+ id: string;
941
+ tenantId?: string;
942
+ user?: any;
943
+ context?: Record<string, any>;
944
+ overrideAccess?: boolean;
945
+ }
946
+ interface FindResult<T = any> {
947
+ docs: T[];
948
+ totalDocs: number;
949
+ limit: number;
950
+ totalPages: number;
951
+ page: number;
952
+ pagingCounter: number;
953
+ hasPrevPage: boolean;
954
+ hasNextPage: boolean;
955
+ prevPage: number | null;
956
+ nextPage: number | null;
957
+ }
958
+ interface VersionRecord<T = Record<string, any>> {
959
+ id: string;
960
+ collection: string;
961
+ documentId: string;
962
+ version: number;
963
+ status: DocumentStatus;
964
+ data: T;
965
+ createdBy?: string;
966
+ createdAt: string;
967
+ updatedAt: string;
968
+ publishedAt?: string | null;
969
+ changeDescription?: string;
970
+ autosave?: boolean;
971
+ }
972
+ interface CreateVersionArgs<T = Record<string, any>> {
973
+ collection: string;
974
+ documentId: string;
975
+ data: T;
976
+ status: DocumentStatus;
977
+ createdBy?: string;
978
+ changeDescription?: string;
979
+ tenantId?: string;
980
+ /** When true, reuses a single version slot (find existing + update) */
981
+ autosave?: boolean;
982
+ }
983
+ interface FindVersionsArgs {
984
+ collection: string;
985
+ documentId: string;
986
+ tenantId?: string;
987
+ limit?: number;
988
+ page?: number;
989
+ sort?: string;
990
+ }
991
+ interface BaseAdapter {
992
+ init(collections: CollectionConfig[], globals: GlobalConfig[]): Promise<void>;
993
+ find<T = Record<string, any>>(args: FindArgs): Promise<FindResult<T>>;
994
+ findByID<T = Record<string, any>>(args: FindByIDArgs): Promise<T | null>;
995
+ create<T = Record<string, any>>(args: CreateArgs): Promise<T>;
996
+ update<T = Record<string, any>>(args: UpdateArgs): Promise<T>;
997
+ delete<T = Record<string, any>>(args: DeleteArgs): Promise<T>;
998
+ count(args: {
999
+ collection: string;
1000
+ where?: Record<string, any>;
1001
+ tenantId?: string;
1002
+ }): Promise<number>;
1003
+ findOne(args: FindOneArgs): Promise<any>;
1004
+ findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
1005
+ findVersionByID(args: {
1006
+ collection: string;
1007
+ versionId: string;
1008
+ tenantId?: string;
1009
+ }): Promise<VersionRecord | null>;
1010
+ createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
1011
+ deleteVersions(args: {
1012
+ collection: string;
1013
+ documentId: string;
1014
+ keepLatest?: number;
1015
+ tenantId?: string;
1016
+ }): Promise<void>;
1017
+ updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
1018
+ migrate?(): Promise<void>;
1019
+ rollback?(): Promise<void>;
1020
+ connect(): Promise<void>;
1021
+ disconnect(): Promise<void>;
1022
+ transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
1023
+ setTenantContext(context: TenantContext | undefined): void;
1024
+ getTenantContext(): TenantContext | undefined;
1025
+ }
1026
+ interface KyroConfig {
1027
+ collections?: CollectionConfig[];
1028
+ globals?: GlobalConfig[];
1029
+ projects?: ProjectConfig[];
1030
+ organizations?: OrganizationConfig[];
1031
+ adapter: BaseAdapter;
1032
+ storage?: StorageProvider;
1033
+ plugins?: KyroPlugin[];
1034
+ auth?: boolean | {
1035
+ secret?: string;
1036
+ tokenExpiration?: number;
1037
+ cookie?: {
1038
+ secure?: boolean;
1039
+ sameSite?: "strict" | "lax" | "none";
1040
+ domain?: string;
1041
+ };
1042
+ checkSession?: boolean;
1043
+ };
1044
+ authAdapter?: any;
1045
+ cors?: {
1046
+ origins?: string[];
1047
+ credentials?: boolean;
1048
+ };
1049
+ admin?: {
1050
+ meta?: {
1051
+ title?: string;
1052
+ description?: string;
1053
+ ogImage?: string;
1054
+ };
1055
+ dateFormat?: string;
1056
+ avatar?: "default" | "gravatar";
1057
+ disable?: boolean;
1058
+ indexRoute?: string;
1059
+ components?: Record<string, any>;
1060
+ collectionOverrides?: Record<string, CollectionOverrideConfig>;
1061
+ globalOverrides?: Record<string, GlobalOverrideConfig>;
1062
+ smartViews?: SmartViewConfig[];
1063
+ };
1064
+ upload?: {
1065
+ limits?: {
1066
+ fileSize?: number;
1067
+ };
1068
+ };
1069
+ graphQL?: {
1070
+ maxComplexity?: number;
1071
+ disablePlayground?: boolean;
1072
+ };
1073
+ typescript?: {
1074
+ outputFile?: string;
1075
+ };
1076
+ localization?: {
1077
+ locales: string[];
1078
+ defaultLocale: string;
1079
+ };
1080
+ rateLimit?: {
1081
+ window?: number;
1082
+ max?: number;
1083
+ };
1084
+ debug?: boolean;
1085
+ }
1086
+
1087
+ declare const richTextStyles: string;
1088
+ declare function renderRichText(value: unknown): string;
1089
+
1090
+ type StylingMode = 'css' | 'tailwind' | 'css-in-js' | 'styled-components' | 'vanilla-extract';
1091
+ interface StylingConfig {
1092
+ mode: StylingMode;
1093
+ theme?: ThemeConfig;
1094
+ customProperties?: Record<string, string>;
1095
+ }
1096
+ interface ThemeConfig {
1097
+ colors?: ThemeColors;
1098
+ fonts?: ThemeFonts;
1099
+ spacing?: ThemeSpacing;
1100
+ borderRadius?: ThemeBorderRadius;
1101
+ shadows?: ThemeShadows;
1102
+ breakpoints?: Record<string, string>;
1103
+ }
1104
+ interface ThemeColors {
1105
+ primary?: string;
1106
+ secondary?: string;
1107
+ accent?: string;
1108
+ background?: string;
1109
+ surface?: string;
1110
+ text?: string;
1111
+ textMuted?: string;
1112
+ border?: string;
1113
+ error?: string;
1114
+ warning?: string;
1115
+ success?: string;
1116
+ info?: string;
1117
+ }
1118
+ interface ThemeFonts {
1119
+ sans?: string;
1120
+ serif?: string;
1121
+ mono?: string;
1122
+ }
1123
+ interface ThemeSpacing {
1124
+ xs?: string;
1125
+ sm?: string;
1126
+ md?: string;
1127
+ lg?: string;
1128
+ xl?: string;
1129
+ '2xl'?: string;
1130
+ '3xl'?: string;
1131
+ '4xl'?: string;
1132
+ }
1133
+ interface ThemeBorderRadius {
1134
+ sm?: string;
1135
+ md?: string;
1136
+ lg?: string;
1137
+ xl?: string;
1138
+ full?: string;
1139
+ }
1140
+ interface ThemeShadows {
1141
+ sm?: string;
1142
+ md?: string;
1143
+ lg?: string;
1144
+ xl?: string;
1145
+ }
1146
+ declare class CSSGenerator {
1147
+ private config;
1148
+ private css;
1149
+ constructor(config: StylingConfig);
1150
+ addRule(selector: string, properties: Record<string, string>): this;
1151
+ addMediaQuery(breakpoint: string, rules: string[]): this;
1152
+ generate(): string;
1153
+ }
1154
+ declare function generateTailwindConfig(theme: ThemeConfig): Record<string, any>;
1155
+ declare const defaultLightTheme: ThemeConfig;
1156
+ declare const defaultDarkTheme: ThemeConfig;
1157
+ declare const ecommerce2026Theme: ThemeConfig;
1158
+ declare function generateCSSVariables(theme: ThemeConfig): string;
1159
+ interface AdminStylingConfig {
1160
+ mode: StylingMode;
1161
+ theme?: ThemeConfig;
1162
+ customStyles?: string;
1163
+ componentOverrides?: Record<string, Record<string, string>>;
1164
+ }
1165
+ declare function createAdminStyling(config: AdminStylingConfig): string;
1166
+ interface FieldStyling {
1167
+ wrapper?: Record<string, string>;
1168
+ label?: Record<string, string>;
1169
+ input?: Record<string, string>;
1170
+ error?: Record<string, string>;
1171
+ description?: Record<string, string>;
1172
+ }
1173
+ declare const defaultFieldStyling: Record<string, FieldStyling>;
1174
+
1175
+ declare function createAuditContext(req: Request): {
1176
+ ipAddress: string;
1177
+ userAgent: string;
1178
+ };
1179
+
1180
+ declare const FIELD_DEFINITION_KEYS: Set<string>;
1181
+ declare function isFieldOverrideDefinition(obj: any): boolean;
1182
+ declare function flattenFieldOverrides(overrides: Record<string, any>, prefix?: string): Record<string, any>;
1183
+ declare function updateFieldByPath(fields: any[], path: string, updates: Record<string, any>, allowAppend?: boolean): boolean;
1184
+ declare function applyBlocksOverrides(fields: any[], rawBlocks: any): void;
1185
+ declare function applyTabsOverrides(fields: any[], rawTabs: any): void;
1186
+ declare function applyCollectionOverrides(collections: CollectionConfig[], overrides?: Record<string, any>): void;
1187
+ declare function applyGlobalOverrides(globals: GlobalConfig[], overrides?: Record<string, any>): void;
1188
+
1189
+ interface HierarchyNode<T = Record<string, any>> {
1190
+ doc: T;
1191
+ id: string | number;
1192
+ slug?: string;
1193
+ depth: number;
1194
+ path: string;
1195
+ fullPath: string;
1196
+ children: HierarchyNode<T>[];
1197
+ }
1198
+ interface BuildTreeOptions {
1199
+ idField?: string;
1200
+ parentField?: string;
1201
+ slugField?: string;
1202
+ slugPrefix?: boolean;
1203
+ basePath?: string;
1204
+ maxDepth?: number;
1205
+ }
1206
+ interface BreadcrumbItem {
1207
+ id: string | number;
1208
+ label: string;
1209
+ slug?: string;
1210
+ path?: string;
1211
+ }
1212
+ /**
1213
+ * Builds a nested hierarchical tree from a flat list of collection documents.
1214
+ */
1215
+ declare function buildDocumentTree<T extends Record<string, any>>(docs: T[], options?: BuildTreeOptions): HierarchyNode<T>[];
1216
+ /**
1217
+ * Returns breadcrumb trail for a given document within a collection.
1218
+ * Supports both getBreadcrumbs(docs, docId, options) and getBreadcrumbs(docId, docs, options).
1219
+ */
1220
+ declare function getBreadcrumbs<T extends Record<string, any>>(arg1: T[] | string | number, arg2: T[] | string | number, options?: {
1221
+ idField?: string;
1222
+ parentField?: string;
1223
+ labelField?: string;
1224
+ slugField?: string;
1225
+ basePath?: string;
1226
+ }): BreadcrumbItem[];
1227
+ /**
1228
+ * Resolves the full URL path for a document in a hierarchical collection.
1229
+ */
1230
+ declare function getNestedPath<T extends Record<string, any>>(docId: string | number, docs: T[], options?: {
1231
+ idField?: string;
1232
+ parentField?: string;
1233
+ slugField?: string;
1234
+ basePath?: string;
1235
+ }): string;
1236
+ /**
1237
+ * Flattens a document hierarchy tree with depth indicators (useful for admin select dropdowns and indented lists).
1238
+ */
1239
+ declare function flattenDocumentTree<T extends Record<string, any>>(nodes: HierarchyNode<T>[]): Array<{
1240
+ doc: T;
1241
+ id: string | number;
1242
+ depth: number;
1243
+ path: string;
1244
+ fullPath: string;
1245
+ hasChildren: boolean;
1246
+ }>;
1247
+
1248
+ export { ALL_FIELD_TYPES, type AdminConfig, type AdminStylingConfig, type ArrayField, type AuthAdapter, type AuthConfig, type AuthResult, type Session as AuthSession, type AuthTokenConfig, type AuthUser, type BaseField, type Block, type BlockAdmin, type BlockImage, type BlocksField, type BuildTreeOptions, CSSGenerator, type CheckboxField, type CodeField, type CollapsibleField, type CollectionConfig, type ColorField, type DateField, type DeclarativeCondition, type EmailField, FIELD_DEFINITION_KEYS, type Field, type FieldAdmin, type FieldStyling, type FieldType, type GlobalConfig, type GroupField, type HierarchyNode, type IconField, type ImageField, type ImageSize, type JSONField, type JWTPayload, type KyroConfig, type LoginCredentials, type MarkdownField, type NumberField, type PasswordField, type RadioField, type RegisterData, type RelationshipField, type RichTextBlock, type RichTextField, type RowField, type SecretField, type SelectField, type Session, type StylingConfig, type StylingMode, type TabsField, type TextField, type TextareaField, type ThemeBorderRadius, type ThemeColors, type ThemeConfig, type ThemeFonts, type ThemeShadows, type ThemeSpacing, type UploadConfig, type UploadField, type UserRole, type VersionConfig, applyBlocksOverrides, applyCollectionOverrides, applyGlobalOverrides, applyTabsOverrides, buildDocumentTree, createAdminStyling, createAuditContext, defaultDarkTheme, defaultFieldStyling, defaultLightTheme, ecommerce2026Theme, flattenDocumentTree, flattenFieldOverrides, generateCSSVariables, generateTailwindConfig, getBreadcrumbs, getNestedPath, isFieldOverrideDefinition, renderRichText, richTextStyles, updateFieldByPath };