@contentchef/contentchef-types 10.1.0-alpha.1 → 10.1.0-alpha.10

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.
@@ -17,6 +17,39 @@ export declare enum ContentsStatus {
17
17
  unarchived = "unarchived",
18
18
  all = "all"
19
19
  }
20
+ /**
21
+ * This enum represent the fields that can be used to sort a list of contents
22
+ */
23
+ export declare enum ContentSortField {
24
+ name = "name",
25
+ publicId = "publicId",
26
+ createdDate = "createdDate",
27
+ lastModifiedDate = "lastModifiedDate",
28
+ onlineDate = "onlineDate",
29
+ offlineDate = "offlineDate",
30
+ locale = "locale",
31
+ definitionName = "definitionName"
32
+ }
33
+ /**
34
+ * This enum represent the possible sort directions
35
+ */
36
+ export declare enum SortDirection {
37
+ asc = "asc",
38
+ desc = "desc"
39
+ }
40
+ /**
41
+ * This type represent the data that can be used to sort a list of contents
42
+ */
43
+ export type ListContentsSort = {
44
+ /**
45
+ * The field to sort the list of contents by
46
+ */
47
+ field: ContentSortField;
48
+ /**
49
+ * The direction to sort the list of contents in
50
+ */
51
+ direction: SortDirection;
52
+ };
20
53
  /**
21
54
  * This type represent the model of facet
22
55
  */
@@ -298,6 +331,34 @@ export type ListContentsFilters = {
298
331
  * This filter is used to search contents that has the tags inserted
299
332
  */
300
333
  tags?: string[];
334
+ /**
335
+ * This filter is used to search contents whose author matches (case-insensitively) one of the full names or emails inserted
336
+ */
337
+ authors?: string[];
338
+ /**
339
+ * This filter is used to search contents whose locale, or one of their translation locales, matches (case-insensitively) one of the locales inserted
340
+ */
341
+ locales?: string[];
342
+ /**
343
+ * This filter is used to search contents published in channels matching (case-insensitively) one of the mnemonic ids or names inserted
344
+ */
345
+ channels?: string[];
346
+ /**
347
+ * This filter is used to search contents with an online date starting from the ISO 8601 date inserted
348
+ */
349
+ onlineDateFrom?: string;
350
+ /**
351
+ * This filter is used to search contents with an online date up to the ISO 8601 date inserted
352
+ */
353
+ onlineDateTo?: string;
354
+ /**
355
+ * This filter is used to search contents with an offline date starting from the ISO 8601 date inserted
356
+ */
357
+ offlineDateFrom?: string;
358
+ /**
359
+ * This filter is used to search contents with an offline date up to the ISO 8601 date inserted
360
+ */
361
+ offlineDateTo?: string;
301
362
  /**
302
363
  * This filter is used to search contents in the content status inserted
303
364
  */
@@ -323,6 +384,10 @@ export type ListContentsRequest = {
323
384
  * The data used to filter the list of content
324
385
  */
325
386
  filters: ListContentsFilters;
387
+ /**
388
+ * The data used to sort the list of content
389
+ */
390
+ sort?: ListContentsSort;
326
391
  };
327
392
  /**
328
393
  * This type represent the model of the single content returned from the list of content API request
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalizationSettings = exports.ContentFieldViolationCodes = exports.ContentsStatus = void 0;
3
+ exports.LocalizationSettings = exports.ContentFieldViolationCodes = exports.SortDirection = exports.ContentSortField = exports.ContentsStatus = void 0;
4
4
  /**
5
5
  * This enum represent the possible content status
6
6
  */
@@ -10,6 +10,28 @@ var ContentsStatus;
10
10
  ContentsStatus["unarchived"] = "unarchived";
11
11
  ContentsStatus["all"] = "all";
12
12
  })(ContentsStatus || (exports.ContentsStatus = ContentsStatus = {}));
