@hygraph/cli 0.0.16 → 0.0.18

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/define.d.ts CHANGED
@@ -1,98 +1,101 @@
1
- //#region src/management/graphql.d.ts
2
- type ColorPalette = "BLUE" | "BROWN" | "GREEN" | "INDIGO" | "NEUTRAL" | "OLIVE" | "ORANGE" | "PINK" | "PURPLE" | "RED" | "ROSE" | "TEAL" | "YELLOW";
3
- type GraphQlRemoteSourceIntrospectionMethod = "GET" | "POST";
4
- type RelationalFieldType = "ASSET" | "RELATION";
5
- type RemoteFieldApiMethod = "GET" | "POST";
6
- type RemoteSourceKind = "CommerceLayer" | "CommerceTools" | "Custom";
7
- /** Field types */
8
- type SimpleFieldType = "BOOLEAN" | "COLOR" | "DATE" | "DATETIME" | "FLOAT" | "ID" | "INT" | "JSON" | "LOCATION" | "RICHTEXT" | "STRING" | "VECTOR";
9
- type SystemSidebarElementType$1 = "AGENTS" | "CONTENT_WORKFLOWS" | "INFORMATION" | "LOCALIZATIONS" | "PREVIEW_URLS" | "RELEASES" | "STAGES" | "TAGS" | "VARIANTS" | "VERSIONS";
10
- //#endregion
11
- //#region src/ir/types.d.ts
12
- /** A colour of Hygraph's palette. */
13
- type IRStageColor = ColorPalette;
1
+ //#region src/define/fields/renderer.d.ts
14
2
  /**
15
- * Draft or Published. Hygraph creates both with every environment, and
16
- * nothing of them can change but where Published sits.
3
+ * A setting of an app element, by the name the element declares. Studio's
4
+ * form offers text, numbers and switches.
17
5
  */
