@kyro-cms/core 0.12.71 → 0.13.1
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/README.md +150 -76
- package/dist/{WebhookService-DQyM9fVo.d.ts → WebhookService-BLi5Rz2m.d.ts} +1 -1
- package/dist/{WebhookService-bo1NrgBW.d.cts → WebhookService-BOJMgjBm.d.cts} +1 -1
- package/dist/WebhookService-BcuD8tnn.d.cts +143 -0
- package/dist/WebhookService-CFe6Zd0_.d.cts +143 -0
- package/dist/WebhookService-CGxHtw7E.d.cts +143 -0
- package/dist/WebhookService-CNC1lYz7.d.ts +143 -0
- package/dist/WebhookService-CVXmjbtQ.d.cts +143 -0
- package/dist/WebhookService-D5PSI5t6.d.cts +143 -0
- package/dist/WebhookService-DPCCn_12.d.ts +143 -0
- package/dist/WebhookService-Dk1lzSrG.d.cts +143 -0
- package/dist/WebhookService-Dncnbgm9.d.cts +143 -0
- package/dist/WebhookService-I6hdue2Y.d.ts +143 -0
- package/dist/WebhookService-KnQ2UDlW.d.ts +143 -0
- package/dist/WebhookService-UY5p89Bj.d.ts +143 -0
- package/dist/WebhookService-YZXBCRXA.d.ts +143 -0
- package/dist/WebhookService-fk0FGRlk.d.ts +143 -0
- package/dist/WebhookService-vsFnWrOh.d.ts +143 -0
- package/dist/WebhookService-zrDmAx7L.d.cts +143 -0
- 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/{base-urWvrsX8.d.cts → base-B--L0lCn.d.cts} +1 -1
- package/dist/base-B-i-tjm1.d.ts +218 -0
- package/dist/base-B-siit_y.d.cts +218 -0
- package/dist/base-B8SyZI4D.d.ts +218 -0
- package/dist/base-BCgFt3Yx.d.ts +218 -0
- package/dist/base-BHRGJ40F.d.cts +218 -0
- package/dist/base-BVoDPNjJ.d.cts +218 -0
- package/dist/base-BaOJ5uWd.d.cts +218 -0
- package/dist/base-BfPaVEAE.d.cts +218 -0
- package/dist/base-BxrX5EPU.d.cts +218 -0
- package/dist/base-CAb9EYQs.d.ts +218 -0
- package/dist/base-CcZIEll-.d.ts +218 -0
- package/dist/base-CyG7aF1e.d.cts +218 -0
- package/dist/{base-BcfNgOqZ.d.ts → base-DOImeJ-F.d.ts} +1 -1
- package/dist/base-DbnwE42-.d.cts +218 -0
- package/dist/base-NyiSsD-n.d.ts +218 -0
- package/dist/base-OYfoYPYP.d.ts +218 -0
- package/dist/base-xflndGDO.d.ts +218 -0
- package/dist/bootstrap-QQ6D3OYG.js +1 -0
- package/dist/bootstrap-QVKSKXJF.cjs +1 -0
- package/dist/bootstrap-RILR44UM.cjs +1 -0
- package/dist/bootstrap-ZRRUPRUR.js +1 -0
- package/dist/chunk-262YP5XA.cjs +1 -0
- package/dist/chunk-2FSOHXOU.cjs +56 -0
- package/dist/chunk-2OS5Y4LE.cjs +1 -0
- package/dist/chunk-2PXXQKN3.cjs +3 -0
- package/dist/{chunk-K6ZW5M6S.cjs → chunk-355R4LS5.cjs} +3 -3
- package/dist/chunk-35IVNLMA.js +122 -0
- package/dist/{chunk-FSWDDVLA.js → chunk-3GXLOYM3.js} +1 -1
- package/dist/chunk-3KZXF4US.js +2 -0
- package/dist/{chunk-H7PC2ENZ.cjs → chunk-3LAWUINR.cjs} +1 -1
- package/dist/chunk-3O3AVMWM.cjs +1 -0
- package/dist/chunk-3U6MKWET.cjs +120 -0
- package/dist/chunk-4BMWWGJN.js +384 -0
- package/dist/chunk-5A7E7N4B.cjs +431 -0
- package/dist/chunk-6DD4J7LI.js +2 -0
- package/dist/chunk-6GGPY7U2.js +4 -0
- package/dist/chunk-6MNLRAKM.cjs +121 -0
- package/dist/chunk-6NBZDW53.js +133 -0
- package/dist/{chunk-2HATK4C5.js → chunk-73Y63IPP.js} +4 -4
- package/dist/chunk-7K6ZUNJM.js +4 -0
- package/dist/chunk-7NKNSRCB.cjs +448 -0
- package/dist/chunk-A3IOQOV6.js +2 -0
- package/dist/chunk-A3XVL6ED.cjs +3 -0
- package/dist/{chunk-LKQHIOPW.cjs → chunk-APDQ6ZTG.cjs} +1 -1
- package/dist/chunk-ATI2UZ7U.js +2 -0
- package/dist/chunk-B4AC23SG.js +122 -0
- package/dist/chunk-BD6XHMMM.cjs +2 -0
- package/dist/chunk-CH4TZZI5.js +449 -0
- package/dist/{chunk-26KFM3P6.js → chunk-CNHUCCQJ.js} +1 -1
- package/dist/chunk-CRP6PSCE.js +2 -0
- package/dist/chunk-DI6TCZSE.js +122 -0
- package/dist/chunk-DORUYZQV.cjs +1 -0
- package/dist/chunk-E4H3ZZ7U.js +4 -0
- package/dist/chunk-EFKEVWAD.js +4 -0
- package/dist/chunk-EI7FRSNY.js +57 -0
- package/dist/chunk-EON4XLKQ.cjs +1 -0
- package/dist/chunk-EUQAOYEO.cjs +121 -0
- package/dist/chunk-EVAUBT7H.js +57 -0
- package/dist/chunk-EYHD7HZE.cjs +1 -0
- package/dist/chunk-EYYIPA5N.js +432 -0
- package/dist/chunk-F2O4QO5N.cjs +383 -0
- package/dist/chunk-FBWLSWZ4.js +122 -0
- package/dist/chunk-FDKU7HJX.js +2 -0
- package/dist/chunk-FGN6IMPY.cjs +3 -0
- package/dist/chunk-FK2BG4HU.js +3 -0
- package/dist/chunk-GV2IB4WQ.cjs +56 -0
- package/dist/chunk-GWIZT2P5.js +57 -0
- package/dist/chunk-H3FJ54KB.cjs +121 -0
- package/dist/chunk-HY3EAWB2.js +4 -0
- package/dist/chunk-I6UJVO2P.js +57 -0
- package/dist/chunk-IQSF6XRV.js +57 -0
- package/dist/chunk-IXGDTAES.js +4 -0
- package/dist/chunk-JA44K75G.js +2 -0
- package/dist/chunk-JZ7Z6WC2.cjs +3 -0
- package/dist/chunk-K5XGP57D.cjs +19 -0
- package/dist/chunk-KEITOXIP.js +2 -0
- package/dist/chunk-LPFRMQFQ.js +121 -0
- package/dist/chunk-LYU44UNN.cjs +56 -0
- package/dist/chunk-MDLJTZLV.cjs +1 -0
- package/dist/chunk-MFNN5DYG.cjs +1 -0
- package/dist/chunk-MJAODEFC.cjs +121 -0
- package/dist/chunk-MYHNTJLR.cjs +56 -0
- package/dist/chunk-N2YHO2WI.cjs +3 -0
- package/dist/chunk-N4FXLQE3.cjs +132 -0
- package/dist/chunk-NPBXLPOP.js +3 -0
- package/dist/chunk-ON5XJEPO.cjs +3 -0
- package/dist/chunk-OT2Z4XBD.cjs +1 -0
- package/dist/chunk-PFTBTWSC.cjs +1 -0
- package/dist/chunk-PTPVFLET.js +20 -0
- package/dist/chunk-PZDLPRJF.js +4 -0
- package/dist/chunk-Q5TFO66G.cjs +1 -0
- package/dist/chunk-QUTYCUST.js +4 -0
- package/dist/chunk-REKKBAQX.cjs +56 -0
- package/dist/chunk-REQ622YC.js +3 -0
- package/dist/chunk-RTNQP6BV.js +2 -0
- package/dist/chunk-RUJW47ZJ.js +2 -0
- package/dist/chunk-RXYCFZJC.cjs +121 -0
- package/dist/chunk-RYHOWZLK.js +2 -0
- package/dist/chunk-S2MZNEBQ.cjs +1 -0
- package/dist/chunk-S73YERS2.js +57 -0
- package/dist/chunk-SBNMXQNO.cjs +2 -0
- package/dist/chunk-SMQ6736Y.js +57 -0
- package/dist/chunk-T3DJ3UTP.cjs +121 -0
- package/dist/chunk-TJZO7ZSX.cjs +3 -0
- package/dist/chunk-TKUNRCRH.js +4 -0
- package/dist/chunk-TQLCOMKC.js +4 -0
- package/dist/chunk-TRXYDWGE.cjs +1 -0
- package/dist/chunk-TS55CUNJ.js +57 -0
- package/dist/chunk-UFBJ3WOZ.js +2 -0
- package/dist/chunk-UQRVQUVR.js +2 -0
- package/dist/chunk-UW5W35NP.js +122 -0
- package/dist/chunk-VI7WCO2J.cjs +3 -0
- package/dist/chunk-W2GPP6RB.js +122 -0
- package/dist/chunk-WHOA7YJU.cjs +1 -0
- package/dist/chunk-WNRUPL26.js +2 -0
- package/dist/chunk-WXT2XW7T.js +13 -0
- package/dist/chunk-XFYSADHV.cjs +2 -0
- package/dist/chunk-XIAJQLGS.js +2 -0
- package/dist/chunk-XK6UB77Q.js +4 -0
- package/dist/chunk-Y2VHO66Q.cjs +3 -0
- package/dist/chunk-Y5O2OD7J.cjs +3 -0
- package/dist/chunk-YARB43JG.cjs +56 -0
- package/dist/chunk-YLCEMVYY.cjs +56 -0
- package/dist/chunk-YSOM57GK.cjs +3 -0
- package/dist/chunk-Z3UVDGYS.cjs +56 -0
- package/dist/chunk-ZTLGK6R4.cjs +12 -0
- package/dist/chunk-ZUBJ6RLQ.cjs +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/client.cjs +10 -10
- package/dist/client.d.cts +1265 -0
- package/dist/client.d.ts +1265 -0
- package/dist/client.js +10 -10
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +3 -3
- package/dist/drizzle/index.d.ts +3 -3
- package/dist/drizzle/index.js +1 -1
- package/dist/fields/index.cjs +1 -1
- package/dist/fields/index.d.cts +2 -2
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +1 -1
- package/dist/graphql/index.d.cts +3 -3
- package/dist/graphql/index.d.ts +3 -3
- package/dist/index-8Ino7vKq.d.ts +105 -0
- package/dist/{index-d1m_oup7.d.cts → index-B9BFNOHd.d.cts} +1 -1
- package/dist/index-BMcYFpTv.d.cts +105 -0
- package/dist/index-BttsFZDa.d.ts +105 -0
- package/dist/index-ByOM1Y5x.d.ts +105 -0
- package/dist/index-C6xmtRio.d.cts +105 -0
- package/dist/index-CTI3K_uq.d.cts +105 -0
- package/dist/index-CTL4zv_u.d.ts +105 -0
- package/dist/index-CaDbioSg.d.ts +105 -0
- package/dist/index-CxA9uOv0.d.ts +105 -0
- package/dist/{index-4cH-BjtP.d.ts → index-D6AXbuPI.d.ts} +1 -1
- package/dist/index-DF0KDBaM.d.cts +105 -0
- package/dist/index-DG4Xu7gA.d.cts +105 -0
- package/dist/index-DS3DpJli.d.cts +105 -0
- package/dist/index-NGnJpSgf.d.ts +105 -0
- package/dist/index-Zrg3sZ6R.d.cts +105 -0
- package/dist/index-eHex8Iwj.d.ts +105 -0
- package/dist/index-rm7uyOK1.d.cts +105 -0
- package/dist/index.cjs +32 -32
- package/dist/index.d.cts +73 -11
- package/dist/index.d.ts +73 -11
- package/dist/index.js +32 -32
- package/dist/lib-A2D63VXD.cjs +1 -0
- package/dist/lib-JQD2JAOO.js +2 -0
- package/dist/local-KR3AIGVA.cjs +1 -0
- package/dist/local-T7GISZBL.js +1 -0
- package/dist/mongo-auth-adapter-GR2CFFEA.js +1 -0
- package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +1 -0
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.d.cts +4 -3
- package/dist/mongodb/index.d.ts +4 -3
- package/dist/mongodb/index.js +1 -1
- package/dist/nodemailer-transport-3VWVUBM5.cjs +1 -0
- package/dist/nodemailer-transport-7RHATUKL.js +1 -0
- package/dist/nodemailer-transport-CHO2WKIY.js +1 -0
- package/dist/nodemailer-transport-ED2IXNGW.cjs +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.d.cts +4 -4
- package/dist/rest/index.d.ts +4 -4
- package/dist/rest/index.js +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.d.cts +2 -2
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.d.cts +3 -3
- package/dist/trpc/index.d.ts +3 -3
- package/dist/trpc/index.js +1 -1
- package/dist/types-6ShQp2EM.d.cts +839 -0
- package/dist/types-B5Qz1svz.d.cts +822 -0
- package/dist/types-B9oXBEKI.d.cts +330 -0
- package/dist/types-B9oXBEKI.d.ts +330 -0
- package/dist/types-BCOhfwHC.d.ts +839 -0
- package/dist/types-BRDBNacn.d.ts +839 -0
- package/dist/types-Bii0bhUV.d.cts +329 -0
- package/dist/types-Bii0bhUV.d.ts +329 -0
- package/dist/{types-BADIMVGF.d.ts → types-Bt2_ycUO.d.ts} +36 -1
- package/dist/types-C4wXHImf.d.ts +822 -0
- package/dist/types-C8yIAV6K.d.cts +839 -0
- package/dist/types-CORUQhY-.d.ts +839 -0
- package/dist/types-Cdssrcbz.d.cts +839 -0
- package/dist/types-CjGqxBd3.d.cts +330 -0
- package/dist/types-CjGqxBd3.d.ts +330 -0
- package/dist/types-DBGR-eQl.d.cts +839 -0
- package/dist/types-DCWgPFmi.d.cts +822 -0
- package/dist/types-DROqAsr0.d.cts +330 -0
- package/dist/types-DROqAsr0.d.ts +330 -0
- package/dist/{types-YAVR0H9Z.d.cts → types-DsF64Wrc.d.cts} +36 -1
- package/dist/types-DxaK39ix.d.cts +330 -0
- package/dist/types-DxaK39ix.d.ts +330 -0
- package/dist/types-IeKFn7Ky.d.ts +839 -0
- package/dist/types-QglJ7PwT.d.cts +839 -0
- package/dist/types-ZrjEVWfi.d.ts +811 -0
- package/dist/types-dEy5JxvN.d.ts +822 -0
- package/dist/types-tVJc9YbX.d.cts +811 -0
- package/dist/types-zt5qIvje.d.ts +839 -0
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.d.cts +121 -1
- package/dist/ws/index.d.ts +121 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-5M3FKE2V.js +0 -2
- package/dist/chunk-WCFHS7EZ.cjs +0 -1
|
@@ -403,6 +403,9 @@ interface AdminConfig {
|
|
|
403
403
|
description?: string;
|
|
404
404
|
hideAPIURL?: boolean;
|
|
405
405
|
group?: string;
|
|
406
|
+
folder?: string;
|
|
407
|
+
parentFolder?: string;
|
|
408
|
+
treeHierarchy?: boolean;
|
|
406
409
|
icon?: string;
|
|
407
410
|
order?: number;
|
|
408
411
|
preview?: (doc: Record<string, unknown>, options: {
|
|
@@ -417,6 +420,33 @@ interface AdminConfig {
|
|
|
417
420
|
};
|
|
418
421
|
layout?: "split" | "single";
|
|
419
422
|
}
|
|
423
|
+
interface HierarchyConfig {
|
|
424
|
+
parentField?: string;
|
|
425
|
+
maxDepth?: number;
|
|
426
|
+
slugPrefix?: boolean;
|
|
427
|
+
}
|
|
428
|
+
interface ProjectConfig {
|
|
429
|
+
id: string;
|
|
430
|
+
name: string;
|
|
431
|
+
slug: string;
|
|
432
|
+
description?: string;
|
|
433
|
+
environment?: 'development' | 'staging' | 'production' | string;
|
|
434
|
+
collections?: string[];
|
|
435
|
+
globals?: string[];
|
|
436
|
+
settings?: Record<string, unknown>;
|
|
437
|
+
}
|
|
438
|
+
interface OrganizationConfig {
|
|
439
|
+
id: string;
|
|
440
|
+
name: string;
|
|
441
|
+
slug: string;
|
|
442
|
+
billingEmail?: string;
|
|
443
|
+
projects?: ProjectConfig[];
|
|
444
|
+
roles?: Array<{
|
|
445
|
+
name: string;
|
|
446
|
+
description?: string;
|
|
447
|
+
permissions?: string[];
|
|
448
|
+
}>;
|
|
449
|
+
}
|
|
420
450
|
interface FieldOverrides {
|
|
421
451
|
[fieldPath: string]: any;
|
|
422
452
|
}
|
|
@@ -520,6 +550,8 @@ interface CollectionConfig {
|
|
|
520
550
|
tenantField?: string;
|
|
521
551
|
upload?: UploadConfig;
|
|
522
552
|
versions?: VersionConfig;
|
|
553
|
+
folder?: string;
|
|
554
|
+
hierarchy?: HierarchyConfig;
|
|
523
555
|
auth?: boolean | AuthConfig;
|
|
524
556
|
graphQL?: {
|
|
525
557
|
singularName?: string;
|
|
@@ -540,6 +572,7 @@ interface CollectionConfig {
|
|
|
540
572
|
interface GlobalConfig {
|
|
541
573
|
slug: string;
|
|
542
574
|
label?: string;
|
|
575
|
+
folder?: string;
|
|
543
576
|
admin?: AdminConfig;
|
|
544
577
|
fields: Field[];
|
|
545
578
|
access?: GlobalAccess;
|
|
@@ -718,6 +751,8 @@ interface AdapterConfig {
|
|
|
718
751
|
interface KyroConfig {
|
|
719
752
|
collections?: CollectionConfig[];
|
|
720
753
|
globals?: GlobalConfig[];
|
|
754
|
+
projects?: ProjectConfig[];
|
|
755
|
+
organizations?: OrganizationConfig[];
|
|
721
756
|
adapter: BaseAdapter;
|
|
722
757
|
storage?: StorageProvider;
|
|
723
758
|
plugins?: KyroPlugin[];
|
|
@@ -773,4 +808,4 @@ interface KyroConfig {
|
|
|
773
808
|
debug?: boolean;
|
|
774
809
|
}
|
|
775
810
|
|
|
776
|
-
export {
|
|
811
|
+
export { mergeWhereClauses as $, type AccessArgs as A, type BaseAdapter as B, type CollectionConfig as C, type DeleteArgs as D, type EmailConfig as E, type FindArgs as F, type GlobalConfig as G, type HierarchyConfig as H, type ImageSize as I, type PluginHooks as J, KyroPlugin as K, type ProjectConfig as L, ReviewsPlugin as M, SEOPlugin as N, type OrganizationConfig as O, PluginManager as P, type UploadConfig as Q, type Request as R, type StorageConfig as S, type TenantContext as T, type UpdateArgs as U, type VersionRecord as V, type VersionConfig as W, type WhereClause as X, WishlistPlugin as Y, evaluateAccess as Z, getWhereClause as _, type StorageProvider as a, presetPlugins as a0, resolveProvider as a1, runFieldHooks as a2, runHooks as a3, type FindResult as b, type FindByIDArgs as c, type CreateArgs as d, type FindOneArgs as e, type FindVersionsArgs as f, type CreateVersionArgs as g, type KyroConfig as h, type User as i, type AccessControl as j, type AdapterConfig as k, type AdminConfig as l, AnalyticsPlugin as m, type AuthConfig as n, type CollectionAccess as o, type CollectionHooks as p, CommentsPlugin as q, ConfigService as r, type CreateResult as s, type FieldAccess as t, type FieldHooks as u, type GlobalAccess as v, type GlobalHooks as w, type Hook as x, type HookArgs as y, type PluginAPI as z };
|
|
@@ -0,0 +1,330 @@
|
|
|
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?: "pills" | "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[];
|
|
75
|
+
beforeChange?: Hook[];
|
|
76
|
+
afterChange?: Hook[];
|
|
77
|
+
afterRead?: Hook[];
|
|
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 = (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 function isTextField(field: Field): field is TextField;
|
|
311
|
+
declare function isNumberField(field: Field): field is NumberField;
|
|
312
|
+
declare function isRelationshipField(field: Field): field is RelationshipField;
|
|
313
|
+
declare function isArrayField(field: Field): field is ArrayField;
|
|
314
|
+
declare function isGroupField(field: Field): field is GroupField;
|
|
315
|
+
declare function isBlocksField(field: Field): field is BlocksField;
|
|
316
|
+
declare function isUploadField(field: Field): field is UploadField;
|
|
317
|
+
declare function isImageField(field: Field): field is ImageField;
|
|
318
|
+
declare function isRichTextField(field: Field): field is RichTextField;
|
|
319
|
+
declare function isSelectField(field: Field): field is SelectField;
|
|
320
|
+
declare function isLayoutField(field: Field): field is RowField | CollapsibleField | TabsField;
|
|
321
|
+
declare function isIconField(field: Field): field is IconField;
|
|
322
|
+
declare function isEmbeddingField(field: Field): field is EmbeddingField;
|
|
323
|
+
declare const PRIMITIVE_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "icon"];
|
|
324
|
+
declare const COMPLEX_FIELD_TYPES: readonly ["richtext", "json", "code", "upload", "image", "markdown", "embedding"];
|
|
325
|
+
declare const RELATIONAL_FIELD_TYPES: readonly ["relationship", "array", "group", "blocks"];
|
|
326
|
+
declare const LAYOUT_FIELD_TYPES: readonly ["row", "collapsible", "tabs"];
|
|
327
|
+
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"];
|
|
328
|
+
declare function createRelationshipFieldConfig(name: string, relationTo: string | string[], options?: Partial<Omit<RelationshipField, "type" | "name" | "relationTo">>): RelationshipField;
|
|
329
|
+
|
|
330
|
+
export { isImageField as $, ALL_FIELD_TYPES as A, type BaseField as B, COMPLEX_FIELD_TYPES 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, type TextFieldVariant as K, LAYOUT_FIELD_TYPES as L, type MarkdownField as M, type NumberField as N, type TextareaField as O, PRIMITIVE_FIELD_TYPES as P, createRelationshipFieldConfig as Q, RELATIONAL_FIELD_TYPES as R, type SecretField as S, type TabsField as T, type UploadField as U, type ValidateOptions as V, isArrayField as W, isBlocksField as X, isEmbeddingField as Y, isGroupField as Z, isIconField as _, type ActionField as a, isLayoutField as a0, isNumberField as a1, isRelationshipField as a2, isRichTextField as a3, isSelectField as a4, isTextField as a5, isUploadField as a6, type ArrayField as b, type Block as c, type BlockAdmin as d, type BlockImage as e, type BlocksField as f, type ButtonField as g, type CheckboxField as h, type CodeField as i, type CollapsibleField as j, type ColorField as k, type DeclarativeCondition as l, type EmbeddingField as m, type FieldAccess as n, type FieldAdmin as o, type FieldType as p, type ImageField as q, type ListField as r, type PasswordField as s, type RadioField as t, type RelationshipField as u, type RichTextBlock as v, type RichTextField as w, type RowField as x, type SelectField as y, type TextField as z };
|