@contentchef/contentchef-types 11.0.0-alpha.4 → 11.0.0-alpha.6
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 +427 -0
- package/dist/api/Audience.js +28 -0
- package/dist/api/Content.d.ts +23 -26
- package/dist/api/Content.js +8 -11
- package/dist/api/ContentDefinition.d.ts +1 -19
- package/dist/api/ContentDefinition.js +1 -5
- package/dist/api/ContentDefinitionSchema.d.ts +15 -33
- package/dist/api/ContentDefinitionSchema.js +1 -1
- package/dist/api/Dimension.d.ts +249 -0
- package/dist/api/Dimension.js +18 -0
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +2 -1
- package/lib/api/Audience.ts +447 -0
- package/lib/api/Content.ts +23 -26
- package/lib/api/ContentDefinition.ts +1 -20
- package/lib/api/ContentDefinitionSchema.ts +15 -33
- package/lib/api/Dimension.ts +269 -0
- package/lib/api/index.ts +2 -1
- package/package.json +2 -2
- package/dist/api/Segment.d.ts +0 -443
- package/dist/api/Segment.js +0 -18
- package/lib/api/Segment.ts +0 -466
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { AuthorResponse } from './Author';
|
|
2
|
+
import { PagedListResponse } from './common';
|
|
3
|
+
import { DimensionAssignment } from './Dimension';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The audience unique id
|
|
7
|
+
*/
|
|
8
|
+
export type AudienceId = number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
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
|
+
*/
|
|
15
|
+
export const AUDIENCE_NAME_PATTERN = /^[a-z0-9_-]+$/;
|
|
16
|
+
|
|
17
|
+
/**
|
|
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]]
|
|
20
|
+
*/
|
|
21
|
+
export type DimensionPredicate = {
|
|
22
|
+
/**
|
|
23
|
+
* The mnemonic id of the dimension this predicate constrains
|
|
24
|
+
*/
|
|
25
|
+
dimension: string;
|
|
26
|
+
/**
|
|
27
|
+
* The keys of the dimension that satisfy this predicate, at least one
|
|
28
|
+
*/
|
|
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;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
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
|
|
83
|
+
*
|
|
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
|
|
87
|
+
*/
|
|
88
|
+
export type AudienceResponse = {
|
|
89
|
+
/**
|
|
90
|
+
* The audience unique id
|
|
91
|
+
*/
|
|
92
|
+
id: AudienceId;
|
|
93
|
+
/**
|
|
94
|
+
* The audience name
|
|
95
|
+
*/
|
|
96
|
+
name: string;
|
|
97
|
+
/**
|
|
98
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
|
|
99
|
+
*/
|
|
100
|
+
mnemonicId: string;
|
|
101
|
+
/**
|
|
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
|
|
108
|
+
*/
|
|
109
|
+
usedDimensionKeys: DimensionKeyReference[];
|
|
110
|
+
/**
|
|
111
|
+
* The archived status of the audience
|
|
112
|
+
*/
|
|
113
|
+
archived: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* The archive date of the audience
|
|
116
|
+
*/
|
|
117
|
+
archivedDate: Date | null;
|
|
118
|
+
/**
|
|
119
|
+
* The audience creation date
|
|
120
|
+
*/
|
|
121
|
+
createdDate: Date;
|
|
122
|
+
/**
|
|
123
|
+
* The audience last modified date
|
|
124
|
+
*/
|
|
125
|
+
lastModifiedDate: Date;
|
|
126
|
+
/**
|
|
127
|
+
* The audience author, resolved by `list` only
|
|
128
|
+
*/
|
|
129
|
+
author?: AuthorResponse;
|
|
130
|
+
/**
|
|
131
|
+
* The audience last modified author, resolved by every endpoint but `get`
|
|
132
|
+
*/
|
|
133
|
+
latestContributor?: AuthorResponse;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* This type represent all possible filters used to retrieve a list of audience
|
|
138
|
+
*/
|
|
139
|
+
export type ListAudiencesFilters = {
|
|
140
|
+
/**
|
|
141
|
+
* This filter is used to retrieve archived or not archived audiences. Defaults to not archived
|
|
142
|
+
*/
|
|
143
|
+
archived?: boolean;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* This type represent the data needed to make a list audiences API request
|
|
148
|
+
*/
|
|
149
|
+
export type ListAudiencesRequest = {
|
|
150
|
+
/**
|
|
151
|
+
* The number of audiences to skip (this value is used for pagination)
|
|
152
|
+
*/
|
|
153
|
+
skip?: number;
|
|
154
|
+
/**
|
|
155
|
+
* The number of audiences to take (this value is used for pagination), at most 100
|
|
156
|
+
*/
|
|
157
|
+
take?: number;
|
|
158
|
+
/**
|
|
159
|
+
* The data used to filter the list of audiences
|
|
160
|
+
*/
|
|
161
|
+
filters?: ListAudiencesFilters;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* This type represent the item of a list audiences API request: the audience with its rule read back
|
|
166
|
+
* in words, which is what a picker shows. No usage count, that is one query per audience and belongs
|
|
167
|
+
* to [[GetAudienceResponse]]
|
|
168
|
+
*/
|
|
169
|
+
export type ListAudiencesItem = AudienceResponse & {
|
|
170
|
+
/**
|
|
171
|
+
* The rule in words, so it reads without decoding a predicate
|
|
172
|
+
*/
|
|
173
|
+
description: string;
|
|
174
|
+
/**
|
|
175
|
+
* The mnemonic ids of the dimensions the rule depends on
|
|
176
|
+
*/
|
|
177
|
+
dimensions: string[];
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* This type represent the response of a list audiences API request
|
|
182
|
+
*/
|
|
183
|
+
export type ListAudiencesResponse = PagedListResponse<ListAudiencesItem>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* This type represent the data needed to make a get audience API request
|
|
187
|
+
*/
|
|
188
|
+
export type GetAudienceRequest = {
|
|
189
|
+
/**
|
|
190
|
+
* The unique audience id to retrieve
|
|
191
|
+
*/
|
|
192
|
+
id: AudienceId;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* This type represent the response of a get audience API request: the audience, plus what the editor
|
|
197
|
+
* cannot derive on its own - the rule in words, the dimensions it depends on, and how many contents
|
|
198
|
+
* reference it, which is exactly the guard archiving enforces
|
|
199
|
+
*/
|
|
200
|
+
export type GetAudienceResponse = ListAudiencesItem & {
|
|
201
|
+
/**
|
|
202
|
+
* How much of the space depends on this audience
|
|
203
|
+
*/
|
|
204
|
+
usage: {
|
|
205
|
+
/**
|
|
206
|
+
* How many contents reference this audience. Archiving is refused while this is not zero
|
|
207
|
+
*/
|
|
208
|
+
contents: number;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* This type represent the data needed to make a create audience API request
|
|
214
|
+
*/
|
|
215
|
+
export type CreateAudienceRequest = {
|
|
216
|
+
/**
|
|
217
|
+
* The audience name
|
|
218
|
+
*/
|
|
219
|
+
name: string;
|
|
220
|
+
/**
|
|
221
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]. It cannot be changed afterwards
|
|
222
|
+
*/
|
|
223
|
+
mnemonicId: string;
|
|
224
|
+
/**
|
|
225
|
+
* The rule over dimensions. Every dimension it names has to exist in the space and not be
|
|
226
|
+
* archived, and every key has to exist on its dimension and not be deprecated
|
|
227
|
+
*/
|
|
228
|
+
rule: AudienceRule;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* This type represent the response of a create audience API request
|
|
233
|
+
*/
|
|
234
|
+
export type CreateAudienceResponse = AudienceResponse;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* This type represent the data needed to make an update audience API request
|
|
238
|
+
*
|
|
239
|
+
* The rule may change freely even while contents reference the audience: the change reaching delivery
|
|
240
|
+
* on the next publish of any content that uses it is the point of naming an audience once
|
|
241
|
+
*/
|
|
242
|
+
export type UpdateAudienceRequest = {
|
|
243
|
+
/**
|
|
244
|
+
* The audience unique id
|
|
245
|
+
*/
|
|
246
|
+
id: AudienceId;
|
|
247
|
+
/**
|
|
248
|
+
* The audience name to update
|
|
249
|
+
*/
|
|
250
|
+
name: string;
|
|
251
|
+
/**
|
|
252
|
+
* The audience mnemonic id, which must be the stored one
|
|
253
|
+
*/
|
|
254
|
+
mnemonicId: string;
|
|
255
|
+
/**
|
|
256
|
+
* The rule, replacing what is stored
|
|
257
|
+
*/
|
|
258
|
+
rule: AudienceRule;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* This type represent the response of an update audience API request
|
|
263
|
+
*/
|
|
264
|
+
export type UpdateAudienceResponse = AudienceResponse;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* This type represent the data needed to make a toggle archived audience API request
|
|
268
|
+
*/
|
|
269
|
+
export type ToggleArchivedAudienceRequest = {
|
|
270
|
+
/**
|
|
271
|
+
* The audience unique id
|
|
272
|
+
*/
|
|
273
|
+
id: AudienceId;
|
|
274
|
+
/**
|
|
275
|
+
* This value represent the archive status to set in the specified audience. Archiving is refused
|
|
276
|
+
* with an `AudienceInUse` error while any content references the audience
|
|
277
|
+
*/
|
|
278
|
+
archived: boolean;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* This type represent the response of a toggle archived audience API request
|
|
283
|
+
*/
|
|
284
|
+
export type ToggleArchivedAudienceResponse = AudienceResponse;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Thin enum represent all audience rule violations error codes, reported by the create and update
|
|
288
|
+
* audience API requests through the `violations` of an `InvalidAudienceRule` error
|
|
289
|
+
*/
|
|
290
|
+
export enum AudienceRuleViolationCodes {
|
|
291
|
+
ruleMissing = 'audienceRule.ruleMissing',
|
|
292
|
+
unknownShape = 'audienceRule.unknownShape',
|
|
293
|
+
groupIsNotAnArray = 'audienceRule.groupIsNotAnArray',
|
|
294
|
+
dimensionIsNotAString = 'audienceRule.dimensionIsNotAString',
|
|
295
|
+
inIsNotAnArray = 'audienceRule.inIsNotAnArray',
|
|
296
|
+
inIsEmpty = 'audienceRule.inIsEmpty',
|
|
297
|
+
keyIsNotAString = 'audienceRule.keyIsNotAString',
|
|
298
|
+
orUnsetIsNotABoolean = 'audienceRule.orUnsetIsNotABoolean',
|
|
299
|
+
dimensionNotFound = 'audienceRule.dimensionNotFound',
|
|
300
|
+
dimensionArchived = 'audienceRule.dimensionArchived',
|
|
301
|
+
dimensionKeyNotFound = 'audienceRule.dimensionKeyNotFound',
|
|
302
|
+
dimensionKeyDeprecated = 'audienceRule.dimensionKeyDeprecated'
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* This type represent one problem found in an audience rule, carrying the path of the offending node
|
|
307
|
+
*/
|
|
308
|
+
export type AudienceRuleViolation = {
|
|
309
|
+
/**
|
|
310
|
+
* The error code discriminator, one of [[AudienceRuleViolationCodes]]
|
|
311
|
+
*/
|
|
312
|
+
code: string;
|
|
313
|
+
/**
|
|
314
|
+
* The path of the rejected node inside the rule, for instance `rule.all.0.in.1`
|
|
315
|
+
*/
|
|
316
|
+
path: string;
|
|
317
|
+
/**
|
|
318
|
+
* The dimension the node names, when the violation is about one
|
|
319
|
+
*/
|
|
320
|
+
dimension?: string;
|
|
321
|
+
/**
|
|
322
|
+
* The key the node names, when the violation is about one
|
|
323
|
+
*/
|
|
324
|
+
key?: string;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* This type represent how much of an analysed audience list one audience actually serves
|
|
329
|
+
*/
|
|
330
|
+
export type RuleCoverage = {
|
|
331
|
+
/**
|
|
332
|
+
* The position of the audience in the analysed list
|
|
333
|
+
*/
|
|
334
|
+
index: number;
|
|
335
|
+
/**
|
|
336
|
+
* The audience mnemonic id
|
|
337
|
+
*/
|
|
338
|
+
id?: string;
|
|
339
|
+
/**
|
|
340
|
+
* The rule in words, so a finding reads without decoding a predicate
|
|
341
|
+
*/
|
|
342
|
+
condition: string;
|
|
343
|
+
/**
|
|
344
|
+
* How many of the analysed assignments this audience wins. Zero means it can never serve anyone
|
|
345
|
+
*/
|
|
346
|
+
wins: number;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* This type represent what an ordered list of audiences covers, worked out from their rules and the
|
|
351
|
+
* dimensions' keys alone - no request traffic is involved
|
|
352
|
+
*
|
|
353
|
+
* The findings are advisory and never validation violations: a gap is usually deliberate, that being
|
|
354
|
+
* what a fallback is for, while an unreachable audience is almost always a mistake
|
|
355
|
+
*/
|
|
356
|
+
export type CoverageReport = {
|
|
357
|
+
/**
|
|
358
|
+
* How many assignments were evaluated, after collapsing the keys no rule mentions
|
|
359
|
+
*/
|
|
360
|
+
combinations: number;
|
|
361
|
+
/**
|
|
362
|
+
* One entry per analysed audience, in the order they were sent, its `id` being the mnemonic id. An
|
|
363
|
+
* audience the space does not have has no rule to analyse and contributes no entry, so this can be
|
|
364
|
+
* shorter than the request
|
|
365
|
+
*/
|
|
366
|
+
rules: RuleCoverage[];
|
|
367
|
+
/**
|
|
368
|
+
* The audiences that win nothing: shadowed by an earlier one, or self-contradictory
|
|
369
|
+
*/
|
|
370
|
+
unreachableRules: RuleCoverage[];
|
|
371
|
+
/**
|
|
372
|
+
* The assignments no audience claims, so they reach the fallback. Capped at 25 entries, while
|
|
373
|
+
* [[fallbackCount]] is the real total
|
|
374
|
+
*/
|
|
375
|
+
fallbackAssignments: DimensionAssignment[];
|
|
376
|
+
/**
|
|
377
|
+
* How many assignments reach the fallback, of [[combinations]]
|
|
378
|
+
*/
|
|
379
|
+
fallbackCount: number;
|
|
380
|
+
/**
|
|
381
|
+
* What [[OTHER_KEY]] stood for, per dimension: the real unmentioned keys, capped at 10, with their
|
|
382
|
+
* total. Only the dimensions that needed the stand-in appear
|
|
383
|
+
*/
|
|
384
|
+
otherKeys: { [dimension: string]: { keys: string[]; total: number } };
|
|
385
|
+
/**
|
|
386
|
+
* Set when the rules and their dimensions were too large to enumerate. Everything else is then
|
|
387
|
+
* unpopulated rather than guessed, because a sampled "no gaps" is not a fact
|
|
388
|
+
*/
|
|
389
|
+
notAnalysed?: { reason: 'tooManyCombinations'; combinations: number };
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* This type represent the data needed to make an analyse rules API request, which is what a
|
|
394
|
+
* personalized field's editor asks about the variants on screen, before anything is saved
|
|
395
|
+
*
|
|
396
|
+
* The rules and the dimensions' keys are read from the space, so a client sends the audiences and
|
|
397
|
+
* nothing else
|
|
398
|
+
*/
|
|
399
|
+
export type AnalyseAudienceRulesRequest = {
|
|
400
|
+
/**
|
|
401
|
+
* The audience mnemonic ids in the order the variants list them, at most 20. The order is the
|
|
402
|
+
* whole point: the first listed audience that matches wins, so one being unreachable is a
|
|
403
|
+
* consequence of what precedes it
|
|
404
|
+
*/
|
|
405
|
+
audiences: string[];
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* This type represent the response of an analyse rules API request
|
|
410
|
+
*/
|
|
411
|
+
export type AnalyseAudienceRulesResponse = CoverageReport;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* This type represent one variant of a personalized field: the audience served, and the value to
|
|
415
|
+
* serve it
|
|
416
|
+
* @template T The type of the served value, which conforms to the field's `variantType`
|
|
417
|
+
*/
|
|
418
|
+
export type PersonalizedVariant<T = any> = {
|
|
419
|
+
/**
|
|
420
|
+
* The mnemonic id of the audience this variant serves
|
|
421
|
+
*/
|
|
422
|
+
audience: string;
|
|
423
|
+
/**
|
|
424
|
+
* The value served when this variant wins
|
|
425
|
+
*/
|
|
426
|
+
value: T;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* This type represent the value a personalized field holds in a content payload: an ordered list of
|
|
431
|
+
* variants, the first whose audience matches the visitor wins, and the fallback served when none does
|
|
432
|
+
*
|
|
433
|
+
* The fallback is mandatory exactly when the field is required, which keeps the delivery contract of a
|
|
434
|
+
* personalized field the same as any other field. Zero variants is legal: the field is then just its
|
|
435
|
+
* fallback
|
|
436
|
+
* @template T The type of the served values, which conform to the field's `variantType`
|
|
437
|
+
*/
|
|
438
|
+
export type PersonalizedFieldPayload<T = any> = {
|
|
439
|
+
/**
|
|
440
|
+
* The variants, in the order they are evaluated in
|
|
441
|
+
*/
|
|
442
|
+
variants?: PersonalizedVariant<T>[];
|
|
443
|
+
/**
|
|
444
|
+
* The value served when no variant's audience matches
|
|
445
|
+
*/
|
|
446
|
+
fallback?: T;
|
|
447
|
+
};
|
package/lib/api/Content.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
ContentTranslation,
|
|
15
15
|
ContentTranslationStatus,
|
|
16
16
|
} from "./ContentTranslation";
|
|
17
|
-
import { CoverageReport } from "./
|
|
17
|
+
import { CoverageReport } from "./Audience";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* This type represent the content unique id type
|
|
@@ -404,11 +404,10 @@ export type ListContentsFilters = {
|
|
|
404
404
|
translationStatus?: ContentTranslationStatus;
|
|
405
405
|
|
|
406
406
|
/**
|
|
407
|
-
* This filter is used to search contents whose
|
|
408
|
-
* inserted
|
|
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
|
};
|
|
413
412
|
|
|
414
413
|
/**
|
|
@@ -846,17 +845,14 @@ export enum ContentFieldViolationCodes {
|
|
|
846
845
|
textFieldValueMissingInListOfValue = "textField.valueMissingInListOfValue",
|
|
847
846
|
textFieldValueIsNotAString = "textField.valueIsNotAString",
|
|
848
847
|
textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
segmentedFieldSegmentArchived = "segmentedField.segmentArchived",
|
|
858
|
-
segmentedFieldSegmentKeyNotFound = "segmentedField.segmentKeyNotFound",
|
|
859
|
-
segmentedFieldSegmentKeyDeprecated = "segmentedField.segmentKeyDeprecated",
|
|
848
|
+
personalizedFieldValueIsNotPersonalized = "personalizedField.valueIsNotPersonalized",
|
|
849
|
+
personalizedFieldVariantsIsNotAnArray = "personalizedField.variantsIsNotAnArray",
|
|
850
|
+
personalizedFieldVariantIsNotAnObject = "personalizedField.variantIsNotAnObject",
|
|
851
|
+
personalizedFieldAudienceMissing = "personalizedField.audienceMissing",
|
|
852
|
+
personalizedFieldAudienceNotFound = "personalizedField.audienceNotFound",
|
|
853
|
+
personalizedFieldAudienceArchived = "personalizedField.audienceArchived",
|
|
854
|
+
personalizedFieldDuplicateAudience = "personalizedField.duplicateAudience",
|
|
855
|
+
personalizedFieldFallbackRequired = "personalizedField.fallbackRequired",
|
|
860
856
|
}
|
|
861
857
|
|
|
862
858
|
/**
|
|
@@ -903,19 +899,20 @@ export type ToggleContentTranslationsRequest = {
|
|
|
903
899
|
export type ToggleContentTranslationsResponse = ContentResponse;
|
|
904
900
|
|
|
905
901
|
/**
|
|
906
|
-
* This type represent the data needed to make an analyse
|
|
902
|
+
* This type represent the data needed to make an analyse personalized rules API request
|
|
907
903
|
*/
|
|
908
|
-
export type
|
|
904
|
+
export type AnalysePersonalizedRulesRequest = {
|
|
909
905
|
/**
|
|
910
|
-
* Id of the content whose
|
|
906
|
+
* Id of the content whose personalized fields have to be analysed
|
|
911
907
|
*/
|
|
912
908
|
contentId: ContentId;
|
|
913
909
|
};
|
|
914
910
|
|
|
915
911
|
/**
|
|
916
|
-
* This type represent the coverage of one
|
|
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
|
-
export type
|
|
915
|
+
export type PersonalizedFieldCoverage = CoverageReport & {
|
|
919
916
|
/**
|
|
920
917
|
* Where the field sits in the payload
|
|
921
918
|
*/
|
|
@@ -928,12 +925,12 @@ export type SegmentedFieldCoverage = CoverageReport & {
|
|
|
928
925
|
};
|
|
929
926
|
|
|
930
927
|
/**
|
|
931
|
-
* This type represent the response of an analyse
|
|
932
|
-
*
|
|
928
|
+
* This type represent the response of an analyse personalized rules API request: one report per
|
|
929
|
+
* personalized field of the content, empty when it has none
|
|
933
930
|
*/
|
|
934
|
-
export type
|
|
931
|
+
export type AnalysePersonalizedRulesResponse = {
|
|
935
932
|
/**
|
|
936
|
-
* One entry per
|
|
933
|
+
* One entry per personalized field found in the content payload
|
|
937
934
|
*/
|
|
938
|
-
fields:
|
|
935
|
+
fields: PersonalizedFieldCoverage[];
|
|
939
936
|
};
|
|
@@ -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 segments this definition's segmented fields vary by
|
|
195
|
-
* Derived from the schema on every save, never assigned by the client
|
|
196
|
-
*/
|
|
197
|
-
segments?: 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 segments declaration of the
|
|
292
|
-
* definition schema object
|
|
293
|
-
*
|
|
294
|
-
* - The value is a string if the segments value is not in the expected format
|
|
295
|
-
* - The value is a list of AttributeViolation, one per declared segment that does not exist in the
|
|
296
|
-
* space or is archived
|
|
297
|
-
*/
|
|
298
|
-
segments?: 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
|
-
|
|
435
|
-
segmentNameNotFound = 'segmentNameNotFound',
|
|
436
|
-
segmentArchived = 'segmentArchived',
|
|
437
|
-
segmentNotDeclaredByDefinition = 'segmentNotDeclaredByDefinition',
|
|
438
|
-
duplicateSegmentName = 'duplicateSegmentName'
|
|
419
|
+
variantTypeNotAllowed = 'variantTypeNotAllowed'
|
|
439
420
|
}
|
|
@@ -21,7 +21,7 @@ export enum SchemaTypeIds {
|
|
|
21
21
|
ARRAY = 'array',
|
|
22
22
|
SLUG = 'slug',
|
|
23
23
|
MEDIA = 'media',
|
|
24
|
-
|
|
24
|
+
PERSONALIZED = 'personalized',
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -51,14 +51,6 @@ export type ContentDefinitionSchema = {
|
|
|
51
51
|
* A Fragment is a custom field defined by the user and can be used internally in the definition
|
|
52
52
|
*/
|
|
53
53
|
fragments: FragmentsTable;
|
|
54
|
-
/**
|
|
55
|
-
* The segments this definition depends on, chosen by the author. Every one has to exist in the
|
|
56
|
-
* space and not be archived, and a segmented field may only vary by segments named here, so this
|
|
57
|
-
* is what scopes a definition and gives the field editor a short list to offer
|
|
58
|
-
*
|
|
59
|
-
* Optional: a definition that declares none simply cannot hold a segmented field
|
|
60
|
-
*/
|
|
61
|
-
segments?: string[];
|
|
62
54
|
};
|
|
63
55
|
|
|
64
56
|
/**
|
|
@@ -329,39 +321,29 @@ export type OneLinkedContentOfConstraints = {
|
|
|
329
321
|
};
|
|
330
322
|
|
|
331
323
|
/**
|
|
332
|
-
* This type represent what every value of a
|
|
333
|
-
* so the
|
|
324
|
+
* This type represent what every value of a personalized field holds: one descriptor for the whole field,
|
|
325
|
+
* so the variants and the fallback cannot differ in type
|
|
334
326
|
*
|
|
335
327
|
* Only the two `one...Of` forms are admitted: `fragment` and `linked-content` are each the
|
|
336
328
|
* single-target special case of one of them, carrying an identical payload value
|
|
337
329
|
*/
|
|
338
|
-
export type
|
|
330
|
+
export type PersonalizedVariantType =
|
|
339
331
|
| { type: SchemaTypeIds.ONE_FRAGMENT_OF; constraints: OneFragmentOfConstraints; }
|
|
340
332
|
| { type: SchemaTypeIds.ONE_LINKED_CONTENT_OF; constraints: OneLinkedContentOfConstraints; };
|
|
341
333
|
|
|
342
334
|
/**
|
|
343
|
-
* This type represent the model of a
|
|
335
|
+
* This type represent the model of a personalized field constraints
|
|
344
336
|
*
|
|
345
|
-
* A
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
337
|
+
* A personalized field says only *what shape the values have*. Which audiences it serves is authored
|
|
338
|
+
* per content, as an ordered list of variants plus a fallback - see [[PersonalizedFieldPayload]] - so
|
|
339
|
+
* nothing has to be pre-declared here and two contents of the same definition may target entirely
|
|
340
|
+
* different audiences
|
|
349
341
|
*/
|
|
350
|
-
export type
|
|
351
|
-
/**
|
|
352
|
-
* The mnemonic ids of the segments this field varies by, which must be among the ones the
|
|
353
|
-
* definition declares in [[ContentDefinitionSchema.segments]]. Only the declaration is checked
|
|
354
|
-
* against the space, so a segment that does not exist is one error on the definition rather than
|
|
355
|
-
* one on every field that reached for it
|
|
356
|
-
*
|
|
357
|
-
* Declaration order carries no meaning: a rule wins by being first in the content, not by which
|
|
358
|
-
* segment it constrains
|
|
359
|
-
*/
|
|
360
|
-
segments: string[];
|
|
342
|
+
export type PersonalizedFieldConstraints = {
|
|
361
343
|
/**
|
|
362
|
-
* The shape every
|
|
344
|
+
* The shape every variant value and the fallback conform to
|
|
363
345
|
*/
|
|
364
|
-
variantType:
|
|
346
|
+
variantType: PersonalizedVariantType;
|
|
365
347
|
};
|
|
366
348
|
|
|
367
349
|
/**
|
|
@@ -529,9 +511,9 @@ export type OneFragmentOfSchemaType = SchemaType<SchemaTypeIds.ONE_FRAGMENT_OF,
|
|
|
529
511
|
export type OneLinkedContentOfSchemaType = IndexableSchemaType<SchemaTypeIds.ONE_LINKED_CONTENT_OF, OneLinkedContentOfConstraints>;
|
|
530
512
|
|
|
531
513
|
/**
|
|
532
|
-
* This type represent a
|
|
514
|
+
* This type represent a personalized field schema type
|
|
533
515
|
*/
|
|
534
|
-
export type
|
|
516
|
+
export type PersonalizedSchemaType = SchemaType<SchemaTypeIds.PERSONALIZED, PersonalizedFieldConstraints>;
|
|
535
517
|
|
|
536
518
|
/**
|
|
537
519
|
* Slug schema type
|
|
@@ -565,7 +547,7 @@ export type TranslatableSchemaTypes = NumberSchemaType | TextSchemaType | LongTe
|
|
|
565
547
|
/**
|
|
566
548
|
* This type group all the schema types of a content definition that are not indexable
|
|
567
549
|
*/
|
|
568
|
-
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType |
|
|
550
|
+
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType | PersonalizedSchemaType;
|
|
569
551
|
|
|
570
552
|
/**
|
|
571
553
|
* This type group all schema types of a content definition
|