@contentchef/contentchef-types 11.0.0-alpha.3 → 11.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/Audience.d.ts +443 -0
- package/dist/api/Audience.js +18 -0
- package/dist/api/Content.d.ts +48 -14
- package/dist/api/Content.js +11 -11
- package/dist/api/ContentDefinition.d.ts +11 -11
- package/dist/api/ContentDefinition.js +5 -5
- package/dist/api/ContentDefinitionSchema.d.ts +20 -20
- package/dist/api/ContentDefinitionSchema.js +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/lib/api/Audience.ts +466 -0
- package/lib/api/Content.ts +51 -14
- package/lib/api/ContentDefinition.ts +11 -11
- package/lib/api/ContentDefinitionSchema.ts +20 -20
- package/lib/api/index.ts +1 -1
- package/package.json +2 -2
- package/dist/api/Segment.d.ts +0 -312
- package/dist/api/Segment.js +0 -9
- package/lib/api/Segment.ts +0 -336
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { AuthorResponse } from './Author';
|
|
2
|
+
import { PagedListResponse } from './common';
|
|
3
|
+
import { ContentDefinitionId } from './ContentDefinition';
|
|
4
|
+
/**
|
|
5
|
+
* The audience unique id
|
|
6
|
+
*/
|
|
7
|
+
export type AudienceId = number;
|
|
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
|
|
12
|
+
*/
|
|
13
|
+
export declare const AUDIENCE_NAME_PATTERN: RegExp;
|
|
14
|
+
/**
|
|
15
|
+
* This type represent one key of an audience, that is one of the values a visitor can have for it
|
|
16
|
+
*/
|
|
17
|
+
export type AudienceKey = {
|
|
18
|
+
/**
|
|
19
|
+
* The key, matching [[AUDIENCE_NAME_PATTERN]]
|
|
20
|
+
*/
|
|
21
|
+
key: string;
|
|
22
|
+
/**
|
|
23
|
+
* A deprecated key cannot be referenced by new content rules, while every rule already written
|
|
24
|
+
* keeps resolving. The flag toggles both ways
|
|
25
|
+
*/
|
|
26
|
+
deprecated?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
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
|
|
31
|
+
*
|
|
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
|
|
35
|
+
*/
|
|
36
|
+
export type AudienceResponse = {
|
|
37
|
+
/**
|
|
38
|
+
* The audience unique id
|
|
39
|
+
*/
|
|
40
|
+
id: AudienceId;
|
|
41
|
+
/**
|
|
42
|
+
* The audience name
|
|
43
|
+
*/
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
|
|
47
|
+
*/
|
|
48
|
+
mnemonicId: string;
|
|
49
|
+
/**
|
|
50
|
+
* The keys a visitor can hold for this audience, each carrying its own deprecation state
|
|
51
|
+
*/
|
|
52
|
+
keys: AudienceKey[];
|
|
53
|
+
/**
|
|
54
|
+
* The archived status of the audience
|
|
55
|
+
*/
|
|
56
|
+
archived: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The archive date of the audience
|
|
59
|
+
*/
|
|
60
|
+
archivedDate: Date | null;
|
|
61
|
+
/**
|
|
62
|
+
* The audience creation date
|
|
63
|
+
*/
|
|
64
|
+
createdDate: Date;
|
|
65
|
+
/**
|
|
66
|
+
* The audience last modified date
|
|
67
|
+
*/
|
|
68
|
+
lastModifiedDate: Date;
|
|
69
|
+
/**
|
|
70
|
+
* The audience author, resolved by `list` only
|
|
71
|
+
*/
|
|
72
|
+
author?: AuthorResponse;
|
|
73
|
+
/**
|
|
74
|
+
* The audience last modified author, resolved by every endpoint but `get`
|
|
75
|
+
*/
|
|
76
|
+
latestContributor?: AuthorResponse;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* This type represent all possible filters used to retrieve a list of audience
|
|
80
|
+
*/
|
|
81
|
+
export type ListAudiencesFilters = {
|
|
82
|
+
/**
|
|
83
|
+
* This filter is used to retrieve archived or not archived audiences. Defaults to not archived
|
|
84
|
+
*/
|
|
85
|
+
archived?: boolean;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* This type represent the data needed to make a list audiences API request
|
|
89
|
+
*/
|
|
90
|
+
export type ListAudiencesRequest = {
|
|
91
|
+
/**
|
|
92
|
+
* The number of audiences to skip (this value is used for pagination)
|
|
93
|
+
*/
|
|
94
|
+
skip?: number;
|
|
95
|
+
/**
|
|
96
|
+
* The number of audiences to take (this value is used for pagination), at most 100
|
|
97
|
+
*/
|
|
98
|
+
take?: number;
|
|
99
|
+
/**
|
|
100
|
+
* The data used to filter the list of audiences
|
|
101
|
+
*/
|
|
102
|
+
filters?: ListAudiencesFilters;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* This type represent the item of a list audiences API request
|
|
106
|
+
*/
|
|
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 = {
|
|
117
|
+
/**
|
|
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
|
|
120
|
+
*/
|
|
121
|
+
key: string | null;
|
|
122
|
+
/**
|
|
123
|
+
* How many contents reference this key
|
|
124
|
+
*/
|
|
125
|
+
contents: number;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* This type represent a content definition that declares an audience
|
|
129
|
+
*/
|
|
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
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* This type represent the data needed to make a get audience API request
|
|
146
|
+
*/
|
|
147
|
+
export type GetAudienceRequest = {
|
|
148
|
+
/**
|
|
149
|
+
* The unique audience id to retrieve
|
|
150
|
+
*/
|
|
151
|
+
id: AudienceId;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
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
|
|
156
|
+
*/
|
|
157
|
+
export type GetAudienceResponse = AudienceResponse & {
|
|
158
|
+
/**
|
|
159
|
+
* One entry per key at least one content references. A key absent from this list is unused
|
|
160
|
+
*/
|
|
161
|
+
keyUsage: AudienceKeyUsage[];
|
|
162
|
+
/**
|
|
163
|
+
* The content definitions declaring this audience
|
|
164
|
+
*/
|
|
165
|
+
definitions: DefinitionUsingAudience[];
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* This type represent the data needed to make a create audience API request
|
|
169
|
+
*/
|
|
170
|
+
export type CreateAudienceRequest = {
|
|
171
|
+
/**
|
|
172
|
+
* The audience name
|
|
173
|
+
*/
|
|
174
|
+
name: string;
|
|
175
|
+
/**
|
|
176
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
|
|
177
|
+
*/
|
|
178
|
+
mnemonicId: string;
|
|
179
|
+
/**
|
|
180
|
+
* The keys a visitor can hold for this audience, at least one, each key unique
|
|
181
|
+
*/
|
|
182
|
+
keys: AudienceKey[];
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* This type represent the response of a create audience API request
|
|
186
|
+
*/
|
|
187
|
+
export type CreateAudienceResponse = AudienceResponse;
|
|
188
|
+
/**
|
|
189
|
+
* This type represent the data needed to make an update audience API request
|
|
190
|
+
*
|
|
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
|
|
194
|
+
*/
|
|
195
|
+
export type UpdateAudienceRequest = {
|
|
196
|
+
/**
|
|
197
|
+
* The audience unique id
|
|
198
|
+
*/
|
|
199
|
+
id: AudienceId;
|
|
200
|
+
/**
|
|
201
|
+
* The audience name to update
|
|
202
|
+
*/
|
|
203
|
+
name: string;
|
|
204
|
+
/**
|
|
205
|
+
* The audience mnemonic id, which must be the stored one
|
|
206
|
+
*/
|
|
207
|
+
mnemonicId: string;
|
|
208
|
+
/**
|
|
209
|
+
* The whole key list, replacing what is stored
|
|
210
|
+
*/
|
|
211
|
+
keys: AudienceKey[];
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* This type represent the response of an update audience API request
|
|
215
|
+
*/
|
|
216
|
+
export type UpdateAudienceResponse = AudienceResponse;
|
|
217
|
+
/**
|
|
218
|
+
* This type represent the data needed to make a toggle archived audience API request
|
|
219
|
+
*/
|
|
220
|
+
export type ToggleArchivedAudienceRequest = {
|
|
221
|
+
/**
|
|
222
|
+
* The audience unique id
|
|
223
|
+
*/
|
|
224
|
+
id: AudienceId;
|
|
225
|
+
/**
|
|
226
|
+
* This value represent the archive status to set in the specified audience
|
|
227
|
+
*/
|
|
228
|
+
archived: boolean;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* This type represent the response of a toggle archived audience API request
|
|
232
|
+
*/
|
|
233
|
+
export type ToggleArchivedAudienceResponse = AudienceResponse;
|
|
234
|
+
/**
|
|
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]]
|
|
237
|
+
*/
|
|
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
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* This type represent a condition satisfied when at least one child condition is satisfied
|
|
264
|
+
*/
|
|
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;
|
|
286
|
+
/**
|
|
287
|
+
* The condition under which this rule wins
|
|
288
|
+
*/
|
|
289
|
+
when: AudienceRuleCondition;
|
|
290
|
+
/**
|
|
291
|
+
* The value served when this rule wins
|
|
292
|
+
*/
|
|
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> = {
|
|
304
|
+
/**
|
|
305
|
+
* The rules, in the order they are evaluated in
|
|
306
|
+
*/
|
|
307
|
+
rules?: PersonalizedRule<T>[];
|
|
308
|
+
/**
|
|
309
|
+
* The value served when no rule matches
|
|
310
|
+
*/
|
|
311
|
+
fallback?: T;
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
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
|
|
332
|
+
*/
|
|
333
|
+
export type RuleCoverage = {
|
|
334
|
+
/**
|
|
335
|
+
* The position of the rule in the analysed list
|
|
336
|
+
*/
|
|
337
|
+
index: number;
|
|
338
|
+
/**
|
|
339
|
+
* The rule id, when it carries one
|
|
340
|
+
*/
|
|
341
|
+
id?: string;
|
|
342
|
+
/**
|
|
343
|
+
* The condition in words, so a finding reads without decoding a predicate
|
|
344
|
+
*/
|
|
345
|
+
condition: string;
|
|
346
|
+
/**
|
|
347
|
+
* How many of the analysed assignments this rule wins. Zero means it can never serve anyone
|
|
348
|
+
*/
|
|
349
|
+
wins: number;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
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
|
|
354
|
+
*
|
|
355
|
+
* 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
|
|
357
|
+
*/
|
|
358
|
+
export type CoverageReport = {
|
|
359
|
+
/**
|
|
360
|
+
* How many assignments were evaluated, after collapsing the keys no rule mentions
|
|
361
|
+
*/
|
|
362
|
+
combinations: number;
|
|
363
|
+
/**
|
|
364
|
+
* One entry per analysed rule, in author order
|
|
365
|
+
*/
|
|
366
|
+
rules: RuleCoverage[];
|
|
367
|
+
/**
|
|
368
|
+
* The rules that win nothing: shadowed by an earlier rule, or self-contradictory
|
|
369
|
+
*/
|
|
370
|
+
unreachableRules: RuleCoverage[];
|
|
371
|
+
/**
|
|
372
|
+
* The assignments no rule claims, so they reach the fallback. Capped at 25 entries, while
|
|
373
|
+
* [[fallbackCount]] is the real total
|
|
374
|
+
*/
|
|
375
|
+
fallbackAssignments: AudienceAssignment[];
|
|
376
|
+
/**
|
|
377
|
+
* How many assignments reach the fallback, of [[combinations]]
|
|
378
|
+
*/
|
|
379
|
+
fallbackCount: number;
|
|
380
|
+
/**
|
|
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
|
|
388
|
+
*/
|
|
389
|
+
otherKeys: {
|
|
390
|
+
[audience: string]: {
|
|
391
|
+
keys: string[];
|
|
392
|
+
total: number;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Set when the rules and their audiences were too large to enumerate. Everything else is then
|
|
397
|
+
* unpopulated rather than guessed, because a sampled "no gaps" is not a fact
|
|
398
|
+
*/
|
|
399
|
+
notAnalysed?: {
|
|
400
|
+
reason: 'tooManyCombinations';
|
|
401
|
+
combinations: number;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
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
|
|
409
|
+
*/
|
|
410
|
+
export type PersonalizedRuleDraft = {
|
|
411
|
+
/**
|
|
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
|
|
414
|
+
*/
|
|
415
|
+
id?: string;
|
|
416
|
+
/**
|
|
417
|
+
* The condition under which this rule wins
|
|
418
|
+
*/
|
|
419
|
+
when?: AudienceRuleCondition;
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
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
|
|
424
|
+
*
|
|
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
|
|
427
|
+
*/
|
|
428
|
+
export type AnalyseAudienceRulesRequest = {
|
|
429
|
+
/**
|
|
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
|
|
432
|
+
*/
|
|
433
|
+
audiences: string[];
|
|
434
|
+
/**
|
|
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
|
|
437
|
+
*/
|
|
438
|
+
rules: PersonalizedRuleDraft[];
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* This type represent the response of an analyse rules API request
|
|
442
|
+
*/
|
|
443
|
+
export type AnalyseAudienceRulesResponse = CoverageReport;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OTHER_KEY = exports.AUDIENCE_NAME_PATTERN = void 0;
|
|
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
|
|
8
|
+
*/
|
|
9
|
+
exports.AUDIENCE_NAME_PATTERN = /^[a-z0-9_-]+$/;
|
|
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
|
|
17
|
+
*/
|
|
18
|
+
exports.OTHER_KEY = '<any other key>';
|
package/dist/api/Content.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ContentDefinitionId, ContentDefinitionResponse } from "./ContentDefinit
|
|
|
5
5
|
import { SchemaTypeIds } from "./ContentDefinitionSchema";
|
|
6
6
|
import { ContentRepositoryId, ContentRepositoryResponse } from "./ContentRepository";
|
|
7
7
|
import { ContentTranslation, ContentTranslationStatus } from "./ContentTranslation";
|
|
8
|
+
import { CoverageReport } from "./Audience";
|
|
8
9
|
/**
|
|
9
10
|
* This type represent the content unique id type
|
|
10
11
|
*/
|
|
@@ -368,11 +369,11 @@ export type ListContentsFilters = {
|
|
|
368
369
|
*/
|
|
369
370
|
translationStatus?: ContentTranslationStatus;
|
|
370
371
|
/**
|
|
371
|
-
* This filter is used to search contents whose
|
|
372
|
-
* inserted, as `
|
|
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
|
|
373
374
|
* uses it with, and several tokens narrow the result like `tags` do
|
|
374
375
|
*/
|
|
375
|
-
|
|
376
|
+
audiences?: string[];
|
|
376
377
|
};
|
|
377
378
|
/**
|
|
378
379
|
* This type represent the data needed to make a list content API request
|
|
@@ -776,17 +777,17 @@ export declare enum ContentFieldViolationCodes {
|
|
|
776
777
|
textFieldValueMissingInListOfValue = "textField.valueMissingInListOfValue",
|
|
777
778
|
textFieldValueIsNotAString = "textField.valueIsNotAString",
|
|
778
779
|
textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
780
|
+
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",
|
|
787
|
+
personalizedFieldAudienceNotFound = "personalizedField.audienceNotFound",
|
|
788
|
+
personalizedFieldAudienceArchived = "personalizedField.audienceArchived",
|
|
789
|
+
personalizedFieldAudienceKeyNotFound = "personalizedField.audienceKeyNotFound",
|
|
790
|
+
personalizedFieldAudienceKeyDeprecated = "personalizedField.audienceKeyDeprecated"
|
|
790
791
|
}
|
|
791
792
|
/**
|
|
792
793
|
* Request type for getContentStatus
|
|
@@ -824,3 +825,36 @@ export type ToggleContentTranslationsRequest = {
|
|
|
824
825
|
localizationSettings: LocalizationSettings;
|
|
825
826
|
};
|
|
826
827
|
export type ToggleContentTranslationsResponse = ContentResponse;
|
|
828
|
+
/**
|
|
829
|
+
* This type represent the data needed to make an analyse personalized rules API request
|
|
830
|
+
*/
|
|
831
|
+
export type AnalysePersonalizedRulesRequest = {
|
|
832
|
+
/**
|
|
833
|
+
* Id of the content whose personalized fields have to be analysed
|
|
834
|
+
*/
|
|
835
|
+
contentId: ContentId;
|
|
836
|
+
};
|
|
837
|
+
/**
|
|
838
|
+
* This type represent the coverage of one personalized field of a content
|
|
839
|
+
*/
|
|
840
|
+
export type PersonalizedFieldCoverage = CoverageReport & {
|
|
841
|
+
/**
|
|
842
|
+
* Where the field sits in the payload
|
|
843
|
+
*/
|
|
844
|
+
path: string;
|
|
845
|
+
/**
|
|
846
|
+
* Whether the field carries a fallback. An optional field without one resolves to nothing for the
|
|
847
|
+
* assignments in [[CoverageReport.fallbackAssignments]], which is worth knowing
|
|
848
|
+
*/
|
|
849
|
+
hasFallback: boolean;
|
|
850
|
+
};
|
|
851
|
+
/**
|
|
852
|
+
* This type represent the response of an analyse personalized rules API request: one report per
|
|
853
|
+
* personalized field of the content, empty when it has none
|
|
854
|
+
*/
|
|
855
|
+
export type AnalysePersonalizedRulesResponse = {
|
|
856
|
+
/**
|
|
857
|
+
* One entry per personalized field found in the content payload
|
|
858
|
+
*/
|
|
859
|
+
fields: PersonalizedFieldCoverage[];
|
|
860
|
+
};
|
package/dist/api/Content.js
CHANGED
|
@@ -86,17 +86,17 @@ var ContentFieldViolationCodes;
|
|
|
86
86
|
ContentFieldViolationCodes["textFieldValueMissingInListOfValue"] = "textField.valueMissingInListOfValue";
|
|
87
87
|
ContentFieldViolationCodes["textFieldValueIsNotAString"] = "textField.valueIsNotAString";
|
|
88
88
|
ContentFieldViolationCodes["textFieldBlankValueNotAllowed"] = "textField.blankValueNotAllowed";
|
|
89
|
-
ContentFieldViolationCodes["
|
|
90
|
-
ContentFieldViolationCodes["
|
|
91
|
-
ContentFieldViolationCodes["
|
|
92
|
-
ContentFieldViolationCodes["
|
|
93
|
-
ContentFieldViolationCodes["
|
|
94
|
-
ContentFieldViolationCodes["
|
|
95
|
-
ContentFieldViolationCodes["
|
|
96
|
-
ContentFieldViolationCodes["
|
|
97
|
-
ContentFieldViolationCodes["
|
|
98
|
-
ContentFieldViolationCodes["
|
|
99
|
-
ContentFieldViolationCodes["
|
|
89
|
+
ContentFieldViolationCodes["personalizedFieldValueIsNotPersonalized"] = "personalizedField.valueIsNotPersonalized";
|
|
90
|
+
ContentFieldViolationCodes["personalizedFieldRulesIsNotAnArray"] = "personalizedField.rulesIsNotAnArray";
|
|
91
|
+
ContentFieldViolationCodes["personalizedFieldRuleIsNotAnObject"] = "personalizedField.ruleIsNotAnObject";
|
|
92
|
+
ContentFieldViolationCodes["personalizedFieldRuleConditionMissing"] = "personalizedField.ruleConditionMissing";
|
|
93
|
+
ContentFieldViolationCodes["personalizedFieldDuplicateRuleId"] = "personalizedField.duplicateRuleId";
|
|
94
|
+
ContentFieldViolationCodes["personalizedFieldAudienceNotDeclared"] = "personalizedField.audienceNotDeclared";
|
|
95
|
+
ContentFieldViolationCodes["personalizedFieldFallbackRequired"] = "personalizedField.fallbackRequired";
|
|
96
|
+
ContentFieldViolationCodes["personalizedFieldAudienceNotFound"] = "personalizedField.audienceNotFound";
|
|
97
|
+
ContentFieldViolationCodes["personalizedFieldAudienceArchived"] = "personalizedField.audienceArchived";
|
|
98
|
+
ContentFieldViolationCodes["personalizedFieldAudienceKeyNotFound"] = "personalizedField.audienceKeyNotFound";
|
|
99
|
+
ContentFieldViolationCodes["personalizedFieldAudienceKeyDeprecated"] = "personalizedField.audienceKeyDeprecated";
|
|
100
100
|
})(ContentFieldViolationCodes || (exports.ContentFieldViolationCodes = ContentFieldViolationCodes = {}));
|
|
101
101
|
var LocalizationSettings;
|
|
102
102
|
(function (LocalizationSettings) {
|
|
@@ -176,10 +176,10 @@ export type ContentDefinitionResponse = {
|
|
|
176
176
|
*/
|
|
177
177
|
trackableArrayFields?: ArrayField[] | null;
|
|
178
178
|
/**
|
|
179
|
-
* The mnemonic ids of the
|
|
179
|
+
* The mnemonic ids of the audiences this definition's personalized fields vary by
|
|
180
180
|
* Derived from the schema on every save, never assigned by the client
|
|
181
181
|
*/
|
|
182
|
-
|
|
182
|
+
audiences?: string[];
|
|
183
183
|
};
|
|
184
184
|
/**
|
|
185
185
|
* This type represent the response of a create content definition API request
|
|
@@ -267,14 +267,14 @@ export type ContentDefinitionSchemaErrors = {
|
|
|
267
267
|
*/
|
|
268
268
|
lang?: string;
|
|
269
269
|
/**
|
|
270
|
-
* This attribute represents all the error that occurs inside the
|
|
270
|
+
* This attribute represents all the error that occurs inside the audiences declaration of the
|
|
271
271
|
* definition schema object
|
|
272
272
|
*
|
|
273
|
-
* - The value is a string if the
|
|
274
|
-
* - The value is a list of AttributeViolation, one per declared
|
|
273
|
+
* - The value is a string if the audiences value is not in the expected format
|
|
274
|
+
* - The value is a list of AttributeViolation, one per declared audience that does not exist in the
|
|
275
275
|
* space or is archived
|
|
276
276
|
*/
|
|
277
|
-
|
|
277
|
+
audiences?: string | AttributeViolation[];
|
|
278
278
|
};
|
|
279
279
|
/**
|
|
280
280
|
* This type represent the model for the schema fragment errors
|
|
@@ -403,9 +403,9 @@ export declare enum SchemaFieldViolationCodes {
|
|
|
403
403
|
translatableNotAllowed = "translatableNotAllowed",
|
|
404
404
|
invalidEnumValue = "invalidEnumValue",
|
|
405
405
|
compactCannotBeNested = "compactCannotBeNested",
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
406
|
+
audienceTypeNotAllowed = "audienceTypeNotAllowed",
|
|
407
|
+
audienceNameNotFound = "audienceNameNotFound",
|
|
408
|
+
audienceArchived = "audienceArchived",
|
|
409
|
+
audienceNotDeclaredByDefinition = "audienceNotDeclaredByDefinition",
|
|
410
|
+
duplicateAudienceName = "duplicateAudienceName"
|
|
411
411
|
}
|
|
@@ -45,9 +45,9 @@ var SchemaFieldViolationCodes;
|
|
|
45
45
|
SchemaFieldViolationCodes["translatableNotAllowed"] = "translatableNotAllowed";
|
|
46
46
|
SchemaFieldViolationCodes["invalidEnumValue"] = "invalidEnumValue";
|
|
47
47
|
SchemaFieldViolationCodes["compactCannotBeNested"] = "compactCannotBeNested";
|
|
48
|
-
SchemaFieldViolationCodes["
|
|
49
|
-
SchemaFieldViolationCodes["
|
|
50
|
-
SchemaFieldViolationCodes["
|
|
51
|
-
SchemaFieldViolationCodes["
|
|
52
|
-
SchemaFieldViolationCodes["
|
|
48
|
+
SchemaFieldViolationCodes["audienceTypeNotAllowed"] = "audienceTypeNotAllowed";
|
|
49
|
+
SchemaFieldViolationCodes["audienceNameNotFound"] = "audienceNameNotFound";
|
|
50
|
+
SchemaFieldViolationCodes["audienceArchived"] = "audienceArchived";
|
|
51
|
+
SchemaFieldViolationCodes["audienceNotDeclaredByDefinition"] = "audienceNotDeclaredByDefinition";
|
|
52
|
+
SchemaFieldViolationCodes["duplicateAudienceName"] = "duplicateAudienceName";
|
|
53
53
|
})(SchemaFieldViolationCodes || (exports.SchemaFieldViolationCodes = SchemaFieldViolationCodes = {}));
|