@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.
@@ -0,0 +1,269 @@
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
+
92
+ /**
93
+ * This type represent the data needed to make a list dimensions API request
94
+ */
95
+ export type ListDimensionsRequest = {
96
+ /**
97
+ * The number of dimensions to skip (this value is used for pagination)
98
+ */
99
+ skip?: number;
100
+ /**
101
+ * The number of dimensions to take (this value is used for pagination), at most 100
102
+ */
103
+ take?: number;
104
+ /**
105
+ * The data used to filter the list of dimensions
106
+ */
107
+ filters?: ListDimensionsFilters;
108
+ };
109
+
110
+ /**
111
+ * This type represent the item of a list dimensions API request
112
+ */
113
+ export type ListDimensionsItem = DimensionResponse;
114
+
115
+ /**
116
+ * This type represent the response of a list dimensions API request
117
+ */
118
+ export type ListDimensionsResponse = PagedListResponse<ListDimensionsItem>;
119
+
120
+ /**
121
+ * This type represent the usage of one key of a dimension. A key with no entry is named by no audience
122
+ * rule, and is therefore the only kind of key that can be removed or renamed
123
+ */
124
+ export type DimensionKeyUsage = {
125
+ /**
126
+ * The key, or null for the rules that constrain the dimension without naming any key - that is the
127
+ * ones that only fire when the dimension is unknown
128
+ */
129
+ key: string | null;
130
+ /**
131
+ * How many audiences reference this key
132
+ */
133
+ audiences: number;
134
+ };
135
+
136
+ /**
137
+ * This type represent an audience whose rule names a dimension
138
+ */
139
+ export type AudienceUsingDimension = {
140
+ /**
141
+ * The audience unique id
142
+ */
143
+ id: number;
144
+ /**
145
+ * The audience mnemonic id
146
+ */
147
+ mnemonicId: string;
148
+ /**
149
+ * The audience name
150
+ */
151
+ name: string;
152
+ };
153
+
154
+ /**
155
+ * This type represent the data needed to make a get dimension API request
156
+ */
157
+ export type GetDimensionRequest = {
158
+ /**
159
+ * The unique dimension id to retrieve
160
+ */
161
+ id: DimensionId;
162
+ };
163
+
164
+ /**
165
+ * This type represent the response of a get dimension API request: the dimension, plus the two things
166
+ * the editor cannot decide without, which keys are in use and which audiences are written against it
167
+ */
168
+ export type GetDimensionResponse = DimensionResponse & {
169
+ /**
170
+ * One entry per key at least one audience rule names. A key absent from this list is unused
171
+ */
172
+ keyUsage: DimensionKeyUsage[];
173
+ /**
174
+ * The audiences whose rule names this dimension
175
+ */
176
+ audiences: AudienceUsingDimension[];
177
+ };
178
+
179
+ /**
180
+ * This type represent the data needed to make a create dimension API request
181
+ */
182
+ export type CreateDimensionRequest = {
183
+ /**
184
+ * The dimension name
185
+ */
186
+ name: string;
187
+ /**
188
+ * The dimension mnemonic id, matching [[DIMENSION_NAME_PATTERN]]
189
+ */
190
+ mnemonicId: string;
191
+ /**
192
+ * The keys a visitor can hold for this dimension, at least one, each key unique
193
+ */
194
+ keys: DimensionKey[];
195
+ };
196
+
197
+ /**
198
+ * This type represent the response of a create dimension API request
199
+ */
200
+ export type CreateDimensionResponse = DimensionResponse;
201
+
202
+ /**
203
+ * This type represent the data needed to make an update dimension API request
204
+ *
205
+ * `keys` replaces the whole stored list, deprecation flags included. Adding keys and toggling
206
+ * deprecation are always allowed, while removing or renaming a key is refused while an audience rule
207
+ * still names it. `mnemonicId` cannot be changed
208
+ */
209
+ export type UpdateDimensionRequest = {
210
+ /**
211
+ * The dimension unique id
212
+ */
213
+ id: DimensionId;
214
+ /**
215
+ * The dimension name to update
216
+ */
217
+ name: string;
218
+ /**
219
+ * The dimension mnemonic id, which must be the stored one
220
+ */
221
+ mnemonicId: string;
222
+ /**
223
+ * The whole key list, replacing what is stored
224
+ */
225
+ keys: DimensionKey[];
226
+ };
227
+
228
+ /**
229
+ * This type represent the response of an update dimension API request
230
+ */
231
+ export type UpdateDimensionResponse = DimensionResponse;
232
+
233
+ /**
234
+ * This type represent the data needed to make a toggle archived dimension API request
235
+ */
236
+ export type ToggleArchivedDimensionRequest = {
237
+ /**
238
+ * The dimension unique id
239
+ */
240
+ id: DimensionId;
241
+ /**
242
+ * This value represent the archive status to set in the specified dimension
243
+ */
244
+ archived: boolean;
245
+ };
246
+
247
+ /**
248
+ * This type represent the response of a toggle archived dimension API request
249
+ */
250
+ export type ToggleArchivedDimensionResponse = DimensionResponse;
251
+
252
+ /**
253
+ * This type represent a visitor's value per dimension, as the rule engine reads it. A dimension missing
254
+ * from the map, or set to `undefined`, means "not provided" - which is what
255
+ * [[DimensionPredicate.orUnset]] answers
256
+ */
257
+ export type DimensionAssignment = {
258
+ [dimensionMnemonicId: string]: string | undefined;
259
+ };
260
+
261
+ /**
262
+ * The stand-in a coverage report uses for "a key none of the analysed rules mention"
263
+ *
264
+ * Not a real key - it cannot be one, since keys match [[DIMENSION_NAME_PATTERN]]. A rule only ever
265
+ * tests membership in its own list, so every unmentioned key behaves identically and one case covers
266
+ * them all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which
267
+ * real keys it stood for
268
+ */
269
+ export const OTHER_KEY = '<any other key>';
package/lib/api/index.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 './Segment';
16
+ export * from './Audience';
16
17
  export * from './Space';
17
18
  export * from './Subscription';
18
19
  export * from './UnpublishRequest';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentchef/contentchef-types",
3
- "version": "11.0.0-alpha.4",
3
+ "version": "11.0.0-alpha.6",
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": "e6dc1e7bcc12adafcb1d1428f27bbd3b9e3c2bc5"
37
+ "gitHead": "ac29b0d3952e42a58cd181a3f9fa5b1cfb937224"
38
38
  }