@contentchef/contentchef-types 11.0.0-alpha.5 → 11.0.0-alpha.7

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.
@@ -1,6 +1,6 @@
1
1
  import { AuthorResponse } from './Author';
2
2
  import { PagedListResponse } from './common';
3
- import { ContentDefinitionId } from './ContentDefinition';
3
+ import { DimensionAssignment } from './Dimension';
4
4
 
5
5
  /**
6
6
  * The audience unique id
@@ -8,34 +8,82 @@ import { ContentDefinitionId } from './ContentDefinition';
8
8
  export type AudienceId = number;
9
9
 
10
10
  /**
11
- * An audience's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
12
- * underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
13
- * travel in the delivery `audiences` query param and are compared against strings a client supplies
11
+ * An audience's mnemonicId must match this pattern, and is at least 2 characters long. Lowercase like
12
+ * a dimension's, and immutable once created: contents, CSV files, the publishing snapshot and delivery
13
+ * all reference an audience by it
14
14
  */
15
15
  export const AUDIENCE_NAME_PATTERN = /^[a-z0-9_-]+$/;
16
16
 
17
17
  /**
18
- * This type represent one key of an audience, that is one of the values a visitor can have for it
18
+ * This type represent the condition of an audience rule on a single dimension: the visitor's value for
19
+ * [[dimension]] has to be one of [[in]]
19
20
  */
