@hygraph/cli 0.0.1 → 0.0.3
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 +17 -0
- package/bin/hygraph.js +8 -1
- package/dist/cli.d.ts +5 -3
- package/dist/cli.js +16389 -53
- package/dist/define.d.ts +1693 -79
- package/dist/define.js +1 -284
- package/dist/define2.js +1411 -0
- package/dist/rolldown-runtime.js +21 -1
- package/dist/version.js +1 -1
- package/package.json +22 -5
package/dist/define.d.ts
CHANGED
|
@@ -1,66 +1,1226 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
|
|
3
|
-
|
|
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 RelationalFieldType = "ASSET" | "RELATION";
|
|
4
|
+
/** Field types */
|
|
5
|
+
type SimpleFieldType = "BOOLEAN" | "COLOR" | "DATE" | "DATETIME" | "FLOAT" | "ID" | "INT" | "JSON" | "LOCATION" | "RICHTEXT" | "STRING" | "VECTOR";
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/ir/types.d.ts
|
|
8
|
+
/** A colour of Hygraph's palette. */
|
|
9
|
+
type IRStageColor = ColorPalette;
|
|
10
|
+
/**
|
|
11
|
+
* Draft or Published. Hygraph creates both with every environment, and
|
|
12
|
+
* nothing of them can change but where Published sits.
|
|
13
|
+
*/
|
|
14
|
+
type IRSystemStage = {
|
|
15
|
+
apiId: "DRAFT" | "PUBLISHED";
|
|
16
|
+
isSystem: true;
|
|
17
|
+
position: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Hygraph's names for the field types it has: a simple field's `type`, a
|
|
21
|
+
* relation's, or the batch operation's for the others.
|
|
22
|
+
*/
|
|
23
|
+
type IRKnownFieldType = SimpleFieldType | RelationalFieldType | "ENUMERATION" | "UNION" | "COMPONENT" | "COMPONENT_UNION" | "REMOTE" | "TAXONOMY";
|
|
24
|
+
/**
|
|
25
|
+
* Hygraph's name for a field's type. Editors suggest the known ones, and
|
|
26
|
+
* any other string is accepted, so a type Hygraph adds later needs no new
|
|
27
|
+
* CLI.
|
|
28
|
+
*/
|
|
29
|
+
type IRFieldType = IRKnownFieldType | (string & {});
|
|
30
|
+
/** What Studio asks of editors on a reference. The API does not check it. */
|
|
31
|
+
type IRReferenceRules = {
|
|
32
|
+
connections: IRConnectionsRule;
|
|
33
|
+
};
|
|
34
|
+
/** How many entries to connect, between `min` and `max`, either one open. */
|
|
35
|
+
type IRConnectionsRule = {
|
|
36
|
+
min: number | null;
|
|
37
|
+
max: number | null;
|
|
38
|
+
/** What editors see when the count does not pass, `null` for Studio's own. */
|
|
39
|
+
errorMessage: string | null;
|
|
40
|
+
};
|
|
41
|
+
/** Who sees a field: editors and the API, or fewer of them. */
|
|
42
|
+
type IRFieldVisibility = "READ_WRITE" | "READ_ONLY" | "HIDDEN" | "API_ONLY";
|
|
43
|
+
/** While the boolean base field is, or is not, `booleanValue`. */
|
|
44
|
+
type IRBooleanVisibilityCondition = {
|
|
45
|
+
baseField: string;
|
|
46
|
+
operator: "IS" | "IS_NOT";
|
|
47
|
+
booleanValue: boolean;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* While the enumeration base field is (`IS`), or is not (`IS_NOT`), the one
|
|
51
|
+
* value in `enumerationValues`, or holds any, all or none of them.
|
|
52
|
+
*/
|
|
53
|
+
type IREnumerationVisibilityCondition = {
|
|
54
|
+
baseField: string;
|
|
55
|
+
operator: "IS" | "IS_NOT" | "CONTAINS_ANY" | "CONTAINS_ALL" | "CONTAINS_NONE";
|
|
56
|
+
/** Value apiIds, sorted: their order has no meaning. */
|
|
57
|
+
enumerationValues: string[];
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* A colour as Studio writes it: red, green and blue from 0 to 255, alpha
|
|
61
|
+
* from 0 to 1.
|
|
62
|
+
*/
|
|
63
|
+
type IRColor = {
|
|
64
|
+
rgba: {
|
|
65
|
+
r: number;
|
|
66
|
+
g: number;
|
|
67
|
+
b: number;
|
|
68
|
+
a: number;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** A point on the globe, in degrees. */
|
|
72
|
+
type IRLocation = {
|
|
73
|
+
latitude: number;
|
|
74
|
+
longitude: number;
|
|
75
|
+
};
|
|
76
|
+
/** Any value JSON can hold. */
|
|
77
|
+
type IRJsonValue = string | number | boolean | null | IRJsonValue[] | {
|
|
78
|
+
[key: string]: IRJsonValue;
|
|
79
|
+
};
|
|
80
|
+
/** The flags Studio offers on a pattern: case insensitive, multiline, single line. */
|
|
81
|
+
type IRRegexFlag = "i" | "m" | "s";
|
|
4
82
|
//#endregion
|
|
5
83
|
//#region src/define/fields/boolean.d.ts
|
|
6
|
-
|
|
7
|
-
|
|
84
|
+
type BooleanFieldInput = FieldInput & ValueFieldInput<boolean> & UniqueFieldInput & LocalizedFieldInput;
|
|
85
|
+
/** What `define.field.boolean` hands back: the input with every default filled in. */
|
|
86
|
+
type BooleanField = {
|
|
87
|
+
__typename: "BooleanField";
|
|
88
|
+
apiId: string;
|
|
89
|
+
displayName: string;
|
|
90
|
+
description: string | null;
|
|
91
|
+
list: boolean;
|
|
92
|
+
required: boolean;
|
|
93
|
+
unique: boolean;
|
|
94
|
+
localized: boolean;
|
|
95
|
+
title: boolean;
|
|
96
|
+
visibility: FieldVisibility;
|
|
97
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
98
|
+
/** A list of values on a list field, one value otherwise. */
|
|
99
|
+
initialValue: boolean | boolean[] | null;
|
|
100
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
101
|
+
migrationValue: boolean | boolean[] | null;
|
|
102
|
+
renamedFrom: string | null;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* True or false.
|
|
106
|
+
*
|
|
107
|
+
* Nothing here is validated. The apiId format, uniqueness within the model
|
|
108
|
+
* or component and options that exclude each other are plan-time checks,
|
|
109
|
+
* reported together with its own.
|
|
110
|
+
*/
|
|
111
|
+
declare function boolean(input: BooleanFieldInput): BooleanField;
|
|
8
112
|
//#endregion
|
|
9
113
|
//#region src/define/fields/color.d.ts
|
|
10
|
-
/**
|
|
11
|
-
|
|
114
|
+
/**
|
|
115
|
+
* A colour: `r`, `g` and `b` whole numbers from 0 to 255, `a` from 0 to 1.
|
|
116
|
+
*
|
|
117
|
+
* @example { rgba: { r: 255, g: 99, b: 71, a: 1 } }
|
|
118
|
+
*/
|
|
119
|
+
type ColorValue = IRColor;
|
|
120
|
+
/**
|
|
121
|
+
* The options `color` takes. Studio has no title on a color field, so it
|
|
122
|
+
* takes no `title`.
|
|
123
|
+
*/
|
|
124
|
+
type ColorFieldInput = FieldInput & ValueFieldInput<ColorValue> & UniqueFieldInput & LocalizedFieldInput & {
|
|
125
|
+
title?: never;
|
|
126
|
+
};
|
|
127
|
+
/** What `define.field.color` hands back: the input with every default filled in. */
|
|
128
|
+
type ColorField = {
|
|
129
|
+
__typename: "ColorField";
|
|
130
|
+
apiId: string;
|
|
131
|
+
displayName: string;
|
|
132
|
+
description: string | null;
|
|
133
|
+
list: boolean;
|
|
134
|
+
required: boolean;
|
|
135
|
+
unique: boolean;
|
|
136
|
+
localized: boolean;
|
|
137
|
+
/** Always `false`: Studio has no title on a color field. */
|
|
138
|
+
title: false;
|
|
139
|
+
visibility: FieldVisibility;
|
|
140
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
141
|
+
/** A list of values on a list field, one value otherwise. */
|
|
142
|
+
initialValue: ColorValue | ColorValue[] | null;
|
|
143
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
144
|
+
migrationValue: ColorValue | ColorValue[] | null;
|
|
145
|
+
renamedFrom: string | null;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* A colour, such as a brand colour. Nothing here is validated; the checks
|
|
149
|
+
* run at plan time with the model's or component's own.
|
|
150
|
+
*/
|
|
151
|
+
declare function color(input: ColorFieldInput): ColorField;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/define/resources/model.d.ts
|
|
154
|
+
type ModelInput = {
|
|
155
|
+
apiId: string;
|
|
156
|
+
apiIdPlural: string;
|
|
157
|
+
displayName: string;
|
|
158
|
+
description?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The model's fields, built with `define.field.*`. The order here is the
|
|
161
|
+
* order editors see them in. May be empty.
|
|
162
|
+
*/
|
|
163
|
+
fields: Field[];
|
|
164
|
+
/**
|
|
165
|
+
* The apiId this model has in Hygraph right now, when you are renaming it.
|
|
166
|
+
* The rename keeps the model's content instead of deleting the model and
|
|
167
|
+
* creating a new one. Safe to leave in place once applied.
|
|
168
|
+
*/
|
|
169
|
+
renamedFrom?: string;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* What `define.model` hands back: the input with every default filled in.
|
|
173
|
+
* Plain data in the same shape the user wrote, not the IR — the canonical
|
|
174
|
+
* form is built from these later and never reaches the config.
|
|
175
|
+
*/
|
|
176
|
+
type Model = {
|
|
177
|
+
__typename: "Model";
|
|
178
|
+
apiId: string;
|
|
179
|
+
apiIdPlural: string;
|
|
180
|
+
displayName: string;
|
|
181
|
+
description: string | null;
|
|
182
|
+
fields: Field[];
|
|
183
|
+
renamedFrom: string | null;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* One model.
|
|
187
|
+
*
|
|
188
|
+
* Nothing here is validated. Format rules, `apiIdPlural` against `apiId` and
|
|
189
|
+
* uniqueness are plan-time checks, reported together rather than thrown one
|
|
190
|
+
* at a time while the config loads.
|
|
191
|
+
*/
|
|
192
|
+
declare function model(input: ModelInput): Model;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/define/fields/referenceOneWay.d.ts
|
|
195
|
+
/**
|
|
196
|
+
* The options `referenceOneWay` takes. A reference cannot be required. To
|
|
197
|
+
* make editors connect an entry, set `rules: { connections: { min: 1 } }`.
|
|
198
|
+
*/
|
|
199
|
+
type ReferenceOneWayFieldInput = Omit<FieldInput, "required"> & {
|
|
200
|
+
/**
|
|
201
|
+
* The model whose entries the field connects to, as `define.model`
|
|
202
|
+
* returns it, behind a function: `() => Product`. The function lets a
|
|
203
|
+
* model reference itself, and two files use each other in any order. List
|
|
204
|
+
* the model in the environment's `models` too. Cannot change once the
|
|
205
|
+
* field exists: changing it deletes the field and its connections.
|
|
206
|
+
*/
|
|
207
|
+
to: () => Model;
|
|
208
|
+
/**
|
|
209
|
+
* Whether the field connects to a list of entries. Cannot change once
|
|
210
|
+
* the field exists: changing it deletes the field and its connections.
|
|
211
|
+
* @default false
|
|
212
|
+
*/
|
|
213
|
+
list?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* What Studio asks of editors before they save an entry. The API does
|
|
216
|
+
* not check it. To require a connected entry, set
|
|
217
|
+
* `{ connections: { min: 1 } }`. That is the only rule a single
|
|
218
|
+
* reference takes; a list takes any `min` and `max`.
|
|
219
|
+
* @default null
|
|
220
|
+
*/
|
|
221
|
+
rules?: ReferenceRulesInput;
|
|
222
|
+
};
|
|
223
|
+
/** What Studio asks of editors on a reference. */
|
|
224
|
+
type ReferenceRulesInput = {
|
|
225
|
+
/**
|
|
226
|
+
* How many entries to connect. Give `min`, `max` or both, as whole
|
|
227
|
+
* numbers of 0 or more, with `min` no more than `max`.
|
|
228
|
+
*/
|
|
229
|
+
connections: {
|
|
230
|
+
/**
|
|
231
|
+
* The fewest entries to connect. Without it, there is no lower bound.
|
|
232
|
+
* @default null
|
|
233
|
+
*/
|
|
234
|
+
min?: number;
|
|
235
|
+
/**
|
|
236
|
+
* The most entries to connect. Without it, there is no upper bound.
|
|
237
|
+
* @default null
|
|
238
|
+
*/
|
|
239
|
+
max?: number;
|
|
240
|
+
/**
|
|
241
|
+
* What editors see when the count does not pass. Studio says how many
|
|
242
|
+
* to connect when it is not given.
|
|
243
|
+
* @default null
|
|
244
|
+
*/
|
|
245
|
+
errorMessage?: string;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
/** The rules with every default filled in. */
|
|
249
|
+
type ReferenceRules = IRReferenceRules;
|
|
250
|
+
/**
|
|
251
|
+
* What `define.field.referenceOneWay` hands back: the input with every
|
|
252
|
+
* default filled in.
|
|
253
|
+
*/
|
|
254
|
+
type ReferenceOneWayField = {
|
|
255
|
+
__typename: "ReferenceOneWayField";
|
|
256
|
+
apiId: string;
|
|
257
|
+
displayName: string;
|
|
258
|
+
description: string | null;
|
|
259
|
+
to: () => Model;
|
|
260
|
+
list: boolean;
|
|
261
|
+
/** Always `false`: a reference cannot be required. */
|
|
262
|
+
required: false;
|
|
263
|
+
rules: ReferenceRules | null;
|
|
264
|
+
visibility: FieldVisibility;
|
|
265
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
266
|
+
renamedFrom: string | null;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Entries of another model, or of the same one, that editors connect to
|
|
270
|
+
* the entry. Only this side has a field: Hygraph keeps the other side
|
|
271
|
+
* hidden on the model referenced. Allowed on components.
|
|
272
|
+
*
|
|
273
|
+
* Nothing here is validated, and the model is not looked at until the
|
|
274
|
+
* plan: the checks run at plan time with the model's or component's own.
|
|
275
|
+
*/
|
|
276
|
+
declare function referenceOneWay(input: ReferenceOneWayFieldInput): ReferenceOneWayField;
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/define/fields/referenceTwoWay.d.ts
|
|
279
|
+
/**
|
|
280
|
+
* The options `referenceTwoWay` takes. A reference cannot be required. To
|
|
281
|
+
* make editors connect an entry, set `rules: { connections: { min: 1 } }`.
|
|
282
|
+
*/
|
|
283
|
+
type ReferenceTwoWayFieldInput = Omit<FieldInput, "required"> & {
|
|
284
|
+
/**
|
|
285
|
+
* The model whose entries the field connects to, as `define.model`
|
|
286
|
+
* returns it, behind a function: `() => Author`. The function lets a
|
|
287
|
+
* model reference itself, and two files use each other in any order. List
|
|
288
|
+
* the model in the environment's `models` too. Cannot change once the
|
|
289
|
+
* field exists: changing it deletes both fields and their connections.
|
|
290
|
+
*/
|
|
291
|
+
to: () => Model;
|
|
292
|
+
/**
|
|
293
|
+
* The apiId of the field on `to` that connects back: its partner. The
|
|
294
|
+
* partner is a `referenceTwoWay` too, with `to` set to this model and
|
|
295
|
+
* `reverse` set to this field's apiId. When the partner is renamed with
|
|
296
|
+
* `renamedFrom`, set this to its new apiId: both fields and their
|
|
297
|
+
* connections stay. Changing it to another field deletes both fields
|
|
298
|
+
* and their connections.
|
|
299
|
+
*/
|
|
300
|
+
reverse: string;
|
|
301
|
+
/**
|
|
302
|
+
* Whether the field connects to a list of entries. Cannot change once
|
|
303
|
+
* the field exists: changing it deletes both fields and their
|
|
304
|
+
* connections.
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
307
|
+
list?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* What Studio asks of editors before they save an entry. The API does
|
|
310
|
+
* not check it. To require a connected entry, set
|
|
311
|
+
* `{ connections: { min: 1 } }`. That is the only rule a single
|
|
312
|
+
* reference takes; a list takes any `min` and `max`.
|
|
313
|
+
* @default null
|
|
314
|
+
*/
|
|
315
|
+
rules?: ReferenceRulesInput;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* What `define.field.referenceTwoWay` hands back: the input with every
|
|
319
|
+
* default filled in.
|
|
320
|
+
*/
|
|
321
|
+
type ReferenceTwoWayField = {
|
|
322
|
+
__typename: "ReferenceTwoWayField";
|
|
323
|
+
apiId: string;
|
|
324
|
+
displayName: string;
|
|
325
|
+
description: string | null;
|
|
326
|
+
to: () => Model;
|
|
327
|
+
reverse: string;
|
|
328
|
+
list: boolean;
|
|
329
|
+
/** Always `false`: a reference cannot be required. */
|
|
330
|
+
required: false;
|
|
331
|
+
rules: ReferenceRules | null;
|
|
332
|
+
visibility: FieldVisibility;
|
|
333
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
334
|
+
renamedFrom: string | null;
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Entries of another model, or of the same one, that editors connect to
|
|
338
|
+
* the entry, and that show the connection back in a field of their own.
|
|
339
|
+
* Declare both fields, each on the model it belongs to, each naming the
|
|
340
|
+
* other in `reverse`. Both can be on the same model. Each one has its own
|
|
341
|
+
* name, list, visibility, rules and condition, and renames on its own.
|
|
342
|
+
* Models only: a component cannot have one.
|
|
343
|
+
*
|
|
344
|
+
* Nothing here is validated, and the model is not looked at until the
|
|
345
|
+
* plan: the checks run at plan time with the model's own.
|
|
346
|
+
*/
|
|
347
|
+
declare function referenceTwoWay(input: ReferenceTwoWayFieldInput): ReferenceTwoWayField;
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/define/resources/component.d.ts
|
|
350
|
+
type ComponentInput = {
|
|
351
|
+
/**
|
|
352
|
+
* How the API names the component, such as `Seo`. An uppercase letter,
|
|
353
|
+
* then letters, digits and underscores, up to 64 characters. No model,
|
|
354
|
+
* enumeration or taxonomy may have the same apiId, and some names, such
|
|
355
|
+
* as `Type`, are reserved.
|
|
356
|
+
*/
|
|
357
|
+
apiId: string;
|
|
358
|
+
/**
|
|
359
|
+
* The plural the API uses for a list of the component, such as `Seos`.
|
|
360
|
+
* Same rules as `apiId`, and not the same value. Unique among the
|
|
361
|
+
* components.
|
|
362
|
+
*/
|
|
363
|
+
apiIdPlural: string;
|
|
364
|
+
/** The label editors see in Studio. Unique among the components. */
|
|
365
|
+
displayName: string;
|
|
366
|
+
/** @default null */
|
|
367
|
+
description?: string;
|
|
368
|
+
/**
|
|
369
|
+
* The component's fields, built with `define.field.*`. The order here is
|
|
370
|
+
* the order editors see them in. May be empty. Every field type but
|
|
371
|
+
* `referenceTwoWay`, which only models have.
|
|
372
|
+
*/
|
|
373
|
+
fields: Exclude<Field, ReferenceTwoWayField>[];
|
|
374
|
+
/**
|
|
375
|
+
* The apiId this component has in Hygraph right now, when you are
|
|
376
|
+
* renaming it. The rename keeps the component's fields and content
|
|
377
|
+
* instead of deleting the component and creating a new one. Safe to leave
|
|
378
|
+
* in place once applied.
|
|
379
|
+
*/
|
|
380
|
+
renamedFrom?: string;
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* What `define.component` hands back: the input with every default filled
|
|
384
|
+
* in.
|
|
385
|
+
*/
|
|
386
|
+
type Component = {
|
|
387
|
+
__typename: "Component";
|
|
388
|
+
apiId: string;
|
|
389
|
+
apiIdPlural: string;
|
|
390
|
+
displayName: string;
|
|
391
|
+
description: string | null;
|
|
392
|
+
fields: Field[];
|
|
393
|
+
renamedFrom: string | null;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* A group of fields that editors fill in inside an entry. A component has
|
|
397
|
+
* no entries of its own.
|
|
398
|
+
*
|
|
399
|
+
* Nothing here is validated. Format rules and uniqueness are plan-time
|
|
400
|
+
* checks, reported together with the rest of the config's.
|
|
401
|
+
*/
|
|
402
|
+
declare function component$1(input: ComponentInput): Component;
|
|
12
403
|
//#endregion
|
|
13
404
|
//#region src/define/fields/component.d.ts
|
|
14
|
-
/**
|
|
15
|
-
|
|
405
|
+
/** The options `component` takes. */
|
|
406
|
+
type ComponentFieldInput = Omit<FieldInput, "required"> & {
|
|
407
|
+
/**
|
|
408
|
+
* The component, as `define.component` returns it, behind a function:
|
|
409
|
+
* `() => Seo`. The function lets a component hold itself, and two files
|
|
410
|
+
* use each other in any order. List the component in the environment's
|
|
411
|
+
* `components` too. Cannot change once the field exists: changing it
|
|
412
|
+
* deletes the field and its content.
|
|
413
|
+
*/
|
|
414
|
+
component: () => Component;
|
|
415
|
+
/**
|
|
416
|
+
* Whether the field holds a list of components. Cannot change once the
|
|
417
|
+
* field exists: changing it deletes the field and its content.
|
|
418
|
+
* @default false
|
|
419
|
+
*/
|
|
420
|
+
list?: boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Whether an entry needs the component filled in to be saved. On a model
|
|
423
|
+
* or component that already has entries, add the field without it, fill
|
|
424
|
+
* the field in every entry, then make it required: Hygraph refuses a
|
|
425
|
+
* required component field that existing entries would leave empty.
|
|
426
|
+
* @default false
|
|
427
|
+
*/
|
|
428
|
+
required?: boolean;
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* What `define.field.component` hands back: the input with every default
|
|
432
|
+
* filled in.
|
|
433
|
+
*/
|
|
434
|
+
type ComponentField = {
|
|
435
|
+
__typename: "ComponentField";
|
|
436
|
+
apiId: string;
|
|
437
|
+
displayName: string;
|
|
438
|
+
description: string | null;
|
|
439
|
+
component: () => Component;
|
|
440
|
+
list: boolean;
|
|
441
|
+
required: boolean;
|
|
442
|
+
visibility: FieldVisibility;
|
|
443
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
444
|
+
renamedFrom: string | null;
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* One component, or a list of them, that editors fill in inside the entry.
|
|
448
|
+
*
|
|
449
|
+
* Nothing here is validated, and the component is not looked at until the
|
|
450
|
+
* plan: the checks run at plan time with the model's or component's own.
|
|
451
|
+
*/
|
|
452
|
+
declare function component(input: ComponentFieldInput): ComponentField;
|
|
16
453
|
//#endregion
|
|
17
454
|
//#region src/define/fields/componentUnion.d.ts
|
|
18
|
-
/**
|
|
19
|
-
|
|
455
|
+
/**
|
|
456
|
+
* The options `componentUnion` takes. Hygraph stores a union as never
|
|
457
|
+
* required, so it takes no `required`.
|
|
458
|
+
*/
|
|
459
|
+
type ComponentUnionFieldInput = Omit<FieldInput, "required" | "visibility"> & {
|
|
460
|
+
/**
|
|
461
|
+
* The components editors choose from, as `define.component` returns them,
|
|
462
|
+
* each behind a function: `[() => Hero, () => Banner]`. At least one, and
|
|
463
|
+
* each once. Their order does not matter. List them in the environment's
|
|
464
|
+
* `components` too. Removing a member deletes its content from every
|
|
465
|
+
* entry.
|
|
466
|
+
*/
|
|
467
|
+
components: (() => Component)[];
|
|
468
|
+
/**
|
|
469
|
+
* Whether the field holds a list of components. Cannot change once the
|
|
470
|
+
* field exists: changing it deletes the field and its content.
|
|
471
|
+
* @default false
|
|
472
|
+
*/
|
|
473
|
+
list?: boolean;
|
|
474
|
+
/**
|
|
475
|
+
* Cannot change once the field exists: changing it deletes the field and
|
|
476
|
+
* its content.
|
|
477
|
+
* @default "READ_WRITE"
|
|
478
|
+
*/
|
|
479
|
+
visibility?: FieldVisibility;
|
|
480
|
+
};
|
|
481
|
+
/**
|
|
482
|
+
* What `define.field.componentUnion` hands back: the input with every
|
|
483
|
+
* default filled in.
|
|
484
|
+
*/
|
|
485
|
+
type ComponentUnionField = {
|
|
486
|
+
__typename: "ComponentUnionField";
|
|
487
|
+
apiId: string;
|
|
488
|
+
displayName: string;
|
|
489
|
+
description: string | null;
|
|
490
|
+
components: (() => Component)[];
|
|
491
|
+
list: boolean;
|
|
492
|
+
/** Always `false`: Hygraph stores a union as never required. */
|
|
493
|
+
required: false;
|
|
494
|
+
visibility: FieldVisibility;
|
|
495
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
496
|
+
renamedFrom: string | null;
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* A choice of components, or a list of them, that editors fill in inside
|
|
500
|
+
* the entry, such as page sections.
|
|
501
|
+
*
|
|
502
|
+
* Nothing here is validated, and the components are not looked at until
|
|
503
|
+
* the plan: the checks run at plan time with the model's or component's
|
|
504
|
+
* own.
|
|
505
|
+
*/
|
|
506
|
+
declare function componentUnion(input: ComponentUnionFieldInput): ComponentUnionField;
|
|
20
507
|
//#endregion
|
|
21
508
|
//#region src/define/fields/date.d.ts
|
|
22
|
-
/**
|
|
23
|
-
|
|
509
|
+
/**
|
|
510
|
+
* The options `date` and `dateTime` take. Values are ISO strings: a day,
|
|
511
|
+
* `"2026-09-29"`, or a moment, `"2026-09-29T10:00:00Z"`.
|
|
512
|
+
*/
|
|
513
|
+
type DateFieldInput = FieldInput & ValueFieldInput<string> & UniqueFieldInput & LocalizedFieldInput;
|
|
514
|
+
/**
|
|
515
|
+
* What `date` and `dateTime` hand back besides their `__typename`: the
|
|
516
|
+
* input with every default filled in.
|
|
517
|
+
*/
|
|
518
|
+
type DateFieldAttributes = {
|
|
519
|
+
apiId: string;
|
|
520
|
+
displayName: string;
|
|
521
|
+
description: string | null;
|
|
522
|
+
list: boolean;
|
|
523
|
+
required: boolean;
|
|
524
|
+
unique: boolean;
|
|
525
|
+
localized: boolean;
|
|
526
|
+
title: boolean;
|
|
527
|
+
visibility: FieldVisibility;
|
|
528
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
529
|
+
/** A list of values on a list field, one value otherwise. */
|
|
530
|
+
initialValue: string | string[] | null;
|
|
531
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
532
|
+
migrationValue: string | string[] | null;
|
|
533
|
+
renamedFrom: string | null;
|
|
534
|
+
};
|
|
535
|
+
/** What `define.field.date` hands back. */
|
|
536
|
+
type DateField = DateFieldAttributes & {
|
|
537
|
+
__typename: "DateField";
|
|
538
|
+
};
|
|
539
|
+
/** What `define.field.dateTime` hands back. */
|
|
540
|
+
type DateTimeField = DateFieldAttributes & {
|
|
541
|
+
__typename: "DateTimeField";
|
|
542
|
+
};
|
|
543
|
+
/**
|
|
544
|
+
* A calendar day, such as a release date. Nothing here is validated; the
|
|
545
|
+
* checks run at plan time with the model's or component's own.
|
|
546
|
+
*/
|
|
547
|
+
declare function date(input: DateFieldInput): DateField;
|
|
24
548
|
//#endregion
|
|
25
|
-
//#region src/define/
|
|
26
|
-
/**
|
|
27
|
-
|
|
549
|
+
//#region src/define/resources/enumeration.d.ts
|
|
550
|
+
/** One value an enumeration field can hold. */
|
|
551
|
+
type EnumerationValueInput<V extends string = string> = {
|
|
552
|
+
/**
|
|
553
|
+
* How the API names the value, such as `IN_STOCK`. A letter, then
|
|
554
|
+
* letters, digits and underscores, up to 191 characters. Not `null`,
|
|
555
|
+
* `true` or `false`. Unique within the enumeration.
|
|
556
|
+
*/
|
|
557
|
+
apiId: V;
|
|
558
|
+
/** The label editors see in Studio. Unique within the enumeration. */
|
|
559
|
+
displayName: string;
|
|
560
|
+
/**
|
|
561
|
+
* The apiId this value has in Hygraph right now, when you are renaming
|
|
562
|
+
* it. The rename keeps the entries that hold the value. Safe to leave in
|
|
563
|
+
* place once applied.
|
|
564
|
+
*/
|
|
565
|
+
renamedFrom?: string;
|
|
566
|
+
};
|
|
567
|
+
type EnumerationInput<V extends string = string> = {
|
|
568
|
+
/**
|
|
569
|
+
* How the API names the enumeration, such as `Availability`. An
|
|
570
|
+
* uppercase letter, then letters, digits and underscores, up to 64
|
|
571
|
+
* characters. No model, component, taxonomy or built-in enumeration
|
|
572
|
+
* (such as `Stage`) may have the same apiId, and some names, such as
|
|
573
|
+
* `Status`, are reserved.
|
|
574
|
+
*/
|
|
575
|
+
apiId: string;
|
|
576
|
+
/**
|
|
577
|
+
* The label editors see in Studio. Unique among the enumerations,
|
|
578
|
+
* built-in ones included.
|
|
579
|
+
*/
|
|
580
|
+
displayName: string;
|
|
581
|
+
/** @default null */
|
|
582
|
+
description?: string;
|
|
583
|
+
/** The values. Their order does not matter: Hygraph keeps none. */
|
|
584
|
+
values: EnumerationValueInput<V>[];
|
|
585
|
+
/**
|
|
586
|
+
* The apiId this enumeration has in Hygraph right now, when you are
|
|
587
|
+
* renaming it. The rename keeps the enumeration's values and the fields
|
|
588
|
+
* that use it. Safe to leave in place once applied.
|
|
589
|
+
*/
|
|
590
|
+
renamedFrom?: string;
|
|
591
|
+
};
|
|
592
|
+
/** A value as `define.enumeration` hands it back. */
|
|
593
|
+
type EnumerationValue<V extends string = string> = {
|
|
594
|
+
apiId: V;
|
|
595
|
+
displayName: string;
|
|
596
|
+
renamedFrom: string | null;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* What `define.enumeration` hands back: the input with every default filled
|
|
600
|
+
* in. `V` is the union of its value apiIds, so a field can check its values
|
|
601
|
+
* against them.
|
|
602
|
+
*/
|
|
603
|
+
type Enumeration<V extends string = string> = {
|
|
604
|
+
__typename: "Enumeration";
|
|
605
|
+
apiId: string;
|
|
606
|
+
displayName: string;
|
|
607
|
+
description: string | null;
|
|
608
|
+
values: EnumerationValue<V>[];
|
|
609
|
+
renamedFrom: string | null;
|
|
610
|
+
};
|
|
611
|
+
/**
|
|
612
|
+
* A fixed set of values, for enumeration fields to pick from.
|
|
613
|
+
*
|
|
614
|
+
* Nothing here is validated. Format rules and uniqueness are plan-time
|
|
615
|
+
* checks, reported together with the rest of the config's.
|
|
616
|
+
*/
|
|
617
|
+
declare function enumeration$1<const V extends string>(input: EnumerationInput<V>): Enumeration<V>;
|
|
28
618
|
//#endregion
|
|
29
619
|
//#region src/define/fields/enumeration.d.ts
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
|
|
620
|
+
/** The options `enumeration` takes. Values are the enumeration's value apiIds. */
|
|
621
|
+
type EnumerationFieldInput<V extends string> = FieldInput & ValueFieldInput<NoInfer<V>> & UniqueFieldInput & {
|
|
622
|
+
/**
|
|
623
|
+
* Whether the field has a value per locale. Cannot change once the
|
|
624
|
+
* field exists: changing it deletes the field and its content.
|
|
625
|
+
* @default false
|
|
626
|
+
*/
|
|
627
|
+
localized?: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* The enumeration the field's values come from, as `define.enumeration`
|
|
630
|
+
* returns it. List it in the environment's `enumerations` too. Cannot
|
|
631
|
+
* change once the field exists: changing it deletes the field and its
|
|
632
|
+
* content.
|
|
633
|
+
*/
|
|
634
|
+
enumeration: Enumeration<V>;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* What `define.field.enumeration` hands back: the input with every default
|
|
638
|
+
* filled in.
|
|
639
|
+
*/
|
|
640
|
+
type EnumerationField<V extends string = string> = {
|
|
641
|
+
__typename: "EnumerationField";
|
|
642
|
+
apiId: string;
|
|
643
|
+
displayName: string;
|
|
644
|
+
description: string | null;
|
|
645
|
+
enumeration: Enumeration<V>;
|
|
646
|
+
list: boolean;
|
|
647
|
+
required: boolean;
|
|
648
|
+
unique: boolean;
|
|
649
|
+
localized: boolean;
|
|
650
|
+
title: boolean;
|
|
651
|
+
visibility: FieldVisibility;
|
|
652
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
653
|
+
/** A list of values on a list field, one value otherwise. */
|
|
654
|
+
initialValue: V | V[] | null;
|
|
655
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
656
|
+
migrationValue: V | V[] | null;
|
|
657
|
+
renamedFrom: string | null;
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* One value, or a list of them, from an enumeration. Takes the enumeration
|
|
661
|
+
* itself, not a lambda, and types `initialValue` and `migrationValue` by
|
|
662
|
+
* its values.
|
|
663
|
+
*
|
|
664
|
+
* Nothing here is validated; the checks run at plan time with the model's
|
|
665
|
+
* or component's own.
|
|
666
|
+
*/
|
|
667
|
+
declare function enumeration<V extends string>(input: EnumerationFieldInput<V>): EnumerationField<V>;
|
|
40
668
|
//#endregion
|
|
41
669
|
//#region src/define/fields/json.d.ts
|
|
42
|
-
/**
|
|
43
|
-
|
|
670
|
+
/** Any value JSON can hold: text, a number, a boolean, `null`, a list or an object. */
|
|
671
|
+
type JsonValue = IRJsonValue;
|
|
672
|
+
/**
|
|
673
|
+
* The options `json` takes. Studio has no title on a JSON field, so it
|
|
674
|
+
* takes no `title`.
|
|
675
|
+
*/
|
|
676
|
+
type JsonFieldInput = FieldInput & ValueFieldInput<JsonValue> & UniqueFieldInput & LocalizedFieldInput & {
|
|
677
|
+
title?: never;
|
|
678
|
+
};
|
|
679
|
+
/** What `define.field.json` hands back: the input with every default filled in. */
|
|
680
|
+
type JsonField = {
|
|
681
|
+
__typename: "JsonField";
|
|
682
|
+
apiId: string;
|
|
683
|
+
displayName: string;
|
|
684
|
+
description: string | null;
|
|
685
|
+
list: boolean;
|
|
686
|
+
required: boolean;
|
|
687
|
+
unique: boolean;
|
|
688
|
+
localized: boolean;
|
|
689
|
+
/** Always `false`: Studio has no title on a JSON field. */
|
|
690
|
+
title: false;
|
|
691
|
+
visibility: FieldVisibility;
|
|
692
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
693
|
+
/** A list of values on a list field, one value otherwise. */
|
|
694
|
+
initialValue: JsonValue | JsonValue[] | null;
|
|
695
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
696
|
+
migrationValue: JsonValue | JsonValue[] | null;
|
|
697
|
+
renamedFrom: string | null;
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* Any JSON, such as settings for a widget. One value may be a list or an
|
|
701
|
+
* object itself. Nothing here is validated; the checks run at plan time
|
|
702
|
+
* with the model's or component's own.
|
|
703
|
+
*/
|
|
704
|
+
declare function json(input: JsonFieldInput): JsonField;
|
|
44
705
|
//#endregion
|
|
45
706
|
//#region src/define/fields/location.d.ts
|
|
46
|
-
/**
|
|
47
|
-
|
|
707
|
+
/**
|
|
708
|
+
* A point on the globe, in degrees.
|
|
709
|
+
*
|
|
710
|
+
* @example { latitude: 52.52, longitude: 13.405 }
|
|
711
|
+
*/
|
|
712
|
+
type LocationValue = IRLocation;
|
|
713
|
+
/**
|
|
714
|
+
* The options `location` takes. Studio has no title on a location field,
|
|
715
|
+
* so it takes no `title`.
|
|
716
|
+
*/
|
|
717
|
+
type LocationFieldInput = FieldInput & ValueFieldInput<LocationValue> & UniqueFieldInput & LocalizedFieldInput & {
|
|
718
|
+
title?: never;
|
|
719
|
+
};
|
|
720
|
+
/** What `define.field.location` hands back: the input with every default filled in. */
|
|
721
|
+
type LocationField = {
|
|
722
|
+
__typename: "LocationField";
|
|
723
|
+
apiId: string;
|
|
724
|
+
displayName: string;
|
|
725
|
+
description: string | null;
|
|
726
|
+
list: boolean;
|
|
727
|
+
required: boolean;
|
|
728
|
+
unique: boolean;
|
|
729
|
+
localized: boolean;
|
|
730
|
+
/** Always `false`: Studio has no title on a location field. */
|
|
731
|
+
title: false;
|
|
732
|
+
visibility: FieldVisibility;
|
|
733
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
734
|
+
/** A list of values on a list field, one value otherwise. */
|
|
735
|
+
initialValue: LocationValue | LocationValue[] | null;
|
|
736
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
737
|
+
migrationValue: LocationValue | LocationValue[] | null;
|
|
738
|
+
renamedFrom: string | null;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* A point on the globe, such as where a store is. Nothing here is
|
|
742
|
+
* validated; the checks run at plan time with the model's or component's
|
|
743
|
+
* own.
|
|
744
|
+
*/
|
|
745
|
+
declare function location(input: LocationFieldInput): LocationField;
|
|
48
746
|
//#endregion
|
|
49
|
-
//#region src/define/fields/
|
|
50
|
-
/**
|
|
51
|
-
|
|
747
|
+
//#region src/define/fields/rangeRule.d.ts
|
|
748
|
+
/** A range rule on a field's `validations`, which text and number fields share. */
|
|
749
|
+
type RangeRuleInput = {
|
|
750
|
+
/** The lowest allowed. */
|
|
751
|
+
min?: number;
|
|
752
|
+
/** The highest allowed. */
|
|
753
|
+
max?: number;
|
|
754
|
+
/** What editors see when the value is out of range. */
|
|
755
|
+
errorMessage: string;
|
|
756
|
+
};
|
|
757
|
+
type RangeRule = {
|
|
758
|
+
min: number | null;
|
|
759
|
+
max: number | null;
|
|
760
|
+
errorMessage: string;
|
|
761
|
+
};
|
|
52
762
|
//#endregion
|
|
53
|
-
//#region src/define/fields/
|
|
54
|
-
/** The
|
|
55
|
-
|
|
763
|
+
//#region src/define/fields/number.d.ts
|
|
764
|
+
/** The options `int` and `float` take. Values are numbers. */
|
|
765
|
+
type NumberFieldInput = FieldInput & ValueFieldInput<number> & UniqueFieldInput & LocalizedFieldInput & {
|
|
766
|
+
/** Checks on the number before an entry saves. @default null */
|
|
767
|
+
validations?: NumberValidationRulesInput;
|
|
768
|
+
};
|
|
769
|
+
/**
|
|
770
|
+
* What `int` and `float` hand back besides their `__typename`: the input
|
|
771
|
+
* with every default filled in.
|
|
772
|
+
*/
|
|
773
|
+
type NumberFieldAttributes = {
|
|
774
|
+
apiId: string;
|
|
775
|
+
displayName: string;
|
|
776
|
+
description: string | null;
|
|
777
|
+
list: boolean;
|
|
778
|
+
required: boolean;
|
|
779
|
+
unique: boolean;
|
|
780
|
+
localized: boolean;
|
|
781
|
+
title: boolean;
|
|
782
|
+
visibility: FieldVisibility;
|
|
783
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
784
|
+
/** A list of values on a list field, one value otherwise. */
|
|
785
|
+
initialValue: number | number[] | null;
|
|
786
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
787
|
+
migrationValue: number | number[] | null;
|
|
788
|
+
validations: NumberValidationRules | null;
|
|
789
|
+
renamedFrom: string | null;
|
|
790
|
+
};
|
|
791
|
+
/** What `define.field.int` hands back. */
|
|
792
|
+
type IntField = NumberFieldAttributes & {
|
|
793
|
+
__typename: "IntField";
|
|
794
|
+
};
|
|
795
|
+
/** What `define.field.float` hands back. */
|
|
796
|
+
type FloatField = NumberFieldAttributes & {
|
|
797
|
+
__typename: "FloatField";
|
|
798
|
+
};
|
|
799
|
+
/** Checks Hygraph runs on a number field's value before an entry saves. */
|
|
800
|
+
type NumberValidationRulesInput = {
|
|
801
|
+
/** The values allowed, such as `{ min: 0, max: 5, errorMessage }`. */
|
|
802
|
+
range?: RangeRuleInput;
|
|
803
|
+
/** How many values a list field may hold. List fields only. */
|
|
804
|
+
listItemCount?: RangeRuleInput;
|
|
805
|
+
};
|
|
806
|
+
type NumberValidationRules = {
|
|
807
|
+
range: RangeRule | null;
|
|
808
|
+
listItemCount: RangeRule | null;
|
|
809
|
+
};
|
|
56
810
|
//#endregion
|
|
57
|
-
//#region src/define/fields/
|
|
58
|
-
/**
|
|
59
|
-
|
|
811
|
+
//#region src/define/fields/string.d.ts
|
|
812
|
+
/**
|
|
813
|
+
* The options every text editor takes. Each editor's builder adds its own,
|
|
814
|
+
* such as a slug's template.
|
|
815
|
+
*/
|
|
816
|
+
type StringFieldInput = FieldInput & ValueFieldInput<string> & UniqueFieldInput & LocalizedFieldInput & {
|
|
817
|
+
/** Checks on the text before an entry saves. @default null */
|
|
818
|
+
validations?: StringValidationRulesInput;
|
|
819
|
+
};
|
|
820
|
+
/**
|
|
821
|
+
* What every text builder hands back besides its `__typename`: the input
|
|
822
|
+
* with every default filled in. Each editor has its own `__typename`
|
|
823
|
+
* (`SingleLineField`, ...), so the editor never appears as an option.
|
|
824
|
+
*/
|
|
825
|
+
type StringFieldAttributes = {
|
|
826
|
+
apiId: string;
|
|
827
|
+
displayName: string;
|
|
828
|
+
description: string | null;
|
|
829
|
+
list: boolean;
|
|
830
|
+
required: boolean;
|
|
831
|
+
unique: boolean;
|
|
832
|
+
localized: boolean;
|
|
833
|
+
title: boolean;
|
|
834
|
+
visibility: FieldVisibility;
|
|
835
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
836
|
+
/** A list of values on a list field, one value otherwise. */
|
|
837
|
+
initialValue: string | string[] | null;
|
|
838
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
839
|
+
migrationValue: string | string[] | null;
|
|
840
|
+
validations: StringValidationRules | null;
|
|
841
|
+
renamedFrom: string | null;
|
|
842
|
+
};
|
|
843
|
+
/** What `define.field.singleLine` hands back. */
|
|
844
|
+
type SingleLineField = StringFieldAttributes & {
|
|
845
|
+
__typename: "SingleLineField";
|
|
846
|
+
};
|
|
847
|
+
/** What `define.field.multiline` hands back. */
|
|
848
|
+
type MultilineField = StringFieldAttributes & {
|
|
849
|
+
__typename: "MultilineField";
|
|
850
|
+
};
|
|
851
|
+
/** What `define.field.markdown` hands back. */
|
|
852
|
+
type MarkdownField = StringFieldAttributes & {
|
|
853
|
+
__typename: "MarkdownField";
|
|
854
|
+
};
|
|
855
|
+
/** What `define.field.slug` hands back. */
|
|
856
|
+
type SlugField = StringFieldAttributes & {
|
|
857
|
+
__typename: "SlugField";
|
|
858
|
+
lowercase: boolean;
|
|
859
|
+
autoGenerate: boolean;
|
|
860
|
+
template: string | null;
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* A text field of any editor. Every text editor is Hygraph's `STRING`
|
|
864
|
+
* type, so switching editor is an update, not a new field.
|
|
865
|
+
*/
|
|
866
|
+
type StringField = SingleLineField | MultilineField | MarkdownField | SlugField;
|
|
867
|
+
/** Text rendered by an installed app's element. `renderer` is required. */
|
|
868
|
+
declare function string(_options: unknown): never;
|
|
869
|
+
/** `i` case insensitive, `m` multiline, `s` single line, as Studio offers them. */
|
|
870
|
+
type RegexFlag = IRRegexFlag;
|
|
871
|
+
type RegexRuleInput = {
|
|
872
|
+
/** A regular expression, such as `"^[a-z0-9-]+$"`. */
|
|
873
|
+
regex: string;
|
|
874
|
+
flags?: RegexFlag[];
|
|
875
|
+
/** What editors see when the value does not fit. */
|
|
876
|
+
errorMessage: string;
|
|
877
|
+
};
|
|
878
|
+
/** Checks Hygraph runs on a text field's value before an entry saves. */
|
|
879
|
+
type StringValidationRulesInput = {
|
|
880
|
+
/** How long the text may be. */
|
|
881
|
+
characters?: RangeRuleInput;
|
|
882
|
+
/** A pattern the text must match. */
|
|
883
|
+
matches?: RegexRuleInput;
|
|
884
|
+
/** A pattern the text must not match. */
|
|
885
|
+
notMatches?: RegexRuleInput;
|
|
886
|
+
/** How many values a list field may hold. List fields only. */
|
|
887
|
+
listItemCount?: RangeRuleInput;
|
|
888
|
+
};
|
|
889
|
+
type RegexRule = {
|
|
890
|
+
regex: string;
|
|
891
|
+
flags: RegexFlag[] | null;
|
|
892
|
+
errorMessage: string;
|
|
893
|
+
};
|
|
894
|
+
type StringValidationRules = {
|
|
895
|
+
characters: RangeRule | null;
|
|
896
|
+
matches: RegexRule | null;
|
|
897
|
+
notMatches: RegexRule | null;
|
|
898
|
+
listItemCount: RangeRule | null;
|
|
899
|
+
};
|
|
60
900
|
//#endregion
|
|
61
|
-
//#region src/define/
|
|
62
|
-
/**
|
|
63
|
-
|
|
901
|
+
//#region src/define/resources/taxonomy.d.ts
|
|
902
|
+
/** One node of a taxonomy, with the nodes below it. */
|
|
903
|
+
type TaxonomyNodeInput = {
|
|
904
|
+
/**
|
|
905
|
+
* How the API names the node, such as `Shoes`. An uppercase letter, then
|
|
906
|
+
* letters, digits and underscores, up to 64 characters. Unique within the
|
|
907
|
+
* taxonomy.
|
|
908
|
+
*/
|
|
909
|
+
apiId: string;
|
|
910
|
+
/** The label editors see in Studio. Unique among its siblings. */
|
|
911
|
+
displayName: string;
|
|
912
|
+
/**
|
|
913
|
+
* The nodes below this one. Their order does not matter: Hygraph keeps
|
|
914
|
+
* none. Moving a node under another parent keeps the entries that hold
|
|
915
|
+
* it.
|
|
916
|
+
* @default []
|
|
917
|
+
*/
|
|
918
|
+
children?: TaxonomyNodeInput[];
|
|
919
|
+
/**
|
|
920
|
+
* The apiId this node has in Hygraph right now, when you are renaming
|
|
921
|
+
* it. The rename keeps the entries that hold the node. Safe to leave in
|
|
922
|
+
* place once applied.
|
|
923
|
+
*/
|
|
924
|
+
renamedFrom?: string;
|
|
925
|
+
};
|
|
926
|
+
type TaxonomyInput = {
|
|
927
|
+
/**
|
|
928
|
+
* How the API names the taxonomy, such as `Category`. An uppercase
|
|
929
|
+
* letter, then letters, digits and underscores, up to 64 characters. No
|
|
930
|
+
* model, component or enumeration may have the same apiId, and some
|
|
931
|
+
* names, such as `Status`, are reserved.
|
|
932
|
+
*/
|
|
933
|
+
apiId: string;
|
|
934
|
+
/** The label editors see in Studio. Unique among the taxonomies. */
|
|
935
|
+
displayName: string;
|
|
936
|
+
/** @default null */
|
|
937
|
+
description?: string;
|
|
938
|
+
/**
|
|
939
|
+
* The node every other node sits under. Studio names it after the
|
|
940
|
+
* taxonomy. It cannot be replaced once the taxonomy exists; rename it
|
|
941
|
+
* with its `renamedFrom`.
|
|
942
|
+
*/
|
|
943
|
+
root: TaxonomyNodeInput;
|
|
944
|
+
/**
|
|
945
|
+
* The apiId this taxonomy has in Hygraph right now, when you are
|
|
946
|
+
* renaming it. The rename keeps its nodes and the fields that use it.
|
|
947
|
+
* Safe to leave in place once applied.
|
|
948
|
+
*/
|
|
949
|
+
renamedFrom?: string;
|
|
950
|
+
};
|
|
951
|
+
/** A node as `define.taxonomy` hands it back. */
|
|
952
|
+
type TaxonomyNode = {
|
|
953
|
+
apiId: string;
|
|
954
|
+
displayName: string;
|
|
955
|
+
children: TaxonomyNode[];
|
|
956
|
+
renamedFrom: string | null;
|
|
957
|
+
};
|
|
958
|
+
/** What `define.taxonomy` hands back: the input with every default filled in. */
|
|
959
|
+
type Taxonomy = {
|
|
960
|
+
__typename: "Taxonomy";
|
|
961
|
+
apiId: string;
|
|
962
|
+
displayName: string;
|
|
963
|
+
description: string | null;
|
|
964
|
+
root: TaxonomyNode;
|
|
965
|
+
renamedFrom: string | null;
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* A tree of nodes, for taxonomy fields to pick from.
|
|
969
|
+
*
|
|
970
|
+
* Nothing here is validated. Format rules and uniqueness are plan-time
|
|
971
|
+
* checks, reported together with the rest of the config's.
|
|
972
|
+
*/
|
|
973
|
+
declare function taxonomy$1(input: TaxonomyInput): Taxonomy;
|
|
974
|
+
//#endregion
|
|
975
|
+
//#region src/define/fields/taxonomy.d.ts
|
|
976
|
+
/**
|
|
977
|
+
* The options `taxonomy` takes. Values are the taxonomy's node apiIds.
|
|
978
|
+
* Hygraph has no title and no localization on a taxonomy field, so it takes
|
|
979
|
+
* neither `title` nor `localized`.
|
|
980
|
+
*/
|
|
981
|
+
type TaxonomyFieldInput = FieldInput & ValueFieldInput<string> & UniqueFieldInput & {
|
|
982
|
+
title?: never;
|
|
983
|
+
/**
|
|
984
|
+
* The taxonomy the field's nodes come from, as `define.taxonomy`
|
|
985
|
+
* returns it. List it in the environment's `taxonomies` too. Cannot
|
|
986
|
+
* change once the field exists: changing it deletes the field and its
|
|
987
|
+
* content.
|
|
988
|
+
*/
|
|
989
|
+
taxonomy: Taxonomy;
|
|
990
|
+
};
|
|
991
|
+
/**
|
|
992
|
+
* What `define.field.taxonomy` hands back: the input with every default
|
|
993
|
+
* filled in.
|
|
994
|
+
*/
|
|
995
|
+
type TaxonomyField = {
|
|
996
|
+
__typename: "TaxonomyField";
|
|
997
|
+
apiId: string;
|
|
998
|
+
displayName: string;
|
|
999
|
+
description: string | null;
|
|
1000
|
+
taxonomy: Taxonomy;
|
|
1001
|
+
list: boolean;
|
|
1002
|
+
required: boolean;
|
|
1003
|
+
unique: boolean;
|
|
1004
|
+
visibility: FieldVisibility;
|
|
1005
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
1006
|
+
/** A list of node apiIds on a list field, one otherwise. */
|
|
1007
|
+
initialValue: string | string[] | null;
|
|
1008
|
+
/** Intent, like `renamedFrom`: read by the plan, never part of the IR. */
|
|
1009
|
+
migrationValue: string | string[] | null;
|
|
1010
|
+
renamedFrom: string | null;
|
|
1011
|
+
};
|
|
1012
|
+
/**
|
|
1013
|
+
* One node, or a list of them, from a taxonomy. Takes the taxonomy itself,
|
|
1014
|
+
* not a lambda.
|
|
1015
|
+
*
|
|
1016
|
+
* Nothing here is validated; the checks run at plan time with the model's
|
|
1017
|
+
* or component's own, the nodes `initialValue` and `migrationValue` name
|
|
1018
|
+
* included.
|
|
1019
|
+
*/
|
|
1020
|
+
declare function taxonomy(input: TaxonomyFieldInput): TaxonomyField;
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src/define/fields/unsupported.d.ts
|
|
1023
|
+
type UnsupportedFieldInput = {
|
|
1024
|
+
/** The field's apiId in Hygraph. */
|
|
1025
|
+
apiId: string;
|
|
1026
|
+
/** Hygraph's name for the field's type, such as `VECTOR` or `RELATION`. */
|
|
1027
|
+
type: IRFieldType;
|
|
1028
|
+
};
|
|
1029
|
+
/** What `define.field.unsupported` hands back. */
|
|
1030
|
+
type UnsupportedField = {
|
|
1031
|
+
__typename: "UnsupportedField";
|
|
1032
|
+
apiId: string;
|
|
1033
|
+
type: IRFieldType;
|
|
1034
|
+
};
|
|
1035
|
+
/**
|
|
1036
|
+
* A field the CLI cannot read yet, written by export in the field's slot.
|
|
1037
|
+
* The plan only moves it, or deletes it when it is left out. To change
|
|
1038
|
+
* anything else, use Studio.
|
|
1039
|
+
*/
|
|
1040
|
+
declare function unsupported(input: UnsupportedFieldInput): UnsupportedField;
|
|
1041
|
+
//#endregion
|
|
1042
|
+
//#region src/define/fields/field.d.ts
|
|
1043
|
+
/** One field of any type, as a `define.field.*` builder returns it. */
|
|
1044
|
+
type Field = BooleanField | StringField | DateField | DateTimeField | IntField | FloatField | EnumerationField | TaxonomyField | JsonField | ColorField | LocationField | ComponentField | ComponentUnionField | ReferenceOneWayField | ReferenceTwoWayField | AssetField | UnsupportedField;
|
|
1045
|
+
/**
|
|
1046
|
+
* Who sees the field. `READ_WRITE` shows it to editors and the API,
|
|
1047
|
+
* `READ_ONLY` shows it without letting editors change it, `HIDDEN` hides
|
|
1048
|
+
* it from editors, `API_ONLY` leaves it out of Studio entirely.
|
|
1049
|
+
*/
|
|
1050
|
+
type FieldVisibility = IRFieldVisibility;
|
|
1051
|
+
/**
|
|
1052
|
+
* Show the field in Studio only while another field on the same model or
|
|
1053
|
+
* component has a given value. On a boolean field: while it is (`IS`) or is not
|
|
1054
|
+
* (`IS_NOT`) `booleanValue`. On an enumeration field that holds one value:
|
|
1055
|
+
* while it is or is not the one value in `enumerationValues`, or while it
|
|
1056
|
+
* is any of them (`CONTAINS_ANY`), all of them (`CONTAINS_ALL`) or none
|
|
1057
|
+
* of them (`CONTAINS_NONE`).
|
|
1058
|
+
*
|
|
1059
|
+
* @example { baseField: "hasDiscount", operator: "IS", booleanValue: true }
|
|
1060
|
+
* @example { baseField: "mediaType", operator: "IS", enumerationValues: ["VIDEO"] }
|
|
1061
|
+
*/
|
|
1062
|
+
type FieldVisibilityCondition = (IRBooleanVisibilityCondition & {
|
|
1063
|
+
enumerationValues?: never;
|
|
1064
|
+
}) | (IREnumerationVisibilityCondition & {
|
|
1065
|
+
booleanValue?: never;
|
|
1066
|
+
});
|
|
1067
|
+
/** The options every field type takes. */
|
|
1068
|
+
type FieldInput = {
|
|
1069
|
+
/**
|
|
1070
|
+
* How the API names the field. A lowercase letter, then letters, digits
|
|
1071
|
+
* and underscores, up to 64 characters. Unique within the model or
|
|
1072
|
+
* component.
|
|
1073
|
+
*/
|
|
1074
|
+
apiId: string;
|
|
1075
|
+
/**
|
|
1076
|
+
* The label editors see in Studio. Unique within the model or component.
|
|
1077
|
+
*/
|
|
1078
|
+
displayName: string;
|
|
1079
|
+
/** Help text editors see under the field. @default null */
|
|
1080
|
+
description?: string;
|
|
1081
|
+
/** Whether an entry needs a value to be saved. @default false */
|
|
1082
|
+
required?: boolean;
|
|
1083
|
+
/** @default "READ_WRITE" */
|
|
1084
|
+
visibility?: FieldVisibility;
|
|
1085
|
+
/**
|
|
1086
|
+
* When Studio shows the field, by the value of another field on the same
|
|
1087
|
+
* model or component. Not on a required field.
|
|
1088
|
+
* @default null
|
|
1089
|
+
*/
|
|
1090
|
+
visibilityCondition?: FieldVisibilityCondition;
|
|
1091
|
+
/**
|
|
1092
|
+
* The apiId this field has in Hygraph right now, when you are renaming it.
|
|
1093
|
+
* The rename keeps the field's content instead of deleting the field and
|
|
1094
|
+
* creating a new one. Safe to leave in place once applied.
|
|
1095
|
+
*/
|
|
1096
|
+
renamedFrom?: string;
|
|
1097
|
+
};
|
|
1098
|
+
/**
|
|
1099
|
+
* `list` and what depends on it, for a field holding values of type `T`.
|
|
1100
|
+
* A list starts with a list of values and cannot be the title.
|
|
1101
|
+
*/
|
|
1102
|
+
type ValueFieldInput<T> = {
|
|
1103
|
+
/**
|
|
1104
|
+
* Whether the field holds a list of values. Cannot change once the
|
|
1105
|
+
* field exists: changing it deletes the field and its content.
|
|
1106
|
+
* @default false
|
|
1107
|
+
*/
|
|
1108
|
+
list?: false;
|
|
1109
|
+
/**
|
|
1110
|
+
* The value a new entry starts with. Not on a localized field, and
|
|
1111
|
+
* not on an `API_ONLY` one.
|
|
1112
|
+
* @default null
|
|
1113
|
+
*/
|
|
1114
|
+
initialValue?: T;
|
|
1115
|
+
/**
|
|
1116
|
+
* Whether Studio shows entries by this field's value. On a component,
|
|
1117
|
+
* Studio labels each instance of the component by it, also while the
|
|
1118
|
+
* rest of it loads. Not on a `HIDDEN` or `API_ONLY` field.
|
|
1119
|
+
* @default false
|
|
1120
|
+
*/
|
|
1121
|
+
title?: boolean;
|
|
1122
|
+
/**
|
|
1123
|
+
* The value existing entries get when the field becomes required, or
|
|
1124
|
+
* is created required. Only used by the plan that makes it required;
|
|
1125
|
+
* safe to leave in place after. Needs `required: true`.
|
|
1126
|
+
*/
|
|
1127
|
+
migrationValue?: T;
|
|
1128
|
+
} | {
|
|
1129
|
+
list: true;
|
|
1130
|
+
/** The values a new entry starts with. @default null */
|
|
1131
|
+
initialValue?: T[];
|
|
1132
|
+
title?: never;
|
|
1133
|
+
/** The values existing entries get when the field becomes required. */
|
|
1134
|
+
migrationValue?: T[];
|
|
1135
|
+
};
|
|
1136
|
+
/** For field types whose value can be unique. */
|
|
1137
|
+
type UniqueFieldInput = {
|
|
1138
|
+
/**
|
|
1139
|
+
* Whether no two entries may have the same value. On a component, no two
|
|
1140
|
+
* instances of the component may, in any entry.
|
|
1141
|
+
* @default false
|
|
1142
|
+
*/
|
|
1143
|
+
unique?: boolean;
|
|
1144
|
+
};
|
|
1145
|
+
/** For field types whose value can differ per locale. */
|
|
1146
|
+
type LocalizedFieldInput = {
|
|
1147
|
+
/** Whether the field has a value per locale. @default false */
|
|
1148
|
+
localized?: boolean;
|
|
1149
|
+
};
|
|
1150
|
+
//#endregion
|
|
1151
|
+
//#region src/define/fields/asset.d.ts
|
|
1152
|
+
/** The options `asset` takes. */
|
|
1153
|
+
type AssetFieldInput = Omit<FieldInput, "required"> & {
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether the field holds a list of assets. Cannot change once the field
|
|
1156
|
+
* exists: changing it deletes the field and its connections.
|
|
1157
|
+
* @default false
|
|
1158
|
+
*/
|
|
1159
|
+
list?: boolean;
|
|
1160
|
+
/**
|
|
1161
|
+
* Whether an entry needs an asset to be saved. Not on a `HIDDEN` or
|
|
1162
|
+
* `API_ONLY` field. Making a field that exists required changes the
|
|
1163
|
+
* Content API at once: every create must set the field, and an entry
|
|
1164
|
+
* without an asset in a single asset field fails to read.
|
|
1165
|
+
* @default false
|
|
1166
|
+
*/
|
|
1167
|
+
required?: boolean;
|
|
1168
|
+
};
|
|
1169
|
+
/**
|
|
1170
|
+
* What `define.field.asset` hands back: the input with every default filled
|
|
1171
|
+
* in.
|
|
1172
|
+
*/
|
|
1173
|
+
type AssetField = {
|
|
1174
|
+
__typename: "AssetField";
|
|
1175
|
+
apiId: string;
|
|
1176
|
+
displayName: string;
|
|
1177
|
+
description: string | null;
|
|
1178
|
+
list: boolean;
|
|
1179
|
+
required: boolean;
|
|
1180
|
+
visibility: FieldVisibility;
|
|
1181
|
+
visibilityCondition: FieldVisibilityCondition | null;
|
|
1182
|
+
renamedFrom: string | null;
|
|
1183
|
+
};
|
|
1184
|
+
/**
|
|
1185
|
+
* One asset, or a list of them, that editors connect to the entry. Hygraph
|
|
1186
|
+
* adds a field back on the Asset model, named after this field and its
|
|
1187
|
+
* model or component: `imagePost` for `image` on `Post`. It is `API_ONLY`.
|
|
1188
|
+
* Allowed on components.
|
|
1189
|
+
*
|
|
1190
|
+
* Nothing here is validated: the checks run at plan time with the model's
|
|
1191
|
+
* or component's own.
|
|
1192
|
+
*/
|
|
1193
|
+
declare function asset$1(input: AssetFieldInput): AssetField;
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region src/define/fields/dateTime.d.ts
|
|
1196
|
+
/**
|
|
1197
|
+
* A moment, such as when an event starts. Values are ISO 8601 with seconds
|
|
1198
|
+
* and `Z` or an offset like `+02:00`, `"2026-09-29T10:00:00Z"`. Same
|
|
1199
|
+
* options as `date`. A `migrationValue` loses its fractions of a second.
|
|
1200
|
+
*/
|
|
1201
|
+
declare function dateTime(input: DateFieldInput): DateTimeField;
|
|
1202
|
+
//#endregion
|
|
1203
|
+
//#region src/define/fields/float.d.ts
|
|
1204
|
+
/** A decimal number, such as a price or a rating. Same options as `int`. */
|
|
1205
|
+
declare function float(input: NumberFieldInput): FloatField;
|
|
1206
|
+
//#endregion
|
|
1207
|
+
//#region src/define/fields/int.d.ts
|
|
1208
|
+
/** A whole number, such as a count or a year. */
|
|
1209
|
+
declare function int(input: NumberFieldInput): IntField;
|
|
1210
|
+
//#endregion
|
|
1211
|
+
//#region src/define/fields/markdown.d.ts
|
|
1212
|
+
/**
|
|
1213
|
+
* Text written in Markdown. Studio's Markdown editor. Same options and
|
|
1214
|
+
* validations as `singleLine`.
|
|
1215
|
+
*/
|
|
1216
|
+
declare function markdown(input: StringFieldInput): MarkdownField;
|
|
1217
|
+
//#endregion
|
|
1218
|
+
//#region src/define/fields/multiline.d.ts
|
|
1219
|
+
/**
|
|
1220
|
+
* Text over several lines, such as a summary. Studio's text area editor.
|
|
1221
|
+
* Same options and validations as `singleLine`.
|
|
1222
|
+
*/
|
|
1223
|
+
declare function multiline(input: StringFieldInput): MultilineField;
|
|
64
1224
|
//#endregion
|
|
65
1225
|
//#region src/define/fields/referenceUnion.d.ts
|
|
66
1226
|
/** A reference to several models. On models every member declares `unionMember`. */
|
|
@@ -75,20 +1235,59 @@ declare function remote(_options: unknown): never;
|
|
|
75
1235
|
declare function richText(_options: unknown): never;
|
|
76
1236
|
//#endregion
|
|
77
1237
|
//#region src/define/fields/singleLine.d.ts
|
|
78
|
-
/**
|
|
79
|
-
|
|
1238
|
+
/**
|
|
1239
|
+
* One line of text, such as a heading or a title. Studio's single line
|
|
1240
|
+
* editor.
|
|
1241
|
+
*/
|
|
1242
|
+
declare function singleLine(input: StringFieldInput): SingleLineField;
|
|
80
1243
|
//#endregion
|
|
81
1244
|
//#region src/define/fields/slug.d.ts
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1245
|
+
/**
|
|
1246
|
+
* A slug holds one value and starts empty, so it takes no `list` and no
|
|
1247
|
+
* `initialValue`, as in Studio's form.
|
|
1248
|
+
*/
|
|
1249
|
+
type SlugFieldInput = FieldInput & LocalizedFieldInput & {
|
|
1250
|
+
/**
|
|
1251
|
+
* Whether no two entries may have the same slug. On a component, no two
|
|
1252
|
+
* instances of the component may, in any entry.
|
|
1253
|
+
* @default true
|
|
1254
|
+
*/
|
|
1255
|
+
unique?: UniqueFieldInput["unique"];
|
|
1256
|
+
/**
|
|
1257
|
+
* Whether Studio shows entries by their slug. On a component, Studio
|
|
1258
|
+
* labels each instance of the component by it. Not on a `HIDDEN` or
|
|
1259
|
+
* `API_ONLY` field.
|
|
1260
|
+
* @default false
|
|
1261
|
+
*/
|
|
1262
|
+
title?: boolean;
|
|
1263
|
+
/**
|
|
1264
|
+
* The value existing entries get when the field becomes required, or
|
|
1265
|
+
* is created required. Only used by the plan that makes it required;
|
|
1266
|
+
* safe to leave in place after. Needs `required: true`.
|
|
1267
|
+
*/
|
|
1268
|
+
migrationValue?: string;
|
|
1269
|
+
/** Checks on the slug before an entry saves. @default null */
|
|
1270
|
+
validations?: StringValidationRulesInput;
|
|
1271
|
+
/** Whether Studio lowercases the slug it generates from `template`. @default true */
|
|
1272
|
+
lowercase?: boolean;
|
|
1273
|
+
/**
|
|
1274
|
+
* Whether Studio makes the slug from `template`. Without it, editors
|
|
1275
|
+
* type the slug.
|
|
1276
|
+
* @default false
|
|
1277
|
+
*/
|
|
1278
|
+
autoGenerate?: boolean;
|
|
1279
|
+
/**
|
|
1280
|
+
* The fields Studio makes the slug from, each in braces, such as
|
|
1281
|
+
* `"{category}-{title}"`. Used while `autoGenerate` is on.
|
|
1282
|
+
* @default null
|
|
1283
|
+
*/
|
|
1284
|
+
template?: string;
|
|
1285
|
+
};
|
|
1286
|
+
/**
|
|
1287
|
+
* A URL friendly identifier. Studio's slug editor. Unique and lowercase
|
|
1288
|
+
* unless said otherwise, as Studio creates one.
|
|
1289
|
+
*/
|
|
1290
|
+
declare function slug(input: SlugFieldInput): SlugField;
|
|
92
1291
|
//#endregion
|
|
93
1292
|
//#region src/define/fields/unionMember.d.ts
|
|
94
1293
|
/** The slot a union's member model declares. All members share one `apiId`. Models only. */
|
|
@@ -98,46 +1297,443 @@ declare function unionMember(_options: unknown): never;
|
|
|
98
1297
|
/** An embedding. `dimension` is required (1 to 3072); `index` is refused above 2000. */
|
|
99
1298
|
declare function vector(_options: unknown): never;
|
|
100
1299
|
declare namespace index_d_exports$2 {
|
|
101
|
-
export { asset$1 as asset, boolean, color, component
|
|
1300
|
+
export { asset$1 as asset, boolean, color, component, componentUnion, date, dateTime, enumeration, float, int, json, location, markdown, multiline, referenceOneWay, referenceTwoWay, referenceUnion, remote, richText, singleLine, slug, string, taxonomy, unionMember, unsupported, vector };
|
|
102
1301
|
}
|
|
103
1302
|
//#endregion
|
|
104
|
-
//#region src/define/
|
|
105
|
-
/**
|
|
106
|
-
|
|
1303
|
+
//#region src/define/system/stage.d.ts
|
|
1304
|
+
/**
|
|
1305
|
+
* What `system.stage.draft()` and `system.stage.published()` hand back:
|
|
1306
|
+
* a stage Hygraph has in every environment, listed in `stages` for its
|
|
1307
|
+
* place only.
|
|
1308
|
+
*/
|
|
1309
|
+
type SystemStage = {
|
|
1310
|
+
__typename: "SystemStage";
|
|
1311
|
+
apiId: IRSystemStage["apiId"];
|
|
1312
|
+
};
|
|
1313
|
+
declare const stage$1: {
|
|
1314
|
+
/** Draft. Always the first of `stages`. */
|
|
1315
|
+
draft(): SystemStage;
|
|
1316
|
+
/** Published. Anywhere in `stages` after Draft. */
|
|
1317
|
+
published(): SystemStage;
|
|
1318
|
+
};
|
|
107
1319
|
//#endregion
|
|
108
|
-
//#region src/define/resources/
|
|
109
|
-
|
|
1320
|
+
//#region src/define/resources/locale-names.d.ts
|
|
1321
|
+
/**
|
|
1322
|
+
* The locales Studio's Display Name field offers, by displayName, each
|
|
1323
|
+
* with its apiId. Types only: it suggests one from the other in
|
|
1324
|
+
* `define.locale` and is never read at runtime. Keyed by displayName,
|
|
1325
|
+
* which is unique here; a few apiIds, such as `az_AZ`, have two.
|
|
1326
|
+
*/
|
|
1327
|
+
type LocaleNames = {
|
|
1328
|
+
Afrikaans: "af";
|
|
1329
|
+
"Afrikaans (South Africa)": "af_ZA";
|
|
1330
|
+
Arabic: "ar";
|
|
1331
|
+
"Arabic (U.A.E.)": "ar_AE";
|
|
1332
|
+
"Arabic (Bahrain)": "ar_BH";
|
|
1333
|
+
"Arabic (Algeria)": "ar_DZ";
|
|
1334
|
+
"Arabic (Egypt)": "ar_EG";
|
|
1335
|
+
"Arabic (Iraq)": "ar_IQ";
|
|
1336
|
+
"Arabic (Jordan)": "ar_JO";
|
|
1337
|
+
"Arabic (Kuwait)": "ar_KW";
|
|
1338
|
+
"Arabic (Lebanon)": "ar_LB";
|
|
1339
|
+
"Arabic (Libya)": "ar_LY";
|
|
1340
|
+
"Arabic (Morocco)": "ar_MA";
|
|
1341
|
+
"Arabic (Oman)": "ar_OM";
|
|
1342
|
+
"Arabic (Qatar)": "ar_QA";
|
|
1343
|
+
"Arabic (Saudi Arabia)": "ar_SA";
|
|
1344
|
+
"Arabic (Syria)": "ar_SY";
|
|
1345
|
+
"Arabic (Tunisia)": "ar_TN";
|
|
1346
|
+
"Arabic (Yemen)": "ar_YE";
|
|
1347
|
+
"Azeri (Latin)": "az";
|
|
1348
|
+
"Azeri (Latin) (Azerbaijan)": "az_AZ";
|
|
1349
|
+
"Azeri (Cyrillic) (Azerbaijan)": "az_AZ";
|
|
1350
|
+
Belarusian: "be";
|
|
1351
|
+
"Belarusian (Belarus)": "be_BY";
|
|
1352
|
+
Bulgarian: "bg";
|
|
1353
|
+
"Bulgarian (Bulgaria)": "bg_BG";
|
|
1354
|
+
"Bosnian (Bosnia and Herzegovina)": "bs_BA";
|
|
1355
|
+
Catalan: "ca";
|
|
1356
|
+
"Catalan (Spain)": "ca_ES";
|
|
1357
|
+
Czech: "cs";
|
|
1358
|
+
"Czech (Czech Republic)": "cs_CZ";
|
|
1359
|
+
Welsh: "cy";
|
|
1360
|
+
"Welsh (United Kingdom)": "cy_GB";
|
|
1361
|
+
Danish: "da";
|
|
1362
|
+
"Danish (Denmark)": "da_DK";
|
|
1363
|
+
German: "de";
|
|
1364
|
+
"German (Austria)": "de_AT";
|
|
1365
|
+
"German (Switzerland)": "de_CH";
|
|
1366
|
+
"German (Germany)": "de_DE";
|
|
1367
|
+
"German (Liechtenstein)": "de_LI";
|
|
1368
|
+
"German (Luxembourg)": "de_LU";
|
|
1369
|
+
Divehi: "dv";
|
|
1370
|
+
"Divehi (Maldives)": "dv_MV";
|
|
1371
|
+
Greek: "el";
|
|
1372
|
+
"Greek (Greece)": "el_GR";
|
|
1373
|
+
English: "en";
|
|
1374
|
+
"English (Australia)": "en_AU";
|
|
1375
|
+
"English (Belize)": "en_BZ";
|
|
1376
|
+
"English (Canada)": "en_CA";
|
|
1377
|
+
"English (Caribbean)": "en_CB";
|
|
1378
|
+
"English (United Kingdom)": "en_GB";
|
|
1379
|
+
"English (Ireland)": "en_IE";
|
|
1380
|
+
"English (Jamaica)": "en_JM";
|
|
1381
|
+
"English (New Zealand)": "en_NZ";
|
|
1382
|
+
"English (Republic of the Philippines)": "en_PH";
|
|
1383
|
+
"English (Trinidad and Tobago)": "en_TT";
|
|
1384
|
+
"English (United States)": "en_US";
|
|
1385
|
+
"English (South Africa)": "en_ZA";
|
|
1386
|
+
"English (Zimbabwe)": "en_ZW";
|
|
1387
|
+
Esperanto: "eo";
|
|
1388
|
+
Spanish: "es";
|
|
1389
|
+
"Spanish (Argentina)": "es_AR";
|
|
1390
|
+
"Spanish (Bolivia)": "es_BO";
|
|
1391
|
+
"Spanish (Chile)": "es_CL";
|
|
1392
|
+
"Spanish (Colombia)": "es_CO";
|
|
1393
|
+
"Spanish (Costa Rica)": "es_CR";
|
|
1394
|
+
"Spanish (Dominican Republic)": "es_DO";
|
|
1395
|
+
"Spanish (Ecuador)": "es_EC";
|
|
1396
|
+
"Spanish (Castilian)": "es_ES";
|
|
1397
|
+
"Spanish (Spain)": "es_ES";
|
|
1398
|
+
"Spanish (Guatemala)": "es_GT";
|
|
1399
|
+
"Spanish (Honduras)": "es_HN";
|
|
1400
|
+
"Spanish (Mexico)": "es_MX";
|
|
1401
|
+
"Spanish (Nicaragua)": "es_NI";
|
|
1402
|
+
"Spanish (Panama)": "es_PA";
|
|
1403
|
+
"Spanish (Peru)": "es_PE";
|
|
1404
|
+
"Spanish (Puerto Rico)": "es_PR";
|
|
1405
|
+
"Spanish (Paraguay)": "es_PY";
|
|
1406
|
+
"Spanish (El Salvador)": "es_SV";
|
|
1407
|
+
"Spanish (Uruguay)": "es_UY";
|
|
1408
|
+
"Spanish (Venezuela)": "es_VE";
|
|
1409
|
+
Estonian: "et";
|
|
1410
|
+
"Estonian (Estonia)": "et_EE";
|
|
1411
|
+
Basque: "eu";
|
|
1412
|
+
"Basque (Spain)": "eu_ES";
|
|
1413
|
+
Farsi: "fa";
|
|
1414
|
+
"Farsi (Iran)": "fa_IR";
|
|
1415
|
+
Finnish: "fi";
|
|
1416
|
+
"Finnish (Finland)": "fi_FI";
|
|
1417
|
+
Faroese: "fo";
|
|
1418
|
+
"Faroese (Faroe Islands)": "fo_FO";
|
|
1419
|
+
French: "fr";
|
|
1420
|
+
"French (Belgium)": "fr_BE";
|
|
1421
|
+
"French (Canada)": "fr_CA";
|
|
1422
|
+
"French (Switzerland)": "fr_CH";
|
|
1423
|
+
"French (France)": "fr_FR";
|
|
1424
|
+
"French (Luxembourg)": "fr_LU";
|
|
1425
|
+
"French (Principality of Monaco)": "fr_MC";
|
|
1426
|
+
Galician: "gl";
|
|
1427
|
+
"Galician (Spain)": "gl_ES";
|
|
1428
|
+
Gujarati: "gu";
|
|
1429
|
+
"Gujarati (India)": "gu_IN";
|
|
1430
|
+
Hebrew: "he";
|
|
1431
|
+
"Hebrew (Israel)": "he_IL";
|
|
1432
|
+
Hindi: "hi";
|
|
1433
|
+
"Hindi (India)": "hi_IN";
|
|
1434
|
+
Croatian: "hr";
|
|
1435
|
+
"Croatian (Bosnia and Herzegovina)": "hr_BA";
|
|
1436
|
+
"Croatian (Croatia)": "hr_HR";
|
|
1437
|
+
Hungarian: "hu";
|
|
1438
|
+
"Hungarian (Hungary)": "hu_HU";
|
|
1439
|
+
Armenian: "HY";
|
|
1440
|
+
"Armenian (Armenia)": "hy_AM";
|
|
1441
|
+
Indonesian: "id";
|
|
1442
|
+
"Indonesian (Indonesia)": "id_ID";
|
|
1443
|
+
Icelandic: "is";
|
|
1444
|
+
"Icelandic (Iceland)": "is_IS";
|
|
1445
|
+
Italian: "it";
|
|
1446
|
+
"Italian (Switzerland)": "it_CH";
|
|
1447
|
+
"Italian (Italy)": "it_IT";
|
|
1448
|
+
Japanese: "ja";
|
|
1449
|
+
"Japanese (Japan)": "ja_JP";
|
|
1450
|
+
Georgian: "ka";
|
|
1451
|
+
"Georgian (Georgia)": "ka_GE";
|
|
1452
|
+
Kazakh: "kk";
|
|
1453
|
+
"Kazakh (Kazakhstan)": "kk_KZ";
|
|
1454
|
+
Kannada: "kn";
|
|
1455
|
+
"Kannada (India)": "kn_IN";
|
|
1456
|
+
Korean: "ko";
|
|
1457
|
+
"Korean (Korea)": "ko_KR";
|
|
1458
|
+
Konkani: "kok";
|
|
1459
|
+
"Konkani (India)": "kok_IN";
|
|
1460
|
+
Kyrgyz: "ky";
|
|
1461
|
+
"Kyrgyz (Kyrgyzstan)": "ky_KG";
|
|
1462
|
+
Lithuanian: "lt";
|
|
1463
|
+
"Lithuanian (Lithuania)": "lt_LT";
|
|
1464
|
+
Latvian: "lv";
|
|
1465
|
+
"Latvian (Latvia)": "lv_LV";
|
|
1466
|
+
Maori: "mi";
|
|
1467
|
+
"Maori (New Zealand)": "mi_NZ";
|
|
1468
|
+
"FYRO Macedonian": "mk";
|
|
1469
|
+
"FYRO Macedonian (Former Yugoslav Republic of Macedonia)": "mk_MK";
|
|
1470
|
+
Mongolian: "mn";
|
|
1471
|
+
"Mongolian (Mongolia)": "mn_MN";
|
|
1472
|
+
Marathi: "mr";
|
|
1473
|
+
"Marathi (India)": "mr_IN";
|
|
1474
|
+
Malay: "ms";
|
|
1475
|
+
"Malay (Brunei Darussalam)": "ms_BN";
|
|
1476
|
+
"Malay (Malaysia)": "ms_MY";
|
|
1477
|
+
Maltese: "mt";
|
|
1478
|
+
"Maltese (Malta)": "mt_MT";
|
|
1479
|
+
"Norwegian (Bokmål)": "nb";
|
|
1480
|
+
"Norwegian (Bokmål) (Norway)": "nb_NO";
|
|
1481
|
+
Dutch: "nl";
|
|
1482
|
+
"Dutch (Belgium)": "nl_BE";
|
|
1483
|
+
"Dutch (Netherlands)": "nl_NL";
|
|
1484
|
+
"Norwegian (Nynorsk) (Norway)": "nn_NO";
|
|
1485
|
+
"Northern Sotho": "ns";
|
|
1486
|
+
"Northern Sotho (South Africa)": "ns_ZA";
|
|
1487
|
+
Punjabi: "pa";
|
|
1488
|
+
"Punjabi (India)": "pa_IN";
|
|
1489
|
+
Polish: "pl";
|
|
1490
|
+
"Polish (Poland)": "pl_PL";
|
|
1491
|
+
Pashto: "ps";
|
|
1492
|
+
"Pashto (Afghanistan)": "ps_AR";
|
|
1493
|
+
Portuguese: "pt";
|
|
1494
|
+
"Portuguese (Brazil)": "pt_BR";
|
|
1495
|
+
"Portuguese (Portugal)": "pt_PT";
|
|
1496
|
+
Quechua: "qu";
|
|
1497
|
+
"Quechua (Bolivia)": "qu_BO";
|
|
1498
|
+
"Quechua (Ecuador)": "qu_EC";
|
|
1499
|
+
"Quechua (Peru)": "qu_PE";
|
|
1500
|
+
Romanian: "ro";
|
|
1501
|
+
"Romanian (Romania)": "ro_RO";
|
|
1502
|
+
Russian: "ru";
|
|
1503
|
+
"Russian (Russia)": "ru_RU";
|
|
1504
|
+
Sanskrit: "sa";
|
|
1505
|
+
"Sanskrit (India)": "sa_IN";
|
|
1506
|
+
"Sami (Northern)": "se";
|
|
1507
|
+
"Sami (Northern) (Finland)": "se_FI";
|
|
1508
|
+
"Sami (Skolt) (Finland)": "se_FI";
|
|
1509
|
+
"Sami (Inari) (Finland)": "se_FI";
|
|
1510
|
+
"Sami (Northern) (Norway)": "se_NO";
|
|
1511
|
+
"Sami (Lule) (Norway)": "se_NO";
|
|
1512
|
+
"Sami (Southern) (Norway)": "se_NO";
|
|
1513
|
+
"Sami (Northern) (Sweden)": "se_SE";
|
|
1514
|
+
"Sami (Lule) (Sweden)": "se_SE";
|
|
1515
|
+
"Sami (Southern) (Sweden)": "se_SE";
|
|
1516
|
+
Slovak: "sk";
|
|
1517
|
+
"Slovak (Slovakia)": "sk_SK";
|
|
1518
|
+
Slovenian: "sl";
|
|
1519
|
+
"Slovenian (Slovenia)": "sl_SI";
|
|
1520
|
+
Albanian: "sq";
|
|
1521
|
+
"Albanian (Albania)": "sq_AL";
|
|
1522
|
+
"Serbian (Latin) (Bosnia and Herzegovina)": "sr_BA";
|
|
1523
|
+
"Serbian (Cyrillic) (Bosnia and Herzegovina)": "sr_BA";
|
|
1524
|
+
"Serbian (Latin) (Serbia and Montenegro)": "sr_SP";
|
|
1525
|
+
"Serbian (Cyrillic) (Serbia and Montenegro)": "sr_SP";
|
|
1526
|
+
Swedish: "sv";
|
|
1527
|
+
"Swedish (Finland)": "sv_FI";
|
|
1528
|
+
"Swedish (Sweden)": "sv_SE";
|
|
1529
|
+
Swahili: "sw";
|
|
1530
|
+
"Swahili (Kenya)": "sw_KE";
|
|
1531
|
+
Syriac: "syr";
|
|
1532
|
+
"Syriac (Syria)": "syr_SY";
|
|
1533
|
+
Tamil: "ta";
|
|
1534
|
+
"Tamil (India)": "ta_IN";
|
|
1535
|
+
Telugu: "te";
|
|
1536
|
+
"Telugu (India)": "te_IN";
|
|
1537
|
+
Thai: "th";
|
|
1538
|
+
"Thai (Thailand)": "th_TH";
|
|
1539
|
+
Tagalog: "tl";
|
|
1540
|
+
"Tagalog (Philippines)": "tl_PH";
|
|
1541
|
+
Tswana: "tn";
|
|
1542
|
+
"Tswana (South Africa)": "tn_ZA";
|
|
1543
|
+
Turkish: "tr";
|
|
1544
|
+
"Turkish (Turkey)": "tr_TR";
|
|
1545
|
+
Tatar: "tt";
|
|
1546
|
+
"Tatar (Russia)": "tt_RU";
|
|
1547
|
+
Tsonga: "ts";
|
|
1548
|
+
Ukrainian: "uk";
|
|
1549
|
+
"Ukrainian (Ukraine)": "uk_UA";
|
|
1550
|
+
Urdu: "ur";
|
|
1551
|
+
"Urdu (Islamic Republic of Pakistan)": "ur_PK";
|
|
1552
|
+
"Uzbek (Latin)": "uz";
|
|
1553
|
+
"Uzbek (Latin) (Uzbekistan)": "uz_UZ";
|
|
1554
|
+
"Uzbek (Cyrillic) (Uzbekistan)": "uz_UZ";
|
|
1555
|
+
Vietnamese: "vi";
|
|
1556
|
+
"Vietnamese (Viet Nam)": "vi_VN";
|
|
1557
|
+
Xhosa: "xh";
|
|
1558
|
+
"Xhosa (South Africa)": "xh_ZA";
|
|
1559
|
+
Chinese: "zh";
|
|
1560
|
+
"Chinese (S)": "zh_CN";
|
|
1561
|
+
"Chinese (Hong Kong)": "zh_HK";
|
|
1562
|
+
"Chinese (Macau)": "zh_MO";
|
|
1563
|
+
"Chinese (Singapore)": "zh_SG";
|
|
1564
|
+
"Chinese (T)": "zh_TW";
|
|
1565
|
+
Zulu: "zu";
|
|
1566
|
+
"Zulu (South Africa)": "zu_ZA";
|
|
1567
|
+
};
|
|
1568
|
+
//#endregion
|
|
1569
|
+
//#region src/define/resources/locale.d.ts
|
|
1570
|
+
/** A displayName in `LocaleNames`. */
|
|
1571
|
+
type KnownDisplayName = keyof LocaleNames;
|
|
1572
|
+
/** An apiId in `LocaleNames`. */
|
|
1573
|
+
type KnownApiId = LocaleNames[KnownDisplayName];
|
|
1574
|
+
/**
|
|
1575
|
+
* The apiId paired with `DisplayName`, or every known one while
|
|
1576
|
+
* `DisplayName` is not known, such as while it is still empty.
|
|
1577
|
+
*/
|
|
1578
|
+
type ApiIdFor<DisplayName> = DisplayName extends KnownDisplayName ? LocaleNames[DisplayName] : KnownApiId;
|
|
1579
|
+
/**
|
|
1580
|
+
* The displayNames paired with `ApiId` (a few apiIds have two), or every
|
|
1581
|
+
* known one while `ApiId` is not known.
|
|
1582
|
+
*/
|
|
1583
|
+
type DisplayNameFor<ApiId> = ApiId extends KnownApiId ? { [Name in KnownDisplayName]: ApiId extends LocaleNames[Name] ? Name : never; }[KnownDisplayName] : KnownDisplayName;
|
|
1584
|
+
/**
|
|
1585
|
+
* `DisplayName` and `ApiId` are the two as written. Each one suggests the
|
|
1586
|
+
* other from `LocaleNames`; any other pair is accepted too.
|
|
1587
|
+
*/
|
|
1588
|
+
type LocaleInput<DisplayName extends string = string, ApiId extends string = string> = {
|
|
1589
|
+
/**
|
|
1590
|
+
* How the API names the locale, such as `en` or `de_DE`. A letter, then
|
|
1591
|
+
* letters, digits and underscores, up to 64 characters.
|
|
1592
|
+
*/
|
|
1593
|
+
apiId: ApiId | NoInfer<ApiIdFor<DisplayName>>;
|
|
1594
|
+
/** The label editors see in Studio. Unique within the environment. */
|
|
1595
|
+
displayName: DisplayName | NoInfer<DisplayNameFor<ApiId>>;
|
|
1596
|
+
/** @default null */
|
|
1597
|
+
description?: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* The locale content is read in when a query names no locale. Exactly one
|
|
1600
|
+
* locale of the environment is the default. Hygraph cannot change it on an
|
|
1601
|
+
* existing environment yet: keep it on the locale that is the default now.
|
|
1602
|
+
* @default false
|
|
1603
|
+
*/
|
|
1604
|
+
isDefault?: boolean;
|
|
1605
|
+
/**
|
|
1606
|
+
* The apiId this locale has in Hygraph right now, when you are renaming
|
|
1607
|
+
* it. The rename keeps the content in that locale. Safe to leave in place
|
|
1608
|
+
* once applied.
|
|
1609
|
+
*/
|
|
1610
|
+
renamedFrom?: string;
|
|
1611
|
+
};
|
|
1612
|
+
/** What `define.locale` hands back: the input with every default filled in. */
|
|
1613
|
+
type Locale = {
|
|
1614
|
+
__typename: "Locale";
|
|
1615
|
+
apiId: string;
|
|
1616
|
+
displayName: string;
|
|
1617
|
+
description: string | null;
|
|
1618
|
+
isDefault: boolean;
|
|
1619
|
+
renamedFrom: string | null;
|
|
1620
|
+
};
|
|
1621
|
+
/**
|
|
1622
|
+
* A language or region content can be localized into. Fields take
|
|
1623
|
+
* `localized: true`; the locales themselves are listed in the
|
|
1624
|
+
* environment's `locales`.
|
|
1625
|
+
*
|
|
1626
|
+
* Nothing here is validated. Format rules, uniqueness and the one default
|
|
1627
|
+
* are plan-time checks, reported together with the rest of the config's.
|
|
1628
|
+
*/
|
|
1629
|
+
declare function locale<const DisplayName extends string, const ApiId extends string>(input: LocaleInput<DisplayName, ApiId>): Locale;
|
|
1630
|
+
//#endregion
|
|
1631
|
+
//#region src/define/resources/stage.d.ts
|
|
1632
|
+
type StageInput = {
|
|
1633
|
+
/**
|
|
1634
|
+
* How the API names the stage, such as `REVIEW`. A letter, then letters,
|
|
1635
|
+
* digits and underscores, up to 32 characters. `DRAFT` and `PUBLISHED`
|
|
1636
|
+
* are Hygraph's.
|
|
1637
|
+
*/
|
|
1638
|
+
apiId: string;
|
|
1639
|
+
/** The label editors see in Studio. Unique within the environment. */
|
|
1640
|
+
displayName: string;
|
|
1641
|
+
/** @default null */
|
|
1642
|
+
description?: string;
|
|
1643
|
+
/** The colour the stage is shown in. */
|
|
1644
|
+
color: IRStageColor;
|
|
1645
|
+
};
|
|
1646
|
+
/** What `define.stage` hands back: the input with every default filled in. */
|
|
1647
|
+
type Stage = {
|
|
1648
|
+
__typename: "Stage";
|
|
1649
|
+
apiId: string;
|
|
1650
|
+
displayName: string;
|
|
1651
|
+
description: string | null;
|
|
1652
|
+
color: IRStageColor;
|
|
1653
|
+
};
|
|
1654
|
+
/**
|
|
1655
|
+
* A content stage entries can be published to. The environment's `stages`
|
|
1656
|
+
* lists every stage in order, Draft and Published included, as
|
|
1657
|
+
* `system.stage.draft()` and `system.stage.published()`.
|
|
1658
|
+
*
|
|
1659
|
+
* Nothing here is validated. Format rules and uniqueness are plan-time
|
|
1660
|
+
* checks, reported together with the rest of the config's.
|
|
1661
|
+
*/
|
|
1662
|
+
declare function stage(input: StageInput): Stage;
|
|
110
1663
|
//#endregion
|
|
111
1664
|
//#region src/define/resources/environment.d.ts
|
|
112
|
-
|
|
113
|
-
|
|
1665
|
+
type EnvironmentInput = {
|
|
1666
|
+
/** Every locale of the environment, the default one included. */
|
|
1667
|
+
locales: Locale[];
|
|
1668
|
+
/**
|
|
1669
|
+
* Every stage, in the order editors move entries through them. Draft
|
|
1670
|
+
* comes first. Published can come anywhere after Draft, also between
|
|
1671
|
+
* two `define.stage` stages, such as
|
|
1672
|
+
* `[system.stage.draft(), Review, system.stage.published(), Legal]`.
|
|
1673
|
+
* Without stages of your own, it is
|
|
1674
|
+
* `[system.stage.draft(), system.stage.published()]`.
|
|
1675
|
+
*/
|
|
1676
|
+
stages: (Stage | SystemStage)[];
|
|
1677
|
+
/** @default [] */
|
|
1678
|
+
enumerations?: Enumeration[];
|
|
1679
|
+
/** @default [] */
|
|
1680
|
+
taxonomies?: Taxonomy[];
|
|
1681
|
+
/** @default [] */
|
|
1682
|
+
components?: Component[];
|
|
1683
|
+
models: Model[];
|
|
1684
|
+
};
|
|
1685
|
+
type Environment = {
|
|
1686
|
+
__typename: "Environment";
|
|
1687
|
+
locales: Locale[];
|
|
1688
|
+
stages: (Stage | SystemStage)[];
|
|
1689
|
+
enumerations: Enumeration[];
|
|
1690
|
+
taxonomies: Taxonomy[];
|
|
1691
|
+
components: Component[];
|
|
1692
|
+
models: Model[];
|
|
1693
|
+
};
|
|
1694
|
+
/**
|
|
1695
|
+
* One environment: typed arrays per resource kind. The what.
|
|
1696
|
+
*
|
|
1697
|
+
* Ordering, keying and positions are not decided here. This returns the
|
|
1698
|
+
* resources as written; `convertToIR` turns them into the canonical form.
|
|
1699
|
+
*/
|
|
1700
|
+
declare function environment(input: EnvironmentInput): Environment;
|
|
114
1701
|
//#endregion
|
|
115
1702
|
//#region src/define/resources/graphqlRemoteSource.d.ts
|
|
116
1703
|
declare function graphqlRemoteSource(_options: unknown): never;
|
|
117
1704
|
//#endregion
|
|
118
|
-
//#region src/define/resources/locale.d.ts
|
|
119
|
-
declare function locale(_options: unknown): never;
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/define/resources/model.d.ts
|
|
122
|
-
declare function model(_options: unknown): never;
|
|
123
|
-
//#endregion
|
|
124
1705
|
//#region src/define/resources/restRemoteSource.d.ts
|
|
125
1706
|
declare function restRemoteSource(_options: unknown): never;
|
|
126
1707
|
//#endregion
|
|
127
|
-
//#region src/define/resources/stage.d.ts
|
|
128
|
-
declare function stage(_options: unknown): never;
|
|
129
|
-
//#endregion
|
|
130
1708
|
//#region src/define/resources/target.d.ts
|
|
1709
|
+
type TargetInput = {
|
|
1710
|
+
name: string;
|
|
1711
|
+
project: string;
|
|
1712
|
+
environment: string;
|
|
1713
|
+
/**
|
|
1714
|
+
* The management API of the project's region, such as
|
|
1715
|
+
* `https://management-eu-central-1.hygraph.com/graphql`.
|
|
1716
|
+
*/
|
|
1717
|
+
endpoint: string;
|
|
1718
|
+
token: string;
|
|
1719
|
+
apply: Environment;
|
|
1720
|
+
};
|
|
1721
|
+
type Target = {
|
|
1722
|
+
__typename: "Target";
|
|
1723
|
+
name: string;
|
|
1724
|
+
project: string;
|
|
1725
|
+
environment: string;
|
|
1726
|
+
endpoint: string;
|
|
1727
|
+
token: string;
|
|
1728
|
+
apply: Environment;
|
|
1729
|
+
};
|
|
131
1730
|
/**
|
|
132
|
-
* One environment of one project,
|
|
133
|
-
* definition to apply there. The where.
|
|
1731
|
+
* One environment of one project, where to reach it and the token to do so,
|
|
1732
|
+
* and the environment definition to apply there. The where.
|
|
134
1733
|
*/
|
|
135
|
-
declare function target(
|
|
136
|
-
//#endregion
|
|
137
|
-
//#region src/define/resources/taxonomy.d.ts
|
|
138
|
-
declare function taxonomy(_options: unknown): never;
|
|
1734
|
+
declare function target(input: TargetInput): Target;
|
|
139
1735
|
declare namespace index_d_exports {
|
|
140
|
-
export { component, enumeration, environment, index_d_exports$2 as field, graphqlRemoteSource, locale, model, restRemoteSource, stage, target, taxonomy };
|
|
1736
|
+
export { component$1 as component, enumeration$1 as enumeration, environment, index_d_exports$2 as field, graphqlRemoteSource, locale, model, restRemoteSource, stage, target, taxonomy$1 as taxonomy };
|
|
141
1737
|
}
|
|
142
1738
|
//#endregion
|
|
143
1739
|
//#region src/define/system/asset.d.ts
|
|
@@ -149,7 +1745,25 @@ declare function query(_options?: unknown): never;
|
|
|
149
1745
|
//#region src/define/system/segment.d.ts
|
|
150
1746
|
declare function segment(_options?: unknown): never;
|
|
151
1747
|
declare namespace index_d_exports$1 {
|
|
152
|
-
export { asset, query, segment };
|
|
1748
|
+
export { asset, query, segment, stage$1 as stage };
|
|
1749
|
+
}
|
|
1750
|
+
//#endregion
|
|
1751
|
+
//#region src/define.d.ts
|
|
1752
|
+
/**
|
|
1753
|
+
* `process.env`, which a config reads its token from, for projects without
|
|
1754
|
+
* @types/node. Declared as @types/node declares it, so the two merge where
|
|
1755
|
+
* both are present.
|
|
1756
|
+
*/
|
|
1757
|
+
declare global {
|
|
1758
|
+
namespace NodeJS {
|
|
1759
|
+
interface ProcessEnv {
|
|
1760
|
+
[key: string]: string | undefined;
|
|
1761
|
+
}
|
|
1762
|
+
interface Process {
|
|
1763
|
+
env: ProcessEnv;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
var process: NodeJS.Process;
|
|
153
1767
|
}
|
|
154
1768
|
//#endregion
|
|
155
1769
|
export { index_d_exports as define, index_d_exports$1 as system };
|