@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
|
@@ -20,7 +20,7 @@ export declare enum SchemaTypeIds {
|
|
|
20
20
|
ARRAY = "array",
|
|
21
21
|
SLUG = "slug",
|
|
22
22
|
MEDIA = "media",
|
|
23
|
-
|
|
23
|
+
PERSONALIZED = "personalized"
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* This enum represent al possible long text sub types
|
|
@@ -48,14 +48,6 @@ export type ContentDefinitionSchema = {
|
|
|
48
48
|
* A Fragment is a custom field defined by the user and can be used internally in the definition
|
|
49
49
|
*/
|
|
50
50
|
fragments: FragmentsTable;
|
|
51
|
-
/**
|
|
52
|
-
* The segments this definition depends on, chosen by the author. Every one has to exist in the
|
|
53
|
-
* space and not be archived, and a segmented field may only vary by segments named here, so this
|
|
54
|
-
* is what scopes a definition and gives the field editor a short list to offer
|
|
55
|
-
*
|
|
56
|
-
* Optional: a definition that declares none simply cannot hold a segmented field
|
|
57
|
-
*/
|
|
58
|
-
segments?: string[];
|
|
59
51
|
};
|
|
60
52
|
/**
|
|
61
53
|
* This type represent the model of the attribute fragments in a content definition schema
|
|
@@ -303,13 +295,13 @@ export type OneLinkedContentOfConstraints = {
|
|
|
303
295
|
linkType?: LinkType;
|
|
304
296
|
};
|
|
305
297
|
/**
|
|
306
|
-
* This type represent what every value of a
|
|
307
|
-
* so the
|
|
298
|
+
* This type represent what every value of a personalized field holds: one descriptor for the whole field,
|
|
299
|
+
* so the variants and the fallback cannot differ in type
|
|
308
300
|
*
|
|
309
301
|
* Only the two `one...Of` forms are admitted: `fragment` and `linked-content` are each the
|
|
310
302
|
* single-target special case of one of them, carrying an identical payload value
|
|
311
303
|
*/
|
|
312
|
-
export type
|
|
304
|
+
export type PersonalizedVariantType = {
|
|
313
305
|
type: SchemaTypeIds.ONE_FRAGMENT_OF;
|
|
314
306
|
constraints: OneFragmentOfConstraints;
|
|
315
307
|
} | {
|
|
@@ -317,28 +309,18 @@ export type SegmentVariantType = {
|
|
|
317
309
|
constraints: OneLinkedContentOfConstraints;
|
|
318
310
|
};
|
|
319
311
|
/**
|
|
320
|
-
* This type represent the model of a
|
|
312
|
+
* This type represent the model of a personalized field constraints
|
|
321
313
|
*
|
|
322
|
-
* A
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
314
|
+
* A personalized field says only *what shape the values have*. Which audiences it serves is authored
|
|
315
|
+
* per content, as an ordered list of variants plus a fallback - see [[PersonalizedFieldPayload]] - so
|
|
316
|
+
* nothing has to be pre-declared here and two contents of the same definition may target entirely
|
|
317
|
+
* different audiences
|
|
326
318
|
*/
|
|
327
|
-
export type
|
|
328
|
-
/**
|
|
329
|
-
* The mnemonic ids of the segments this field varies by, which must be among the ones the
|
|
330
|
-
* definition declares in [[ContentDefinitionSchema.segments]]. Only the declaration is checked
|
|
331
|
-
* against the space, so a segment that does not exist is one error on the definition rather than
|
|
332
|
-
* one on every field that reached for it
|
|
333
|
-
*
|
|
334
|
-
* Declaration order carries no meaning: a rule wins by being first in the content, not by which
|
|
335
|
-
* segment it constrains
|
|
336
|
-
*/
|
|
337
|
-
segments: string[];
|
|
319
|
+
export type PersonalizedFieldConstraints = {
|
|
338
320
|
/**
|
|
339
|
-
* The shape every
|
|
321
|
+
* The shape every variant value and the fallback conform to
|
|
340
322
|
*/
|
|
341
|
-
variantType:
|
|
323
|
+
variantType: PersonalizedVariantType;
|
|
342
324
|
};
|
|
343
325
|
/**
|
|
344
326
|
* This type represent the model of an array field constraints
|
|
@@ -492,9 +474,9 @@ export type OneFragmentOfSchemaType = SchemaType<SchemaTypeIds.ONE_FRAGMENT_OF,
|
|
|
492
474
|
*/
|
|
493
475
|
export type OneLinkedContentOfSchemaType = IndexableSchemaType<SchemaTypeIds.ONE_LINKED_CONTENT_OF, OneLinkedContentOfConstraints>;
|
|
494
476
|
/**
|
|
495
|
-
* This type represent a
|
|
477
|
+
* This type represent a personalized field schema type
|
|
496
478
|
*/
|
|
497
|
-
export type
|
|
479
|
+
export type PersonalizedSchemaType = SchemaType<SchemaTypeIds.PERSONALIZED, PersonalizedFieldConstraints>;
|
|
498
480
|
/**
|
|
499
481
|
* Slug schema type
|
|
500
482
|
* This type is indexable and translatable by default
|
|
@@ -520,7 +502,7 @@ export type TranslatableSchemaTypes = NumberSchemaType | TextSchemaType | LongTe
|
|
|
520
502
|
/**
|
|
521
503
|
* This type group all the schema types of a content definition that are not indexable
|
|
522
504
|
*/
|
|
523
|
-
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType |
|
|
505
|
+
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType | PersonalizedSchemaType;
|
|
524
506
|
/**
|
|
525
507
|
* This type group all schema types of a content definition
|
|
526
508
|
*/
|
|
@@ -23,7 +23,7 @@ var SchemaTypeIds;
|
|
|
23
23
|
SchemaTypeIds["ARRAY"] = "array";
|
|
24
24
|
SchemaTypeIds["SLUG"] = "slug";
|
|
25
25
|
SchemaTypeIds["MEDIA"] = "media";
|
|
26
|
-
SchemaTypeIds["
|
|
26
|
+
SchemaTypeIds["PERSONALIZED"] = "personalized";
|
|
27
27
|
})(SchemaTypeIds || (exports.SchemaTypeIds = SchemaTypeIds = {}));
|
|
28
28
|
/**
|
|
29
29
|
* This enum represent al possible long text sub types
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { AuthorResponse } from './Author';
|
|
2
|
+
import { PagedListResponse } from './common';
|
|
3
|
+
/**
|
|
4
|
+
* The dimension unique id
|
|
5
|
+
*/
|
|
6
|
+
export type DimensionId = number;
|
|
7
|
+
/**
|
|
8
|
+
* A dimension's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
|
|
9
|
+
* underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
|
|
10
|
+
* travel in the delivery `audiences` query param and are compared against strings a client supplies
|
|
11
|
+
*/
|
|
12
|
+
export declare const DIMENSION_NAME_PATTERN: RegExp;
|
|
13
|
+
/**
|
|
14
|
+
* This type represent one key of a dimension, that is one of the values a visitor can have for it
|
|
15
|
+
*/
|
|
16
|
+
export type DimensionKey = {
|
|
17
|
+
/**
|
|
18
|
+
* The key, matching [[DIMENSION_NAME_PATTERN]]
|
|
19
|
+
*/
|
|
20
|
+
key: string;
|
|
21
|
+
/**
|
|
22
|
+
* A deprecated key cannot be referenced by new audience rules, while every rule already written
|
|
23
|
+
* keeps resolving. The flag toggles both ways
|
|
24
|
+
*/
|
|
25
|
+
deprecated?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* This type represent the model of a dimension, that is something a visitor can be described by -
|
|
29
|
+
* `gender`, `loyalty`, `auth_status` - holding the fixed set of keys they can have for it
|
|
30
|
+
*
|
|
31
|
+
* Dimensions are what audience rules are written over, and a visitor's values for them are what the
|
|
32
|
+
* delivery request carries. Audiences reference a dimension by mnemonicId and key, so dimensions are
|
|
33
|
+
* archived and never deleted, and a key can only be removed or renamed while no audience uses it
|
|
34
|
+
*/
|
|
35
|
+
export type DimensionResponse = {
|
|
36
|
+
/**
|
|
37
|
+
* The dimension unique id
|
|
38
|
+
*/
|
|
39
|
+
id: DimensionId;
|
|
40
|
+
/**
|
|
41
|
+
* The dimension name
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* The dimension mnemonic id, matching [[DIMENSION_NAME_PATTERN]]
|
|
46
|
+
*/
|
|
47
|
+
mnemonicId: string;
|
|
48
|
+
/**
|
|
49
|
+
* The keys a visitor can hold for this dimension, each carrying its own deprecation state
|
|
50
|
+
*/
|
|
51
|
+
keys: DimensionKey[];
|
|
52
|
+
/**
|
|
53
|
+
* The archived status of the dimension
|
|
54
|
+
*/
|
|
55
|
+
archived: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The archive date of the dimension
|
|
58
|
+
*/
|
|
59
|
+
archivedDate: Date | null;
|
|
60
|
+
/**
|
|
61
|
+
* The dimension creation date
|
|
62
|
+
*/
|
|
63
|
+
createdDate: Date;
|
|
64
|
+
/**
|
|
65
|
+
* The dimension last modified date
|
|
66
|
+
*/
|
|
67
|
+
lastModifiedDate: Date;
|
|
68
|
+
/**
|
|
69
|
+
* The dimension author, resolved by `list` only
|
|
70
|
+
*/
|
|
71
|
+
author?: AuthorResponse;
|
|
72
|
+
/**
|
|
73
|
+
* The dimension last modified author, resolved by every endpoint but `get`
|
|
74
|
+
*/
|
|
75
|
+
latestContributor?: AuthorResponse;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* This type represent all possible filters used to retrieve a list of dimension
|
|
79
|
+
*/
|
|
80
|
+
export type ListDimensionsFilters = {
|
|
81
|
+
/**
|
|
82
|
+
* This filter is used to retrieve archived or not archived dimensions. Defaults to not archived
|
|
83
|
+
*/
|
|
84
|
+
archived?: boolean;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* This type represent the data needed to make a list dimensions API request
|
|
88
|
+
*/
|
|
89
|
+
export type ListDimensionsRequest = {
|
|
90
|
+
/**
|
|
91
|
+
* The number of dimensions to skip (this value is used for pagination)
|
|
92
|
+
*/
|
|
93
|
+
skip?: number;
|
|
94
|
+
/**
|
|
95
|
+
* The number of dimensions to take (this value is used for pagination), at most 100
|
|
96
|
+
*/
|
|
97
|
+
take?: number;
|
|
98
|
+
/**
|
|
99
|
+
* The data used to filter the list of dimensions
|
|
100
|
+
*/
|
|
101
|
+
filters?: ListDimensionsFilters;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* This type represent the item of a list dimensions API request
|
|
105
|
+
*/
|
|
106
|
+
export type ListDimensionsItem = DimensionResponse;
|
|
107
|
+
/**
|
|
108
|
+
* This type represent the response of a list dimensions API request
|
|
109
|
+
*/
|
|
110
|
+
export type ListDimensionsResponse = PagedListResponse<ListDimensionsItem>;
|
|
111
|
+
/**
|
|
112
|
+
* This type represent the usage of one key of a dimension. A key with no entry is named by no audience
|
|
113
|
+
* rule, and is therefore the only kind of key that can be removed or renamed
|
|
114
|
+
*/
|
|
115
|
+
export type DimensionKeyUsage = {
|
|
116
|
+
/**
|
|
117
|
+
* The key, or null for the rules that constrain the dimension without naming any key - that is the
|
|
118
|
+
* ones that only fire when the dimension is unknown
|
|
119
|
+
*/
|
|
120
|
+
key: string | null;
|
|
121
|
+
/**
|
|
122
|
+
* How many audiences reference this key
|
|
123
|
+
*/
|
|
124
|
+
audiences: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* This type represent an audience whose rule names a dimension
|
|
128
|
+
*/
|
|
129
|
+
export type AudienceUsingDimension = {
|
|
130
|
+
/**
|
|
131
|
+
* The audience unique id
|
|
132
|
+
*/
|
|
133
|
+
id: number;
|
|
134
|
+
/**
|
|
135
|
+
* The audience mnemonic id
|
|
136
|
+
*/
|
|
137
|
+
mnemonicId: string;
|
|
138
|
+
/**
|
|
139
|
+
* The audience name
|
|
140
|
+
*/
|
|
141
|
+
name: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* This type represent the data needed to make a get dimension API request
|
|
145
|
+
*/
|
|
146
|
+
export type GetDimensionRequest = {
|
|
147
|
+
/**
|
|
148
|
+
* The unique dimension id to retrieve
|
|
149
|
+
*/
|
|
150
|
+
id: DimensionId;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* This type represent the response of a get dimension API request: the dimension, plus the two things
|
|
154
|
+
* the editor cannot decide without, which keys are in use and which audiences are written against it
|
|
155
|
+
*/
|
|
156
|
+
export type GetDimensionResponse = DimensionResponse & {
|
|
157
|
+
/**
|
|
158
|
+
* One entry per key at least one audience rule names. A key absent from this list is unused
|
|
159
|
+
*/
|
|
160
|
+
keyUsage: DimensionKeyUsage[];
|
|
161
|
+
/**
|
|
162
|
+
* The audiences whose rule names this dimension
|
|
163
|
+
*/
|
|
164
|
+
audiences: AudienceUsingDimension[];
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* This type represent the data needed to make a create dimension API request
|
|
168
|
+
*/
|
|
169
|
+
export type CreateDimensionRequest = {
|
|
170
|
+
/**
|
|
171
|
+
* The dimension name
|
|
172
|
+
*/
|
|
173
|
+
name: string;
|
|
174
|
+
/**
|
|
175
|
+
* The dimension mnemonic id, matching [[DIMENSION_NAME_PATTERN]]
|
|
176
|
+
*/
|
|
177
|
+
mnemonicId: string;
|
|
178
|
+
/**
|
|
179
|
+
* The keys a visitor can hold for this dimension, at least one, each key unique
|
|
180
|
+
*/
|
|
181
|
+
keys: DimensionKey[];
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* This type represent the response of a create dimension API request
|
|
185
|
+
*/
|
|
186
|
+
export type CreateDimensionResponse = DimensionResponse;
|
|
187
|
+
/**
|
|
188
|
+
* This type represent the data needed to make an update dimension API request
|
|
189
|
+
*
|
|
190
|
+
* `keys` replaces the whole stored list, deprecation flags included. Adding keys and toggling
|
|
191
|
+
* deprecation are always allowed, while removing or renaming a key is refused while an audience rule
|
|
192
|
+
* still names it. `mnemonicId` cannot be changed
|
|
193
|
+
*/
|
|
194
|
+
export type UpdateDimensionRequest = {
|
|
195
|
+
/**
|
|
196
|
+
* The dimension unique id
|
|
197
|
+
*/
|
|
198
|
+
id: DimensionId;
|
|
199
|
+
/**
|
|
200
|
+
* The dimension name to update
|
|
201
|
+
*/
|
|
202
|
+
name: string;
|
|
203
|
+
/**
|
|
204
|
+
* The dimension mnemonic id, which must be the stored one
|
|
205
|
+
*/
|
|
206
|
+
mnemonicId: string;
|
|
207
|
+
/**
|
|
208
|
+
* The whole key list, replacing what is stored
|
|
209
|
+
*/
|
|
210
|
+
keys: DimensionKey[];
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* This type represent the response of an update dimension API request
|
|
214
|
+
*/
|
|
215
|
+
export type UpdateDimensionResponse = DimensionResponse;
|
|
216
|
+
/**
|
|
217
|
+
* This type represent the data needed to make a toggle archived dimension API request
|
|
218
|
+
*/
|
|
219
|
+
export type ToggleArchivedDimensionRequest = {
|
|
220
|
+
/**
|
|
221
|
+
* The dimension unique id
|
|
222
|
+
*/
|
|
223
|
+
id: DimensionId;
|
|
224
|
+
/**
|
|
225
|
+
* This value represent the archive status to set in the specified dimension
|
|
226
|
+
*/
|
|
227
|
+
archived: boolean;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* This type represent the response of a toggle archived dimension API request
|
|
231
|
+
*/
|
|
232
|
+
export type ToggleArchivedDimensionResponse = DimensionResponse;
|
|
233
|
+
/**
|
|
234
|
+
* This type represent a visitor's value per dimension, as the rule engine reads it. A dimension missing
|
|
235
|
+
* from the map, or set to `undefined`, means "not provided" - which is what
|
|
236
|
+
* [[DimensionPredicate.orUnset]] answers
|
|
237
|
+
*/
|
|
238
|
+
export type DimensionAssignment = {
|
|
239
|
+
[dimensionMnemonicId: string]: string | undefined;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* The stand-in a coverage report uses for "a key none of the analysed rules mention"
|
|
243
|
+
*
|
|
244
|
+
* Not a real key - it cannot be one, since keys match [[DIMENSION_NAME_PATTERN]]. A rule only ever
|
|
245
|
+
* tests membership in its own list, so every unmentioned key behaves identically and one case covers
|
|
246
|
+
* them all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which
|
|
247
|
+
* real keys it stood for
|
|
248
|
+
*/
|
|
249
|
+
export declare const OTHER_KEY = "<any other key>";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OTHER_KEY = exports.DIMENSION_NAME_PATTERN = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A dimension's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
|
|
6
|
+
* underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
|
|
7
|
+
* travel in the delivery `audiences` query param and are compared against strings a client supplies
|
|
8
|
+
*/
|
|
9
|
+
exports.DIMENSION_NAME_PATTERN = /^[a-z0-9_-]+$/;
|
|
10
|
+
/**
|
|
11
|
+
* The stand-in a coverage report uses for "a key none of the analysed rules mention"
|
|
12
|
+
*
|
|
13
|
+
* Not a real key - it cannot be one, since keys match [[DIMENSION_NAME_PATTERN]]. A rule only ever
|
|
14
|
+
* tests membership in its own list, so every unmentioned key behaves identically and one case covers
|
|
15
|
+
* them all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which
|
|
16
|
+
* real keys it stood for
|
|
17
|
+
*/
|
|
18
|
+
exports.OTHER_KEY = '<any other key>';
|
package/dist/api/index.d.ts
CHANGED
|
@@ -8,11 +8,12 @@ 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';
|
|
14
15
|
export * from './PublishingRequest';
|
|
15
|
-
export * from './
|
|
16
|
+
export * from './Audience';
|
|
16
17
|
export * from './Space';
|
|
17
18
|
export * from './Subscription';
|
|
18
19
|
export * from './UnpublishRequest';
|
package/dist/api/index.js
CHANGED
|
@@ -24,11 +24,12 @@ __exportStar(require("./ContentDefinitionSchema"), exports);
|
|
|
24
24
|
__exportStar(require("./ContentExportImport"), exports);
|
|
25
25
|
__exportStar(require("./ContentRepository"), exports);
|
|
26
26
|
__exportStar(require("./ContentTag"), exports);
|
|
27
|
+
__exportStar(require("./Dimension"), exports);
|
|
27
28
|
__exportStar(require("./Invites"), exports);
|
|
28
29
|
__exportStar(require("./MediaGallery"), exports);
|
|
29
30
|
__exportStar(require("./PublishedContent"), exports);
|
|
30
31
|
__exportStar(require("./PublishingRequest"), exports);
|
|
31
|
-
__exportStar(require("./
|
|
32
|
+
__exportStar(require("./Audience"), exports);
|
|
32
33
|
__exportStar(require("./Space"), exports);
|
|
33
34
|
__exportStar(require("./Subscription"), exports);
|
|
34
35
|
__exportStar(require("./UnpublishRequest"), exports);
|