@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
|
@@ -2,21 +2,21 @@ import { AuthorResponse } from './Author';
|
|
|
2
2
|
import { PagedListResponse } from './common';
|
|
3
3
|
import { ContentDefinitionId } from './ContentDefinition';
|
|
4
4
|
/**
|
|
5
|
-
* The
|
|
5
|
+
* The audience unique id
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type AudienceId = number;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* An audience's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
|
|
10
10
|
* underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
|
|
11
|
-
* travel in the delivery `
|
|
11
|
+
* travel in the delivery `audiences` query param and are compared against strings a client supplies
|
|
12
12
|
*/
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const AUDIENCE_NAME_PATTERN: RegExp;
|
|
14
14
|
/**
|
|
15
|
-
* This type represent one key of
|
|
15
|
+
* This type represent one key of an audience, that is one of the values a visitor can have for it
|
|
16
16
|
*/
|
|
17
|
-
export type
|
|
17
|
+
export type AudienceKey = {
|
|
18
18
|
/**
|
|
19
|
-
* The key, matching [[
|
|
19
|
+
* The key, matching [[AUDIENCE_NAME_PATTERN]]
|
|
20
20
|
*/
|
|
21
21
|
key: string;
|
|
22
22
|
/**
|
|
@@ -26,97 +26,97 @@ export type SegmentKey = {
|
|
|
26
26
|
deprecated?: boolean;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
|
-
* This type represent the model of
|
|
29
|
+
* This type represent the model of an audience, that is a dimension a content can vary by - `gender`,
|
|
30
30
|
* `loyalty`, `auth_status` - holding the fixed set of keys a visitor can have for it
|
|
31
31
|
*
|
|
32
|
-
* Contents reference
|
|
33
|
-
* mnemonicId, so
|
|
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
34
|
* while no content references it
|
|
35
35
|
*/
|
|
36
|
-
export type
|
|
36
|
+
export type AudienceResponse = {
|
|
37
37
|
/**
|
|
38
|
-
* The
|
|
38
|
+
* The audience unique id
|
|
39
39
|
*/
|
|
40
|
-
id:
|
|
40
|
+
id: AudienceId;
|
|
41
41
|
/**
|
|
42
|
-
* The
|
|
42
|
+
* The audience name
|
|
43
43
|
*/
|
|
44
44
|
name: string;
|
|
45
45
|
/**
|
|
46
|
-
* The
|
|
46
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
|
|
47
47
|
*/
|
|
48
48
|
mnemonicId: string;
|
|
49
49
|
/**
|
|
50
|
-
* The keys a visitor can hold for this
|
|
50
|
+
* The keys a visitor can hold for this audience, each carrying its own deprecation state
|
|
51
51
|
*/
|
|
52
|
-
keys:
|
|
52
|
+
keys: AudienceKey[];
|
|
53
53
|
/**
|
|
54
|
-
* The archived status of the
|
|
54
|
+
* The archived status of the audience
|
|
55
55
|
*/
|
|
56
56
|
archived: boolean;
|
|
57
57
|
/**
|
|
58
|
-
* The archive date of the
|
|
58
|
+
* The archive date of the audience
|
|
59
59
|
*/
|
|
60
60
|
archivedDate: Date | null;
|
|
61
61
|
/**
|
|
62
|
-
* The
|
|
62
|
+
* The audience creation date
|
|
63
63
|
*/
|
|
64
64
|
createdDate: Date;
|
|
65
65
|
/**
|
|
66
|
-
* The
|
|
66
|
+
* The audience last modified date
|
|
67
67
|
*/
|
|
68
68
|
lastModifiedDate: Date;
|
|
69
69
|
/**
|
|
70
|
-
* The
|
|
70
|
+
* The audience author, resolved by `list` only
|
|
71
71
|
*/
|
|
72
72
|
author?: AuthorResponse;
|
|
73
73
|
/**
|
|
74
|
-
* The
|
|
74
|
+
* The audience last modified author, resolved by every endpoint but `get`
|
|
75
75
|
*/
|
|
76
76
|
latestContributor?: AuthorResponse;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
|
-
* This type represent all possible filters used to retrieve a list of
|
|
79
|
+
* This type represent all possible filters used to retrieve a list of audience
|
|
80
80
|
*/
|
|
81
|
-
export type
|
|
81
|
+
export type ListAudiencesFilters = {
|
|
82
82
|
/**
|
|
83
|
-
* This filter is used to retrieve archived or not archived
|
|
83
|
+
* This filter is used to retrieve archived or not archived audiences. Defaults to not archived
|
|
84
84
|
*/
|
|
85
85
|
archived?: boolean;
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
|
-
* This type represent the data needed to make a list
|
|
88
|
+
* This type represent the data needed to make a list audiences API request
|
|
89
89
|
*/
|
|
90
|
-
export type
|
|
90
|
+
export type ListAudiencesRequest = {
|
|
91
91
|
/**
|
|
92
|
-
* The number of
|
|
92
|
+
* The number of audiences to skip (this value is used for pagination)
|
|
93
93
|
*/
|
|
94
94
|
skip?: number;
|
|
95
95
|
/**
|
|
96
|
-
* The number of
|
|
96
|
+
* The number of audiences to take (this value is used for pagination), at most 100
|
|
97
97
|
*/
|
|
98
98
|
take?: number;
|
|
99
99
|
/**
|
|
100
|
-
* The data used to filter the list of
|
|
100
|
+
* The data used to filter the list of audiences
|
|
101
101
|
*/
|
|
102
|
-
filters?:
|
|
102
|
+
filters?: ListAudiencesFilters;
|
|
103
103
|
};
|
|
104
104
|
/**
|
|
105
|
-
* This type represent the item of a list
|
|
105
|
+
* This type represent the item of a list audiences API request
|
|
106
106
|
*/
|
|
107
|
-
export type
|
|
107
|
+
export type ListAudiencesItem = AudienceResponse;
|
|
108
108
|
/**
|
|
109
|
-
* This type represent the response of a list
|
|
109
|
+
* This type represent the response of a list audiences API request
|
|
110
110
|
*/
|
|
111
|
-
export type
|
|
111
|
+
export type ListAudiencesResponse = PagedListResponse<ListAudiencesItem>;
|
|
112
112
|
/**
|
|
113
|
-
* This type represent the usage of one key of
|
|
113
|
+
* This type represent the usage of one key of an audience. A key with no entry is used by no content,
|
|
114
114
|
* and is therefore the only kind of key that can be removed or renamed
|
|
115
115
|
*/
|
|
116
|
-
export type
|
|
116
|
+
export type AudienceKeyUsage = {
|
|
117
117
|
/**
|
|
118
|
-
* The key, or null for the rules that constrain the
|
|
119
|
-
* ones that only fire when the
|
|
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
120
|
*/
|
|
121
121
|
key: string | null;
|
|
122
122
|
/**
|
|
@@ -125,9 +125,9 @@ export type SegmentKeyUsage = {
|
|
|
125
125
|
contents: number;
|
|
126
126
|
};
|
|
127
127
|
/**
|
|
128
|
-
* This type represent a content definition that declares
|
|
128
|
+
* This type represent a content definition that declares an audience
|
|
129
129
|
*/
|
|
130
|
-
export type
|
|
130
|
+
export type DefinitionUsingAudience = {
|
|
131
131
|
/**
|
|
132
132
|
* The content definition unique id
|
|
133
133
|
*/
|
|
@@ -142,113 +142,113 @@ export type DefinitionUsingSegment = {
|
|
|
142
142
|
name: string;
|
|
143
143
|
};
|
|
144
144
|
/**
|
|
145
|
-
* This type represent the data needed to make a get
|
|
145
|
+
* This type represent the data needed to make a get audience API request
|
|
146
146
|
*/
|
|
147
|
-
export type
|
|
147
|
+
export type GetAudienceRequest = {
|
|
148
148
|
/**
|
|
149
|
-
* The unique
|
|
149
|
+
* The unique audience id to retrieve
|
|
150
150
|
*/
|
|
151
|
-
id:
|
|
151
|
+
id: AudienceId;
|
|
152
152
|
};
|
|
153
153
|
/**
|
|
154
|
-
* This type represent the response of a get
|
|
155
|
-
* editor cannot decide without, which keys are in use and which definitions vary by this
|
|
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
156
|
*/
|
|
157
|
-
export type
|
|
157
|
+
export type GetAudienceResponse = AudienceResponse & {
|
|
158
158
|
/**
|
|
159
159
|
* One entry per key at least one content references. A key absent from this list is unused
|
|
160
160
|
*/
|
|
161
|
-
keyUsage:
|
|
161
|
+
keyUsage: AudienceKeyUsage[];
|
|
162
162
|
/**
|
|
163
|
-
* The content definitions declaring this
|
|
163
|
+
* The content definitions declaring this audience
|
|
164
164
|
*/
|
|
165
|
-
definitions:
|
|
165
|
+
definitions: DefinitionUsingAudience[];
|
|
166
166
|
};
|
|
167
167
|
/**
|
|
168
|
-
* This type represent the data needed to make a create
|
|
168
|
+
* This type represent the data needed to make a create audience API request
|
|
169
169
|
*/
|
|
170
|
-
export type
|
|
170
|
+
export type CreateAudienceRequest = {
|
|
171
171
|
/**
|
|
172
|
-
* The
|
|
172
|
+
* The audience name
|
|
173
173
|
*/
|
|
174
174
|
name: string;
|
|
175
175
|
/**
|
|
176
|
-
* The
|
|
176
|
+
* The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
|
|
177
177
|
*/
|
|
178
178
|
mnemonicId: string;
|
|
179
179
|
/**
|
|
180
|
-
* The keys a visitor can hold for this
|
|
180
|
+
* The keys a visitor can hold for this audience, at least one, each key unique
|
|
181
181
|
*/
|
|
182
|
-
keys:
|
|
182
|
+
keys: AudienceKey[];
|
|
183
183
|
};
|
|
184
184
|
/**
|
|
185
|
-
* This type represent the response of a create
|
|
185
|
+
* This type represent the response of a create audience API request
|
|
186
186
|
*/
|
|
187
|
-
export type
|
|
187
|
+
export type CreateAudienceResponse = AudienceResponse;
|
|
188
188
|
/**
|
|
189
|
-
* This type represent the data needed to make an update
|
|
189
|
+
* This type represent the data needed to make an update audience API request
|
|
190
190
|
*
|
|
191
191
|
* `keys` replaces the whole stored list, deprecation flags included. Adding keys and toggling
|
|
192
192
|
* deprecation are always allowed, while removing or renaming a key is refused while a content still
|
|
193
193
|
* references it. `mnemonicId` cannot be changed
|
|
194
194
|
*/
|
|
195
|
-
export type
|
|
195
|
+
export type UpdateAudienceRequest = {
|
|
196
196
|
/**
|
|
197
|
-
* The
|
|
197
|
+
* The audience unique id
|
|
198
198
|
*/
|
|
199
|
-
id:
|
|
199
|
+
id: AudienceId;
|
|
200
200
|
/**
|
|
201
|
-
* The
|
|
201
|
+
* The audience name to update
|
|
202
202
|
*/
|
|
203
203
|
name: string;
|
|
204
204
|
/**
|
|
205
|
-
* The
|
|
205
|
+
* The audience mnemonic id, which must be the stored one
|
|
206
206
|
*/
|
|
207
207
|
mnemonicId: string;
|
|
208
208
|
/**
|
|
209
209
|
* The whole key list, replacing what is stored
|
|
210
210
|
*/
|
|
211
|
-
keys:
|
|
211
|
+
keys: AudienceKey[];
|
|
212
212
|
};
|
|
213
213
|
/**
|
|
214
|
-
* This type represent the response of an update
|
|
214
|
+
* This type represent the response of an update audience API request
|
|
215
215
|
*/
|
|
216
|
-
export type
|
|
216
|
+
export type UpdateAudienceResponse = AudienceResponse;
|
|
217
217
|
/**
|
|
218
|
-
* This type represent the data needed to make a toggle archived
|
|
218
|
+
* This type represent the data needed to make a toggle archived audience API request
|
|
219
219
|
*/
|
|
220
|
-
export type
|
|
220
|
+
export type ToggleArchivedAudienceRequest = {
|
|
221
221
|
/**
|
|
222
|
-
* The
|
|
222
|
+
* The audience unique id
|
|
223
223
|
*/
|
|
224
|
-
id:
|
|
224
|
+
id: AudienceId;
|
|
225
225
|
/**
|
|
226
|
-
* This value represent the archive status to set in the specified
|
|
226
|
+
* This value represent the archive status to set in the specified audience
|
|
227
227
|
*/
|
|
228
228
|
archived: boolean;
|
|
229
229
|
};
|
|
230
230
|
/**
|
|
231
|
-
* This type represent the response of a toggle archived
|
|
231
|
+
* This type represent the response of a toggle archived audience API request
|
|
232
232
|
*/
|
|
233
|
-
export type
|
|
233
|
+
export type ToggleArchivedAudienceResponse = AudienceResponse;
|
|
234
234
|
/**
|
|
235
|
-
* This type represent the condition of one rule on a single
|
|
236
|
-
* [[
|
|
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
237
|
*/
|
|
238
|
-
export type
|
|
238
|
+
export type AudiencePredicate = {
|
|
239
239
|
/**
|
|
240
|
-
* The mnemonic id of the
|
|
240
|
+
* The mnemonic id of the audience this predicate constrains, which the field must declare
|
|
241
241
|
*/
|
|
242
|
-
|
|
242
|
+
audience: string;
|
|
243
243
|
/**
|
|
244
|
-
* The keys of the
|
|
244
|
+
* The keys of the audience that satisfy this predicate
|
|
245
245
|
*/
|
|
246
246
|
in: string[];
|
|
247
247
|
/**
|
|
248
|
-
* Set this value to also satisfy the predicate when the
|
|
248
|
+
* Set this value to also satisfy the predicate when the audience was not provided at all
|
|
249
249
|
*
|
|
250
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
|
|
251
|
+
* narrow the moment a key is added to the audience. A key that was provided but is not listed does
|
|
252
252
|
* not satisfy this flag: it falls through to the field's fallback
|
|
253
253
|
*/
|
|
254
254
|
orUnset?: boolean;
|
|
@@ -256,29 +256,29 @@ export type SegmentPredicate = {
|
|
|
256
256
|
/**
|
|
257
257
|
* This type represent a condition satisfied when every child condition is satisfied
|
|
258
258
|
*/
|
|
259
|
-
export type
|
|
260
|
-
all:
|
|
259
|
+
export type AllAudiencePredicate = {
|
|
260
|
+
all: AudienceRuleCondition[];
|
|
261
261
|
};
|
|
262
262
|
/**
|
|
263
263
|
* This type represent a condition satisfied when at least one child condition is satisfied
|
|
264
264
|
*/
|
|
265
|
-
export type
|
|
266
|
-
any:
|
|
265
|
+
export type AnyAudiencePredicate = {
|
|
266
|
+
any: AudienceRuleCondition[];
|
|
267
267
|
};
|
|
268
268
|
/**
|
|
269
269
|
* This type represent the condition of a rule
|
|
270
270
|
*
|
|
271
271
|
* The stored form is a tree so that new kinds of condition stay additive, but an editor only needs to
|
|
272
|
-
* build an [[
|
|
273
|
-
* between
|
|
274
|
-
* thing from one listed with [[
|
|
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
275
|
*/
|
|
276
|
-
export type
|
|
276
|
+
export type AudienceRuleCondition = AudiencePredicate | AllAudiencePredicate | AnyAudiencePredicate;
|
|
277
277
|
/**
|
|
278
|
-
* This type represent one rule of a
|
|
278
|
+
* This type represent one rule of a personalized field: the condition, and the value to serve when it wins
|
|
279
279
|
* @template T The type of the value served by the rule, which conforms to the field's `variantType`
|
|
280
280
|
*/
|
|
281
|
-
export type
|
|
281
|
+
export type PersonalizedRule<T = any> = {
|
|
282
282
|
/**
|
|
283
283
|
* The rule id, unique in the field. Used for diagnostics only, matching never reads it
|
|
284
284
|
*/
|
|
@@ -286,42 +286,42 @@ export type SegmentRule<T = any> = {
|
|
|
286
286
|
/**
|
|
287
287
|
* The condition under which this rule wins
|
|
288
288
|
*/
|
|
289
|
-
when:
|
|
289
|
+
when: AudienceRuleCondition;
|
|
290
290
|
/**
|
|
291
291
|
* The value served when this rule wins
|
|
292
292
|
*/
|
|
293
293
|
value: T;
|
|
294
294
|
};
|
|
295
295
|
/**
|
|
296
|
-
* This type represent the value a
|
|
296
|
+
* This type represent the value a personalized field holds in a content payload: an ordered list of
|
|
297
297
|
* rules, first match wins, and the fallback served when no rule matches
|
|
298
298
|
*
|
|
299
299
|
* The fallback is mandatory exactly when the field is required, which keeps the delivery contract of a
|
|
300
|
-
*
|
|
300
|
+
* personalized field the same as any other field. Zero rules is legal: the field is then just its fallback
|
|
301
301
|
* @template T The type of the served values, which conform to the field's `variantType`
|
|
302
302
|
*/
|
|
303
|
-
export type
|
|
303
|
+
export type PersonalizedFieldPayload<T = any> = {
|
|
304
304
|
/**
|
|
305
305
|
* The rules, in the order they are evaluated in
|
|
306
306
|
*/
|
|
307
|
-
rules?:
|
|
307
|
+
rules?: PersonalizedRule<T>[];
|
|
308
308
|
/**
|
|
309
309
|
* The value served when no rule matches
|
|
310
310
|
*/
|
|
311
311
|
fallback?: T;
|
|
312
312
|
};
|
|
313
313
|
/**
|
|
314
|
-
* This type represent the visitor's value per
|
|
314
|
+
* This type represent the visitor's value per audience, as the rule engine reads it. An audience missing
|
|
315
315
|
* from the map, or set to `undefined`, means "not provided" - which is what
|
|
316
|
-
* [[
|
|
316
|
+
* [[AudiencePredicate.orUnset]] answers
|
|
317
317
|
*/
|
|
318
|
-
export type
|
|
319
|
-
[
|
|
318
|
+
export type AudienceAssignment = {
|
|
319
|
+
[audienceMnemonicId: string]: string | undefined;
|
|
320
320
|
};
|
|
321
321
|
/**
|
|
322
322
|
* The stand-in a coverage report uses for "a key none of the rules mention"
|
|
323
323
|
*
|
|
324
|
-
* Not a real key - it cannot be one, since keys match [[
|
|
324
|
+
* Not a real key - it cannot be one, since keys match [[AUDIENCE_NAME_PATTERN]]. A rule only ever tests
|
|
325
325
|
* membership in its own list, so every unmentioned key behaves identically and one case covers them
|
|
326
326
|
* all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which real
|
|
327
327
|
* keys it stood for
|
|
@@ -349,7 +349,7 @@ export type RuleCoverage = {
|
|
|
349
349
|
wins: number;
|
|
350
350
|
};
|
|
351
351
|
/**
|
|
352
|
-
* This type represent what an ordered rule list covers, worked out from the rules and the
|
|
352
|
+
* This type represent what an ordered rule list covers, worked out from the rules and the audiences'
|
|
353
353
|
* keys alone - no request traffic is involved
|
|
354
354
|
*
|
|
355
355
|
* The findings are advisory and never validation violations: a gap is usually deliberate, that being
|
|
@@ -372,28 +372,28 @@ export type CoverageReport = {
|
|
|
372
372
|
* The assignments no rule claims, so they reach the fallback. Capped at 25 entries, while
|
|
373
373
|
* [[fallbackCount]] is the real total
|
|
374
374
|
*/
|
|
375
|
-
fallbackAssignments:
|
|
375
|
+
fallbackAssignments: AudienceAssignment[];
|
|
376
376
|
/**
|
|
377
377
|
* How many assignments reach the fallback, of [[combinations]]
|
|
378
378
|
*/
|
|
379
379
|
fallbackCount: number;
|
|
380
380
|
/**
|
|
381
|
-
* The
|
|
381
|
+
* The audiences declared by the field but constrained by no rule, so they change nothing about what
|
|
382
382
|
* it serves
|
|
383
383
|
*/
|
|
384
|
-
|
|
384
|
+
unusedAudiences: string[];
|
|
385
385
|
/**
|
|
386
|
-
* What [[OTHER_KEY]] stood for, per
|
|
387
|
-
* total. Only the
|
|
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
388
|
*/
|
|
389
389
|
otherKeys: {
|
|
390
|
-
[
|
|
390
|
+
[audience: string]: {
|
|
391
391
|
keys: string[];
|
|
392
392
|
total: number;
|
|
393
393
|
};
|
|
394
394
|
};
|
|
395
395
|
/**
|
|
396
|
-
* Set when the rules and their
|
|
396
|
+
* Set when the rules and their audiences were too large to enumerate. Everything else is then
|
|
397
397
|
* unpopulated rather than guessed, because a sampled "no gaps" is not a fact
|
|
398
398
|
*/
|
|
399
399
|
notAnalysed?: {
|
|
@@ -407,7 +407,7 @@ export type CoverageReport = {
|
|
|
407
407
|
* request - and a half written rule with no condition is analysed as one that matches nothing rather
|
|
408
408
|
* than refused
|
|
409
409
|
*/
|
|
410
|
-
export type
|
|
410
|
+
export type PersonalizedRuleDraft = {
|
|
411
411
|
/**
|
|
412
412
|
* The rule id, when it carries one. Reported back on the finding, so a client can match a finding
|
|
413
413
|
* to the rule on screen without relying on the index
|
|
@@ -416,28 +416,28 @@ export type SegmentRuleDraft = {
|
|
|
416
416
|
/**
|
|
417
417
|
* The condition under which this rule wins
|
|
418
418
|
*/
|
|
419
|
-
when?:
|
|
419
|
+
when?: AudienceRuleCondition;
|
|
420
420
|
};
|
|
421
421
|
/**
|
|
422
422
|
* This type represent the data needed to make an analyse rules API request, which is what a field's
|
|
423
423
|
* rule editor asks about the rules on screen, before anything is saved
|
|
424
424
|
*
|
|
425
|
-
* The keys of every
|
|
425
|
+
* The keys of every audience are read from the space rather than taken from the request, so a client
|
|
426
426
|
* never has to hold them or keep them current
|
|
427
427
|
*/
|
|
428
|
-
export type
|
|
428
|
+
export type AnalyseAudienceRulesRequest = {
|
|
429
429
|
/**
|
|
430
|
-
* The mnemonic ids of the
|
|
430
|
+
* The mnemonic ids of the audiences the field varies by, at most 20. The analysis is bounded by
|
|
431
431
|
* these, as the field's rules are
|
|
432
432
|
*/
|
|
433
|
-
|
|
433
|
+
audiences: string[];
|
|
434
434
|
/**
|
|
435
435
|
* The rules in author order, at most 200. The order is the whole point: first match wins, so a rule
|
|
436
436
|
* being unreachable is a consequence of what precedes it
|
|
437
437
|
*/
|
|
438
|
-
rules:
|
|
438
|
+
rules: PersonalizedRuleDraft[];
|
|
439
439
|
};
|
|
440
440
|
/**
|
|
441
441
|
* This type represent the response of an analyse rules API request
|
|
442
442
|
*/
|
|
443
|
-
export type
|
|
443
|
+
export type AnalyseAudienceRulesResponse = CoverageReport;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OTHER_KEY = exports.
|
|
3
|
+
exports.OTHER_KEY = exports.AUDIENCE_NAME_PATTERN = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* An audience's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
|
|
6
6
|
* underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
|
|
7
|
-
* travel in the delivery `
|
|
7
|
+
* travel in the delivery `audiences` query param and are compared against strings a client supplies
|
|
8
8
|
*/
|
|
9
|
-
exports.
|
|
9
|
+
exports.AUDIENCE_NAME_PATTERN = /^[a-z0-9_-]+$/;
|
|
10
10
|
/**
|
|
11
11
|
* The stand-in a coverage report uses for "a key none of the rules mention"
|
|
12
12
|
*
|
|
13
|
-
* Not a real key - it cannot be one, since keys match [[
|
|
13
|
+
* Not a real key - it cannot be one, since keys match [[AUDIENCE_NAME_PATTERN]]. A rule only ever tests
|
|
14
14
|
* membership in its own list, so every unmentioned key behaves identically and one case covers them
|
|
15
15
|
* all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which real
|
|
16
16
|
* keys it stood for
|
package/dist/api/Content.d.ts
CHANGED
|
@@ -5,7 +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 "./
|
|
8
|
+
import { CoverageReport } from "./Audience";
|
|
9
9
|
/**
|
|
10
10
|
* This type represent the content unique id type
|
|
11
11
|
*/
|
|
@@ -369,11 +369,11 @@ export type ListContentsFilters = {
|
|
|
369
369
|
*/
|
|
370
370
|
translationStatus?: ContentTranslationStatus;
|
|
371
371
|
/**
|
|
372
|
-
* This filter is used to search contents whose
|
|
373
|
-
* 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
|
|
374
374
|
* uses it with, and several tokens narrow the result like `tags` do
|
|
375
375
|
*/
|
|
376
|
-
|
|
376
|
+
audiences?: string[];
|
|
377
377
|
};
|
|
378
378
|
/**
|
|
379
379
|
* This type represent the data needed to make a list content API request
|
|
@@ -777,17 +777,17 @@ export declare enum ContentFieldViolationCodes {
|
|
|
777
777
|
textFieldValueMissingInListOfValue = "textField.valueMissingInListOfValue",
|
|
778
778
|
textFieldValueIsNotAString = "textField.valueIsNotAString",
|
|
779
779
|
textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
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"
|
|
791
791
|
}
|
|
792
792
|
/**
|
|
793
793
|
* Request type for getContentStatus
|
|
@@ -826,18 +826,18 @@ export type ToggleContentTranslationsRequest = {
|
|
|
826
826
|
};
|
|
827
827
|
export type ToggleContentTranslationsResponse = ContentResponse;
|
|
828
828
|
/**
|
|
829
|
-
* This type represent the data needed to make an analyse
|
|
829
|
+
* This type represent the data needed to make an analyse personalized rules API request
|
|
830
830
|
*/
|
|
831
|
-
export type
|
|
831
|
+
export type AnalysePersonalizedRulesRequest = {
|
|
832
832
|
/**
|
|
833
|
-
* Id of the content whose
|
|
833
|
+
* Id of the content whose personalized fields have to be analysed
|
|
834
834
|
*/
|
|
835
835
|
contentId: ContentId;
|
|
836
836
|
};
|
|
837
837
|
/**
|
|
838
|
-
* This type represent the coverage of one
|
|
838
|
+
* This type represent the coverage of one personalized field of a content
|
|
839
839
|
*/
|
|
840
|
-
export type
|
|
840
|
+
export type PersonalizedFieldCoverage = CoverageReport & {
|
|
841
841
|
/**
|
|
842
842
|
* Where the field sits in the payload
|
|
843
843
|
*/
|
|
@@ -849,12 +849,12 @@ export type SegmentedFieldCoverage = CoverageReport & {
|
|
|
849
849
|
hasFallback: boolean;
|
|
850
850
|
};
|
|
851
851
|
/**
|
|
852
|
-
* This type represent the response of an analyse
|
|
853
|
-
*
|
|
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
854
|
*/
|
|
855
|
-
export type
|
|
855
|
+
export type AnalysePersonalizedRulesResponse = {
|
|
856
856
|
/**
|
|
857
|
-
* One entry per
|
|
857
|
+
* One entry per personalized field found in the content payload
|
|
858
858
|
*/
|
|
859
|
-
fields:
|
|
859
|
+
fields: PersonalizedFieldCoverage[];
|
|
860
860
|
};
|