13
+ /**
14
+ * This enum represent the fields that can be used to sort a list of contents
15
+ */
16
+ var ContentSortField;
17
+ (function (ContentSortField) {
18
+ ContentSortField["name"] = "name";
19
+ ContentSortField["publicId"] = "publicId";
20
+ ContentSortField["createdDate"] = "createdDate";
21
+ ContentSortField["lastModifiedDate"] = "lastModifiedDate";
22
+ ContentSortField["onlineDate"] = "onlineDate";
23
+ ContentSortField["offlineDate"] = "offlineDate";
24
+ ContentSortField["locale"] = "locale";
25
+ ContentSortField["definitionName"] = "definitionName";
26
+ })(ContentSortField || (exports.ContentSortField = ContentSortField = {}));
27
+ /**
28
+ * This enum represent the possible sort directions
29
+ */
30
+ var SortDirection;
31
+ (function (SortDirection) {
32
+ SortDirection["asc"] = "asc";
33
+ SortDirection["desc"] = "desc";
34
+ })(SortDirection || (exports.SortDirection = SortDirection = {}));
13
35
  /**
14
36
  * Thin enum represent all content fields violations error codes
15
37
  */
@@ -0,0 +1,533 @@
1
+ import { AuthorResponse } from './Author';
2
+ import { PagedListResponse } from './common';
3
+ import { ContentId, ListContentsFilters } from './Content';
4
+ /**
5
+ * The content export request unique id
6
+ */
7
+ export type ContentExportRequestId = number;
8
+ /**
9
+ * The content import request unique id
10
+ */
11
+ export type ContentImportRequestId = number;
12
+ /**
13
+ * The content import request item unique id
14
+ */
15
+ export type ContentImportRequestItemId = number;
16
+ /**
17
+ * This enum represent the file format of a content export, and the format an import file is read with
18
+ */
19
+ export declare enum ContentExportFormat {
20
+ JSON = "json",
21
+ CSV = "csv"
22
+ }
23
+ /**
24
+ * This enum represent the lifecycle of a content export request. Exports are processed
25
+ * asynchronously, so a freshly created request is always `queued`
26
+ */
27
+ export declare enum ContentExportStatus {
28
+ QUEUED = "queued",
29
+ PROCESSING = "processing",
30
+ COMPLETED = "completed",
31
+ FAILED = "failed"
32
+ }
33
+ /**
34
+ * This enum represent the lifecycle of a content import request. A freshly created request is
35
+ * `awaiting_upload` until the import file is uploaded to
36
+ * [[CreateContentImportRequestResponse.uploadUrl]], which is what starts the import
37
+ */
38
+ export declare enum ContentImportStatus {
39
+ AWAITING_UPLOAD = "awaiting_upload",
40
+ PROCESSING = "processing",
41
+ COMPLETED = "completed",
42
+ COMPLETED_WITH_ERRORS = "completed_with_errors",
43
+ FAILED = "failed"
44
+ }
45
+ /**
46
+ * This enum represent what an imported row describes: the content itself or one of its translations
47
+ */
48
+ export declare enum ContentImportRowType {
49
+ CONTENT = "content",
50
+ TRANSLATION = "translation"
51
+ }
52
+ /**
53
+ * This enum represent the outcome of a single imported row
54
+ */
55
+ export declare enum ContentImportItemStatus {
56
+ SUCCESS = "success",
57
+ FAILED = "failed"
58
+ }
59
+ /**
60
+ * This enum represent what the import did to the content of a successfully imported row
61
+ */
62
+ export declare enum ContentImportItemAction {
63
+ UPDATED = "updated"
64
+ }
65
+ /**
66
+ * This type represent the error attached to a failed content export or import request
67
+ */
68
+ export type ContentExportImportError = {
69
+ /**
70
+ * The error type discriminator
71
+ */
72
+ type: string;
73
+ /**
74
+ * The human readable error message
75
+ */
76
+ message: string;
77
+ };
78
+ /**
79
+ * This type represent one of the files produced by a content export, one per exported content
80
+ * definition. The whole list is written when the export completes, so a `processing` export
81
+ * exposes no file yet
82
+ */
83
+ export type ContentExportFile = {
84
+ /**
85
+ * The mnemonic id of the content definition the file contains the contents of
86
+ */
87
+ definitionMnemonicId: string;
88
+ /**
89
+ * The internal storage key of the file. Not fetchable as is, pass
90
+ * [[definitionMnemonicId]] to [[ContentExportImportFacade.downloadExport]] to get a
91
+ * downloadable url
92
+ */
93
+ s3Key: string;
94
+ /**
95
+ * The number of contents written in the file
96
+ */
97
+ itemCount: number;
98
+ };
99
+ /**
100
+ * This type represent the model of a content export request
101
+ */
102
+ export type ContentExportRequestResponse = {
103
+ /**
104
+ * The content export request unique id
105
+ */
106
+ id: ContentExportRequestId;
107
+ /**
108
+ * The space the exported contents belong to
109
+ */
110
+ spaceId: string;
111
+ /**
112
+ * The current status of the export
113
+ */
114
+ status: ContentExportStatus;
115
+ /**
116
+ * The filters the exported contents have been selected with
117
+ */
118
+ filters: ListContentsFilters;
119
+ /**
120
+ * The format the export files are written in
121
+ */
122
+ format: ContentExportFormat;
123
+ /**
124
+ * The separator used by the exported csv files. Meaningless when [[format]] is `json`
125
+ */
126
+ csvSeparator: string;
127
+ /**
128
+ * The produced files, one per exported content definition. Empty until [[status]] is
129
+ * `completed`, the whole list is written in one go when the export finalizes
130
+ */
131
+ files: ContentExportFile[] | null;
132
+ /**
133
+ * The error describing why the export failed, null unless [[status]] is `failed`
134
+ */
135
+ error: ContentExportImportError | null;
136
+ /**
137
+ * The author that requested the export
138
+ */
139
+ author: AuthorResponse;
140
+ /**
141
+ * The last author that modified the export request. Only returned by
142
+ * [[ContentExportImportFacade.createExport]], the listing does not resolve it
143
+ */
144
+ latestContributor?: AuthorResponse;
145
+ /**
146
+ * The export request creation date
147
+ */
148
+ createdDate: Date;
149
+ /**
150
+ * The export request last modified date
151
+ */
152
+ lastModifiedDate: Date;
153
+ };
154
+ /**
155
+ * This type represent the data needed to make a create content export request API request
156
+ */
157
+ export type CreateContentExportRequestRequest = {
158
+ /**
159
+ * The filters selecting the contents to export, the same ones accepted by
160
+ * [[ContentFacade.list]]. When omitted every unarchived content of the space is exported.
161
+ * [[ListContentsFilters.contentsStatus]] cannot be given: archived contents cannot be
162
+ * imported back, so an export always covers the unarchived ones only
163
+ */
164
+ filters?: Omit<Partial<ListContentsFilters>, 'contentsStatus'>;
165
+ /**
166
+ * The format to write the export files in, defaults to `json`
167
+ */
168
+ format?: ContentExportFormat;
169
+ /**
170
+ * The single character separator to write the exported csv files with, defaults to `,`.
171
+ * Ignored when [[format]] is `json`
172
+ */
173
+ csvSeparator?: string;
174
+ };
175
+ /**
176
+ * This type represent the response of a create content export request API request.
177
+ * The returned export is always `queued`: it is processed asynchronously
178
+ */
179
+ export type CreateContentExportRequestResponse = ContentExportRequestResponse;
180
+ /**
181
+ * This type represent the data needed to make a list content export requests API request
182
+ */
183
+ export type ListContentExportRequestsRequest = {
184
+ /**
185
+ * The export requests to skip (used to paginate the result), defaults to 0
186
+ */
187
+ skip?: number;
188
+ /**
189
+ * The export requests to take (used to paginate the result), defaults to 20.
190
+ * Cannot exceed [[MAX_CONTENT_EXPORT_IMPORT_PAGE_SIZE]]
191
+ */
192
+ take?: number;
193
+ };
194
+ /**
195
+ * This type represent the response of a list content export requests API request,
196
+ * sorted by [[ContentExportRequestResponse.createdDate]] descending
197
+ */
198
+ export type ListContentExportRequestsResponse = PagedListResponse<ContentExportRequestResponse>;
199
+ /**
200
+ * This type represent the data needed to make a download content export API request
201
+ */
202
+ export type DownloadContentExportRequest = {
203
+ /**
204
+ * The unique id of the completed export request to download a file of
205
+ */
206
+ exportRequestId: ContentExportRequestId;
207
+ /**
208
+ * The mnemonic id of the content definition whose exported file is wanted.
209
+ * It must be one of the [[ContentExportRequestResponse.files]] entries
210
+ */
211
+ definitionMnemonicId: string;
212
+ };
213
+ /**
214
+ * This type represent the response of a download content export API request
215
+ */
216
+ export type DownloadContentExportResponse = {
217
+ /**
218
+ * The mnemonic id of the content definition the file contains the contents of
219
+ */
220
+ definitionMnemonicId: string;
221
+ /**
222
+ * The temporary url to download the exported file from. The client does not download the
223
+ * file, fetch this url yourself
224
+ */
225
+ downloadUrl: string;
226
+ /**
227
+ * The number of seconds [[downloadUrl]] stays valid for
228
+ */
229
+ expiresInSeconds: number;
230
+ /**
231
+ * The number of contents written in the file
232
+ */
233
+ itemCount: number;
234
+ };
235
+ /**
236
+ * This type represent the options a content import file is read with
237
+ */
238
+ export type ContentImportOptions = {
239
+ /**
240
+ * The format the import file is read as
241
+ */
242
+ format: ContentExportFormat;
243
+ /**
244
+ * The separator the imported csv file is read with. Meaningless when [[format]] is `json`
245
+ */
246
+ csvSeparator?: string;
247
+ /**
248
+ * Whether payloads violating their content definition schema are applied anyway, with the
249
+ * violations logged instead of failing the row
250
+ */
251
+ skipPayloadValidation?: boolean;
252
+ };
253
+ /**
254
+ * This type represent the model of a content import request
255
+ */
256
+ export type ContentImportRequestResponse = {
257
+ /**
258
+ * The content import request unique id
259
+ */
260
+ id: ContentImportRequestId;
261
+ /**
262
+ * The space the contents are imported in
263
+ */
264
+ spaceId: string;
265
+ /**
266
+ * The current status of the import
267
+ */
268
+ status: ContentImportStatus;
269
+ /**
270
+ * The name of the uploaded file, as declared when the import was created. Null when not declared
271
+ */
272
+ fileName: string | null;
273
+ /**
274
+ * The storage key the import file is expected at
275
+ */
276
+ s3Key: string;
277
+ /**
278
+ * The options the import file is read with
279
+ */
280
+ options: ContentImportOptions;
281
+ /**
282
+ * The arn of the workflow execution processing the import.
283
+ * Null while the import is still `awaiting_upload`
284
+ */
285
+ executionArn: string | null;
286
+ /**
287
+ * The number of rows found in the import file, null until the file has been read
288
+ */
289
+ totalItems: number | null;
290
+ /**
291
+ * The number of successfully imported rows, null until the import completes
292
+ */
293
+ succeededItems: number | null;
294
+ /**
295
+ * The number of rows that failed to import, null until the import completes.
296
+ * When greater than 0 the [[status]] is `completed_with_errors`
297
+ */
298
+ failedItems: number | null;
299
+ /**
300
+ * The error describing why the whole import failed, null unless [[status]] is `failed`.
301
+ * Single row failures are reported by [[ContentImportRequestItemResponse.error]] instead
302
+ */
303
+ error: ContentExportImportError | null;
304
+ /**
305
+ * The author that requested the import
306
+ */
307
+ author: AuthorResponse;
308
+ /**
309
+ * The import request creation date
310
+ */
311
+ createdDate: Date;
312
+ /**
313
+ * The import request last modified date
314
+ */
315
+ lastModifiedDate: Date;
316
+ };
317
+ /**
318
+ * This type represent the data needed to make a create content import request API request
319
+ */
320
+ export type CreateContentImportRequestRequest = {
321
+ /**
322
+ * The name of the file about to be uploaded, kept for display purposes only
323
+ */
324
+ fileName?: string;
325
+ /**
326
+ * The options to read the uploaded file with
327
+ */
328
+ options?: {
329
+ /**
330
+ * The format the uploaded file is read as, defaults to `json`
331
+ */
332
+ format?: ContentExportFormat;
333
+ /**
334
+ * The single character separator the uploaded csv file is read with, defaults to `,`.
335
+ * Ignored when [[format]] is `json`
336
+ */
337
+ csvSeparator?: string;
338
+ /**
339
+ * Whether to apply payloads that violate their content definition schema, recording the
340
+ * violations instead of failing the row. Defaults to false.
341
+ * [[ContentExportImportFacade.retryImport]] can turn it on for an already uploaded file
342
+ */
343
+ skipPayloadValidation?: boolean;
344
+ };
345
+ };
346
+ /**
347
+ * This type represent the response of a create content import request API request
348
+ */
349
+ export type CreateContentImportRequestResponse = {
350
+ /**
351
+ * The created content import request unique id
352
+ */
353
+ importRequestId: ContentImportRequestId;
354
+ /**
355
+ * The storage key the file is uploaded to
356
+ */
357
+ s3Key: string;
358
+ /**
359
+ * The temporary url to upload the import file to, with a `PUT` and a `Content-Type` of
360
+ * `text/csv` or `application/json` matching the requested format. The client does not upload
361
+ * the file, upload it yourself: the upload is what starts the import
362
+ */
363
+ uploadUrl: string;
364
+ /**
365
+ * The number of seconds [[uploadUrl]] stays valid for
366
+ */
367
+ expiresInSeconds: number;
368
+ };
369
+ /**
370
+ * This type represent the data needed to make a retry content import API request
371
+ */
372
+ export type RetryContentImportRequest = {
373
+ /**
374
+ * The unique id of the import request to re-run the file of. It must have been uploaded:
375
+ * an import still `awaiting_upload` has nothing to retry
376
+ */
377
+ importRequestId: ContentImportRequestId;
378
+ /**
379
+ * Whether to apply payloads that violate their content definition schema, recording the
380
+ * violations instead of failing the row. Use it to push through a run whose validation
381
+ * failures have been judged acceptable. Defaults to false
382
+ */
383
+ skipPayloadValidation?: boolean;
384
+ };
385
+ /**
386
+ * This type represent the response of a retry content import API request.
387
+ * A retry is a new import request re-running the whole original file, not only its failed rows:
388
+ * imports are update only and idempotent. Nothing has to be uploaded again, the file is copied
389
+ * server side, and that copy is what starts the new import
390
+ */
391
+ export type RetryContentImportResponse = {
392
+ /**
393
+ * The unique id of the created import request, the one to follow from now on
394
+ */
395
+ importRequestId: ContentImportRequestId;
396
+ /**
397
+ * The unique id of the import request being retried
398
+ */
399
+ retryOf: ContentImportRequestId;
400
+ /**
401
+ * The storage key the original file has been copied to
402
+ */
403
+ s3Key: string;
404
+ /**
405
+ * Whether the retry applies payloads violating their content definition schema
406
+ */
407
+ skipPayloadValidation: boolean;
408
+ };
409
+ /**
410
+ * This type represent the data needed to make a list content import requests API request
411
+ */
412
+ export type ListContentImportRequestsRequest = {
413
+ /**
414
+ * The import requests to skip (used to paginate the result), defaults to 0
415
+ */
416
+ skip?: number;
417
+ /**
418
+ * The import requests to take (used to paginate the result), defaults to 20.
419
+ * Cannot exceed [[MAX_CONTENT_EXPORT_IMPORT_PAGE_SIZE]]
420
+ */
421
+ take?: number;
422
+ };
423
+ /**
424
+ * This type represent the response of a list content import requests API request,
425
+ * sorted by [[ContentImportRequestResponse.createdDate]] descending
426
+ */
427
+ export type ListContentImportRequestsResponse = PagedListResponse<ContentImportRequestResponse>;
428
+ /**
429
+ * This type represent the error attached to a single failed imported row
430
+ */
431
+ export type ContentImportItemError = {
432
+ /**
433
+ * The error code discriminator
434
+ */
435
+ code: string;
436
+ /**
437
+ * The human readable error message
438
+ */
439
+ message?: string;
440
+ /**
441
+ * The error additional details, their shape depends on [[code]]
442
+ */
443
+ details?: any;
444
+ };
445
+ /**
446
+ * This type represent the outcome of a single row of a content import. One item is written per
447
+ * content row plus one per translation row, so a content with 3 translated locales produces 4 items
448
+ */
449
+ export type ContentImportRequestItemResponse = {
450
+ /**
451
+ * The content import request item unique id
452
+ */
453
+ id: ContentImportRequestItemId;
454
+ /**
455
+ * The space the contents are imported in
456
+ */
457
+ spaceId: string;
458
+ /**
459
+ * The unique id of the import request the item belongs to
460
+ */
461
+ importRequestId: ContentImportRequestId;
462
+ /**
463
+ * The zero based position of the row in the import file
464
+ */
465
+ itemIndex: number;
466
+ /**
467
+ * The public id of the imported content, null when the row did not carry a readable one
468
+ */
469
+ publicId: string | null;
470
+ /**
471
+ * The mnemonic id of the imported content definition, null when the row did not carry a
472
+ * readable one
473
+ */
474
+ definitionMnemonicId: string | null;
475
+ /**
476
+ * Whether the row describes the content itself or one of its translations
477
+ */
478
+ rowType: ContentImportRowType;
479
+ /**
480
+ * The locale the row has been imported in. Always null when [[rowType]] is `content`:
481
+ * only translation rows are locale specific
482
+ */
483
+ locale: string | null;
484
+ /**
485
+ * What the import did to the content. Null when the row failed, and on a translation row
486
+ * that carried nothing to apply, which succeeds as a no-op
487
+ */
488
+ action: ContentImportItemAction | null;
489
+ /**
490
+ * The outcome of the row
491
+ */
492
+ status: ContentImportItemStatus;
493
+ /**
494
+ * The unique id of the imported content, null when the row failed before the content
495
+ * could be resolved
496
+ */
497
+ contentId: ContentId | null;
498
+ /**
499
+ * The error describing why the row failed, null unless [[status]] is `failed`
500
+ */
501
+ error: ContentImportItemError | null;
502
+ };
503
+ /**
504
+ * This type represent the data needed to make a list content import request items API request
505
+ */
506
+ export type ListContentImportRequestItemsRequest = {
507
+ /**
508
+ * The unique id of the import request to list the items of
509
+ */
510
+ importRequestId: ContentImportRequestId;
511
+ /**
512
+ * The items to skip (used to paginate the result), defaults to 0
513
+ */
514
+ skip?: number;
515
+ /**
516
+ * The items to take (used to paginate the result), defaults to 50.
517
+ * Cannot exceed [[MAX_CONTENT_EXPORT_IMPORT_PAGE_SIZE]]
518
+ */
519
+ take?: number;
520
+ /**
521
+ * This filter is used to list only the items with the given outcome, typically `failed` to
522
+ * review what an import could not apply. When omitted every item is returned
523
+ */
524
+ status?: ContentImportItemStatus;
525
+ };
526
+ /**
527
+ * This type represent the response of a list content import request items API request
528
+ */
529
+ export type ListContentImportRequestItemsResponse = PagedListResponse<ContentImportRequestItemResponse>;
530
+ /**
531
+ * The maximum number of items a content export or import list API request can take in a single page
532
+ */
533
+ export declare const MAX_CONTENT_EXPORT_IMPORT_PAGE_SIZE = 100;