@contentchef/contentchef-types 11.0.0-alpha.5 → 11.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/Audience.d.ts +185 -196
- package/dist/api/Audience.js +21 -11
- package/dist/api/Content.d.ts +9 -12
- package/dist/api/Content.js +5 -8
- package/dist/api/ContentDefinition.d.ts +1 -19
- package/dist/api/ContentDefinition.js +1 -5
- package/dist/api/ContentDefinitionSchema.d.ts +6 -24
- package/dist/api/Dimension.d.ts +254 -0
- package/dist/api/Dimension.js +18 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/lib/api/Audience.ts +191 -205
- package/lib/api/Content.ts +9 -12
- package/lib/api/ContentDefinition.ts +1 -20
- package/lib/api/ContentDefinitionSchema.ts +6 -24
- package/lib/api/Dimension.ts +274 -0
- package/lib/api/index.ts +1 -0
- package/package.json +2 -2
|
@@ -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 audiences this definition depends on, chosen by the author. Every one has to exist in the
|
|
56
|
-
* space and not be archived, and a personalized field may only vary by audiences 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 personalized field
|
|
60
|
-
*/
|
|
61
|
-
audiences?: string[];
|
|
62
54
|
};
|
|
63
55
|
|
|
64
56
|
/**
|
|
@@ -330,7 +322,7 @@ export type OneLinkedContentOfConstraints = {
|
|
|
330
322
|
|
|
331
323
|
/**
|
|
332
324
|
* This type represent what every value of a personalized field holds: one descriptor for the whole field,
|
|
333
|
-
* so the
|
|
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
|
|
@@ -342,24 +334,14 @@ export type PersonalizedVariantType =
|
|
|
342
334
|
/**
|
|
343
335
|
* This type represent the model of a personalized field constraints
|
|
344
336
|
*
|
|
345
|
-
* A personalized field
|
|
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
342
|
export type PersonalizedFieldConstraints = {
|
|
351
343
|
/**
|
|
352
|
-
* The
|
|
353
|
-
* definition declares in [[ContentDefinitionSchema.audiences]]. Only the declaration is checked
|
|
354
|
-
* against the space, so an audience 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
|
-
* audience it constrains
|
|
359
|
-
*/
|
|
360
|
-
audiences: string[];
|
|
361
|
-
/**
|
|
362
|
-
* The shape every rule value and the fallback conform to
|
|
344
|
+
* The shape every variant value and the fallback conform to
|
|
363
345
|
*/
|
|
364
346
|
variantType: PersonalizedVariantType;
|
|
365
347
|
};
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { AuthorResponse } from './Author';
|
|
2
|
+
import { PagedListResponse } from './common';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The dimension unique id
|
|
6
|
+
*/
|
|
7
|
+
export type DimensionId = number;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A dimension's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
|
|
11
|
+
* underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
|
|
12
|
+
* travel in the delivery `audiences` query param and are compared against strings a client supplies
|
|
13
|
+
*/
|
|
14
|
+
export const DIMENSION_NAME_PATTERN = /^[a-z0-9_-]+$/;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This type represent one key of a dimension, that is one of the values a visitor can have for it
|
|
18
|
+
*/
|
|
19
|
+
export type DimensionKey = {
|
|
20
|
+
/**
|
|
21
|
+
* The key, matching [[DIMENSION_NAME_PATTERN]]
|
|
22
|
+
*/
|
|
23
|
+
key: string;
|
|
24
|
+
/**
|
|
25
|
+
* A deprecated key cannot be referenced by new audience rules, while every rule already written
|
|
26
|
+
* keeps resolving. The flag toggles both ways
|
|
27
|
+
*/
|
|
28
|
+
deprecated?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* This type represent the model of a dimension, that is something a visitor can be described by -
|
|
33
|
+
* `gender`, `loyalty`, `auth_status` - holding the fixed set of keys they can have for it
|
|
34
|
+
*
|
|
35
|
+
* Dimensions are what audience rules are written over, and a visitor's values for them are what the
|
|
36
|
+
* delivery request carries. Audiences reference a dimension by mnemonicId and key, so dimensions are
|
|
37
|
+
* archived and never deleted, and a key can only be removed or renamed while no audience uses it
|
|
38
|
+
*/
|
|
39
|
+
export type DimensionResponse = {
|
|
40
|
+
/**
|
|
41
|
+
* The dimension unique id
|
|
42
|
+
*/
|
|
43
|
+
id: DimensionId;
|
|
44
|
+
/**
|
|
45
|
+
* The dimension name
|
|
46
|
+
*/
|
|
47
|
+
name: string;
|
|
48
|
+
/**
|
|
49
|
+
* The dimension mnemonic id, matching [[DIMENSION_NAME_PATTERN]]
|
|
50
|
+
*/
|
|
51
|
+
mnemonicId: string;
|
|
52
|
+
/**
|
|
53
|
+
* The keys a visitor can hold for this dimension, each carrying its own deprecation state
|
|
54
|
+
*/
|
|
55
|
+
keys: DimensionKey[];
|
|
56
|
+
/**
|
|
57
|
+
* The archived status of the dimension
|
|
58
|
+
*/
|
|
59
|
+
archived: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The archive date of the dimension
|
|
62
|
+
*/
|
|
63
|
+
archivedDate: Date | null;
|
|
64
|
+
/**
|
|
65
|
+
* The dimension creation date
|
|
66
|
+
*/
|
|
67
|
+
createdDate: Date;
|
|
68
|
+
/**
|
|
69
|
+
* The dimension last modified date
|
|
70
|
+
*/
|
|
71
|
+
lastModifiedDate: Date;
|
|
72
|
+
/**
|
|
73
|
+
* The dimension author, resolved by `list` only
|
|
74
|
+
*/
|
|
75
|
+
author?: AuthorResponse;
|
|
76
|
+
/**
|
|
77
|
+
* The dimension last modified author, resolved by every endpoint but `get`
|
|
78
|
+
*/
|
|
79
|
+
latestContributor?: AuthorResponse;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* This type represent all possible filters used to retrieve a list of dimension
|
|
84
|
+
*/
|
|
85
|
+
export type ListDimensionsFilters = {
|
|
86
|
+
/**
|
|
87
|
+
* This filter is used to retrieve archived or not archived dimensions. Defaults to not archived
|
|
88
|
+
*/
|
|
89
|
+
archived?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* This filter is used to search dimensions whose name or mnemonic id contain the value inserted,
|
|
92
|
+
* case insensitively. At most 100 characters
|
|
93
|
+
*/
|
|
94
|
+
name?: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* This type represent the data needed to make a list dimensions API request
|
|
99
|
+
*/
|
|
100
|
+
export type ListDimensionsRequest = {
|
|
101
|
+
/**
|
|
102
|
+
* The number of dimensions to skip (this value is used for pagination)
|
|
103
|
+
*/
|
|
104
|
+
skip?: number;
|
|
105
|
+
/**
|
|
106
|
+
* The number of dimensions to take (this value is used for pagination), at most 100
|
|
107
|
+
*/
|
|
108
|
+
take?: number;
|
|
109
|
+
/**
|
|
110
|
+
* The data used to filter the list of dimensions
|
|
111
|
+
*/
|
|
112
|
+
filters?: ListDimensionsFilters;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* This type represent the item of a list dimensions API request
|
|
117
|
+
*/
|
|
118
|
+
export type ListDimensionsItem = DimensionResponse;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* This type represent the response of a list dimensions API request
|
|
122
|
+
*/
|
|
123
|
+
export type ListDimensionsResponse = PagedListResponse<ListDimensionsItem>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* This type represent the usage of one key of a dimension. A key with no entry is named by no audience
|
|
127
|
+
* rule, and is therefore the only kind of key that can be removed or renamed
|
|
128
|
+
*/
|
|
129
|
+
export type DimensionKeyUsage = {
|
|
130
|
+
/**
|
|
131
|
+
* The key, or null for the rules that constrain the dimension without naming any key - that is the
|
|
132
|
+
* ones that only fire when the dimension is unknown
|
|
133
|
+
*/
|
|
134
|
+
key: string | null;
|
|
135
|
+
/**
|
|
136
|
+
* How many audiences reference this key
|
|
137
|
+
*/
|
|
138
|
+
audiences: number;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* This type represent an audience whose rule names a dimension
|
|
143
|
+
*/
|
|
144
|
+
export type AudienceUsingDimension = {
|
|
145
|
+
/**
|
|
146
|
+
* The audience unique id
|
|
147
|
+
*/
|
|
148
|
+
id: number;
|
|
149
|
+
/**
|
|
150
|
+
* The audience mnemonic id
|
|
151
|
+
*/
|
|
152
|
+
mnemonicId: string;
|
|
153
|
+
/**
|
|
154
|
+
* The audience name
|
|
155
|
+
*/
|
|
156
|
+
name: string;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* This type represent the data needed to make a get dimension API request
|
|
161
|
+
*/
|
|
162
|
+
export type GetDimensionRequest = {
|
|
163
|
+
/**
|
|
164
|
+
* The unique dimension id to retrieve
|
|
165
|
+
*/
|
|
166
|
+
id: DimensionId;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* This type represent the response of a get dimension API request: the dimension, plus the two things
|
|
171
|
+
* the editor cannot decide without, which keys are in use and which audiences are written against it
|
|
172
|
+
*/
|
|
173
|
+
export type GetDimensionResponse = DimensionResponse & {
|
|
174
|
+
/**
|
|
175
|
+
* One entry per key at least one audience rule names. A key absent from this list is unused
|
|
176
|
+
*/
|
|
177
|
+
keyUsage: DimensionKeyUsage[];
|
|
178
|
+
/**
|
|
179
|
+
* The audiences whose rule names this dimension
|
|
180
|
+
*/
|
|
181
|
+
audiences: AudienceUsingDimension[];
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* This type represent the data needed to make a create dimension API request
|
|
186
|
+
*/
|
|
187
|
+
export type CreateDimensionRequest = {
|
|
188
|
+
/**
|
|
189
|
+
* The dimension name
|
|
190
|
+
*/
|
|
191
|
+
name: string;
|
|
192
|
+
/**
|
|
193
|
+
* The dimension mnemonic id, matching [[DIMENSION_NAME_PATTERN]]
|
|
194
|
+
*/
|
|
195
|
+
mnemonicId: string;
|
|
196
|
+
/**
|
|
197
|
+
* The keys a visitor can hold for this dimension, at least one, each key unique
|
|
198
|
+
*/
|
|
199
|
+
keys: DimensionKey[];
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* This type represent the response of a create dimension API request
|
|
204
|
+
*/
|
|
205
|
+
export type CreateDimensionResponse = DimensionResponse;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* This type represent the data needed to make an update dimension API request
|
|
209
|
+
*
|
|
210
|
+
* `keys` replaces the whole stored list, deprecation flags included. Adding keys and toggling
|
|
211
|
+
* deprecation are always allowed, while removing or renaming a key is refused while an audience rule
|
|
212
|
+
* still names it. `mnemonicId` cannot be changed
|
|
213
|
+
*/
|
|
214
|
+
export type UpdateDimensionRequest = {
|
|
215
|
+
/**
|
|
216
|
+
* The dimension unique id
|
|
217
|
+
*/
|
|
218
|
+
id: DimensionId;
|
|
219
|
+
/**
|
|
220
|
+
* The dimension name to update
|
|
221
|
+
*/
|
|
222
|
+
name: string;
|
|
223
|
+
/**
|
|
224
|
+
* The dimension mnemonic id, which must be the stored one
|
|
225
|
+
*/
|
|
226
|
+
mnemonicId: string;
|
|
227
|
+
/**
|
|
228
|
+
* The whole key list, replacing what is stored
|
|
229
|
+
*/
|
|
230
|
+
keys: DimensionKey[];
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* This type represent the response of an update dimension API request
|
|
235
|
+
*/
|
|
236
|
+
export type UpdateDimensionResponse = DimensionResponse;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* This type represent the data needed to make a toggle archived dimension API request
|
|
240
|
+
*/
|
|
241
|
+
export type ToggleArchivedDimensionRequest = {
|
|
242
|
+
/**
|
|
243
|
+
* The dimension unique id
|
|
244
|
+
*/
|
|
245
|
+
id: DimensionId;
|
|
246
|
+
/**
|
|
247
|
+
* This value represent the archive status to set in the specified dimension
|
|
248
|
+
*/
|
|
249
|
+
archived: boolean;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* This type represent the response of a toggle archived dimension API request
|
|
254
|
+
*/
|
|
255
|
+
export type ToggleArchivedDimensionResponse = DimensionResponse;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* This type represent a visitor's value per dimension, as the rule engine reads it. A dimension missing
|
|
259
|
+
* from the map, or set to `undefined`, means "not provided" - which is what
|
|
260
|
+
* [[DimensionPredicate.orUnset]] answers
|
|
261
|
+
*/
|
|
262
|
+
export type DimensionAssignment = {
|
|
263
|
+
[dimensionMnemonicId: string]: string | undefined;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* The stand-in a coverage report uses for "a key none of the analysed rules mention"
|
|
268
|
+
*
|
|
269
|
+
* Not a real key - it cannot be one, since keys match [[DIMENSION_NAME_PATTERN]]. A rule only ever
|
|
270
|
+
* tests membership in its own list, so every unmentioned key behaves identically and one case covers
|
|
271
|
+
* them all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which
|
|
272
|
+
* real keys it stood for
|
|
273
|
+
*/
|
|
274
|
+
export const OTHER_KEY = '<any other key>';
|
package/lib/api/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './ContentDefinitionSchema';
|
|
|
8
8
|
export * from './ContentExportImport';
|
|
9
9
|
export * from './ContentRepository';
|
|
10
10
|
export * from './ContentTag';
|
|
11
|
+
export * from './Dimension';
|
|
11
12
|
export * from './Invites';
|
|
12
13
|
export * from './MediaGallery';
|
|
13
14
|
export * from './PublishedContent';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentchef/contentchef-types",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.7",
|
|
4
4
|
"description": "ContentChef types",
|
|
5
5
|
"author": "PierpaoloIannone <piannone@byte-code.com>",
|
|
6
6
|
"homepage": "https://github.com/ContentChef/contentchef-management-js-client#readme",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^5.9.3"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "85695d5bd81fb801da3ab37fba91c841ab8d47ae"
|
|
38
38
|
}
|