@kyro-cms/core 0.12.10 → 0.12.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{bootstrap-4W4342G2.js → bootstrap-A3OBR3YI.js} +1 -1
- package/dist/bootstrap-YLGVKTQS.cjs +1 -0
- package/dist/{chunk-EYUT6MOM.cjs → chunk-2NJR2B4W.cjs} +2 -2
- package/dist/chunk-3RR6IV5I.js +133 -0
- package/dist/chunk-3ZFRP5M2.cjs +133 -0
- package/dist/{chunk-7WOX27LK.js → chunk-6NGUY76Y.js} +22 -22
- package/dist/chunk-DTSYK7KK.js +21 -0
- package/dist/{chunk-5B7GPMJI.js → chunk-FGSIHWQJ.js} +1 -1
- package/dist/{chunk-AJAZ7D3W.cjs → chunk-GCQTSPX6.cjs} +22 -22
- package/dist/chunk-GO34AOBZ.cjs +1 -0
- package/dist/chunk-IETGL7WJ.js +1 -0
- package/dist/chunk-IQYP3DDJ.cjs +21 -0
- package/dist/chunk-M5JUPA7G.cjs +86 -0
- package/dist/chunk-NI7S5JMH.js +86 -0
- package/dist/{chunk-MSTTFMCM.js → chunk-O62KJ2J7.js} +1 -1
- package/dist/{chunk-AMOXD7EJ.cjs → chunk-QMQXKCCQ.cjs} +1 -1
- package/dist/{chunk-WHK4LW6V.cjs → chunk-RY3BG3AN.cjs} +1 -1
- package/dist/{chunk-NTZACLOF.js → chunk-ZZIGN5PZ.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.js +1 -1
- package/package.json +3 -3
- package/dist/WebhookService-ByrpAI4d.d.ts +0 -143
- package/dist/WebhookService-i-Kl3dvf.d.cts +0 -143
- package/dist/api-handler-graphql.d.cts +0 -6
- package/dist/api-handler-graphql.d.ts +0 -6
- package/dist/api-handler-trpc.d.cts +0 -5
- package/dist/api-handler-trpc.d.ts +0 -5
- package/dist/api-handler.d.cts +0 -7
- package/dist/api-handler.d.ts +0 -7
- package/dist/base-iyJTfH-3.d.cts +0 -74
- package/dist/base-oUSURe4_.d.ts +0 -74
- package/dist/bootstrap-ZGTRVWYE.cjs +0 -1
- package/dist/chunk-4JW6IVU5.js +0 -86
- package/dist/chunk-5YW2WHXR.cjs +0 -133
- package/dist/chunk-AE6GXUT7.js +0 -1
- package/dist/chunk-GFU7AOI3.cjs +0 -1
- package/dist/chunk-J5SP3Y2H.js +0 -133
- package/dist/chunk-NUUPBDZC.js +0 -21
- package/dist/chunk-OTFVOKH3.cjs +0 -21
- package/dist/chunk-PFHIBSOU.cjs +0 -86
- package/dist/cli/index.d.cts +0 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/client.d.cts +0 -12
- package/dist/client.d.ts +0 -12
- package/dist/drizzle/index.d.cts +0 -168
- package/dist/drizzle/index.d.ts +0 -168
- package/dist/fields/index.d.cts +0 -7
- package/dist/fields/index.d.ts +0 -7
- package/dist/graphql/index.d.cts +0 -57
- package/dist/graphql/index.d.ts +0 -57
- package/dist/index-Bz9JqRGI.d.cts +0 -86
- package/dist/index-Bz9JqRGI.d.ts +0 -86
- package/dist/index-DNy8jbA2.d.cts +0 -282
- package/dist/index-DVDMEql7.d.ts +0 -282
- package/dist/index.d.cts +0 -1246
- package/dist/index.d.ts +0 -1246
- package/dist/integration.d.cts +0 -14
- package/dist/integration.d.ts +0 -14
- package/dist/mongodb/index.d.cts +0 -134
- package/dist/mongodb/index.d.ts +0 -134
- package/dist/rest/index.d.cts +0 -56
- package/dist/rest/index.d.ts +0 -56
- package/dist/richtext-DrhORshE.d.cts +0 -5
- package/dist/richtext-DrhORshE.d.ts +0 -5
- package/dist/templates/index.d.cts +0 -107
- package/dist/templates/index.d.ts +0 -107
- package/dist/trpc/index.d.cts +0 -142
- package/dist/trpc/index.d.ts +0 -142
- package/dist/types-BcZiluXL.d.cts +0 -569
- package/dist/types-CpjuXbe7.d.cts +0 -150
- package/dist/types-CpjuXbe7.d.ts +0 -150
- package/dist/types-Dc8VAPhF.d.ts +0 -569
- package/dist/types-euTszc-1.d.cts +0 -294
- package/dist/types-euTszc-1.d.ts +0 -294
- package/dist/ws/index.d.cts +0 -88
- package/dist/ws/index.d.ts +0 -88
|
@@ -1,294 +0,0 @@
|
|
|
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
|
-
pickerMode?: "drawer" | "dropdown";
|
|
34
|
-
condition?: ((data: Record<string, unknown>, siblingData: Record<string, unknown>) => boolean) | DeclarativeCondition;
|
|
35
|
-
}
|
|
36
|
-
interface BaseField {
|
|
37
|
-
name: string;
|
|
38
|
-
label?: string;
|
|
39
|
-
required?: boolean;
|
|
40
|
-
unique?: boolean;
|
|
41
|
-
indexed?: boolean;
|
|
42
|
-
defaultValue?: any;
|
|
43
|
-
admin?: FieldAdmin;
|
|
44
|
-
validate?: (value: any, options: ValidateOptions) => string | true | Promise<string | true>;
|
|
45
|
-
hooks?: {
|
|
46
|
-
beforeValidate?: Hook[];
|
|
47
|
-
beforeChange?: Hook[];
|
|
48
|
-
afterChange?: Hook[];
|
|
49
|
-
afterRead?: Hook[];
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
interface ValidateOptions {
|
|
53
|
-
data?: Record<string, any>;
|
|
54
|
-
siblingData?: Record<string, any>;
|
|
55
|
-
user?: unknown;
|
|
56
|
-
operation?: string;
|
|
57
|
-
required?: boolean;
|
|
58
|
-
}
|
|
59
|
-
type Hook = (args: any) => Promise<any> | any;
|
|
60
|
-
type TextFieldVariant = "text" | "email" | "password" | "url" | "id";
|
|
61
|
-
interface TextField extends BaseField {
|
|
62
|
-
type: "text";
|
|
63
|
-
variant?: TextFieldVariant;
|
|
64
|
-
minLength?: number;
|
|
65
|
-
maxLength?: number;
|
|
66
|
-
pattern?: string;
|
|
67
|
-
hasMany?: boolean;
|
|
68
|
-
localized?: boolean;
|
|
69
|
-
}
|
|
70
|
-
interface NumberField extends BaseField {
|
|
71
|
-
type: "number";
|
|
72
|
-
min?: number;
|
|
73
|
-
max?: number;
|
|
74
|
-
step?: number;
|
|
75
|
-
integer?: boolean;
|
|
76
|
-
hasMany?: boolean;
|
|
77
|
-
}
|
|
78
|
-
interface CheckboxField extends BaseField {
|
|
79
|
-
type: "checkbox";
|
|
80
|
-
}
|
|
81
|
-
interface DateField extends BaseField {
|
|
82
|
-
type: "date";
|
|
83
|
-
minDate?: string;
|
|
84
|
-
maxDate?: string;
|
|
85
|
-
time?: boolean;
|
|
86
|
-
}
|
|
87
|
-
interface EmailField extends BaseField {
|
|
88
|
-
type: "email";
|
|
89
|
-
}
|
|
90
|
-
interface PasswordField extends BaseField {
|
|
91
|
-
type: "password";
|
|
92
|
-
}
|
|
93
|
-
interface TextareaField extends BaseField {
|
|
94
|
-
type: "textarea";
|
|
95
|
-
minLength?: number;
|
|
96
|
-
maxLength?: number;
|
|
97
|
-
rows?: number;
|
|
98
|
-
localized?: boolean;
|
|
99
|
-
}
|
|
100
|
-
interface SelectField extends BaseField {
|
|
101
|
-
type: "select";
|
|
102
|
-
options?: Array<{
|
|
103
|
-
label: string;
|
|
104
|
-
value: string;
|
|
105
|
-
}> | ((args: {
|
|
106
|
-
data: any;
|
|
107
|
-
siblingData: any;
|
|
108
|
-
}) => Array<{
|
|
109
|
-
label: string;
|
|
110
|
-
value: string;
|
|
111
|
-
}>);
|
|
112
|
-
dynamicOptions?: string;
|
|
113
|
-
hasMany?: boolean;
|
|
114
|
-
defaultValue?: string | string[];
|
|
115
|
-
}
|
|
116
|
-
interface RadioField extends BaseField {
|
|
117
|
-
type: "radio";
|
|
118
|
-
options: Array<{
|
|
119
|
-
label: string;
|
|
120
|
-
value: string;
|
|
121
|
-
}> | ((args: {
|
|
122
|
-
data: any;
|
|
123
|
-
siblingData: any;
|
|
124
|
-
}) => Array<{
|
|
125
|
-
label: string;
|
|
126
|
-
value: string;
|
|
127
|
-
}>);
|
|
128
|
-
defaultValue?: string;
|
|
129
|
-
}
|
|
130
|
-
interface ColorField extends BaseField {
|
|
131
|
-
type: "color";
|
|
132
|
-
format?: "hex" | "rgb" | "hsl";
|
|
133
|
-
defaultValue?: string;
|
|
134
|
-
}
|
|
135
|
-
interface ImageField extends BaseField {
|
|
136
|
-
type: "image";
|
|
137
|
-
minCount?: number;
|
|
138
|
-
maxCount?: number;
|
|
139
|
-
allowedTypes?: string[];
|
|
140
|
-
maxSize?: number;
|
|
141
|
-
}
|
|
142
|
-
type RichTextBlock = Record<string, any>;
|
|
143
|
-
interface RichTextField extends BaseField {
|
|
144
|
-
type: "richtext";
|
|
145
|
-
defaultValue?: Record<string, any>;
|
|
146
|
-
localized?: boolean;
|
|
147
|
-
}
|
|
148
|
-
interface JSONField extends BaseField {
|
|
149
|
-
type: "json";
|
|
150
|
-
defaultValue?: Record<string, any>;
|
|
151
|
-
}
|
|
152
|
-
interface CodeField extends BaseField {
|
|
153
|
-
type: "code";
|
|
154
|
-
language?: string;
|
|
155
|
-
defaultValue?: string;
|
|
156
|
-
}
|
|
157
|
-
interface UploadField extends BaseField {
|
|
158
|
-
type: "upload";
|
|
159
|
-
relationTo: string;
|
|
160
|
-
hasMany?: boolean;
|
|
161
|
-
maxDepth?: number;
|
|
162
|
-
defaultValue?: string;
|
|
163
|
-
}
|
|
164
|
-
interface MarkdownField extends BaseField {
|
|
165
|
-
type: "markdown";
|
|
166
|
-
localized?: boolean;
|
|
167
|
-
defaultValue?: string;
|
|
168
|
-
}
|
|
169
|
-
interface RelationshipField extends BaseField {
|
|
170
|
-
type: "relationship";
|
|
171
|
-
/**
|
|
172
|
-
* The collection slug(s) to relate to.
|
|
173
|
-
* Use "*" to allow relating to ANY registered collection.
|
|
174
|
-
*/
|
|
175
|
-
relationTo: string | string[];
|
|
176
|
-
hasMany?: boolean;
|
|
177
|
-
maxDepth?: number;
|
|
178
|
-
filterOptions?: (args: {
|
|
179
|
-
data: any;
|
|
180
|
-
user: any;
|
|
181
|
-
}) => Record<string, any>;
|
|
182
|
-
defaultValue?: string | string[];
|
|
183
|
-
}
|
|
184
|
-
interface ArrayField extends BaseField {
|
|
185
|
-
type: "array";
|
|
186
|
-
fields: Field[];
|
|
187
|
-
minRows?: number;
|
|
188
|
-
maxRows?: number;
|
|
189
|
-
labels?: {
|
|
190
|
-
singular?: string;
|
|
191
|
-
plural?: string;
|
|
192
|
-
};
|
|
193
|
-
defaultValue?: Record<string, any>[];
|
|
194
|
-
}
|
|
195
|
-
interface ListField extends BaseField {
|
|
196
|
-
type: "list";
|
|
197
|
-
defaultValue?: string[];
|
|
198
|
-
}
|
|
199
|
-
interface GroupField extends BaseField {
|
|
200
|
-
type: "group";
|
|
201
|
-
fields: Field[];
|
|
202
|
-
defaultValue?: Record<string, any>;
|
|
203
|
-
}
|
|
204
|
-
interface BlockImage {
|
|
205
|
-
url: string;
|
|
206
|
-
alt?: string;
|
|
207
|
-
}
|
|
208
|
-
interface BlockAdmin {
|
|
209
|
-
group?: string;
|
|
210
|
-
description?: string;
|
|
211
|
-
images?: {
|
|
212
|
-
icon?: BlockImage | string;
|
|
213
|
-
thumbnail?: BlockImage | string;
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
interface Block {
|
|
217
|
-
slug: string;
|
|
218
|
-
label: string;
|
|
219
|
-
fields: Field[];
|
|
220
|
-
imageURL?: string;
|
|
221
|
-
admin?: BlockAdmin;
|
|
222
|
-
}
|
|
223
|
-
interface BlocksField extends BaseField {
|
|
224
|
-
type: "blocks";
|
|
225
|
-
blocks?: Block[];
|
|
226
|
-
minRows?: number;
|
|
227
|
-
maxRows?: number;
|
|
228
|
-
defaultValue?: Array<{
|
|
229
|
-
blockType: string;
|
|
230
|
-
[key: string]: any;
|
|
231
|
-
}>;
|
|
232
|
-
}
|
|
233
|
-
interface RowField extends Omit<BaseField, "name"> {
|
|
234
|
-
type: "row";
|
|
235
|
-
fields: Field[];
|
|
236
|
-
name?: string;
|
|
237
|
-
}
|
|
238
|
-
interface CollapsibleField extends Omit<BaseField, "name"> {
|
|
239
|
-
type: "collapsible";
|
|
240
|
-
fields: Field[];
|
|
241
|
-
label: string;
|
|
242
|
-
name?: string;
|
|
243
|
-
}
|
|
244
|
-
interface TabsField extends Omit<BaseField, "name"> {
|
|
245
|
-
type: "tabs";
|
|
246
|
-
tabs: Array<{
|
|
247
|
-
label: string;
|
|
248
|
-
fields: Field[];
|
|
249
|
-
name?: string;
|
|
250
|
-
}>;
|
|
251
|
-
name?: string;
|
|
252
|
-
}
|
|
253
|
-
interface ButtonField extends BaseField {
|
|
254
|
-
type: "button";
|
|
255
|
-
label: string;
|
|
256
|
-
action?: string;
|
|
257
|
-
method?: string;
|
|
258
|
-
inline?: boolean;
|
|
259
|
-
}
|
|
260
|
-
interface ActionField extends BaseField {
|
|
261
|
-
type: "action";
|
|
262
|
-
label: string;
|
|
263
|
-
action?: string;
|
|
264
|
-
method?: string;
|
|
265
|
-
inline?: boolean;
|
|
266
|
-
}
|
|
267
|
-
interface SecretField extends BaseField {
|
|
268
|
-
type: "secret";
|
|
269
|
-
}
|
|
270
|
-
interface IconField extends BaseField {
|
|
271
|
-
type: "icon";
|
|
272
|
-
}
|
|
273
|
-
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;
|
|
274
|
-
type FieldType = Field["type"];
|
|
275
|
-
declare function isTextField(field: Field): field is TextField;
|
|
276
|
-
declare function isNumberField(field: Field): field is NumberField;
|
|
277
|
-
declare function isRelationshipField(field: Field): field is RelationshipField;
|
|
278
|
-
declare function isArrayField(field: Field): field is ArrayField;
|
|
279
|
-
declare function isGroupField(field: Field): field is GroupField;
|
|
280
|
-
declare function isBlocksField(field: Field): field is BlocksField;
|
|
281
|
-
declare function isUploadField(field: Field): field is UploadField;
|
|
282
|
-
declare function isImageField(field: Field): field is ImageField;
|
|
283
|
-
declare function isRichTextField(field: Field): field is RichTextField;
|
|
284
|
-
declare function isSelectField(field: Field): field is SelectField;
|
|
285
|
-
declare function isLayoutField(field: Field): field is RowField | CollapsibleField | TabsField;
|
|
286
|
-
declare function isIconField(field: Field): field is IconField;
|
|
287
|
-
declare const PRIMITIVE_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "icon"];
|
|
288
|
-
declare const COMPLEX_FIELD_TYPES: readonly ["richtext", "json", "code", "upload", "image", "markdown"];
|
|
289
|
-
declare const RELATIONAL_FIELD_TYPES: readonly ["relationship", "array", "group", "blocks"];
|
|
290
|
-
declare const LAYOUT_FIELD_TYPES: readonly ["row", "collapsible", "tabs"];
|
|
291
|
-
declare const ALL_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "icon", "richtext", "json", "code", "upload", "image", "markdown", "relationship", "array", "group", "blocks", "row", "collapsible", "tabs"];
|
|
292
|
-
declare function createRelationshipFieldConfig(name: string, relationTo: string | string[], options?: Partial<Omit<RelationshipField, "type" | "name" | "relationTo">>): RelationshipField;
|
|
293
|
-
|
|
294
|
-
export { isRelationshipField as $, ALL_FIELD_TYPES as A, type BaseField as B, type CheckboxField as C, type DateField as D, type EmailField as E, type Field as F, type GroupField as G, type Hook as H, type IconField as I, type JSONField as J, createRelationshipFieldConfig as K, LAYOUT_FIELD_TYPES as L, type MarkdownField as M, type NumberField as N, isArrayField as O, type PasswordField as P, isBlocksField as Q, type RadioField as R, type SecretField as S, type TabsField as T, type UploadField as U, type ValidateOptions as V, isGroupField as W, isIconField as X, isImageField as Y, isLayoutField as Z, isNumberField as _, type ArrayField as a, isRichTextField as a0, isSelectField as a1, isTextField as a2, isUploadField as a3, type Block as b, type BlockAdmin as c, type BlockImage as d, type BlocksField as e, type CodeField as f, type CollapsibleField as g, type ColorField as h, type DeclarativeCondition as i, type FieldAdmin as j, type FieldType as k, type ImageField as l, type RelationshipField as m, type RichTextBlock as n, type RichTextField as o, type RowField as p, type SelectField as q, type TextField as r, type TextareaField as s, type ActionField as t, type ButtonField as u, COMPLEX_FIELD_TYPES as v, type ListField as w, PRIMITIVE_FIELD_TYPES as x, RELATIONAL_FIELD_TYPES as y, type TextFieldVariant as z };
|
package/dist/types-euTszc-1.d.ts
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
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
|
-
pickerMode?: "drawer" | "dropdown";
|
|
34
|
-
condition?: ((data: Record<string, unknown>, siblingData: Record<string, unknown>) => boolean) | DeclarativeCondition;
|
|
35
|
-
}
|
|
36
|
-
interface BaseField {
|
|
37
|
-
name: string;
|
|
38
|
-
label?: string;
|
|
39
|
-
required?: boolean;
|
|
40
|
-
unique?: boolean;
|
|
41
|
-
indexed?: boolean;
|
|
42
|
-
defaultValue?: any;
|
|
43
|
-
admin?: FieldAdmin;
|
|
44
|
-
validate?: (value: any, options: ValidateOptions) => string | true | Promise<string | true>;
|
|
45
|
-
hooks?: {
|
|
46
|
-
beforeValidate?: Hook[];
|
|
47
|
-
beforeChange?: Hook[];
|
|
48
|
-
afterChange?: Hook[];
|
|
49
|
-
afterRead?: Hook[];
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
interface ValidateOptions {
|
|
53
|
-
data?: Record<string, any>;
|
|
54
|
-
siblingData?: Record<string, any>;
|
|
55
|
-
user?: unknown;
|
|
56
|
-
operation?: string;
|
|
57
|
-
required?: boolean;
|
|
58
|
-
}
|
|
59
|
-
type Hook = (args: any) => Promise<any> | any;
|
|
60
|
-
type TextFieldVariant = "text" | "email" | "password" | "url" | "id";
|
|
61
|
-
interface TextField extends BaseField {
|
|
62
|
-
type: "text";
|
|
63
|
-
variant?: TextFieldVariant;
|
|
64
|
-
minLength?: number;
|
|
65
|
-
maxLength?: number;
|
|
66
|
-
pattern?: string;
|
|
67
|
-
hasMany?: boolean;
|
|
68
|
-
localized?: boolean;
|
|
69
|
-
}
|
|
70
|
-
interface NumberField extends BaseField {
|
|
71
|
-
type: "number";
|
|
72
|
-
min?: number;
|
|
73
|
-
max?: number;
|
|
74
|
-
step?: number;
|
|
75
|
-
integer?: boolean;
|
|
76
|
-
hasMany?: boolean;
|
|
77
|
-
}
|
|
78
|
-
interface CheckboxField extends BaseField {
|
|
79
|
-
type: "checkbox";
|
|
80
|
-
}
|
|
81
|
-
interface DateField extends BaseField {
|
|
82
|
-
type: "date";
|
|
83
|
-
minDate?: string;
|
|
84
|
-
maxDate?: string;
|
|
85
|
-
time?: boolean;
|
|
86
|
-
}
|
|
87
|
-
interface EmailField extends BaseField {
|
|
88
|
-
type: "email";
|
|
89
|
-
}
|
|
90
|
-
interface PasswordField extends BaseField {
|
|
91
|
-
type: "password";
|
|
92
|
-
}
|
|
93
|
-
interface TextareaField extends BaseField {
|
|
94
|
-
type: "textarea";
|
|
95
|
-
minLength?: number;
|
|
96
|
-
maxLength?: number;
|
|
97
|
-
rows?: number;
|
|
98
|
-
localized?: boolean;
|
|
99
|
-
}
|
|
100
|
-
interface SelectField extends BaseField {
|
|
101
|
-
type: "select";
|
|
102
|
-
options?: Array<{
|
|
103
|
-
label: string;
|
|
104
|
-
value: string;
|
|
105
|
-
}> | ((args: {
|
|
106
|
-
data: any;
|
|
107
|
-
siblingData: any;
|
|
108
|
-
}) => Array<{
|
|
109
|
-
label: string;
|
|
110
|
-
value: string;
|
|
111
|
-
}>);
|
|
112
|
-
dynamicOptions?: string;
|
|
113
|
-
hasMany?: boolean;
|
|
114
|
-
defaultValue?: string | string[];
|
|
115
|
-
}
|
|
116
|
-
interface RadioField extends BaseField {
|
|
117
|
-
type: "radio";
|
|
118
|
-
options: Array<{
|
|
119
|
-
label: string;
|
|
120
|
-
value: string;
|
|
121
|
-
}> | ((args: {
|
|
122
|
-
data: any;
|
|
123
|
-
siblingData: any;
|
|
124
|
-
}) => Array<{
|
|
125
|
-
label: string;
|
|
126
|
-
value: string;
|
|
127
|
-
}>);
|
|
128
|
-
defaultValue?: string;
|
|
129
|
-
}
|
|
130
|
-
interface ColorField extends BaseField {
|
|
131
|
-
type: "color";
|
|
132
|
-
format?: "hex" | "rgb" | "hsl";
|
|
133
|
-
defaultValue?: string;
|
|
134
|
-
}
|
|
135
|
-
interface ImageField extends BaseField {
|
|
136
|
-
type: "image";
|
|
137
|
-
minCount?: number;
|
|
138
|
-
maxCount?: number;
|
|
139
|
-
allowedTypes?: string[];
|
|
140
|
-
maxSize?: number;
|
|
141
|
-
}
|
|
142
|
-
type RichTextBlock = Record<string, any>;
|
|
143
|
-
interface RichTextField extends BaseField {
|
|
144
|
-
type: "richtext";
|
|
145
|
-
defaultValue?: Record<string, any>;
|
|
146
|
-
localized?: boolean;
|
|
147
|
-
}
|
|
148
|
-
interface JSONField extends BaseField {
|
|
149
|
-
type: "json";
|
|
150
|
-
defaultValue?: Record<string, any>;
|
|
151
|
-
}
|
|
152
|
-
interface CodeField extends BaseField {
|
|
153
|
-
type: "code";
|
|
154
|
-
language?: string;
|
|
155
|
-
defaultValue?: string;
|
|
156
|
-
}
|
|
157
|
-
interface UploadField extends BaseField {
|
|
158
|
-
type: "upload";
|
|
159
|
-
relationTo: string;
|
|
160
|
-
hasMany?: boolean;
|
|
161
|
-
maxDepth?: number;
|
|
162
|
-
defaultValue?: string;
|
|
163
|
-
}
|
|
164
|
-
interface MarkdownField extends BaseField {
|
|
165
|
-
type: "markdown";
|
|
166
|
-
localized?: boolean;
|
|
167
|
-
defaultValue?: string;
|
|
168
|
-
}
|
|
169
|
-
interface RelationshipField extends BaseField {
|
|
170
|
-
type: "relationship";
|
|
171
|
-
/**
|
|
172
|
-
* The collection slug(s) to relate to.
|
|
173
|
-
* Use "*" to allow relating to ANY registered collection.
|
|
174
|
-
*/
|
|
175
|
-
relationTo: string | string[];
|
|
176
|
-
hasMany?: boolean;
|
|
177
|
-
maxDepth?: number;
|
|
178
|
-
filterOptions?: (args: {
|
|
179
|
-
data: any;
|
|
180
|
-
user: any;
|
|
181
|
-
}) => Record<string, any>;
|
|
182
|
-
defaultValue?: string | string[];
|
|
183
|
-
}
|
|
184
|
-
interface ArrayField extends BaseField {
|
|
185
|
-
type: "array";
|
|
186
|
-
fields: Field[];
|
|
187
|
-
minRows?: number;
|
|
188
|
-
maxRows?: number;
|
|
189
|
-
labels?: {
|
|
190
|
-
singular?: string;
|
|
191
|
-
plural?: string;
|
|
192
|
-
};
|
|
193
|
-
defaultValue?: Record<string, any>[];
|
|
194
|
-
}
|
|
195
|
-
interface ListField extends BaseField {
|
|
196
|
-
type: "list";
|
|
197
|
-
defaultValue?: string[];
|
|
198
|
-
}
|
|
199
|
-
interface GroupField extends BaseField {
|
|
200
|
-
type: "group";
|
|
201
|
-
fields: Field[];
|
|
202
|
-
defaultValue?: Record<string, any>;
|
|
203
|
-
}
|
|
204
|
-
interface BlockImage {
|
|
205
|
-
url: string;
|
|
206
|
-
alt?: string;
|
|
207
|
-
}
|
|
208
|
-
interface BlockAdmin {
|
|
209
|
-
group?: string;
|
|
210
|
-
description?: string;
|
|
211
|
-
images?: {
|
|
212
|
-
icon?: BlockImage | string;
|
|
213
|
-
thumbnail?: BlockImage | string;
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
interface Block {
|
|
217
|
-
slug: string;
|
|
218
|
-
label: string;
|
|
219
|
-
fields: Field[];
|
|
220
|
-
imageURL?: string;
|
|
221
|
-
admin?: BlockAdmin;
|
|
222
|
-
}
|
|
223
|
-
interface BlocksField extends BaseField {
|
|
224
|
-
type: "blocks";
|
|
225
|
-
blocks?: Block[];
|
|
226
|
-
minRows?: number;
|
|
227
|
-
maxRows?: number;
|
|
228
|
-
defaultValue?: Array<{
|
|
229
|
-
blockType: string;
|
|
230
|
-
[key: string]: any;
|
|
231
|
-
}>;
|
|
232
|
-
}
|
|
233
|
-
interface RowField extends Omit<BaseField, "name"> {
|
|
234
|
-
type: "row";
|
|
235
|
-
fields: Field[];
|
|
236
|
-
name?: string;
|
|
237
|
-
}
|
|
238
|
-
interface CollapsibleField extends Omit<BaseField, "name"> {
|
|
239
|
-
type: "collapsible";
|
|
240
|
-
fields: Field[];
|
|
241
|
-
label: string;
|
|
242
|
-
name?: string;
|
|
243
|
-
}
|
|
244
|
-
interface TabsField extends Omit<BaseField, "name"> {
|
|
245
|
-
type: "tabs";
|
|
246
|
-
tabs: Array<{
|
|
247
|
-
label: string;
|
|
248
|
-
fields: Field[];
|
|
249
|
-
name?: string;
|
|
250
|
-
}>;
|
|
251
|
-
name?: string;
|
|
252
|
-
}
|
|
253
|
-
interface ButtonField extends BaseField {
|
|
254
|
-
type: "button";
|
|
255
|
-
label: string;
|
|
256
|
-
action?: string;
|
|
257
|
-
method?: string;
|
|
258
|
-
inline?: boolean;
|
|
259
|
-
}
|
|
260
|
-
interface ActionField extends BaseField {
|
|
261
|
-
type: "action";
|
|
262
|
-
label: string;
|
|
263
|
-
action?: string;
|
|
264
|
-
method?: string;
|
|
265
|
-
inline?: boolean;
|
|
266
|
-
}
|
|
267
|
-
interface SecretField extends BaseField {
|
|
268
|
-
type: "secret";
|
|
269
|
-
}
|
|
270
|
-
interface IconField extends BaseField {
|
|
271
|
-
type: "icon";
|
|
272
|
-
}
|
|
273
|
-
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;
|
|
274
|
-
type FieldType = Field["type"];
|
|
275
|
-
declare function isTextField(field: Field): field is TextField;
|
|
276
|
-
declare function isNumberField(field: Field): field is NumberField;
|
|
277
|
-
declare function isRelationshipField(field: Field): field is RelationshipField;
|
|
278
|
-
declare function isArrayField(field: Field): field is ArrayField;
|
|
279
|
-
declare function isGroupField(field: Field): field is GroupField;
|
|
280
|
-
declare function isBlocksField(field: Field): field is BlocksField;
|
|
281
|
-
declare function isUploadField(field: Field): field is UploadField;
|
|
282
|
-
declare function isImageField(field: Field): field is ImageField;
|
|
283
|
-
declare function isRichTextField(field: Field): field is RichTextField;
|
|
284
|
-
declare function isSelectField(field: Field): field is SelectField;
|
|
285
|
-
declare function isLayoutField(field: Field): field is RowField | CollapsibleField | TabsField;
|
|
286
|
-
declare function isIconField(field: Field): field is IconField;
|
|
287
|
-
declare const PRIMITIVE_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "icon"];
|
|
288
|
-
declare const COMPLEX_FIELD_TYPES: readonly ["richtext", "json", "code", "upload", "image", "markdown"];
|
|
289
|
-
declare const RELATIONAL_FIELD_TYPES: readonly ["relationship", "array", "group", "blocks"];
|
|
290
|
-
declare const LAYOUT_FIELD_TYPES: readonly ["row", "collapsible", "tabs"];
|
|
291
|
-
declare const ALL_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "icon", "richtext", "json", "code", "upload", "image", "markdown", "relationship", "array", "group", "blocks", "row", "collapsible", "tabs"];
|
|
292
|
-
declare function createRelationshipFieldConfig(name: string, relationTo: string | string[], options?: Partial<Omit<RelationshipField, "type" | "name" | "relationTo">>): RelationshipField;
|
|
293
|
-
|
|
294
|
-
export { isRelationshipField as $, ALL_FIELD_TYPES as A, type BaseField as B, type CheckboxField as C, type DateField as D, type EmailField as E, type Field as F, type GroupField as G, type Hook as H, type IconField as I, type JSONField as J, createRelationshipFieldConfig as K, LAYOUT_FIELD_TYPES as L, type MarkdownField as M, type NumberField as N, isArrayField as O, type PasswordField as P, isBlocksField as Q, type RadioField as R, type SecretField as S, type TabsField as T, type UploadField as U, type ValidateOptions as V, isGroupField as W, isIconField as X, isImageField as Y, isLayoutField as Z, isNumberField as _, type ArrayField as a, isRichTextField as a0, isSelectField as a1, isTextField as a2, isUploadField as a3, type Block as b, type BlockAdmin as c, type BlockImage as d, type BlocksField as e, type CodeField as f, type CollapsibleField as g, type ColorField as h, type DeclarativeCondition as i, type FieldAdmin as j, type FieldType as k, type ImageField as l, type RelationshipField as m, type RichTextBlock as n, type RichTextField as o, type RowField as p, type SelectField as q, type TextField as r, type TextareaField as s, type ActionField as t, type ButtonField as u, COMPLEX_FIELD_TYPES as v, type ListField as w, PRIMITIVE_FIELD_TYPES as x, RELATIONAL_FIELD_TYPES as y, type TextFieldVariant as z };
|
package/dist/ws/index.d.cts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { WebSocket, WebSocketServer } from 'ws';
|
|
2
|
-
|
|
3
|
-
type EventHandler = (data: any) => void | Promise<void>;
|
|
4
|
-
declare class PubSub {
|
|
5
|
-
private channels;
|
|
6
|
-
private maxListeners;
|
|
7
|
-
constructor(maxListeners?: number);
|
|
8
|
-
subscribe(channel: string, handler: EventHandler): () => void;
|
|
9
|
-
publish(channel: string, data: any): void;
|
|
10
|
-
hasSubscribers(channel: string): boolean;
|
|
11
|
-
getSubscriberCount(channel: string): number;
|
|
12
|
-
getChannels(): string[];
|
|
13
|
-
clear(): void;
|
|
14
|
-
}
|
|
15
|
-
interface KyroEvent {
|
|
16
|
-
type: 'create' | 'update' | 'delete';
|
|
17
|
-
collection: string;
|
|
18
|
-
doc?: any;
|
|
19
|
-
originalDoc?: any;
|
|
20
|
-
id?: string;
|
|
21
|
-
tenantId?: string;
|
|
22
|
-
timestamp: string;
|
|
23
|
-
user?: any;
|
|
24
|
-
}
|
|
25
|
-
declare class KyroPubSub extends PubSub {
|
|
26
|
-
private registry;
|
|
27
|
-
constructor(registry: any, maxListeners?: number);
|
|
28
|
-
publishCollectionEvent(collection: string, event: KyroEvent): void;
|
|
29
|
-
subscribeToCollection(collection: string, handler: EventHandler): () => void;
|
|
30
|
-
subscribeToCollectionEvent(collection: string, eventType: 'create' | 'update' | 'delete', handler: EventHandler): () => void;
|
|
31
|
-
subscribeToTenant(tenantId: string, handler: EventHandler): () => void;
|
|
32
|
-
subscribeToTenantCollection(tenantId: string, collection: string, handler: EventHandler): () => void;
|
|
33
|
-
subscribeToAllCollections(handler: EventHandler): () => void;
|
|
34
|
-
createAfterChangeHook(collection: string): (args: any) => Promise<void>;
|
|
35
|
-
createAfterDeleteHook(collection: string): (args: any) => Promise<void>;
|
|
36
|
-
autoRegisterHooks(): void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface WSServerOptions {
|
|
40
|
-
port?: number;
|
|
41
|
-
pubsub: KyroPubSub;
|
|
42
|
-
maxConnections?: number;
|
|
43
|
-
pingInterval?: number;
|
|
44
|
-
requireAuth?: boolean;
|
|
45
|
-
verifyToken?: (token: string) => Promise<any>;
|
|
46
|
-
}
|
|
47
|
-
interface WSSubscription {
|
|
48
|
-
channel: string;
|
|
49
|
-
unsubscribe: () => void;
|
|
50
|
-
}
|
|
51
|
-
interface WSClient {
|
|
52
|
-
id: string;
|
|
53
|
-
ws: WebSocket;
|
|
54
|
-
subscriptions: Map<string, WSSubscription>;
|
|
55
|
-
authenticated: boolean;
|
|
56
|
-
user?: any;
|
|
57
|
-
tenantId?: string;
|
|
58
|
-
connectedAt: Date;
|
|
59
|
-
lastActivity: Date;
|
|
60
|
-
}
|
|
61
|
-
declare class KyroWSServer {
|
|
62
|
-
private wss;
|
|
63
|
-
private clients;
|
|
64
|
-
private pubsub;
|
|
65
|
-
private options;
|
|
66
|
-
private pingTimer?;
|
|
67
|
-
constructor(options: WSServerOptions);
|
|
68
|
-
private setupServer;
|
|
69
|
-
private handleMessage;
|
|
70
|
-
private handleAuthenticate;
|
|
71
|
-
private handleSubscribe;
|
|
72
|
-
private handleUnsubscribe;
|
|
73
|
-
private handleUnsubscribeAll;
|
|
74
|
-
private handleList;
|
|
75
|
-
private handleDisconnect;
|
|
76
|
-
private sendToClient;
|
|
77
|
-
private generateClientId;
|
|
78
|
-
private startPingInterval;
|
|
79
|
-
broadcast(channel: string, data: any): void;
|
|
80
|
-
getConnectedClients(): WSClient[];
|
|
81
|
-
getClientCount(): number;
|
|
82
|
-
getSubscriptionCount(): number;
|
|
83
|
-
close(): Promise<void>;
|
|
84
|
-
getServer(): WebSocketServer;
|
|
85
|
-
}
|
|
86
|
-
declare function createWSServer(options: WSServerOptions): KyroWSServer;
|
|
87
|
-
|
|
88
|
-
export { type EventHandler, type KyroEvent, KyroPubSub, KyroWSServer, PubSub, type WSClient, type WSServerOptions, createWSServer };
|