@contentchef/contentchef-types 11.0.0-alpha.4 → 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/{Segment.d.ts → Audience.d.ts} +121 -121
- package/dist/api/{Segment.js → Audience.js} +5 -5
- package/dist/api/Content.d.ts +25 -25
- 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/{Segment.ts → Audience.ts} +121 -121
- package/lib/api/Content.ts +25 -25
- 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
|
@@ -3,23 +3,23 @@ import { PagedListResponse } from './common';
|
|
|
3
3
|
import { ContentDefinitionId } from './ContentDefinition';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
6
|
+
* The audience unique id
|
|
7
7
|
*/
|
|
8
|
-
export type
|
|
8
|
+
export type AudienceId = number;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* An audience's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
|
|
12
12
|
* underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
|
|
13
|
-
* travel in the delivery `
|
|
13
|
+
* travel in the delivery `audiences` query param and are compared against strings a client supplies
|
|
14
14
|
*/
|
|
15
|
-
export const
|
|
15
|
+
export const AUDIENCE_NAME_PATTERN = /^[a-z0-9_-]+$/;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* This type represent one key of
|
|
18
|
+
* This type represent one key of an audience, that is one of the values a visitor can have for it
|
|
19
19
|
*/
|
|
20
|
-
export type
|
|
20
|
+
export type AudienceKey = {
|
|
21
21
|
/**
|
|
22
|
-
* The key, matching [[
|
|
22
|
+
* The key, matching [[AUDIENCE_NAME_PATTERN]]
|
|
23
23
|
*/
|
|
24
24
|
key: string;
|
|
25
25
|
/**
|
|
@@ -30,102 +30,102 @@ export type SegmentKey = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* This type represent the model of
|
|
33
|
+
* This type represent the model of an audience, that is a dimension a content can vary by - `gender`,
|
|
34
34
|
* `loyalty`, `auth_status` - holding the fixed set of keys a visitor can have for it
|
|
35
35
|
*
|
|
36
|
-
* Contents reference
|
|
37
|
-
* mnemonicId, so
|
|
36
|
+
* Contents reference an audience by mnemonicId and key inside their rules, and definitions by
|
|
37
|
+
* mnemonicId, so audiences are archived and never deleted, and a key can only be removed or renamed
|
|
38
38
|
* while no content references it
|
|
39
39
|
*/
|
|
40
|
-
export type
|
|
40
|
+
export type AudienceResponse = {
|
|
41
41
|
/**
|
|
42
|
-
* The
|
|
42
|
+
* The audience unique id
|
|
43
43
|
*/
|
|
44
|
-
id:
|
|
44
|
+
id: AudienceId;
|
|
45
45
|
/**
|
|
46
|
-
* The
|
|
46
|
+
* The audience name
|
|
47
47
|
*/
|
|
48
48
|
name: string;
|
|
49
49
|
/**
|
|
50
|
-
* The
|
|
50
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
|
|
51
51
|
*/
|
|
52
52
|
mnemonicId: string;
|
|
53
53
|
/**
|
|
54
|
-
* The keys a visitor can hold for this
|
|
54
|
+
* The keys a visitor can hold for this audience, each carrying its own deprecation state
|
|
55
55
|
*/
|
|
56
|
-
keys:
|
|
56
|
+
keys: AudienceKey[];
|
|
57
57
|
/**
|
|
58
|
-
* The archived status of the
|
|
58
|
+
* The archived status of the audience
|
|
59
59
|
*/
|
|
60
60
|
archived: boolean;
|
|
61
61
|
/**
|
|
62
|
-
* The archive date of the
|
|
62
|
+
* The archive date of the audience
|
|
63
63
|
*/
|
|
64
64
|
archivedDate: Date | null;
|
|
65
65
|
/**
|
|
66
|
-
* The
|
|
66
|
+
* The audience creation date
|
|
67
67
|
*/
|
|
68
68
|
createdDate: Date;
|
|
69
69
|
/**
|
|
70
|
-
* The
|
|
70
|
+
* The audience last modified date
|
|
71
71
|
*/
|
|
72
72
|
lastModifiedDate: Date;
|
|
73
73
|
/**
|
|
74
|
-
* The
|
|
74
|
+
* The audience author, resolved by `list` only
|
|
75
75
|
*/
|
|
76
76
|
author?: AuthorResponse;
|
|
77
77
|
/**
|
|
78
|
-
* The
|
|
78
|
+
* The audience last modified author, resolved by every endpoint but `get`
|
|
79
79
|
*/
|
|
80
80
|
latestContributor?: AuthorResponse;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* This type represent all possible filters used to retrieve a list of
|
|
84
|
+
* This type represent all possible filters used to retrieve a list of audience
|
|
85
85
|
*/
|
|
86
|
-
export type
|
|
86
|
+
export type ListAudiencesFilters = {
|
|
87
87
|
/**
|
|
88
|
-
* This filter is used to retrieve archived or not archived
|
|
88
|
+
* This filter is used to retrieve archived or not archived audiences. Defaults to not archived
|
|
89
89
|
*/
|
|
90
90
|
archived?: boolean;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* This type represent the data needed to make a list
|
|
94
|
+
* This type represent the data needed to make a list audiences API request
|
|
95
95
|
*/
|
|
96
|
-
export type
|
|
96
|
+
export type ListAudiencesRequest = {
|
|
97
97
|
/**
|
|
98
|
-
* The number of
|
|
98
|
+
* The number of audiences to skip (this value is used for pagination)
|
|
99
99
|
*/
|
|
100
100
|
skip?: number;
|
|
101
101
|
/**
|
|
102
|
-
* The number of
|
|
102
|
+
* The number of audiences to take (this value is used for pagination), at most 100
|
|
103
103
|
*/
|
|
104
104
|
take?: number;
|
|
105
105
|
/**
|
|
106
|
-
* The data used to filter the list of
|
|
106
|
+
* The data used to filter the list of audiences
|
|
107
107
|
*/
|
|
108
|
-
filters?:
|
|
108
|
+
filters?: ListAudiencesFilters;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* This type represent the item of a list
|
|
112
|
+
* This type represent the item of a list audiences API request
|
|
113
113
|
*/
|
|
114
|
-
export type
|
|
114
|
+
export type ListAudiencesItem = AudienceResponse;
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* This type represent the response of a list
|
|
117
|
+
* This type represent the response of a list audiences API request
|
|
118
118
|
*/
|
|
119
|
-
export type
|
|
119
|
+
export type ListAudiencesResponse = PagedListResponse<ListAudiencesItem>;
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* This type represent the usage of one key of
|
|
122
|
+
* This type represent the usage of one key of an audience. A key with no entry is used by no content,
|
|
123
123
|
* and is therefore the only kind of key that can be removed or renamed
|
|
124
124
|
*/
|
|
125
|
-
export type
|
|
125
|
+
export type AudienceKeyUsage = {
|
|
126
126
|
/**
|
|
127
|
-
* The key, or null for the rules that constrain the
|
|
128
|
-
* ones that only fire when the
|
|
127
|
+
* The key, or null for the rules that constrain the audience without naming any key - that is the
|
|
128
|
+
* ones that only fire when the audience is unknown
|
|
129
129
|
*/
|
|
130
130
|
key: string | null;
|
|
131
131
|
/**
|
|
@@ -135,9 +135,9 @@ export type SegmentKeyUsage = {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* This type represent a content definition that declares
|
|
138
|
+
* This type represent a content definition that declares an audience
|
|
139
139
|
*/
|
|
140
|
-
export type
|
|
140
|
+
export type DefinitionUsingAudience = {
|
|
141
141
|
/**
|
|
142
142
|
* The content definition unique id
|
|
143
143
|
*/
|
|
@@ -153,121 +153,121 @@ export type DefinitionUsingSegment = {
|
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* This type represent the data needed to make a get
|
|
156
|
+
* This type represent the data needed to make a get audience API request
|
|
157
157
|
*/
|
|
158
|
-
export type
|
|
158
|
+
export type GetAudienceRequest = {
|
|
159
159
|
/**
|
|
160
|
-
* The unique
|
|
160
|
+
* The unique audience id to retrieve
|
|
161
161
|
*/
|
|
162
|
-
id:
|
|
162
|
+
id: AudienceId;
|
|
163
163
|
};
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
|
-
* This type represent the response of a get
|
|
167
|
-
* editor cannot decide without, which keys are in use and which definitions vary by this
|
|
166
|
+
* This type represent the response of a get audience API request: the audience, plus the two things the
|
|
167
|
+
* editor cannot decide without, which keys are in use and which definitions vary by this audience
|
|
168
168
|
*/
|
|
169
|
-
export type
|
|
169
|
+
export type GetAudienceResponse = AudienceResponse & {
|
|
170
170
|
/**
|
|
171
171
|
* One entry per key at least one content references. A key absent from this list is unused
|
|
172
172
|
*/
|
|
173
|
-
keyUsage:
|
|
173
|
+
keyUsage: AudienceKeyUsage[];
|
|
174
174
|
/**
|
|
175
|
-
* The content definitions declaring this
|
|
175
|
+
* The content definitions declaring this audience
|
|
176
176
|
*/
|
|
177
|
-
definitions:
|
|
177
|
+
definitions: DefinitionUsingAudience[];
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
-
* This type represent the data needed to make a create
|
|
181
|
+
* This type represent the data needed to make a create audience API request
|
|
182
182
|
*/
|
|
183
|
-
export type
|
|
183
|
+
export type CreateAudienceRequest = {
|
|
184
184
|
/**
|
|
185
|
-
* The
|
|
185
|
+
* The audience name
|
|
186
186
|
*/
|
|
187
187
|
name: string;
|
|
188
188
|
/**
|
|
189
|
-
* The
|
|
189
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
|
|
190
190
|
*/
|
|
191
191
|
mnemonicId: string;
|
|
192
192
|
/**
|
|
193
|
-
* The keys a visitor can hold for this
|
|
193
|
+
* The keys a visitor can hold for this audience, at least one, each key unique
|
|
194
194
|
*/
|
|
195
|
-
keys:
|
|
195
|
+
keys: AudienceKey[];
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
* This type represent the response of a create
|
|
199
|
+
* This type represent the response of a create audience API request
|
|
200
200
|
*/
|
|
201
|
-
export type
|
|
201
|
+
export type CreateAudienceResponse = AudienceResponse;
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
|
-
* This type represent the data needed to make an update
|
|
204
|
+
* This type represent the data needed to make an update audience API request
|
|
205
205
|
*
|
|
206
206
|
* `keys` replaces the whole stored list, deprecation flags included. Adding keys and toggling
|
|
207
207
|
* deprecation are always allowed, while removing or renaming a key is refused while a content still
|
|
208
208
|
* references it. `mnemonicId` cannot be changed
|
|
209
209
|
*/
|
|
210
|
-
export type
|
|
210
|
+
export type UpdateAudienceRequest = {
|
|
211
211
|
/**
|
|
212
|
-
* The
|
|
212
|
+
* The audience unique id
|
|
213
213
|
*/
|
|
214
|
-
id:
|
|
214
|
+
id: AudienceId;
|
|
215
215
|
/**
|
|
216
|
-
* The
|
|
216
|
+
* The audience name to update
|
|
217
217
|
*/
|
|
218
218
|
name: string;
|
|
219
219
|
/**
|
|
220
|
-
* The
|
|
220
|
+
* The audience mnemonic id, which must be the stored one
|
|
221
221
|
*/
|
|
222
222
|
mnemonicId: string;
|
|
223
223
|
/**
|
|
224
224
|
* The whole key list, replacing what is stored
|
|
225
225
|
*/
|
|
226
|
-
keys:
|
|
226
|
+
keys: AudienceKey[];
|
|
227
227
|
};
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
|
-
* This type represent the response of an update
|
|
230
|
+
* This type represent the response of an update audience API request
|
|
231
231
|
*/
|
|
232
|
-
export type
|
|
232
|
+
export type UpdateAudienceResponse = AudienceResponse;
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
|
-
* This type represent the data needed to make a toggle archived
|
|
235
|
+
* This type represent the data needed to make a toggle archived audience API request
|
|
236
236
|
*/
|
|
237
|
-
export type
|
|
237
|
+
export type ToggleArchivedAudienceRequest = {
|
|
238
238
|
/**
|
|
239
|
-
* The
|
|
239
|
+
* The audience unique id
|
|
240
240
|
*/
|
|
241
|
-
id:
|
|
241
|
+
id: AudienceId;
|
|
242
242
|
/**
|
|
243
|
-
* This value represent the archive status to set in the specified
|
|
243
|
+
* This value represent the archive status to set in the specified audience
|
|
244
244
|
*/
|
|
245
245
|
archived: boolean;
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
|
-
* This type represent the response of a toggle archived
|
|
249
|
+
* This type represent the response of a toggle archived audience API request
|
|
250
250
|
*/
|
|
251
|
-
export type
|
|
251
|
+
export type ToggleArchivedAudienceResponse = AudienceResponse;
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* This type represent the condition of one rule on a single
|
|
255
|
-
* [[
|
|
254
|
+
* This type represent the condition of one rule on a single audience: the visitor's value for
|
|
255
|
+
* [[audience]] has to be one of [[in]]
|
|
256
256
|
*/
|
|
257
|
-
export type
|
|
257
|
+
export type AudiencePredicate = {
|
|
258
258
|
/**
|
|
259
|
-
* The mnemonic id of the
|
|
259
|
+
* The mnemonic id of the audience this predicate constrains, which the field must declare
|
|
260
260
|
*/
|
|
261
|
-
|
|
261
|
+
audience: string;
|
|
262
262
|
/**
|
|
263
|
-
* The keys of the
|
|
263
|
+
* The keys of the audience that satisfy this predicate
|
|
264
264
|
*/
|
|
265
265
|
in: string[];
|
|
266
266
|
/**
|
|
267
|
-
* Set this value to also satisfy the predicate when the
|
|
267
|
+
* Set this value to also satisfy the predicate when the audience was not provided at all
|
|
268
268
|
*
|
|
269
269
|
* Not-provided is not a key, so no list of keys can express it, and an enumeration would silently
|
|
270
|
-
* narrow the moment a key is added to the
|
|
270
|
+
* narrow the moment a key is added to the audience. A key that was provided but is not listed does
|
|
271
271
|
* not satisfy this flag: it falls through to the field's fallback
|
|
272
272
|
*/
|
|
273
273
|
orUnset?: boolean;
|
|
@@ -276,32 +276,32 @@ export type SegmentPredicate = {
|
|
|
276
276
|
/**
|
|
277
277
|
* This type represent a condition satisfied when every child condition is satisfied
|
|
278
278
|
*/
|
|
279
|
-
export type
|
|
280
|
-
all:
|
|
279
|
+
export type AllAudiencePredicate = {
|
|
280
|
+
all: AudienceRuleCondition[];
|
|
281
281
|
};
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
284
|
* This type represent a condition satisfied when at least one child condition is satisfied
|
|
285
285
|
*/
|
|
286
|
-
export type
|
|
287
|
-
any:
|
|
286
|
+
export type AnyAudiencePredicate = {
|
|
287
|
+
any: AudienceRuleCondition[];
|
|
288
288
|
};
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* This type represent the condition of a rule
|
|
292
292
|
*
|
|
293
293
|
* The stored form is a tree so that new kinds of condition stay additive, but an editor only needs to
|
|
294
|
-
* build an [[
|
|
295
|
-
* between
|
|
296
|
-
* thing from one listed with [[
|
|
294
|
+
* build an [[AllAudiencePredicate]] of one [[AudiencePredicate]] per audience: or within an audience, and
|
|
295
|
+
* between audiences. An audience the condition does not mention is unconstrained, which is a different
|
|
296
|
+
* thing from one listed with [[AudiencePredicate.orUnset]]
|
|
297
297
|
*/
|
|
298
|
-
export type
|
|
298
|
+
export type AudienceRuleCondition = AudiencePredicate | AllAudiencePredicate | AnyAudiencePredicate;
|
|
299
299
|
|
|
300
300
|
/**
|
|
301
|
-
* This type represent one rule of a
|
|
301
|
+
* This type represent one rule of a personalized field: the condition, and the value to serve when it wins
|
|
302
302
|
* @template T The type of the value served by the rule, which conforms to the field's `variantType`
|
|
303
303
|
*/
|
|
304
|
-
export type
|
|
304
|
+
export type PersonalizedRule<T = any> = {
|
|
305
305
|
/**
|
|
306
306
|
* The rule id, unique in the field. Used for diagnostics only, matching never reads it
|
|
307
307
|
*/
|
|
@@ -309,7 +309,7 @@ export type SegmentRule<T = any> = {
|
|
|
309
309
|
/**
|
|
310
310
|
* The condition under which this rule wins
|
|
311
311
|
*/
|
|
312
|
-
when:
|
|
312
|
+
when: AudienceRuleCondition;
|
|
313
313
|
/**
|
|
314
314
|
* The value served when this rule wins
|
|
315
315
|
*/
|
|
@@ -317,18 +317,18 @@ export type SegmentRule<T = any> = {
|
|
|
317
317
|
};
|
|
318
318
|
|
|
319
319
|
/**
|
|
320
|
-
* This type represent the value a
|
|
320
|
+
* This type represent the value a personalized field holds in a content payload: an ordered list of
|
|
321
321
|
* rules, first match wins, and the fallback served when no rule matches
|
|
322
322
|
*
|
|
323
323
|
* The fallback is mandatory exactly when the field is required, which keeps the delivery contract of a
|
|
324
|
-
*
|
|
324
|
+
* personalized field the same as any other field. Zero rules is legal: the field is then just its fallback
|
|
325
325
|
* @template T The type of the served values, which conform to the field's `variantType`
|
|
326
326
|
*/
|
|
327
|
-
export type
|
|
327
|
+
export type PersonalizedFieldPayload<T = any> = {
|
|
328
328
|
/**
|
|
329
329
|
* The rules, in the order they are evaluated in
|
|
330
330
|
*/
|
|
331
|
-
rules?:
|
|
331
|
+
rules?: PersonalizedRule<T>[];
|
|
332
332
|
/**
|
|
333
333
|
* The value served when no rule matches
|
|
334
334
|
*/
|
|
@@ -336,18 +336,18 @@ export type SegmentedFieldPayload<T = any> = {
|
|
|
336
336
|
};
|
|
337
337
|
|
|
338
338
|
/**
|
|
339
|
-
* This type represent the visitor's value per
|
|
339
|
+
* This type represent the visitor's value per audience, as the rule engine reads it. An audience missing
|
|
340
340
|
* from the map, or set to `undefined`, means "not provided" - which is what
|
|
341
|
-
* [[
|
|
341
|
+
* [[AudiencePredicate.orUnset]] answers
|
|
342
342
|
*/
|
|
343
|
-
export type
|
|
344
|
-
[
|
|
343
|
+
export type AudienceAssignment = {
|
|
344
|
+
[audienceMnemonicId: string]: string | undefined;
|
|
345
345
|
};
|
|
346
346
|
|
|
347
347
|
/**
|
|
348
348
|
* The stand-in a coverage report uses for "a key none of the rules mention"
|
|
349
349
|
*
|
|
350
|
-
* Not a real key - it cannot be one, since keys match [[
|
|
350
|
+
* Not a real key - it cannot be one, since keys match [[AUDIENCE_NAME_PATTERN]]. A rule only ever tests
|
|
351
351
|
* membership in its own list, so every unmentioned key behaves identically and one case covers them
|
|
352
352
|
* all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which real
|
|
353
353
|
* keys it stood for
|
|
@@ -377,7 +377,7 @@ export type RuleCoverage = {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
/**
|
|
380
|
-
* This type represent what an ordered rule list covers, worked out from the rules and the
|
|
380
|
+
* This type represent what an ordered rule list covers, worked out from the rules and the audiences'
|
|
381
381
|
* keys alone - no request traffic is involved
|
|
382
382
|
*
|
|
383
383
|
* The findings are advisory and never validation violations: a gap is usually deliberate, that being
|
|
@@ -400,23 +400,23 @@ export type CoverageReport = {
|
|
|
400
400
|
* The assignments no rule claims, so they reach the fallback. Capped at 25 entries, while
|
|
401
401
|
* [[fallbackCount]] is the real total
|
|
402
402
|
*/
|
|
403
|
-
fallbackAssignments:
|
|
403
|
+
fallbackAssignments: AudienceAssignment[];
|
|
404
404
|
/**
|
|
405
405
|
* How many assignments reach the fallback, of [[combinations]]
|
|
406
406
|
*/
|
|
407
407
|
fallbackCount: number;
|
|
408
408
|
/**
|
|
409
|
-
* The
|
|
409
|
+
* The audiences declared by the field but constrained by no rule, so they change nothing about what
|
|
410
410
|
* it serves
|
|
411
411
|
*/
|
|
412
|
-
|
|
412
|
+
unusedAudiences: string[];
|
|
413
413
|
/**
|
|
414
|
-
* What [[OTHER_KEY]] stood for, per
|
|
415
|
-
* total. Only the
|
|
414
|
+
* What [[OTHER_KEY]] stood for, per audience: the real unmentioned keys, capped at 10, with their
|
|
415
|
+
* total. Only the audiences that needed the stand-in appear
|
|
416
416
|
*/
|
|
417
|
-
otherKeys: { [
|
|
417
|
+
otherKeys: { [audience: string]: { keys: string[]; total: number } };
|
|
418
418
|
/**
|
|
419
|
-
* Set when the rules and their
|
|
419
|
+
* Set when the rules and their audiences were too large to enumerate. Everything else is then
|
|
420
420
|
* unpopulated rather than guessed, because a sampled "no gaps" is not a fact
|
|
421
421
|
*/
|
|
422
422
|
notAnalysed?: { reason: 'tooManyCombinations'; combinations: number };
|
|
@@ -428,7 +428,7 @@ export type CoverageReport = {
|
|
|
428
428
|
* request - and a half written rule with no condition is analysed as one that matches nothing rather
|
|
429
429
|
* than refused
|
|
430
430
|
*/
|
|
431
|
-
export type
|
|
431
|
+
export type PersonalizedRuleDraft = {
|
|
432
432
|
/**
|
|
433
433
|
* The rule id, when it carries one. Reported back on the finding, so a client can match a finding
|
|
434
434
|
* to the rule on screen without relying on the index
|
|
@@ -437,30 +437,30 @@ export type SegmentRuleDraft = {
|
|
|
437
437
|
/**
|
|
438
438
|
* The condition under which this rule wins
|
|
439
439
|
*/
|
|
440
|
-
when?:
|
|
440
|
+
when?: AudienceRuleCondition;
|
|
441
441
|
};
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
444
|
* This type represent the data needed to make an analyse rules API request, which is what a field's
|
|
445
445
|
* rule editor asks about the rules on screen, before anything is saved
|
|
446
446
|
*
|
|
447
|
-
* The keys of every
|
|
447
|
+
* The keys of every audience are read from the space rather than taken from the request, so a client
|
|
448
448
|
* never has to hold them or keep them current
|
|
449
449
|
*/
|
|
450
|
-
export type
|
|
450
|
+
export type AnalyseAudienceRulesRequest = {
|
|
451
451
|
/**
|
|
452
|
-
* The mnemonic ids of the
|
|
452
|
+
* The mnemonic ids of the audiences the field varies by, at most 20. The analysis is bounded by
|
|
453
453
|
* these, as the field's rules are
|
|
454
454
|
*/
|
|
455
|
-
|
|
455
|
+
audiences: string[];
|
|
456
456
|
/**
|
|
457
457
|
* The rules in author order, at most 200. The order is the whole point: first match wins, so a rule
|
|
458
458
|
* being unreachable is a consequence of what precedes it
|
|
459
459
|
*/
|
|
460
|
-
rules:
|
|
460
|
+
rules: PersonalizedRuleDraft[];
|
|
461
461
|
};
|
|
462
462
|
|
|
463
463
|
/**
|
|
464
464
|
* This type represent the response of an analyse rules API request
|
|
465
465
|
*/
|
|
466
|
-
export type
|
|
466
|
+
export type AnalyseAudienceRulesResponse = CoverageReport;
|
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,11 @@ export type ListContentsFilters = {
|
|
|
404
404
|
translationStatus?: ContentTranslationStatus;
|
|
405
405
|
|
|
406
406
|
/**
|
|
407
|
-
* This filter is used to search contents whose
|
|
408
|
-
* inserted, as `
|
|
407
|
+
* This filter is used to search contents whose personalized fields have rules referencing the audiences
|
|
408
|
+
* inserted, as `audience` or `audience:key` tokens. A bare `audience` matches whichever key a content
|
|
409
409
|
* uses it with, and several tokens narrow the result like `tags` do
|
|
410
410
|
*/
|
|
411
|
-
|
|
411
|
+
audiences?: string[];
|
|
412
412
|
};
|
|
413
413
|
|
|
414
414
|
/**
|
|
@@ -846,17 +846,17 @@ export enum ContentFieldViolationCodes {
|
|
|
846
846
|
textFieldValueMissingInListOfValue = "textField.valueMissingInListOfValue",
|
|
847
847
|
textFieldValueIsNotAString = "textField.valueIsNotAString",
|
|
848
848
|
textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
849
|
+
personalizedFieldValueIsNotPersonalized = "personalizedField.valueIsNotPersonalized",
|
|
850
|
+
personalizedFieldRulesIsNotAnArray = "personalizedField.rulesIsNotAnArray",
|
|
851
|
+
personalizedFieldRuleIsNotAnObject = "personalizedField.ruleIsNotAnObject",
|
|
852
|
+
personalizedFieldRuleConditionMissing = "personalizedField.ruleConditionMissing",
|
|
853
|
+
personalizedFieldDuplicateRuleId = "personalizedField.duplicateRuleId",
|
|
854
|
+
personalizedFieldAudienceNotDeclared = "personalizedField.audienceNotDeclared",
|
|
855
|
+
personalizedFieldFallbackRequired = "personalizedField.fallbackRequired",
|
|
856
|
+
personalizedFieldAudienceNotFound = "personalizedField.audienceNotFound",
|
|
857
|
+
personalizedFieldAudienceArchived = "personalizedField.audienceArchived",
|
|
858
|
+
personalizedFieldAudienceKeyNotFound = "personalizedField.audienceKeyNotFound",
|
|
859
|
+
personalizedFieldAudienceKeyDeprecated = "personalizedField.audienceKeyDeprecated",
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
/**
|
|
@@ -903,19 +903,19 @@ export type ToggleContentTranslationsRequest = {
|
|
|
903
903
|
export type ToggleContentTranslationsResponse = ContentResponse;
|
|
904
904
|
|
|
905
905
|
/**
|
|
906
|
-
* This type represent the data needed to make an analyse
|
|
906
|
+
* This type represent the data needed to make an analyse personalized rules API request
|
|
907
907
|
*/
|
|
908
|
-
export type
|
|
908
|
+
export type AnalysePersonalizedRulesRequest = {
|
|
909
909
|
/**
|
|
910
|
-
* Id of the content whose
|
|
910
|
+
* Id of the content whose personalized fields have to be analysed
|
|
911
911
|
*/
|
|
912
912
|
contentId: ContentId;
|
|
913
913
|
};
|
|
914
914
|
|
|
915
915
|
/**
|
|
916
|
-
* This type represent the coverage of one
|
|
916
|
+
* This type represent the coverage of one personalized field of a content
|
|
917
917
|
*/
|
|
918
|
-
export type
|
|
918
|
+
export type PersonalizedFieldCoverage = CoverageReport & {
|
|
919
919
|
/**
|
|
920
920
|
* Where the field sits in the payload
|
|
921
921
|
*/
|
|
@@ -928,12 +928,12 @@ export type SegmentedFieldCoverage = CoverageReport & {
|
|
|
928
928
|
};
|
|
929
929
|
|
|
930
930
|
/**
|
|
931
|
-
* This type represent the response of an analyse
|
|
932
|
-
*
|
|
931
|
+
* This type represent the response of an analyse personalized rules API request: one report per
|
|
932
|
+
* personalized field of the content, empty when it has none
|
|
933
933
|
*/
|
|
934
|
-
export type
|
|
934
|
+
export type AnalysePersonalizedRulesResponse = {
|
|
935
935
|
/**
|
|
936
|
-
* One entry per
|
|
936
|
+
* One entry per personalized field found in the content payload
|
|
937
937
|
*/
|
|
938
|
-
fields:
|
|
938
|
+
fields: PersonalizedFieldCoverage[];
|
|
939
939
|
};
|