20
- export type AudienceKey = {
21
+ export type DimensionPredicate = {
21
22
  /**
22
- * The key, matching [[AUDIENCE_NAME_PATTERN]]
23
+ * The mnemonic id of the dimension this predicate constrains
23
24
  */
24
- key: string;
25
+ dimension: string;
25
26
  /**
26
- * A deprecated key cannot be referenced by new content rules, while every rule already written
27
- * keeps resolving. The flag toggles both ways
27
+ * The keys of the dimension that satisfy this predicate, at least one
28
28
  */
29
- deprecated?: boolean;
29
+ in: string[];
30
+ /**
31
+ * Set this value to also satisfy the predicate when the dimension was not provided at all
32
+ *
33
+ * Not-provided is not a key, so no list of keys can express it, and an enumeration would silently
34
+ * narrow the moment a key is added to the dimension. A key that was provided but is not listed does
35
+ * not satisfy this flag: the audience simply does not match
36
+ */
37
+ orUnset?: boolean;
38
+ };
39
+
40
+ /**
41
+ * This type represent a condition satisfied when every child condition is satisfied
42
+ */
43
+ export type AllDimensionPredicate = {
44
+ all: AudienceRule[];
45
+ };
46
+
47
+ /**
48
+ * This type represent a condition satisfied when at least one child condition is satisfied
49
+ */
50
+ export type AnyDimensionPredicate = {
51
+ any: AudienceRule[];
52
+ };
53
+
54
+ /**
55
+ * This type represent the rule of an audience: or within a dimension, and between dimensions
56
+ *
57
+ * The stored form is a tree so that new kinds of condition stay additive, but an editor only needs to
58
+ * build an [[AllDimensionPredicate]] of one [[DimensionPredicate]] per dimension. A dimension the rule
59
+ * does not mention is unconstrained, which is a different thing from one listed with
60
+ * [[DimensionPredicate.orUnset]]. `{ all: [] }` matches everyone
61
+ */
62
+ export type AudienceRule = DimensionPredicate | AllDimensionPredicate | AnyDimensionPredicate;
63
+
64
+ /**
65
+ * This type represent one dimension key an audience rule references. `key` is absent for a rule that
66
+ * constrains the dimension without naming a key
67
+ */
68
+ export type DimensionKeyReference = {
69
+ /**
70
+ * The dimension mnemonic id
71
+ */
72
+ dimension: string;
73
+ /**
74
+ * The key, absent when the rule names none
75
+ */
76
+ key?: string;
30
77
  };
31
78
 
32
79
  /**
33
- * This type represent the model of an audience, that is a dimension a content can vary by - `gender`,
34
- * `loyalty`, `auth_status` - holding the fixed set of keys a visitor can have for it
80
+ * This type represent the model of an audience, that is a named rule over dimensions -
81
+ * "authenticated users with a silver card" - written once and referenced by mnemonicId from every
82
+ * content that wants it
35
83
  *
36
- * Contents reference an audience by mnemonicId and key inside their rules, and definitions by
37
- * mnemonicId, so audiences are archived and never deleted, and a key can only be removed or renamed
38
- * while no content references it
84
+ * Nothing to evaluate lives in a content: a personalized field lists audiences, and the rules stay
85
+ * here. Audiences are archived and never deleted, and archiving is refused while a content still
86
+ * references one
39
87
  */
40
88
  export type AudienceResponse = {
41
89
  /**
@@ -51,9 +99,14 @@ export type AudienceResponse = {
51
99
  */
52
100
  mnemonicId: string;
53
101
  /**
54
- * The keys a visitor can hold for this audience, each carrying its own deprecation state
102
+ * The rule that decides whether a visitor belongs to this audience
103
+ */
104
+ rule: AudienceRule;
105
+ /**
106
+ * The dimension keys the rule references, derived from it on every save. This is what makes a
107
+ * dimension key removable or not
55
108
  */
56
- keys: AudienceKey[];
109
+ usedDimensionKeys: DimensionKeyReference[];
57
110
  /**
58
111
  * The archived status of the audience
59
112
  */
@@ -88,6 +141,11 @@ export type ListAudiencesFilters = {
88
141
  * This filter is used to retrieve archived or not archived audiences. Defaults to not archived
89
142
  */
90
143
  archived?: boolean;
144
+ /**
145
+ * This filter is used to search audiences whose name or mnemonic id contain the value inserted,
146
+ * case insensitively. At most 100 characters
147
+ */
148
+ name?: string;
91
149
  };
92
150
 
93
151
  /**
@@ -109,48 +167,25 @@ export type ListAudiencesRequest = {
109
167
  };
110
168
 
111
169
  /**
112
- * This type represent the item of a list audiences API request
113
- */
114
- export type ListAudiencesItem = AudienceResponse;
115
-
116
- /**
117
- * This type represent the response of a list audiences API request
170
+ * This type represent the item of a list audiences API request: the audience with its rule read back
171
+ * in words, which is what a picker shows. No usage count, that is one query per audience and belongs
172
+ * to [[GetAudienceResponse]]
118
173
  */
119
- export type ListAudiencesResponse = PagedListResponse<ListAudiencesItem>;
120
-
121
- /**
122
- * This type represent the usage of one key of an audience. A key with no entry is used by no content,
123
- * and is therefore the only kind of key that can be removed or renamed
124
- */
125
- export type AudienceKeyUsage = {
174
+ export type ListAudiencesItem = AudienceResponse & {
126
175
  /**
127
- * The key, or null for the rules that constrain the audience without naming any key - that is the
128
- * ones that only fire when the audience is unknown
176
+ * The rule in words, so it reads without decoding a predicate
129
177
  */
130
- key: string | null;
178
+ description: string;
131
179
  /**
132
- * How many contents reference this key
180
+ * The mnemonic ids of the dimensions the rule depends on
133
181
  */
134
- contents: number;
182
+ dimensions: string[];
135
183
  };
136
184
 
137
185
  /**
138
- * This type represent a content definition that declares an audience
186
+ * This type represent the response of a list audiences API request
139
187
  */
140
- export type DefinitionUsingAudience = {
141
- /**
142
- * The content definition unique id
143
- */
144
- id: ContentDefinitionId;
145
- /**
146
- * The content definition mnemonic id
147
- */
148
- mnemonicId: string;
149
- /**
150
- * The content definition name
151
- */
152
- name: string;
153
- };
188
+ export type ListAudiencesResponse = PagedListResponse<ListAudiencesItem>;
154
189
 
155
190
  /**
156
191
  * This type represent the data needed to make a get audience API request
@@ -163,18 +198,20 @@ export type GetAudienceRequest = {
163
198
  };
164
199
 
165
200
  /**
166
- * This type represent the response of a get audience API request: the audience, plus the two things the
167
- * editor cannot decide without, which keys are in use and which definitions vary by this audience
201
+ * This type represent the response of a get audience API request: the audience, plus what the editor
202
+ * cannot derive on its own - the rule in words, the dimensions it depends on, and how many contents
203
+ * reference it, which is exactly the guard archiving enforces
168
204
  */
169
- export type GetAudienceResponse = AudienceResponse & {
170
- /**
171
- * One entry per key at least one content references. A key absent from this list is unused
172
- */
173
- keyUsage: AudienceKeyUsage[];
205
+ export type GetAudienceResponse = ListAudiencesItem & {
174
206
  /**
175
- * The content definitions declaring this audience
207
+ * How much of the space depends on this audience
176
208
  */
177
- definitions: DefinitionUsingAudience[];
209
+ usage: {
210
+ /**
211
+ * How many contents reference this audience. Archiving is refused while this is not zero
212
+ */
213
+ contents: number;
214
+ };
178
215
  };
179
216
 
180
217
  /**
@@ -186,13 +223,14 @@ export type CreateAudienceRequest = {
186
223
  */
187
224
  name: string;
188
225
  /**
189
- * The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
226
+ * The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]. It cannot be changed afterwards
190
227
  */
191
228
  mnemonicId: string;
192
229
  /**
193
- * The keys a visitor can hold for this audience, at least one, each key unique
230
+ * The rule over dimensions. Every dimension it names has to exist in the space and not be
231
+ * archived, and every key has to exist on its dimension and not be deprecated
194
232
  */
195
- keys: AudienceKey[];
233
+ rule: AudienceRule;
196
234
  };
197
235
 
198
236
  /**
@@ -203,9 +241,8 @@ export type CreateAudienceResponse = AudienceResponse;
203
241
  /**
204
242
  * This type represent the data needed to make an update audience API request
205
243
  *
206
- * `keys` replaces the whole stored list, deprecation flags included. Adding keys and toggling
207
- * deprecation are always allowed, while removing or renaming a key is refused while a content still
208
- * references it. `mnemonicId` cannot be changed
244
+ * The rule may change freely even while contents reference the audience: the change reaching delivery
245
+ * on the next publish of any content that uses it is the point of naming an audience once
209
246
  */
210
247
  export type UpdateAudienceRequest = {
211
248
  /**
@@ -221,9 +258,9 @@ export type UpdateAudienceRequest = {
221
258
  */
222
259
  mnemonicId: string;
223
260
  /**
224
- * The whole key list, replacing what is stored
261
+ * The rule, replacing what is stored
225
262
  */
226
- keys: AudienceKey[];
263
+ rule: AudienceRule;
227
264
  };
228
265
 
229
266
  /**
@@ -240,7 +277,8 @@ export type ToggleArchivedAudienceRequest = {
240
277
  */
241
278
  id: AudienceId;
242
279
  /**
243
- * This value represent the archive status to set in the specified audience
280
+ * This value represent the archive status to set in the specified audience. Archiving is refused
281
+ * with an `AudienceInUse` error while any content references the audience
244
282
  */
245
283
  archived: boolean;
246
284
  };
@@ -251,137 +289,74 @@ export type ToggleArchivedAudienceRequest = {
251
289
  export type ToggleArchivedAudienceResponse = AudienceResponse;
252
290
 
253
291
  /**
254
- * This type represent the condition of one rule on a single audience: the visitor's value for
255
- * [[audience]] has to be one of [[in]]
292
+ * Thin enum represent all audience rule violations error codes, reported by the create and update
293
+ * audience API requests through the `violations` of an `InvalidAudienceRule` error
256
294
  */
257
- export type AudiencePredicate = {
258
- /**
259
- * The mnemonic id of the audience this predicate constrains, which the field must declare
260
- */
261
- audience: string;
262
- /**
263
- * The keys of the audience that satisfy this predicate
264
- */
265
- in: string[];
266
- /**
267
- * Set this value to also satisfy the predicate when the audience was not provided at all
268
- *
269
- * Not-provided is not a key, so no list of keys can express it, and an enumeration would silently
270
- * narrow the moment a key is added to the audience. A key that was provided but is not listed does
271
- * not satisfy this flag: it falls through to the field's fallback
272
- */
273
- orUnset?: boolean;
274
- };
295
+ export enum AudienceRuleViolationCodes {
296
+ ruleMissing = 'audienceRule.ruleMissing',
297
+ unknownShape = 'audienceRule.unknownShape',
298
+ groupIsNotAnArray = 'audienceRule.groupIsNotAnArray',
299
+ dimensionIsNotAString = 'audienceRule.dimensionIsNotAString',
300
+ inIsNotAnArray = 'audienceRule.inIsNotAnArray',
301
+ inIsEmpty = 'audienceRule.inIsEmpty',
302
+ keyIsNotAString = 'audienceRule.keyIsNotAString',
303
+ orUnsetIsNotABoolean = 'audienceRule.orUnsetIsNotABoolean',
304
+ dimensionNotFound = 'audienceRule.dimensionNotFound',
305
+ dimensionArchived = 'audienceRule.dimensionArchived',
306
+ dimensionKeyNotFound = 'audienceRule.dimensionKeyNotFound',
307
+ dimensionKeyDeprecated = 'audienceRule.dimensionKeyDeprecated'
308
+ }
275
309
 
276
310
  /**
277
- * This type represent a condition satisfied when every child condition is satisfied
311
+ * This type represent one problem found in an audience rule, carrying the path of the offending node
278
312
  */
279
- export type AllAudiencePredicate = {
280
- all: AudienceRuleCondition[];
281
- };
282
-
283
- /**
284
- * This type represent a condition satisfied when at least one child condition is satisfied
285
- */
286
- export type AnyAudiencePredicate = {
287
- any: AudienceRuleCondition[];
288
- };
289
-
290
- /**
291
- * This type represent the condition of a rule
292
- *
293
- * The stored form is a tree so that new kinds of condition stay additive, but an editor only needs to
294
- * build an [[AllAudiencePredicate]] of one [[AudiencePredicate]] per audience: or within an audience, and
295
- * between audiences. An audience the condition does not mention is unconstrained, which is a different
296
- * thing from one listed with [[AudiencePredicate.orUnset]]
297
- */
298
- export type AudienceRuleCondition = AudiencePredicate | AllAudiencePredicate | AnyAudiencePredicate;
299
-
300
- /**
301
- * This type represent one rule of a personalized field: the condition, and the value to serve when it wins
302
- * @template T The type of the value served by the rule, which conforms to the field's `variantType`
303
- */
304
- export type PersonalizedRule<T = any> = {
305
- /**
306
- * The rule id, unique in the field. Used for diagnostics only, matching never reads it
307
- */
308
- id?: string;
313
+ export type AudienceRuleViolation = {
309
314
  /**
310
- * The condition under which this rule wins
315
+ * The error code discriminator, one of [[AudienceRuleViolationCodes]]
311
316
  */
312
- when: AudienceRuleCondition;
317
+ code: string;
313
318
  /**
314
- * The value served when this rule wins
319
+ * The path of the rejected node inside the rule, for instance `rule.all.0.in.1`
315
320
  */
316
- value: T;
317
- };
318
-
319
- /**
320
- * This type represent the value a personalized field holds in a content payload: an ordered list of
321
- * rules, first match wins, and the fallback served when no rule matches
322
- *
323
- * The fallback is mandatory exactly when the field is required, which keeps the delivery contract of a
324
- * personalized field the same as any other field. Zero rules is legal: the field is then just its fallback
325
- * @template T The type of the served values, which conform to the field's `variantType`
326
- */
327
- export type PersonalizedFieldPayload<T = any> = {
321
+ path: string;
328
322
  /**
329
- * The rules, in the order they are evaluated in
323
+ * The dimension the node names, when the violation is about one
330
324
  */
331
- rules?: PersonalizedRule<T>[];
325
+ dimension?: string;
332
326
  /**
333
- * The value served when no rule matches
327
+ * The key the node names, when the violation is about one
334
328
  */
335
- fallback?: T;
336
- };
337
-
338
- /**
339
- * This type represent the visitor's value per audience, as the rule engine reads it. An audience missing
340
- * from the map, or set to `undefined`, means "not provided" - which is what
341
- * [[AudiencePredicate.orUnset]] answers
342
- */
343
- export type AudienceAssignment = {
344
- [audienceMnemonicId: string]: string | undefined;
329
+ key?: string;
345
330
  };
346
331
 
347
332
  /**
348
- * The stand-in a coverage report uses for "a key none of the rules mention"
349
- *
350
- * Not a real key - it cannot be one, since keys match [[AUDIENCE_NAME_PATTERN]]. A rule only ever tests
351
- * membership in its own list, so every unmentioned key behaves identically and one case covers them
352
- * all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which real
353
- * keys it stood for
354
- */
355
- export const OTHER_KEY = '<any other key>';
356
-
357
- /**
358
- * This type represent how much of a rule list one rule actually serves
333
+ * This type represent how much of an analysed audience list one audience actually serves
359
334
  */
360
335
  export type RuleCoverage = {
361
336
  /**
362
- * The position of the rule in the analysed list
337
+ * The position of the audience in the analysed list
363
338
  */
364
339
  index: number;
365
340
  /**
366
- * The rule id, when it carries one
341
+ * The audience mnemonic id
367
342
  */
368
343
  id?: string;
369
344
  /**
370
- * The condition in words, so a finding reads without decoding a predicate
345
+ * The rule in words, so a finding reads without decoding a predicate
371
346
  */
372
347
  condition: string;
373
348
  /**
374
- * How many of the analysed assignments this rule wins. Zero means it can never serve anyone
349
+ * How many of the analysed assignments this audience wins. Zero means it can never serve anyone
375
350
  */
376
351
  wins: number;
377
352
  };
378
353
 
379
354
  /**
380
- * This type represent what an ordered rule list covers, worked out from the rules and the audiences'
381
- * keys alone - no request traffic is involved
355
+ * This type represent what an ordered list of audiences covers, worked out from their rules and the
356
+ * dimensions' keys alone - no request traffic is involved
382
357
  *
383
358
  * The findings are advisory and never validation violations: a gap is usually deliberate, that being
384
- * what a fallback is for, while an unreachable rule is almost always a mistake
359
+ * what a fallback is for, while an unreachable audience is almost always a mistake
385
360
  */
386
361
  export type CoverageReport = {
387
362
  /**
@@ -389,78 +364,89 @@ export type CoverageReport = {
389
364
  */
390
365
  combinations: number;
391
366
  /**
392
- * One entry per analysed rule, in author order
367
+ * One entry per analysed audience, in the order they were sent, its `id` being the mnemonic id. An
368
+ * audience the space does not have has no rule to analyse and contributes no entry, so this can be
369
+ * shorter than the request
393
370
  */
394
371
  rules: RuleCoverage[];
395
372
  /**
396
- * The rules that win nothing: shadowed by an earlier rule, or self-contradictory
373
+ * The audiences that win nothing: shadowed by an earlier one, or self-contradictory
397
374
  */
398
375
  unreachableRules: RuleCoverage[];
399
376
  /**
400
- * The assignments no rule claims, so they reach the fallback. Capped at 25 entries, while
377
+ * The assignments no audience claims, so they reach the fallback. Capped at 25 entries, while
401
378
  * [[fallbackCount]] is the real total
402
379
  */
403
- fallbackAssignments: AudienceAssignment[];
380
+ fallbackAssignments: DimensionAssignment[];
404
381
  /**
405
382
  * How many assignments reach the fallback, of [[combinations]]
406
383
  */
407
384
  fallbackCount: number;
408
385
  /**
409
- * The audiences declared by the field but constrained by no rule, so they change nothing about what
410
- * it serves
386
+ * What [[OTHER_KEY]] stood for, per dimension: the real unmentioned keys, capped at 10, with their
387
+ * total. Only the dimensions that needed the stand-in appear
411
388
  */
412
- unusedAudiences: string[];
389
+ otherKeys: { [dimension: string]: { keys: string[]; total: number } };
413
390
  /**
414
- * What [[OTHER_KEY]] stood for, per audience: the real unmentioned keys, capped at 10, with their
415
- * total. Only the audiences that needed the stand-in appear
416
- */
417
- otherKeys: { [audience: string]: { keys: string[]; total: number } };
418
- /**
419
- * Set when the rules and their audiences were too large to enumerate. Everything else is then
391
+ * Set when the rules and their dimensions were too large to enumerate. Everything else is then
420
392
  * unpopulated rather than guessed, because a sampled "no gaps" is not a fact
421
393
  */
422
394
  notAnalysed?: { reason: 'tooManyCombinations'; combinations: number };
423
395
  };
424
396
 
425
397
  /**
426
- * This type represent one rule as the analyse rules API request takes it: the condition, and nothing
427
- * about what the rule serves. Coverage is decided by conditions only, so the values stay out of the
428
- * request - and a half written rule with no condition is analysed as one that matches nothing rather
429
- * than refused
398
+ * This type represent the data needed to make an analyse rules API request, which is what a
399
+ * personalized field's editor asks about the variants on screen, before anything is saved
400
+ *
401
+ * The rules and the dimensions' keys are read from the space, so a client sends the audiences and
402
+ * nothing else
430
403
  */
431
- export type PersonalizedRuleDraft = {
432
- /**
433
- * The rule id, when it carries one. Reported back on the finding, so a client can match a finding
434
- * to the rule on screen without relying on the index
435
- */
436
- id?: string;
404
+ export type AnalyseAudienceRulesRequest = {
437
405
  /**
438
- * The condition under which this rule wins
406
+ * The audience mnemonic ids in the order the variants list them, at most 20. The order is the
407
+ * whole point: the first listed audience that matches wins, so one being unreachable is a
408
+ * consequence of what precedes it
439
409
  */
440
- when?: AudienceRuleCondition;
410
+ audiences: string[];
441
411
  };
442
412
 
443
413
  /**
444
- * This type represent the data needed to make an analyse rules API request, which is what a field's
445
- * rule editor asks about the rules on screen, before anything is saved
446
- *
447
- * The keys of every audience are read from the space rather than taken from the request, so a client
448
- * never has to hold them or keep them current
414
+ * This type represent the response of an analyse rules API request
449
415
  */
450
- export type AnalyseAudienceRulesRequest = {
416
+ export type AnalyseAudienceRulesResponse = CoverageReport;
417
+
418
+ /**
419
+ * This type represent one variant of a personalized field: the audience served, and the value to
420
+ * serve it
421
+ * @template T The type of the served value, which conforms to the field's `variantType`
422
+ */
423
+ export type PersonalizedVariant<T = any> = {
451
424
  /**
452
- * The mnemonic ids of the audiences the field varies by, at most 20. The analysis is bounded by
453
- * these, as the field's rules are
425
+ * The mnemonic id of the audience this variant serves
454
426
  */
455
- audiences: string[];
427
+ audience: string;
456
428
  /**
457
- * The rules in author order, at most 200. The order is the whole point: first match wins, so a rule
458
- * being unreachable is a consequence of what precedes it
429
+ * The value served when this variant wins
459
430
  */
460
- rules: PersonalizedRuleDraft[];
431
+ value: T;
461
432
  };
462
433
 
463
434
  /**
464
- * This type represent the response of an analyse rules API request
435
+ * This type represent the value a personalized field holds in a content payload: an ordered list of
436
+ * variants, the first whose audience matches the visitor wins, and the fallback served when none does
437
+ *
438
+ * The fallback is mandatory exactly when the field is required, which keeps the delivery contract of a
439
+ * personalized field the same as any other field. Zero variants is legal: the field is then just its
440
+ * fallback
441
+ * @template T The type of the served values, which conform to the field's `variantType`
465
442
  */
466
- export type AnalyseAudienceRulesResponse = CoverageReport;
443
+ export type PersonalizedFieldPayload<T = any> = {
444
+ /**
445
+ * The variants, in the order they are evaluated in
446
+ */
447
+ variants?: PersonalizedVariant<T>[];
448
+ /**
449
+ * The value served when no variant's audience matches
450
+ */
451
+ fallback?: T;
452
+ };
@@ -404,9 +404,8 @@ export type ListContentsFilters = {
404
404
  translationStatus?: ContentTranslationStatus;
405
405
 
406
406
  /**
407
- * This filter is used to search contents whose personalized fields have rules referencing the audiences
408
- * inserted, as `audience` or `audience:key` tokens. A bare `audience` matches whichever key a content
409
- * uses it with, and several tokens narrow the result like `tags` do
407
+ * This filter is used to search contents whose personalized fields have a variant serving one of the
408
+ * audience mnemonic ids inserted. Several of them narrow the result like `tags` do
410
409
  */
411
410
  audiences?: string[];
412
411
  };
@@ -847,16 +846,13 @@ export enum ContentFieldViolationCodes {
847
846
  textFieldValueIsNotAString = "textField.valueIsNotAString",
848
847
  textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
849
848
  personalizedFieldValueIsNotPersonalized = "personalizedField.valueIsNotPersonalized",
850
- personalizedFieldRulesIsNotAnArray = "personalizedField.rulesIsNotAnArray",
851
- personalizedFieldRuleIsNotAnObject = "personalizedField.ruleIsNotAnObject",
852
- personalizedFieldRuleConditionMissing = "personalizedField.ruleConditionMissing",
853
- personalizedFieldDuplicateRuleId = "personalizedField.duplicateRuleId",
854
- personalizedFieldAudienceNotDeclared = "personalizedField.audienceNotDeclared",
855
- personalizedFieldFallbackRequired = "personalizedField.fallbackRequired",
849
+ personalizedFieldVariantsIsNotAnArray = "personalizedField.variantsIsNotAnArray",
850
+ personalizedFieldVariantIsNotAnObject = "personalizedField.variantIsNotAnObject",
851
+ personalizedFieldAudienceMissing = "personalizedField.audienceMissing",
856
852
  personalizedFieldAudienceNotFound = "personalizedField.audienceNotFound",
857
853
  personalizedFieldAudienceArchived = "personalizedField.audienceArchived",
858
- personalizedFieldAudienceKeyNotFound = "personalizedField.audienceKeyNotFound",
859
- personalizedFieldAudienceKeyDeprecated = "personalizedField.audienceKeyDeprecated",
854
+ personalizedFieldDuplicateAudience = "personalizedField.duplicateAudience",
855
+ personalizedFieldFallbackRequired = "personalizedField.fallbackRequired",
860
856
  }
861
857
 
862
858
  /**
@@ -913,7 +909,8 @@ export type AnalysePersonalizedRulesRequest = {
913
909
  };
914
910
 
915
911
  /**
916
- * This type represent the coverage of one personalized field of a content
912
+ * This type represent the coverage of one personalized field of a content, that is what the audiences
913
+ * of its variants cover
917
914
  */
918
915
  export type PersonalizedFieldCoverage = CoverageReport & {
919
916
  /**
@@ -189,12 +189,6 @@ export type ContentDefinitionResponse = {
189
189
  * Valued with paths to each array or null if definition is legacy
190
190
  */
191
191
  trackableArrayFields?: ArrayField[] | null;
192
-
193
- /**
194
- * The mnemonic ids of the audiences this definition's personalized fields vary by
195
- * Derived from the schema on every save, never assigned by the client
196
- */
197
- audiences?: string[];
198
192
  };
199
193
 
200
194
  /**
@@ -287,15 +281,6 @@ export type ContentDefinitionSchemaErrors = {
287
281
  * This attribute represents an error if the language of the schema is not a valid string
288
282
  */
289
283
  lang?: string;
290
- /**
291
- * This attribute represents all the error that occurs inside the audiences declaration of the
292
- * definition schema object
293
- *
294
- * - The value is a string if the audiences value is not in the expected format
295
- * - The value is a list of AttributeViolation, one per declared audience that does not exist in the
296
- * space or is archived
297
- */
298
- audiences?: string | AttributeViolation[];
299
284
  };
300
285
 
301
286
  /**
@@ -431,9 +416,5 @@ export enum SchemaFieldViolationCodes {
431
416
  translatableNotAllowed = 'translatableNotAllowed',
432
417
  invalidEnumValue = 'invalidEnumValue',
433
418
  compactCannotBeNested = 'compactCannotBeNested',
434
- audienceTypeNotAllowed = 'audienceTypeNotAllowed',
435
- audienceNameNotFound = 'audienceNameNotFound',
436
- audienceArchived = 'audienceArchived',
437
- audienceNotDeclaredByDefinition = 'audienceNotDeclaredByDefinition',
438
- duplicateAudienceName = 'duplicateAudienceName'
419
+ variantTypeNotAllowed = 'variantTypeNotAllowed'
439
420
  }