@hygraph/cli 0.0.17 → 0.0.19

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
  /**
@@ -1438,14 +1332,7 @@ type RemoteFieldArgInput = {
1438
1332
  list?: boolean;
1439
1333
  };
1440
1334
  /** The options every remote field takes, whatever its source. */
1441
- type RemoteFieldBaseInput = Omit<FieldInput, "visibility" | "visibilityCondition" | "variantEnabled" | "renamedFrom"> & {
1442
- /**
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.
1447
- */
1448
- renamedFrom?: never;
1335
+ type RemoteFieldBaseInput = Omit<FieldInput, "visibility" | "visibilityCondition" | "variantEnabled"> & {
1449
1336
  /**
1450
1337
  * The name of the type the field returns, without the prefix: one of the
1451
1338
  * source's types, or a scalar.
@@ -1551,22 +1438,25 @@ declare function remote(input: RemoteFieldInput): RemoteField;
1551
1438
  * Rich text as Hygraph stores it: the root of a Slate document, such as
1552
1439
  * `{ children: [{ type: "paragraph", children: [{ text: "Hello" }] }] }`.
1553
1440
  */
1554
- type RichTextValue = IRRichTextValue;
1441
+ type RichTextValue = {
1442
+ children: JsonValue[];
1443
+ };
1555
1444
  /** A toolbar action of Studio's rich text editor. */
1556
- type RichTextAction = IRRichTextAction;
1445
+ 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
1446
  /** The options `richText` takes. Hygraph refuses rich text as the title. */
1558
1447
  type RichTextFieldInput = FieldInput & ValueFieldInput<RichTextValue> & UniqueFieldInput & LocalizedFieldInput & {
1559
1448
  title?: never;
1560
1449
  /**
1561
1450
  * The models whose entries editors can embed, as `define.model` returns
1562
- * them, behind a function: `[() => Author]`. Leave it out to turn
1563
- * embeds off. List each model in the environment's `models` too. Once
1564
- * the field has embeds they cannot be turned off: leaving it out then
1565
- * deletes the field and its content. Taking a model out deletes the
1566
- * embeds of its entries.
1451
+ * them, behind a function: `[() => Author]`. Assets too, with
1452
+ * `system.model.asset`: `[() => Author, () => Asset]`. Leave it out to
1453
+ * turn embeds off. List each model, Asset included, in the
1454
+ * environment's `models` too. Once the field has embeds they cannot be
1455
+ * turned off: leaving it out then deletes the field and its content.
1456
+ * Taking a model out deletes the embeds of its entries.
1567
1457
  * @default null
1568
1458
  */
1569
- embeds?: (() => Model)[];
1459
+ embeds?: (() => Model | SystemAsset)[];
1570
1460
  /**
1571
1461
  * The toolbar actions Studio shows. Leave it out to show every action;
1572
1462
  * `[]` shows none. Embeds have a button of their own, shown while the
@@ -1592,9 +1482,12 @@ type RichTextField = {
1592
1482
  variantEnabled: boolean;
1593
1483
  /** A list of values on a list field, one value otherwise. */
1594
1484
  initialValue: RichTextValue | RichTextValue[] | null;
1595
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1485
+ /**
1486
+ * The value existing entries get when the field becomes required, or is
1487
+ * created required. A list of values on a list field.
1488
+ */
1596
1489
  migrationValue: RichTextValue | RichTextValue[] | null;
1597
- embeds: (() => Model)[] | null;
1490
+ embeds: (() => Model | SystemAsset)[] | null;
1598
1491
  actions: RichTextAction[] | null;
1599
1492
  /**
1600
1493
  * The field's editor: `null` for Hygraph's own, or an app's element,
@@ -1605,7 +1498,7 @@ type RichTextField = {
1605
1498
  };
1606
1499
  /**
1607
1500
  * Formatted text, such as an article's body, with embedded entries of
1608
- * other models when `embeds` lists them. Allowed on components.
1501
+ * other models and assets when `embeds` lists them. Allowed on components.
1609
1502
  *
1610
1503
  * Nothing here is validated, and the models are not looked at until the
1611
1504
  * plan: the checks run at plan time with the model's or component's own.
@@ -1640,7 +1533,10 @@ type StringFieldAttributes = {
1640
1533
  variantEnabled: boolean;
1641
1534
  /** A list of values on a list field, one value otherwise. */
1642
1535
  initialValue: string | string[] | null;
1643
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1536
+ /**
1537
+ * The value existing entries get when the field becomes required, or is
1538
+ * created required. A list of values on a list field.
1539
+ */
1644
1540
  migrationValue: string | string[] | null;
1645
1541
  validations: StringValidationRules | null;
1646
1542
  renamedFrom: string | null;
@@ -1676,7 +1572,7 @@ type StringField = StringFieldAttributes & {
1676
1572
  */
1677
1573
  type TextField = SingleLineField | MultilineField | MarkdownField | SlugField | StringField;
1678
1574
  /** `i` case insensitive, `m` multiline, `s` single line, as Studio offers them. */
1679
- type RegexFlag = IRRegexFlag;
1575
+ type RegexFlag = "i" | "m" | "s";
1680
1576
  type RegexRuleInput = {
1681
1577
  /** A regular expression, such as `"^[a-z0-9-]+$"`. */
1682
1578
  regex: string;
@@ -1817,7 +1713,10 @@ type TaxonomyField = {
1817
1713
  variantEnabled: boolean;
1818
1714
  /** A list of node apiIds on a list field, one otherwise. */
1819
1715
  initialValue: string | string[] | null;
1820
- /** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
1716
+ /**
1717
+ * The node apiId existing entries get when the field becomes required, or
1718
+ * is created required. A list of node apiIds on a list field.
1719
+ */
1821
1720
  migrationValue: string | string[] | null;
1822
1721
  renamedFrom: string | null;
1823
1722
  };
@@ -1832,17 +1731,25 @@ type TaxonomyField = {
1832
1731
  declare function taxonomy(input: TaxonomyFieldInput): TaxonomyField;
1833
1732
  //#endregion
1834
1733
  //#region src/define/fields/unsupported.d.ts
1734
+ /** The field types Hygraph has. */
1735
+ type KnownFieldType = SimpleFieldType | RelationalFieldType | "ENUMERATION" | "UNION" | "COMPONENT" | "COMPONENT_UNION" | "REMOTE" | "TAXONOMY";
1736
+ /**
1737
+ * Hygraph's name for a field's type. Your editor suggests the known ones.
1738
+ * Any other name is accepted too, so a type Hygraph adds later works
1739
+ * without a new CLI version.
1740
+ */
1741
+ type FieldType = KnownFieldType | (string & {});
1835
1742
  type UnsupportedFieldInput = {
1836
1743
  /** The field's apiId in Hygraph. */
1837
1744
  apiId: string;
1838
1745
  /** Hygraph's name for the field's type, such as `VECTOR` or `RELATION`. */
1839
- type: IRFieldType;
1746
+ type: FieldType;
1840
1747
  };
1841
1748
  /** What `define.field.unsupported` hands back. */
1842
1749
  type UnsupportedField = {
1843
1750
  __typename: "UnsupportedField";
1844
1751
  apiId: string;
1845
- type: IRFieldType;
1752
+ type: FieldType;
1846
1753
  };
1847
1754
  /**
1848
1755
  * A field the CLI cannot read yet, written by export in the field's slot.
@@ -1859,7 +1766,7 @@ type Field = BooleanField | TextField | DateField | DateTimeField | IntField | F
1859
1766
  * `READ_ONLY` shows it without letting editors change it, `HIDDEN` hides
1860
1767
  * it from editors, `API_ONLY` leaves it out of Studio entirely.
1861
1768
  */
1862
- type FieldVisibility = IRFieldVisibility;
1769
+ type FieldVisibility = "READ_WRITE" | "READ_ONLY" | "HIDDEN" | "API_ONLY";
1863
1770
  /**
1864
1771
  * Show the field in Studio only while another field on the same model or
1865
1772
  * component has a given value. On a boolean field: while it is (`IS`) or is not
@@ -1871,11 +1778,17 @@ type FieldVisibility = IRFieldVisibility;
1871
1778
  * @example { baseField: "hasDiscount", operator: "IS", booleanValue: true }
1872
1779
  * @example { baseField: "mediaType", operator: "IS", enumerationValues: ["VIDEO"] }
1873
1780
  */
1874
- type FieldVisibilityCondition = (IRBooleanVisibilityCondition & {
1781
+ type FieldVisibilityCondition = {
1782
+ baseField: string;
1783
+ operator: "IS" | "IS_NOT";
1784
+ booleanValue: boolean;
1875
1785
  enumerationValues?: never;
1876
- }) | (IREnumerationVisibilityCondition & {
1786
+ } | {
1787
+ baseField: string;
1788
+ operator: "IS" | "IS_NOT" | "CONTAINS_ANY" | "CONTAINS_ALL" | "CONTAINS_NONE";
1789
+ enumerationValues: string[];
1877
1790
  booleanValue?: never;
1878
- });
1791
+ };
1879
1792
  /** The options every field type takes. */
1880
1793
  type FieldInput = {
1881
1794
  /**
@@ -1970,6 +1883,62 @@ type LocalizedFieldInput = {
1970
1883
  localized?: boolean;
1971
1884
  };
1972
1885
  //#endregion
1886
+ //#region src/define/fields/color.d.ts
1887
+ /**
1888
+ * A colour: `r`, `g` and `b` whole numbers from 0 to 255, `a` from 0 to 1.
1889
+ *
1890
+ * @example { rgba: { r: 255, g: 99, b: 71, a: 1 } }
1891
+ */
1892
+ type ColorValue = {
1893
+ rgba: {
1894
+ r: number;
1895
+ g: number;
1896
+ b: number;
1897
+ a: number;
1898
+ };
1899
+ };
1900
+ /**
1901
+ * The options `color` takes. Studio has no title on a color field, so it
1902
+ * takes no `title`.
1903
+ */
1904
+ type ColorFieldInput = FieldInput & ValueFieldInput<ColorValue> & UniqueFieldInput & LocalizedFieldInput & {
1905
+ title?: never;
1906
+ };
1907
+ /** What `define.field.color` hands back: the input with every default filled in. */
1908
+ type ColorField = {
1909
+ __typename: "ColorField";
1910
+ apiId: string;
1911
+ displayName: string;
1912
+ description: string | null;
1913
+ list: boolean;
1914
+ required: boolean;
1915
+ unique: boolean;
1916
+ localized: boolean;
1917
+ /** Always `false`: Studio has no title on a color field. */
1918
+ title: false;
1919
+ visibility: FieldVisibility;
1920
+ visibilityCondition: FieldVisibilityCondition | null;
1921
+ variantEnabled: boolean;
1922
+ /** A list of values on a list field, one value otherwise. */
1923
+ initialValue: ColorValue | ColorValue[] | null;
1924
+ /**
1925
+ * The value existing entries get when the field becomes required, or is
1926
+ * created required. A list of values on a list field.
1927
+ */
1928
+ migrationValue: ColorValue | ColorValue[] | null;
1929
+ /**
1930
+ * The field's editor: `null` for Hygraph's own, or an app's element,
1931
+ * which `define.field.custom` sets.
1932
+ */
1933
+ renderer: FieldRenderer | null;
1934
+ renamedFrom: string | null;
1935
+ };
1936
+ /**
1937
+ * A colour, such as a brand colour. Nothing here is validated; the checks
1938
+ * run at plan time with the model's or component's own.
1939
+ */
1940
+ declare function color(input: ColorFieldInput): ColorField;
1941
+ //#endregion
1973
1942
  //#region src/define/fields/asset.d.ts
1974
1943
  /** The options `asset` takes. */
1975
1944
  type AssetFieldInput = Omit<FieldInput, "required"> & {
@@ -2231,7 +2200,7 @@ declare function segment(input?: SystemSegmentInput): SystemSegment;
2231
2200
  */
2232
2201
  type SystemStage = {
2233
2202
  __typename: "SystemStage";
2234
- apiId: IRSystemStage["apiId"];
2203
+ apiId: "DRAFT" | "PUBLISHED";
2235
2204
  };
2236
2205
  declare const stage$1: {
2237
2206
  /** Draft. Always the first of `stages`. */
@@ -2564,8 +2533,8 @@ type StageInput = {
2564
2533
  displayName: string;
2565
2534
  /** @default null */
2566
2535
  description?: string;
2567
- /** The colour the stage is shown in. */
2568
- color: IRStageColor;
2536
+ /** The colour the stage is shown in, from Hygraph's palette. */
2537
+ color: ColorPalette;
2569
2538
  };
2570
2539
  /** What `define.stage` hands back: the input with every default filled in. */
2571
2540
  type Stage = {
@@ -2573,7 +2542,7 @@ type Stage = {
2573
2542
  apiId: string;
2574
2543
  displayName: string;
2575
2544
  description: string | null;
2576
- color: IRStageColor;
2545
+ color: ColorPalette;
2577
2546
  };
2578
2547
  /**
2579
2548
  * A content stage entries can be published to. The environment's `stages`
@@ -2628,10 +2597,11 @@ type Environment = {
2628
2597
  /** A model Hygraph provides, as `system.*` hands it back. */
2629
2598
  type SystemModel = SystemAsset | SystemQuery | SystemSegment;
2630
2599
  /**
2631
- * One environment: typed arrays per resource kind. The what.
2600
+ * Everything one environment holds: its locales, stages, enumerations,
2601
+ * taxonomies, remote sources, components and models. Pass it to
2602
+ * `define.target` as `apply`.
2632
2603
  *
2633
- * Ordering, keying and positions are not decided here. This returns the
2634
- * resources as written; `convertToIR` turns them into the canonical form.
2604
+ * Only the order of `stages` matters. The other lists can be in any order.
2635
2605
  */
2636
2606
  declare function environment(input: EnvironmentInput): Environment;
2637
2607
  //#endregion
@@ -2658,8 +2628,8 @@ type Target = {
2658
2628
  apply: Environment;
2659
2629
  };
2660
2630
  /**
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.
2631
+ * Where to apply an environment: one environment of one project, the
2632
+ * endpoint to reach it at and the token to use.
2663
2633
  */
2664
2634
  declare function target(input: TargetInput): Target;
2665
2635
  declare namespace index_d_exports {
@@ -2697,4 +2667,5 @@ declare global {
2697
2667
  var process: NodeJS.Process;
2698
2668
  }
2699
2669
  //#endregion
2700
- export { index_d_exports as define, index_d_exports$1 as system };
2670
+ export { index_d_exports as define, index_d_exports$1 as system };
2671
+ //# sourceMappingURL=define.d.ts.map