18
- type IRSystemStage = {
19
- apiId: "DRAFT" | "PUBLISHED";
20
- isSystem: true;
21
- position: number;
6
+ type AppRendererConfig = Record<string, JsonValue>;
7
+ type FieldRendererInput = {
8
+ /**
9
+ * An app's element as the field's editor in Studio. The app must be
10
+ * installed in the environment, which you do in Studio, and the element
11
+ * must be made for the field's type.
12
+ *
13
+ * @example { app: { appApiId: "stars", appElementApiId: "stars", config: { max: 5 } } }
14
+ */
15
+ app: {
16
+ /** The app's apiId. */
17
+ appApiId: string;
18
+ /** The element's apiId within the app. */
19
+ appElementApiId: string;
20
+ /**
21
+ * The element's settings for this field, by the names the element
22
+ * declares.
23
+ * @default {}
24
+ */
25
+ config?: AppRendererConfig;
26
+ };
22
27
  };
23
- /** Hygraph's panels that take no settings. */
24
- type IRSystemSidebarElementType = Exclude<SystemSidebarElementType$1, "PREVIEW_URLS">;
25
- /**
26
- * Hygraph's names for the field types it has: a simple field's `type`, a
27
- * relation's, or the batch operation's for the others.
28
- */
29
- type IRKnownFieldType = SimpleFieldType | RelationalFieldType | "ENUMERATION" | "UNION" | "COMPONENT" | "COMPONENT_UNION" | "REMOTE" | "TAXONOMY";
30
- /**
31
- * Hygraph's name for a field's type. Editors suggest the known ones, and
32
- * any other string is accepted, so a type Hygraph adds later needs no new
33
- * CLI.
34
- */
35
- type IRFieldType = IRKnownFieldType | (string & {});
36
- /** What Studio asks of editors on a reference. The API does not check it. */
37
- type IRReferenceRules = {
38
- connections: IRConnectionsRule;
28
+ /** What every `define.field.custom` builder takes besides its type's options. */
29
+ type CustomFieldInput = {
30
+ /** The installed app's element that is the field's editor in Studio. */
31
+ renderer: FieldRendererInput;
39
32
  };
40
- /** How many entries to connect, between `min` and `max`, either one open. */
41
- type IRConnectionsRule = {
42
- min: number | null;
43
- max: number | null;
44
- /** What editors see when the count does not pass, `null` for Studio's own. */
45
- errorMessage: string | null;
46
- };
47
- /** Who sees a field: editors and the API, or fewer of them. */
48
- type IRFieldVisibility = "READ_WRITE" | "READ_ONLY" | "HIDDEN" | "API_ONLY";
49
- /** An app element's settings, by the names the element declares. */
50
- type IRAppRendererConfig = Record<string, IRJsonValue>;
51
- /** While the boolean base field is, or is not, `booleanValue`. */
52
- type IRBooleanVisibilityCondition = {
53
- baseField: string;
54
- operator: "IS" | "IS_NOT";
55
- booleanValue: boolean;
33
+ /** What a builder hands back for `renderer`: the input with its defaults. */
34
+ type FieldRenderer = {
35
+ app: {
36
+ appApiId: string;
37
+ appElementApiId: string;
38
+ config: AppRendererConfig;
39
+ };
56
40
  };
57
- /**
58
- * While the enumeration base field is (`IS`), or is not (`IS_NOT`), the one
59
- * value in `enumerationValues`, or holds any, all or none of them.
60
- */
61
- type IREnumerationVisibilityCondition = {
62
- baseField: string;
63
- operator: "IS" | "IS_NOT" | "CONTAINS_ANY" | "CONTAINS_ALL" | "CONTAINS_NONE";
64
- /** Value apiIds, sorted: their order has no meaning. */
65
- enumerationValues: string[];
41
+ //#endregion
42
+ //#region src/define/fields/json.d.ts
43
+ /** Any value JSON can hold: text, a number, a boolean, `null`, a list or an object. */
44
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
45
+ [key: string]: JsonValue;
66
46
  };
67
47
  /**
68
- * A colour as Studio writes it: red, green and blue from 0 to 255, alpha
69
- * from 0 to 1.
48
+ * The options `json` takes. Studio has no title on a JSON field, so it
49
+ * takes no `title`.
70
50
  */
71
- type IRColor = {
72
- rgba: {
73
- r: number;
74
- g: number;
75
- b: number;
76
- a: number;
77
- };
78
- };
79
- /** A point on the globe, in degrees. */
80
- type IRLocation = {
81
- latitude: number;
82
- longitude: number;
83
- };
84
- /** Any value JSON can hold. */
85
- type IRJsonValue = string | number | boolean | null | IRJsonValue[] | {
86
- [key: string]: IRJsonValue;
51
+ type JsonFieldInput = FieldInput & ValueFieldInput<JsonValue> & UniqueFieldInput & LocalizedFieldInput & {
52
+ title?: never;
87
53
  };
88
- /** A toolbar action of Studio's rich text editor, by Studio's id. */
89
- type IRRichTextAction = "heading-one" | "heading-two" | "heading-three" | "heading-four" | "heading-five" | "heading-six" | "bold" | "italic" | "underline" | "link" | "block-quote" | "code" | "asset" | "bulleted-list" | "numbered-list" | "code-block" | "iframe" | "class" | "table" | "superscript" | "subscript";
90
- /** Rich text as Hygraph stores it: the root of a Slate document. */
91
- type IRRichTextValue = {
92
- children: IRJsonValue[];
54
+ /** What `define.field.json` hands back: the input with every default filled in. */
55
+ type JsonField = {
56
+ __typename: "JsonField";
57
+ apiId: string;
58
+ displayName: string;
59
+ description: string | null;
60
+ list: boolean;
61
+ required: boolean;
62
+ unique: boolean;
63
+ localized: boolean;
64
+ /** Always `false`: Studio has no title on a JSON field. */
65
+ title: false;
66
+ visibility: FieldVisibility;
67
+ visibilityCondition: FieldVisibilityCondition | null;
68
+ variantEnabled: boolean;
69
+ /** A list of values on a list field, one value otherwise. */
70
+ initialValue: JsonValue | JsonValue[] | null;
71
+ /**
72
+ * The value existing entries get when the field becomes required, or is
73
+ * created required. A list of values on a list field.
74
+ */
75
+ migrationValue: JsonValue | JsonValue[] | null;
76
+ /**
77
+ * The field's editor: `null` for Hygraph's own, or an app's element,
78
+ * which `define.field.custom` sets.
79
+ */
80
+ renderer: FieldRenderer | null;
81
+ renamedFrom: string | null;
93
82
  };
94
- /** The flags Studio offers on a pattern: case insensitive, multiline, single line. */
95
- type IRRegexFlag = "i" | "m" | "s";
83
+ /**
84
+ * Any JSON, such as settings for a widget. One value may be a list or an
85
+ * object itself. Nothing here is validated; the checks run at plan time
86
+ * with the model's or component's own.
87
+ */
88
+ declare function json(input: JsonFieldInput): JsonField;
89
+ //#endregion
90
+ //#region src/management/graphql.d.ts
91
+ type ColorPalette = "BLUE" | "BROWN" | "GREEN" | "INDIGO" | "NEUTRAL" | "OLIVE" | "ORANGE" | "PINK" | "PURPLE" | "RED" | "ROSE" | "TEAL" | "YELLOW";
92
+ type GraphQlRemoteSourceIntrospectionMethod = "GET" | "POST";
93
+ type RelationalFieldType = "ASSET" | "RELATION";
94
+ type RemoteFieldApiMethod = "GET" | "POST";
95
+ type RemoteSourceKind = "CommerceLayer" | "CommerceTools" | "Custom";
96
+ /** Field types */
97
+ type SimpleFieldType = "BOOLEAN" | "COLOR" | "DATE" | "DATETIME" | "FLOAT" | "ID" | "INT" | "JSON" | "LOCATION" | "RICHTEXT" | "STRING" | "VECTOR";
98
+ type SystemSidebarElementType$1 = "AGENTS" | "CONTENT_WORKFLOWS" | "INFORMATION" | "LOCALIZATIONS" | "PREVIEW_URLS" | "RELEASES" | "STAGES" | "TAGS" | "VARIANTS" | "VERSIONS";
96
99
  //#endregion
97
100
  //#region src/define/resources/sidebar.d.ts
98
101
  /**
@@ -109,7 +112,7 @@ type IRRegexFlag = "i" | "m" | "s";
109
112
  * - `AGENTS`: run AI agents on the entry.
110
113
  * - `TAGS`: tag the entry. Only in projects with Tags turned on.
111
114
  */
112
- type SystemSidebarElementType = IRSystemSidebarElementType;
115
+ type SystemSidebarElementType = Exclude<SystemSidebarElementType$1, "PREVIEW_URLS">;
113
116
  /** One link of a preview panel. */
114
117
  type PreviewUrl = {
115
118
  /** The label of the link. */
@@ -122,7 +125,7 @@ type PreviewUrl = {
122
125
  };
123
126
  /** The settings of a panel of an installed app. */
124
127
  type SidebarAppConfig = {
125
- [key: string]: IRJsonValue;
128
+ [key: string]: JsonValue;
126
129
  };
127
130
  /** One panel beside an entry in Studio, as you write it in `sidebar`. */
128
131
  type SidebarElementInput = {
@@ -218,11 +221,7 @@ type ModelInput = {
218
221
  */
219
222
  renamedFrom?: string;
220
223
  };
221
- /**
222
- * What `define.model` hands back: the input with every default filled in.
223
- * Plain data in the same shape the user wrote, not the IR — the canonical
224
- * form is built from these later and never reaches the config.
225
- */
224
+ /** What `define.model` hands back: the input with every default filled in. */
226
225
  type Model = {
227
226
  __typename: "Model";
228
227
  apiId: string;
@@ -243,47 +242,6 @@ type Model = {
243
242
  */
244
243
  declare function model$1(input: ModelInput): Model;
245
244
  //#endregion
246
- //#region src/define/fields/renderer.d.ts
247
- /**
248
- * A setting of an app element, by the name the element declares. Studio's
249
- * form offers text, numbers and switches.
250
- */
251
- type AppRendererConfig = IRAppRendererConfig;
252
- type FieldRendererInput = {
253
- /**
254
- * An app's element as the field's editor in Studio. The app must be
255
- * installed in the environment, which you do in Studio, and the element
256
- * must be made for the field's type.
257
- *
258
- * @example { app: { appApiId: "stars", appElementApiId: "stars", config: { max: 5 } } }
259
- */
260
- app: {
261
- /** The app's apiId. */
262
- appApiId: string;
263
- /** The element's apiId within the app. */
264
- appElementApiId: string;
265
- /**
266
- * The element's settings for this field, by the names the element
267
- * declares.
268
- * @default {}
269
- */
270
- config?: AppRendererConfig;
271
- };
272
- };
273
- /** What every `define.field.custom` builder takes besides its type's options. */
274
- type CustomFieldInput = {
275
- /** The installed app's element that is the field's editor in Studio. */
276
- renderer: FieldRendererInput;
277
- };
278
- /** What a builder hands back for `renderer`: the input with its defaults. */
279
- type FieldRenderer = {
280
- app: {
281
- appApiId: string;
282
- appElementApiId: string;
283
- config: AppRendererConfig;
284
- };
285
- };
286
- //#endregion
287
245
  //#region src/define/fields/referenceOneWay.d.ts
288
246
  /**
289
247
  * The options `referenceOneWay` takes. A reference cannot be required. To
@@ -339,7 +297,14 @@ type ReferenceRulesInput = {
339
297
  };
340
298
  };
341
299
  /** The rules with every default filled in. */
342
- type ReferenceRules = IRReferenceRules;
300
+ type ReferenceRules = {
301
+ connections: {
302
+ min: number | null;
303
+ max: number | null;
304
+ /** What editors see when the count does not pass, `null` for Studio's own. */
305
+ errorMessage: string | null;
306
+ };
307
+ };
343
308
  /**
344
309
  * What `define.field.referenceOneWay` hands back: the input with every
345
310
  * default filled in.
@@ -727,7 +692,10 @@ type BooleanField = {
727
692
  variantEnabled: boolean;
728
693
  /** A list of values on a list field, one value otherwise. */
729
694
  initialValue: boolean | boolean[] | null;
730
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
695
+ /**
696
+ * The value existing entries get when the field becomes required, or is
697
+ * created required. A list of values on a list field.
698
+ */
731
699
  migrationValue: boolean | boolean[] | null;
732
700
  /**
733
701
  * The field's editor: `null` for Hygraph's own, or an app's element,
@@ -745,52 +713,6 @@ type BooleanField = {
745
713
  */
746
714
  declare function boolean(input: BooleanFieldInput): BooleanField;
747
715
  //#endregion
748
- //#region src/define/fields/color.d.ts
749
- /**
750
- * A colour: `r`, `g` and `b` whole numbers from 0 to 255, `a` from 0 to 1.
751
- *
752
- * @example { rgba: { r: 255, g: 99, b: 71, a: 1 } }
753
- */
754
- type ColorValue = IRColor;
755
- /**
756
- * The options `color` takes. Studio has no title on a color field, so it
757
- * takes no `title`.
758
- */
759
- type ColorFieldInput = FieldInput & ValueFieldInput<ColorValue> & UniqueFieldInput & LocalizedFieldInput & {
760
- title?: never;
761
- };
762
- /** What `define.field.color` hands back: the input with every default filled in. */
763
- type ColorField = {
764
- __typename: "ColorField";
765
- apiId: string;
766
- displayName: string;
767
- description: string | null;
768
- list: boolean;
769
- required: boolean;
770
- unique: boolean;
771
- localized: boolean;
772
- /** Always `false`: Studio has no title on a color field. */
773
- title: false;
774
- visibility: FieldVisibility;
775
- visibilityCondition: FieldVisibilityCondition | null;
776
- variantEnabled: boolean;
777
- /** A list of values on a list field, one value otherwise. */
778
- initialValue: ColorValue | ColorValue[] | null;
779
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
780
- migrationValue: ColorValue | ColorValue[] | null;
781
- /**
782
- * The field's editor: `null` for Hygraph's own, or an app's element,
783
- * which `define.field.custom` sets.
784
- */
785
- renderer: FieldRenderer | null;
786
- renamedFrom: string | null;
787
- };
788
- /**
789
- * A colour, such as a brand colour. Nothing here is validated; the checks
790
- * run at plan time with the model's or component's own.
791
- */
792
- declare function color(input: ColorFieldInput): ColorField;
793
- //#endregion
794
716
  //#region src/define/fields/component.d.ts
795
717
  /** The options `component` takes. */
796
718
  type ComponentFieldInput = Omit<FieldInput, "required"> & {
@@ -866,7 +788,10 @@ type DateFieldAttributes = {
866
788
  variantEnabled: boolean;
867
789
  /** A list of values on a list field, one value otherwise. */
868
790
  initialValue: string | string[] | null;
869
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
791
+ /**
792
+ * The value existing entries get when the field becomes required, or is
793
+ * created required. A list of values on a list field.
794
+ */
870
795
  migrationValue: string | string[] | null;
871
796
  /**
872
797
  * The field's editor: `null` for Hygraph's own, or an app's element,
@@ -998,7 +923,10 @@ type EnumerationField<V extends string = string> = {
998
923
  variantEnabled: boolean;
999
924
  /** A list of values on a list field, one value otherwise. */
1000
925
  initialValue: V | V[] | null;
1001
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
926
+ /**
927
+ * The value existing entries get when the field becomes required, or is
928
+ * created required. A list of values on a list field.
929
+ */
1002
930
  migrationValue: V | V[] | null;
1003
931
  renamedFrom: string | null;
1004
932
  };
@@ -1012,56 +940,16 @@ type EnumerationField<V extends string = string> = {
1012
940
  */
1013
941
  declare function enumeration<V extends string>(input: EnumerationFieldInput<V>): EnumerationField<V>;
1014
942
  //#endregion
1015
- //#region src/define/fields/json.d.ts
1016
- /** Any value JSON can hold: text, a number, a boolean, `null`, a list or an object. */
1017
- type JsonValue = IRJsonValue;
1018
- /**
1019
- * The options `json` takes. Studio has no title on a JSON field, so it
1020
- * takes no `title`.
1021
- */
1022
- type JsonFieldInput = FieldInput & ValueFieldInput<JsonValue> & UniqueFieldInput & LocalizedFieldInput & {
1023
- title?: never;
1024
- };
1025
- /** What `define.field.json` hands back: the input with every default filled in. */
1026
- type JsonField = {
1027
- __typename: "JsonField";
1028
- apiId: string;
1029
- displayName: string;
1030
- description: string | null;
1031
- list: boolean;
1032
- required: boolean;
1033
- unique: boolean;
1034
- localized: boolean;
1035
- /** Always `false`: Studio has no title on a JSON field. */
1036
- title: false;
1037
- visibility: FieldVisibility;
1038
- visibilityCondition: FieldVisibilityCondition | null;
1039
- variantEnabled: boolean;
1040
- /** A list of values on a list field, one value otherwise. */
1041
- initialValue: JsonValue | JsonValue[] | null;
1042
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1043
- migrationValue: JsonValue | JsonValue[] | null;
1044
- /**
1045
- * The field's editor: `null` for Hygraph's own, or an app's element,
1046
- * which `define.field.custom` sets.
1047
- */
1048
- renderer: FieldRenderer | null;
1049
- renamedFrom: string | null;
1050
- };
1051
- /**
1052
- * Any JSON, such as settings for a widget. One value may be a list or an
1053
- * object itself. Nothing here is validated; the checks run at plan time
1054
- * with the model's or component's own.
1055
- */
1056
- declare function json(input: JsonFieldInput): JsonField;
1057
- //#endregion
1058
943
  //#region src/define/fields/location.d.ts
1059
944
  /**
1060
945
  * A point on the globe, in degrees.
1061
946
  *
1062
947
  * @example { latitude: 52.52, longitude: 13.405 }
1063
948
  */
1064
- type LocationValue = IRLocation;
949
+ type LocationValue = {
950
+ latitude: number;
951
+ longitude: number;
952
+ };
1065
953
  /**
1066
954
  * The options `location` takes. Studio has no title on a location field,
1067
955
  * so it takes no `title`.
@@ -1086,7 +974,10 @@ type LocationField = {
1086
974
  variantEnabled: boolean;
1087
975
  /** A list of values on a list field, one value otherwise. */
1088
976
  initialValue: LocationValue | LocationValue[] | null;
1089
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
977
+ /**
978
+ * The value existing entries get when the field becomes required, or is
979
+ * created required. A list of values on a list field.
980
+ */
1090
981
  migrationValue: LocationValue | LocationValue[] | null;
1091
982
  /**
1092
983
  * The field's editor: `null` for Hygraph's own, or an app's element,
@@ -1142,7 +1033,10 @@ type NumberFieldAttributes = {
1142
1033
  variantEnabled: boolean;
1143
1034
  /** A list of values on a list field, one value otherwise. */
1144
1035
  initialValue: number | number[] | null;
1145
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1036
+ /**
1037
+ * The value existing entries get when the field becomes required, or is
1038
+ * created required. A list of values on a list field.
1039
+ */
1146
1040
  migrationValue: number | number[] | null;
1147
1041
  validations: NumberValidationRules | null;
1148
1042
  /**
@@ -1382,9 +1276,9 @@ type RemoteSource = GraphQLRemoteSource | RESTRemoteSource;
1382
1276
  //#region src/define/resources/graphqlRemoteSource.d.ts
1383
1277
  type GraphQLRemoteSourceInput = RemoteSourceInput & {
1384
1278
  /**
1385
- * How Hygraph asks the remote API for its schema. It does when it creates
1386
- * the source, and keeps that copy: types the API adds later reach Hygraph
1387
- * only through the Management API's `refreshGraphQLRemoteSourceSchema`.
1279
+ * How Hygraph asks the remote API for its schema. Hygraph reads the
1280
+ * schema when it creates the source and keeps that copy. Types the API
1281
+ * adds later do not reach Hygraph on their own.
1388
1282
  */
1389
1283
  introspectionMethod: GraphQlRemoteSourceIntrospectionMethod;
1390
1284
  /**
@@ -1440,10 +1334,9 @@ type RemoteFieldArgInput = {
1440
1334
  /** The options every remote field takes, whatever its source. */
1441
1335
  type RemoteFieldBaseInput = Omit<FieldInput, "visibility" | "visibilityCondition" | "variantEnabled" | "renamedFrom"> & {
1442
1336
  /**
1443
- * Hygraph cannot rename a remote field: the batch ignores the new apiId
1444
- * (FND-5075).
1445
- * Change `apiId` alone instead; the plan deletes the field and creates
1446
- * it again, which loses nothing, since a remote field holds no content.
1337
+ * Hygraph cannot rename a remote field. Change `apiId` alone instead; the
1338
+ * plan deletes the field and creates it again, which loses nothing, since
1339
+ * a remote field holds no content.
1447
1340
  */
1448
1341
  renamedFrom?: never;
1449
1342
  /**
@@ -1551,9 +1444,11 @@ declare function remote(input: RemoteFieldInput): RemoteField;
1551
1444
  * Rich text as Hygraph stores it: the root of a Slate document, such as
1552
1445
  * `{ children: [{ type: "paragraph", children: [{ text: "Hello" }] }] }`.
1553
1446
  */
1554
- type RichTextValue = IRRichTextValue;
1447
+ type RichTextValue = {
1448
+ children: JsonValue[];
1449
+ };
1555
1450
  /** A toolbar action of Studio's rich text editor. */
1556
- type RichTextAction = IRRichTextAction;
1451
+ type RichTextAction = "heading-one" | "heading-two" | "heading-three" | "heading-four" | "heading-five" | "heading-six" | "bold" | "italic" | "underline" | "link" | "block-quote" | "code" | "asset" | "bulleted-list" | "numbered-list" | "code-block" | "iframe" | "class" | "table" | "superscript" | "subscript";
1557
1452
  /** The options `richText` takes. Hygraph refuses rich text as the title. */
1558
1453
  type RichTextFieldInput = FieldInput & ValueFieldInput<RichTextValue> & UniqueFieldInput & LocalizedFieldInput & {
1559
1454
  title?: never;
@@ -1592,7 +1487,10 @@ type RichTextField = {
1592
1487
  variantEnabled: boolean;
1593
1488
  /** A list of values on a list field, one value otherwise. */
1594
1489
  initialValue: RichTextValue | RichTextValue[] | null;
1595
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1490
+ /**
1491
+ * The value existing entries get when the field becomes required, or is
1492
+ * created required. A list of values on a list field.
1493
+ */
1596
1494
  migrationValue: RichTextValue | RichTextValue[] | null;
1597
1495
  embeds: (() => Model)[] | null;
1598
1496
  actions: RichTextAction[] | null;
@@ -1640,7 +1538,10 @@ type StringFieldAttributes = {
1640
1538
  variantEnabled: boolean;
1641
1539
  /** A list of values on a list field, one value otherwise. */
1642
1540
  initialValue: string | string[] | null;
1643
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1541
+ /**
1542
+ * The value existing entries get when the field becomes required, or is
1543
+ * created required. A list of values on a list field.
1544
+ */
1644
1545
  migrationValue: string | string[] | null;
1645
1546
  validations: StringValidationRules | null;
1646
1547
  renamedFrom: string | null;
@@ -1676,7 +1577,7 @@ type StringField = StringFieldAttributes & {
1676
1577
  */
1677
1578
  type TextField = SingleLineField | MultilineField | MarkdownField | SlugField | StringField;
1678
1579
  /** `i` case insensitive, `m` multiline, `s` single line, as Studio offers them. */
1679
- type RegexFlag = IRRegexFlag;
1580
+ type RegexFlag = "i" | "m" | "s";
1680
1581
  type RegexRuleInput = {
1681
1582
  /** A regular expression, such as `"^[a-z0-9-]+$"`. */
1682
1583
  regex: string;
@@ -1817,7 +1718,10 @@ type TaxonomyField = {
1817
1718
  variantEnabled: boolean;
1818
1719
  /** A list of node apiIds on a list field, one otherwise. */
1819
1720
  initialValue: string | string[] | null;
1820
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1721
+ /**
1722
+ * The node apiId existing entries get when the field becomes required, or
1723
+ * is created required. A list of node apiIds on a list field.
1724
+ */
1821
1725
  migrationValue: string | string[] | null;
1822
1726
  renamedFrom: string | null;
1823
1727
  };
@@ -1832,17 +1736,25 @@ type TaxonomyField = {
1832
1736
  declare function taxonomy(input: TaxonomyFieldInput): TaxonomyField;
1833
1737
  //#endregion
1834
1738
  //#region src/define/fields/unsupported.d.ts
1739
+ /** The field types Hygraph has. */
1740
+ type KnownFieldType = SimpleFieldType | RelationalFieldType | "ENUMERATION" | "UNION" | "COMPONENT" | "COMPONENT_UNION" | "REMOTE" | "TAXONOMY";
1741
+ /**
1742
+ * Hygraph's name for a field's type. Your editor suggests the known ones.
1743
+ * Any other name is accepted too, so a type Hygraph adds later works
1744
+ * without a new CLI version.
1745
+ */
1746
+ type FieldType = KnownFieldType | (string & {});
1835
1747
  type UnsupportedFieldInput = {
1836
1748
  /** The field's apiId in Hygraph. */
1837
1749
  apiId: string;
1838
1750
  /** Hygraph's name for the field's type, such as `VECTOR` or `RELATION`. */
1839
- type: IRFieldType;
1751
+ type: FieldType;
1840
1752
  };
1841
1753
  /** What `define.field.unsupported` hands back. */
1842
1754
  type UnsupportedField = {
1843
1755
  __typename: "UnsupportedField";
1844
1756
  apiId: string;
1845
- type: IRFieldType;
1757
+ type: FieldType;
1846
1758
  };
1847
1759
  /**
1848
1760
  * A field the CLI cannot read yet, written by export in the field's slot.
@@ -1859,7 +1771,7 @@ type Field = BooleanField | TextField | DateField | DateTimeField | IntField | F
1859
1771
  * `READ_ONLY` shows it without letting editors change it, `HIDDEN` hides
1860
1772
  * it from editors, `API_ONLY` leaves it out of Studio entirely.
1861
1773
  */
1862
- type FieldVisibility = IRFieldVisibility;
1774
+ type FieldVisibility = "READ_WRITE" | "READ_ONLY" | "HIDDEN" | "API_ONLY";
1863
1775
  /**
1864
1776
  * Show the field in Studio only while another field on the same model or
1865
1777
  * component has a given value. On a boolean field: while it is (`IS`) or is not
@@ -1871,11 +1783,17 @@ type FieldVisibility = IRFieldVisibility;
1871
1783
  * @example { baseField: "hasDiscount", operator: "IS", booleanValue: true }
1872
1784
  * @example { baseField: "mediaType", operator: "IS", enumerationValues: ["VIDEO"] }
1873
1785
  */
1874
- type FieldVisibilityCondition = (IRBooleanVisibilityCondition & {
1786
+ type FieldVisibilityCondition = {
1787
+ baseField: string;
1788
+ operator: "IS" | "IS_NOT";
1789
+ booleanValue: boolean;
1875
1790
  enumerationValues?: never;
1876
- }) | (IREnumerationVisibilityCondition & {
1791
+ } | {
1792
+ baseField: string;
1793
+ operator: "IS" | "IS_NOT" | "CONTAINS_ANY" | "CONTAINS_ALL" | "CONTAINS_NONE";
1794
+ enumerationValues: string[];
1877
1795
  booleanValue?: never;
1878
- });
1796
+ };
1879
1797
  /** The options every field type takes. */
1880
1798
  type FieldInput = {
1881
1799
  /**
@@ -1970,6 +1888,62 @@ type LocalizedFieldInput = {
1970
1888
  localized?: boolean;
1971
1889
  };
1972
1890
  //#endregion
1891
+ //#region src/define/fields/color.d.ts
1892
+ /**
1893
+ * A colour: `r`, `g` and `b` whole numbers from 0 to 255, `a` from 0 to 1.
1894
+ *
1895
+ * @example { rgba: { r: 255, g: 99, b: 71, a: 1 } }
1896
+ */
1897
+ type ColorValue = {
1898
+ rgba: {
1899
+ r: number;
1900
+ g: number;
1901
+ b: number;
1902
+ a: number;
1903
+ };
1904
+ };
1905
+ /**
1906
+ * The options `color` takes. Studio has no title on a color field, so it
1907
+ * takes no `title`.
1908
+ */
1909
+ type ColorFieldInput = FieldInput & ValueFieldInput<ColorValue> & UniqueFieldInput & LocalizedFieldInput & {
1910
+ title?: never;
1911
+ };
1912
+ /** What `define.field.color` hands back: the input with every default filled in. */
1913
+ type ColorField = {
1914
+ __typename: "ColorField";
1915
+ apiId: string;
1916
+ displayName: string;
1917
+ description: string | null;
1918
+ list: boolean;
1919
+ required: boolean;
1920
+ unique: boolean;
1921
+ localized: boolean;
1922
+ /** Always `false`: Studio has no title on a color field. */
1923
+ title: false;
1924
+ visibility: FieldVisibility;
1925
+ visibilityCondition: FieldVisibilityCondition | null;
1926
+ variantEnabled: boolean;
1927
+ /** A list of values on a list field, one value otherwise. */
1928
+ initialValue: ColorValue | ColorValue[] | null;
1929
+ /**
1930
+ * The value existing entries get when the field becomes required, or is
1931
+ * created required. A list of values on a list field.
1932
+ */
1933
+ migrationValue: ColorValue | ColorValue[] | null;
1934
+ /**
1935
+ * The field's editor: `null` for Hygraph's own, or an app's element,
1936
+ * which `define.field.custom` sets.
1937
+ */
1938
+ renderer: FieldRenderer | null;
1939
+ renamedFrom: string | null;
1940
+ };
1941
+ /**
1942
+ * A colour, such as a brand colour. Nothing here is validated; the checks
1943
+ * run at plan time with the model's or component's own.
1944
+ */
1945
+ declare function color(input: ColorFieldInput): ColorField;
1946
+ //#endregion
1973
1947
  //#region src/define/fields/asset.d.ts
1974
1948
  /** The options `asset` takes. */
1975
1949
  type AssetFieldInput = Omit<FieldInput, "required"> & {
@@ -2231,7 +2205,7 @@ declare function segment(input?: SystemSegmentInput): SystemSegment;
2231
2205
  */
2232
2206
  type SystemStage = {
2233
2207
  __typename: "SystemStage";
2234
- apiId: IRSystemStage["apiId"];
2208
+ apiId: "DRAFT" | "PUBLISHED";
2235
2209
  };
2236
2210
  declare const stage$1: {
2237
2211
  /** Draft. Always the first of `stages`. */
@@ -2564,8 +2538,8 @@ type StageInput = {
2564
2538
  displayName: string;
2565
2539
  /** @default null */
2566
2540
  description?: string;
2567
- /** The colour the stage is shown in. */
2568
- color: IRStageColor;
2541
+ /** The colour the stage is shown in, from Hygraph's palette. */
2542
+ color: ColorPalette;
2569
2543
  };
2570
2544
  /** What `define.stage` hands back: the input with every default filled in. */
2571
2545
  type Stage = {
@@ -2573,7 +2547,7 @@ type Stage = {
2573
2547
  apiId: string;
2574
2548
  displayName: string;
2575
2549
  description: string | null;
2576
- color: IRStageColor;
2550
+ color: ColorPalette;
2577
2551
  };
2578
2552
  /**
2579
2553
  * A content stage entries can be published to. The environment's `stages`
@@ -2628,10 +2602,11 @@ type Environment = {
2628
2602
  /** A model Hygraph provides, as `system.*` hands it back. */
2629
2603
  type SystemModel = SystemAsset | SystemQuery | SystemSegment;
2630
2604
  /**
2631
- * One environment: typed arrays per resource kind. The what.
2605
+ * Everything one environment holds: its locales, stages, enumerations,
2606
+ * taxonomies, remote sources, components and models. Pass it to
2607
+ * `define.target` as `apply`.
2632
2608
  *
2633
- * Ordering, keying and positions are not decided here. This returns the
2634
- * resources as written; `convertToIR` turns them into the canonical form.
2609
+ * Only the order of `stages` matters. The other lists can be in any order.
2635
2610
  */
2636
2611
  declare function environment(input: EnvironmentInput): Environment;
2637
2612
  //#endregion
@@ -2658,8 +2633,8 @@ type Target = {
2658
2633
  apply: Environment;
2659
2634
  };
2660
2635
  /**
2661
- * One environment of one project, where to reach it and the token to do so,
2662
- * and the environment definition to apply there. The where.
2636
+ * Where to apply an environment: one environment of one project, the
2637
+ * endpoint to reach it at and the token to use.
2663
2638
  */
2664
2639
  declare function target(input: TargetInput): Target;
2665
2640
  declare namespace index_d_exports {
@@ -2697,4 +2672,5 @@ declare global {
2697
2672
  var process: NodeJS.Process;
2698
2673
  }
2699
2674
  //#endregion
2700
- export { index_d_exports as define, index_d_exports$1 as system };
2675
+ export { index_d_exports as define, index_d_exports$1 as system };
2676
+ //# sourceMappingURL=define.d.ts.map