@hygraph/cli 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +7121 -5547
- package/dist/define.d.ts +258 -15
- package/dist/define2.js +235 -27
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/define.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ type RemoteFieldApiMethod = "GET" | "POST";
|
|
|
6
6
|
type RemoteSourceKind = "CommerceLayer" | "CommerceTools" | "Custom";
|
|
7
7
|
/** Field types */
|
|
8
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";
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region src/ir/types.d.ts
|
|
11
12
|
/** A colour of Hygraph's palette. */
|
|
@@ -19,6 +20,8 @@ type IRSystemStage = {
|
|
|
19
20
|
isSystem: true;
|
|
20
21
|
position: number;
|
|
21
22
|
};
|
|
23
|
+
/** Hygraph's panels that take no settings. */
|
|
24
|
+
type IRSystemSidebarElementType = Exclude<SystemSidebarElementType$1, "PREVIEW_URLS">;
|
|
22
25
|
/**
|
|
23
26
|
* Hygraph's names for the field types it has: a simple field's `type`, a
|
|
24
27
|
* relation's, or the batch operation's for the others.
|
|
@@ -43,6 +46,8 @@ type IRConnectionsRule = {
|
|
|
43
46
|
};
|
|
44
47
|
/** Who sees a field: editors and the API, or fewer of them. */
|
|
45
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>;
|
|
46
51
|
/** While the boolean base field is, or is not, `booleanValue`. */
|
|
47
52
|
type IRBooleanVisibilityCondition = {
|
|
48
53
|
baseField: string;
|
|
@@ -89,6 +94,89 @@ type IRRichTextValue = {
|
|
|
89
94
|
/** The flags Studio offers on a pattern: case insensitive, multiline, single line. */
|
|
90
95
|
type IRRegexFlag = "i" | "m" | "s";
|
|
91
96
|
//#endregion
|
|
97
|
+
//#region src/define/resources/sidebar.d.ts
|
|
98
|
+
/**
|
|
99
|
+
* A panel Hygraph provides:
|
|
100
|
+
* - `INFORMATION`: the entry's id, dates and authors.
|
|
101
|
+
* - `STAGES`: publish and unpublish.
|
|
102
|
+
* - `LOCALIZATIONS`: switch between locales.
|
|
103
|
+
* - `VERSIONS`: earlier versions of the entry.
|
|
104
|
+
* - `RELEASES`: schedule the entry.
|
|
105
|
+
* - `CONTENT_WORKFLOWS`: the entry's workflow steps. Hygraph adds and
|
|
106
|
+
* removes it when you link a workflow to the model in Studio.
|
|
107
|
+
* - `VARIANTS`: the entry's variants. Hygraph adds it when a field of the
|
|
108
|
+
* model gets `variantEnabled: true`.
|
|
109
|
+
* - `AGENTS`: run AI agents on the entry.
|
|
110
|
+
* - `TAGS`: tag the entry. Only in projects with Tags turned on.
|
|
111
|
+
*/
|
|
112
|
+
type SystemSidebarElementType = IRSystemSidebarElementType;
|
|
113
|
+
/** One link of a preview panel. */
|
|
114
|
+
type PreviewUrl = {
|
|
115
|
+
/** The label of the link. */
|
|
116
|
+
name: string;
|
|
117
|
+
/**
|
|
118
|
+
* The URL to open. Put a field's apiId or `locale` in braces to insert
|
|
119
|
+
* the entry's value, such as `"https://example.com/{locale}/{slug}"`.
|
|
120
|
+
*/
|
|
121
|
+
template: string;
|
|
122
|
+
};
|
|
123
|
+
/** The settings of a panel of an installed app. */
|
|
124
|
+
type SidebarAppConfig = {
|
|
125
|
+
[key: string]: IRJsonValue;
|
|
126
|
+
};
|
|
127
|
+
/** One panel beside an entry in Studio, as you write it in `sidebar`. */
|
|
128
|
+
type SidebarElementInput = {
|
|
129
|
+
element: SystemSidebarElementType;
|
|
130
|
+
} | {
|
|
131
|
+
/** Links that open the entry on your site, such as a preview deployment. */
|
|
132
|
+
element: "PREVIEW_URLS";
|
|
133
|
+
/** At least one link. */
|
|
134
|
+
previewUrls: PreviewUrl[];
|
|
135
|
+
/**
|
|
136
|
+
* Links for a variant of the entry. A template can also insert
|
|
137
|
+
* `{variant.id}` and `{variant.segments[0].id}`.
|
|
138
|
+
* @default []
|
|
139
|
+
*/
|
|
140
|
+
variantPreviewUrls?: PreviewUrl[];
|
|
141
|
+
/**
|
|
142
|
+
* Open the links in a new browser tab.
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
openInNewTab?: boolean;
|
|
146
|
+
} | {
|
|
147
|
+
/** A panel of an app installed in the environment. Install the app in Studio first. */
|
|
148
|
+
element: "app";
|
|
149
|
+
/** The app's apiId. */
|
|
150
|
+
appApiId: string;
|
|
151
|
+
/** The apiId of the app's sidebar element. */
|
|
152
|
+
appElementApiId: string;
|
|
153
|
+
/** The panel's title. */
|
|
154
|
+
displayName: string;
|
|
155
|
+
/** @default null */
|
|
156
|
+
description?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Settings the app reads. Which ones it takes is up to the app.
|
|
159
|
+
* @default {}
|
|
160
|
+
*/
|
|
161
|
+
config?: SidebarAppConfig;
|
|
162
|
+
};
|
|
163
|
+
/** One panel of `Model.sidebar`: the input with every default filled in. */
|
|
164
|
+
type SidebarElement = {
|
|
165
|
+
element: SystemSidebarElementType;
|
|
166
|
+
} | {
|
|
167
|
+
element: "PREVIEW_URLS";
|
|
168
|
+
previewUrls: PreviewUrl[];
|
|
169
|
+
variantPreviewUrls: PreviewUrl[];
|
|
170
|
+
openInNewTab: boolean;
|
|
171
|
+
} | {
|
|
172
|
+
element: "app";
|
|
173
|
+
appApiId: string;
|
|
174
|
+
appElementApiId: string;
|
|
175
|
+
displayName: string;
|
|
176
|
+
description: string | null;
|
|
177
|
+
config: SidebarAppConfig;
|
|
178
|
+
};
|
|
179
|
+
//#endregion
|
|
92
180
|
//#region src/define/resources/model.d.ts
|
|
93
181
|
/** A field a model takes: every type but a field back, which is on Asset. */
|
|
94
182
|
type ModelField = Exclude<Field, AssetReverseField>;
|
|
@@ -102,10 +190,31 @@ type ModelInput = {
|
|
|
102
190
|
* order editors see them in. May be empty.
|
|
103
191
|
*/
|
|
104
192
|
fields: ModelField[];
|
|
193
|
+
/**
|
|
194
|
+
* The panels beside an entry in Studio, in the order editors see them.
|
|
195
|
+
* Leave it out to keep whatever panels the model has: Hygraph's default
|
|
196
|
+
* set on a new model. Once you set it, it is the whole sidebar: a panel
|
|
197
|
+
* you leave out is removed.
|
|
198
|
+
*
|
|
199
|
+
* To start from the panels the model has now, set `sidebar: []` and run
|
|
200
|
+
* `hygraph pull`: it prints them, ready to copy in. Do not plan or apply
|
|
201
|
+
* the empty list, which removes every panel.
|
|
202
|
+
*
|
|
203
|
+
* Leave it out on a model with a panel of a legacy UI extension: the CLI
|
|
204
|
+
* cannot place panels around that one, so plan refuses the sidebar.
|
|
205
|
+
* @example
|
|
206
|
+
* sidebar: [
|
|
207
|
+
* { element: "INFORMATION" },
|
|
208
|
+
* { element: "STAGES" },
|
|
209
|
+
* { element: "PREVIEW_URLS", previewUrls: [{ name: "Web", template: "https://example.com/{slug}" }] },
|
|
210
|
+
* ]
|
|
211
|
+
*/
|
|
212
|
+
sidebar?: SidebarElementInput[];
|
|
105
213
|
/**
|
|
106
214
|
* The apiId this model has in Hygraph right now, when you are renaming it.
|
|
107
215
|
* The rename keeps the model's content instead of deleting the model and
|
|
108
|
-
* creating a new one. Safe to leave in place once applied.
|
|
216
|
+
* creating a new one. Safe to leave in place once applied. An environment
|
|
217
|
+
* that has neither apiId gets a new model under the new apiId.
|
|
109
218
|
*/
|
|
110
219
|
renamedFrom?: string;
|
|
111
220
|
};
|
|
@@ -121,6 +230,8 @@ type Model = {
|
|
|
121
230
|
displayName: string;
|
|
122
231
|
description: string | null;
|
|
123
232
|
fields: Field[];
|
|
233
|
+
/** `null` when the config leaves the sidebar as it is. */
|
|
234
|
+
sidebar: SidebarElement[] | null;
|
|
124
235
|
renamedFrom: string | null;
|
|
125
236
|
};
|
|
126
237
|
/**
|
|
@@ -132,6 +243,47 @@ type Model = {
|
|
|
132
243
|
*/
|
|
133
244
|
declare function model$1(input: ModelInput): Model;
|
|
134
245
|
//#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
|
|
135
287
|
//#region src/define/fields/referenceOneWay.d.ts
|
|
136
288
|
/**
|
|
137
289
|
* The options `referenceOneWay` takes. A reference cannot be required. To
|
|
@@ -205,6 +357,11 @@ type ReferenceOneWayField = {
|
|
|
205
357
|
visibility: FieldVisibility;
|
|
206
358
|
visibilityCondition: FieldVisibilityCondition | null;
|
|
207
359
|
variantEnabled: boolean;
|
|
360
|
+
/**
|
|
361
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
362
|
+
* which `define.field.custom` sets.
|
|
363
|
+
*/
|
|
364
|
+
renderer: FieldRenderer | null;
|
|
208
365
|
renamedFrom: string | null;
|
|
209
366
|
};
|
|
210
367
|
/**
|
|
@@ -274,6 +431,11 @@ type ReferenceTwoWayField = {
|
|
|
274
431
|
visibility: FieldVisibility;
|
|
275
432
|
visibilityCondition: FieldVisibilityCondition | null;
|
|
276
433
|
variantEnabled: boolean;
|
|
434
|
+
/**
|
|
435
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
436
|
+
* which `define.field.custom` sets.
|
|
437
|
+
*/
|
|
438
|
+
renderer: FieldRenderer | null;
|
|
277
439
|
renamedFrom: string | null;
|
|
278
440
|
};
|
|
279
441
|
/**
|
|
@@ -373,7 +535,8 @@ type ComponentInput = {
|
|
|
373
535
|
* The apiId this component has in Hygraph right now, when you are
|
|
374
536
|
* renaming it. The rename keeps the component's fields and content
|
|
375
537
|
* instead of deleting the component and creating a new one. Safe to leave
|
|
376
|
-
* in place once applied.
|
|
538
|
+
* in place once applied. An environment that has neither apiId gets a new
|
|
539
|
+
* component under the new apiId.
|
|
377
540
|
*/
|
|
378
541
|
renamedFrom?: string;
|
|
379
542
|
};
|
|
@@ -572,6 +735,11 @@ type BooleanField = {
|
|
|
572
735
|
initialValue: boolean | boolean[] | null;
|
|
573
736
|
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
574
737
|
migrationValue: boolean | boolean[] | null;
|
|
738
|
+
/**
|
|
739
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
740
|
+
* which `define.field.custom` sets.
|
|
741
|
+
*/
|
|
742
|
+
renderer: FieldRenderer | null;
|
|
575
743
|
renamedFrom: string | null;
|
|
576
744
|
};
|
|
577
745
|
/**
|
|
@@ -616,6 +784,11 @@ type ColorField = {
|
|
|
616
784
|
initialValue: ColorValue | ColorValue[] | null;
|
|
617
785
|
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
618
786
|
migrationValue: ColorValue | ColorValue[] | null;
|
|
787
|
+
/**
|
|
788
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
789
|
+
* which `define.field.custom` sets.
|
|
790
|
+
*/
|
|
791
|
+
renderer: FieldRenderer | null;
|
|
619
792
|
renamedFrom: string | null;
|
|
620
793
|
};
|
|
621
794
|
/**
|
|
@@ -701,6 +874,11 @@ type DateFieldAttributes = {
|
|
|
701
874
|
initialValue: string | string[] | null;
|
|
702
875
|
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
703
876
|
migrationValue: string | string[] | null;
|
|
877
|
+
/**
|
|
878
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
879
|
+
* which `define.field.custom` sets.
|
|
880
|
+
*/
|
|
881
|
+
renderer: FieldRenderer | null;
|
|
704
882
|
renamedFrom: string | null;
|
|
705
883
|
};
|
|
706
884
|
/** What `define.field.date` hands back. */
|
|
@@ -731,7 +909,8 @@ type EnumerationValueInput<V extends string = string> = {
|
|
|
731
909
|
/**
|
|
732
910
|
* The apiId this value has in Hygraph right now, when you are renaming
|
|
733
911
|
* it. The rename keeps the entries that hold the value. Safe to leave in
|
|
734
|
-
* place once applied.
|
|
912
|
+
* place once applied. An enumeration that has no value under either apiId
|
|
913
|
+
* gets a new value under the new apiId.
|
|
735
914
|
*/
|
|
736
915
|
renamedFrom?: string;
|
|
737
916
|
};
|
|
@@ -756,7 +935,8 @@ type EnumerationInput<V extends string = string> = {
|
|
|
756
935
|
/**
|
|
757
936
|
* The apiId this enumeration has in Hygraph right now, when you are
|
|
758
937
|
* renaming it. The rename keeps the enumeration's values and the fields
|
|
759
|
-
* that use it. Safe to leave in place once applied.
|
|
938
|
+
* that use it. Safe to leave in place once applied. An environment that
|
|
939
|
+
* has neither apiId gets a new enumeration under the new apiId.
|
|
760
940
|
*/
|
|
761
941
|
renamedFrom?: string;
|
|
762
942
|
};
|
|
@@ -867,6 +1047,11 @@ type JsonField = {
|
|
|
867
1047
|
initialValue: JsonValue | JsonValue[] | null;
|
|
868
1048
|
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
869
1049
|
migrationValue: JsonValue | JsonValue[] | null;
|
|
1050
|
+
/**
|
|
1051
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
1052
|
+
* which `define.field.custom` sets.
|
|
1053
|
+
*/
|
|
1054
|
+
renderer: FieldRenderer | null;
|
|
870
1055
|
renamedFrom: string | null;
|
|
871
1056
|
};
|
|
872
1057
|
/**
|
|
@@ -909,6 +1094,11 @@ type LocationField = {
|
|
|
909
1094
|
initialValue: LocationValue | LocationValue[] | null;
|
|
910
1095
|
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
911
1096
|
migrationValue: LocationValue | LocationValue[] | null;
|
|
1097
|
+
/**
|
|
1098
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
1099
|
+
* which `define.field.custom` sets.
|
|
1100
|
+
*/
|
|
1101
|
+
renderer: FieldRenderer | null;
|
|
912
1102
|
renamedFrom: string | null;
|
|
913
1103
|
};
|
|
914
1104
|
/**
|
|
@@ -961,6 +1151,11 @@ type NumberFieldAttributes = {
|
|
|
961
1151
|
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
962
1152
|
migrationValue: number | number[] | null;
|
|
963
1153
|
validations: NumberValidationRules | null;
|
|
1154
|
+
/**
|
|
1155
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
1156
|
+
* which `define.field.custom` sets.
|
|
1157
|
+
*/
|
|
1158
|
+
renderer: FieldRenderer | null;
|
|
964
1159
|
renamedFrom: string | null;
|
|
965
1160
|
};
|
|
966
1161
|
/** What `define.field.int` hands back. */
|
|
@@ -1407,6 +1602,11 @@ type RichTextField = {
|
|
|
1407
1602
|
migrationValue: RichTextValue | RichTextValue[] | null;
|
|
1408
1603
|
embeds: (() => Model)[] | null;
|
|
1409
1604
|
actions: RichTextAction[] | null;
|
|
1605
|
+
/**
|
|
1606
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
1607
|
+
* which `define.field.custom` sets.
|
|
1608
|
+
*/
|
|
1609
|
+
renderer: FieldRenderer | null;
|
|
1410
1610
|
renamedFrom: string | null;
|
|
1411
1611
|
};
|
|
1412
1612
|
/**
|
|
@@ -1470,13 +1670,17 @@ type SlugField = StringFieldAttributes & {
|
|
|
1470
1670
|
autoGenerate: boolean;
|
|
1471
1671
|
template: string | null;
|
|
1472
1672
|
};
|
|
1673
|
+
/** What `define.field.custom.string` hands back: text an app's element edits. */
|
|
1674
|
+
type StringField = StringFieldAttributes & {
|
|
1675
|
+
__typename: "StringField";
|
|
1676
|
+
renderer: FieldRenderer;
|
|
1677
|
+
};
|
|
1473
1678
|
/**
|
|
1474
|
-
* A text field of any editor. Every text editor is
|
|
1475
|
-
* type, so switching editor is an update, not a new
|
|
1679
|
+
* A text field of any editor, Hygraph's or an app's. Every text editor is
|
|
1680
|
+
* Hygraph's `STRING` type, so switching editor is an update, not a new
|
|
1681
|
+
* field.
|
|
1476
1682
|
*/
|
|
1477
|
-
type
|
|
1478
|
-
/** Text rendered by an installed app's element. `renderer` is required. */
|
|
1479
|
-
declare function string(_options: unknown): never;
|
|
1683
|
+
type TextField = SingleLineField | MultilineField | MarkdownField | SlugField | StringField;
|
|
1480
1684
|
/** `i` case insensitive, `m` multiline, `s` single line, as Studio offers them. */
|
|
1481
1685
|
type RegexFlag = IRRegexFlag;
|
|
1482
1686
|
type RegexRuleInput = {
|
|
@@ -1530,7 +1734,8 @@ type TaxonomyNodeInput = {
|
|
|
1530
1734
|
/**
|
|
1531
1735
|
* The apiId this node has in Hygraph right now, when you are renaming
|
|
1532
1736
|
* it. The rename keeps the entries that hold the node. Safe to leave in
|
|
1533
|
-
* place once applied.
|
|
1737
|
+
* place once applied. A taxonomy that has no node under either apiId gets
|
|
1738
|
+
* a new node under the new apiId.
|
|
1534
1739
|
*/
|
|
1535
1740
|
renamedFrom?: string;
|
|
1536
1741
|
};
|
|
@@ -1555,7 +1760,8 @@ type TaxonomyInput = {
|
|
|
1555
1760
|
/**
|
|
1556
1761
|
* The apiId this taxonomy has in Hygraph right now, when you are
|
|
1557
1762
|
* renaming it. The rename keeps its nodes and the fields that use it.
|
|
1558
|
-
* Safe to leave in place once applied.
|
|
1763
|
+
* Safe to leave in place once applied. An environment that has neither
|
|
1764
|
+
* apiId gets a new taxonomy under the new apiId.
|
|
1559
1765
|
*/
|
|
1560
1766
|
renamedFrom?: string;
|
|
1561
1767
|
};
|
|
@@ -1653,7 +1859,7 @@ declare function unsupported(input: UnsupportedFieldInput): UnsupportedField;
|
|
|
1653
1859
|
//#endregion
|
|
1654
1860
|
//#region src/define/fields/field.d.ts
|
|
1655
1861
|
/** One field of any type, as a `define.field.*` builder returns it. */
|
|
1656
|
-
type Field = BooleanField |
|
|
1862
|
+
type Field = BooleanField | TextField | DateField | DateTimeField | IntField | FloatField | EnumerationField | TaxonomyField | JsonField | RichTextField | ColorField | LocationField | ComponentField | ComponentUnionField | ReferenceOneWayField | ReferenceTwoWayField | ReferenceUnionField | ReferenceUnionMemberField | AssetField | AssetReverseField | RemoteField | UnsupportedField;
|
|
1657
1863
|
/**
|
|
1658
1864
|
* Who sees the field. `READ_WRITE` shows it to editors and the API,
|
|
1659
1865
|
* `READ_ONLY` shows it without letting editors change it, `HIDDEN` hides
|
|
@@ -1711,7 +1917,9 @@ type FieldInput = {
|
|
|
1711
1917
|
/**
|
|
1712
1918
|
* The apiId this field has in Hygraph right now, when you are renaming it.
|
|
1713
1919
|
* The rename keeps the field's content instead of deleting the field and
|
|
1714
|
-
* creating a new one. Safe to leave in place once applied.
|
|
1920
|
+
* creating a new one. Safe to leave in place once applied. A model or
|
|
1921
|
+
* component that has no field under either apiId gets a new field under
|
|
1922
|
+
* the new apiId.
|
|
1715
1923
|
*/
|
|
1716
1924
|
renamedFrom?: string;
|
|
1717
1925
|
};
|
|
@@ -1810,6 +2018,11 @@ type AssetField = {
|
|
|
1810
2018
|
visibilityCondition: FieldVisibilityCondition | null;
|
|
1811
2019
|
variantEnabled: boolean;
|
|
1812
2020
|
reverse: string | null;
|
|
2021
|
+
/**
|
|
2022
|
+
* The field's editor: `null` for Hygraph's own, or an app's element,
|
|
2023
|
+
* which `define.field.custom` sets.
|
|
2024
|
+
*/
|
|
2025
|
+
renderer: FieldRenderer | null;
|
|
1813
2026
|
renamedFrom: string | null;
|
|
1814
2027
|
};
|
|
1815
2028
|
/**
|
|
@@ -1824,6 +2037,35 @@ type AssetField = {
|
|
|
1824
2037
|
*/
|
|
1825
2038
|
declare function asset(input: AssetFieldInput): AssetField;
|
|
1826
2039
|
//#endregion
|
|
2040
|
+
//#region src/define/fields/custom.d.ts
|
|
2041
|
+
/**
|
|
2042
|
+
* Fields whose editor in Studio is an installed app's element, in place of
|
|
2043
|
+
* Hygraph's own. Each builder takes what its type's builder takes, and the
|
|
2044
|
+
* element as `renderer`. Install the app in the environment in Studio;
|
|
2045
|
+
* the element must be made for the field's type.
|
|
2046
|
+
*
|
|
2047
|
+
* @example define.field.custom.int({ apiId: "rating", displayName: "Rating", renderer: { app: { appApiId: "stars", appElementApiId: "stars", config: { max: 5 } } } })
|
|
2048
|
+
*/
|
|
2049
|
+
declare const custom: {
|
|
2050
|
+
/** Text. Takes what `singleLine` takes. */
|
|
2051
|
+
string: (input: StringFieldInput & CustomFieldInput) => StringField;
|
|
2052
|
+
int: (input: NumberFieldInput & CustomFieldInput) => IntField;
|
|
2053
|
+
float: (input: NumberFieldInput & CustomFieldInput) => FloatField;
|
|
2054
|
+
boolean: (input: BooleanFieldInput & CustomFieldInput) => BooleanField;
|
|
2055
|
+
date: (input: DateFieldInput & CustomFieldInput) => DateField;
|
|
2056
|
+
dateTime: (input: DateFieldInput & CustomFieldInput) => DateTimeField;
|
|
2057
|
+
json: (input: JsonFieldInput & CustomFieldInput) => JsonField;
|
|
2058
|
+
color: (input: ColorFieldInput & CustomFieldInput) => ColorField;
|
|
2059
|
+
location: (input: LocationFieldInput & CustomFieldInput) => LocationField;
|
|
2060
|
+
/** Rich text without `actions`: the element replaces the toolbar. */
|
|
2061
|
+
richText: (input: RichTextFieldInput & CustomFieldInput & {
|
|
2062
|
+
actions?: never;
|
|
2063
|
+
}) => RichTextField;
|
|
2064
|
+
referenceOneWay: (input: ReferenceOneWayFieldInput & CustomFieldInput) => ReferenceOneWayField;
|
|
2065
|
+
referenceTwoWay: (input: ReferenceTwoWayFieldInput & CustomFieldInput) => ReferenceTwoWayField;
|
|
2066
|
+
asset: (input: AssetFieldInput & CustomFieldInput) => AssetField;
|
|
2067
|
+
};
|
|
2068
|
+
//#endregion
|
|
1827
2069
|
//#region src/define/fields/dateTime.d.ts
|
|
1828
2070
|
/**
|
|
1829
2071
|
* A moment, such as when an event starts. Values are ISO 8601 with seconds
|
|
@@ -1913,7 +2155,7 @@ declare function slug(input: SlugFieldInput): SlugField;
|
|
|
1913
2155
|
/** An embedding. `dimension` is required (1 to 3072); `index` is refused above 2000. */
|
|
1914
2156
|
declare function vector(_options: unknown): never;
|
|
1915
2157
|
declare namespace index_d_exports$2 {
|
|
1916
|
-
export { asset, assetReverseField, boolean, color, component, componentUnion, date, dateTime, enumeration, float, int, json, location, markdown, multiline, referenceOneWay, referenceTwoWay, referenceUnion, referenceUnionMember, remote, richText, singleLine, slug,
|
|
2158
|
+
export { asset, assetReverseField, boolean, color, component, componentUnion, custom, date, dateTime, enumeration, float, int, json, location, markdown, multiline, referenceOneWay, referenceTwoWay, referenceUnion, referenceUnionMember, remote, richText, singleLine, slug, taxonomy, unsupported, vector };
|
|
1917
2159
|
}
|
|
1918
2160
|
//#endregion
|
|
1919
2161
|
//#region src/define/system/query.d.ts
|
|
@@ -2292,7 +2534,8 @@ type LocaleInput<DisplayName extends string = string, ApiId extends string = str
|
|
|
2292
2534
|
/**
|
|
2293
2535
|
* The apiId this locale has in Hygraph right now, when you are renaming
|
|
2294
2536
|
* it. The rename keeps the content in that locale. Safe to leave in place
|
|
2295
|
-
* once applied.
|
|
2537
|
+
* once applied. An environment that has neither apiId gets a new locale
|
|
2538
|
+
* under the new apiId.
|
|
2296
2539
|
*/
|
|
2297
2540
|
renamedFrom?: string;
|
|
2298
2541
|
};
|