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