@contentchef/contentchef-types 10.1.0-alpha.9 → 11.0.0-alpha.0
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/ContentExportImport.d.ts +51 -0
- package/dist/api/MediaGallery.d.ts +93 -24
- package/dist/api/MediaGallery.js +21 -0
- package/dist/api/Space.d.ts +104 -0
- package/dist/api/Space.js +24 -0
- package/lib/api/ContentExportImport.ts +53 -0
- package/lib/api/MediaGallery.ts +99 -24
- package/lib/api/Space.ts +105 -0
- package/package.json +2 -2
|
@@ -244,6 +244,11 @@ export type ContentImportOptions = {
|
|
|
244
244
|
* The separator the imported csv file is read with. Meaningless when [[format]] is `json`
|
|
245
245
|
*/
|
|
246
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;
|
|
247
252
|
};
|
|
248
253
|
/**
|
|
249
254
|
* This type represent the model of a content import request
|
|
@@ -330,6 +335,12 @@ export type CreateContentImportRequestRequest = {
|
|
|
330
335
|
* Ignored when [[format]] is `json`
|
|
331
336
|
*/
|
|
332
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;
|
|
333
344
|
};
|
|
334
345
|
};
|
|
335
346
|
/**
|
|
@@ -355,6 +366,46 @@ export type CreateContentImportRequestResponse = {
|
|
|
355
366
|
*/
|
|
356
367
|
expiresInSeconds: number;
|
|
357
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
|
+
};
|
|
358
409
|
/**
|
|
359
410
|
* This type represent the data needed to make a list content import requests API request
|
|
360
411
|
*/
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import { AuthorResponse } from './Author';
|
|
2
2
|
import { PagedListResponse } from './common';
|
|
3
|
+
/**
|
|
4
|
+
* The media provider that stores and serves a media.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum MediaProvider {
|
|
7
|
+
CLOUDFLARE = "cloudflare",
|
|
8
|
+
CLOUDINARY = "cloudinary"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The processing status of a media. Numeric values match the backend `smallint` column:
|
|
12
|
+
* 0 = QUEUED (upload requested, bytes not processed yet), 1 = READY, 2 = ERROR.
|
|
13
|
+
* MIGRATING (3) is reserved for provider migrations.
|
|
14
|
+
*/
|
|
15
|
+
export declare enum MediaStatus {
|
|
16
|
+
QUEUED = 0,
|
|
17
|
+
READY = 1,
|
|
18
|
+
ERROR = 2,
|
|
19
|
+
MIGRATING = 3
|
|
20
|
+
}
|
|
3
21
|
/**
|
|
4
22
|
* This type describe the result of a list request on media
|
|
5
23
|
* @template T The type of media requested
|
|
@@ -46,10 +64,6 @@ export type MediaGallery = {
|
|
|
46
64
|
* The chosen media gallery description
|
|
47
65
|
*/
|
|
48
66
|
description: string;
|
|
49
|
-
/**
|
|
50
|
-
* This is the media provider used to manage media
|
|
51
|
-
*/
|
|
52
|
-
provider: string;
|
|
53
67
|
/**
|
|
54
68
|
* The creation date of the media gallery
|
|
55
69
|
*/
|
|
@@ -79,6 +93,10 @@ export type MediaGallery = {
|
|
|
79
93
|
* This is the media unique id
|
|
80
94
|
*/
|
|
81
95
|
export type MediaPublicId = string;
|
|
96
|
+
/**
|
|
97
|
+
* This is the media numeric unique id (the media entity id)
|
|
98
|
+
*/
|
|
99
|
+
export type MediaId = number;
|
|
82
100
|
/**
|
|
83
101
|
* This type represent a media information
|
|
84
102
|
*/
|
|
@@ -116,9 +134,9 @@ export type Media = {
|
|
|
116
134
|
*/
|
|
117
135
|
originalUrl: string;
|
|
118
136
|
/**
|
|
119
|
-
* The thumbnail public url of the media
|
|
137
|
+
* The thumbnail public url of the media (not provided for every resource type / provider)
|
|
120
138
|
*/
|
|
121
|
-
thumbnailUrl
|
|
139
|
+
thumbnailUrl?: string;
|
|
122
140
|
/**
|
|
123
141
|
* The type of the media
|
|
124
142
|
*/
|
|
@@ -126,12 +144,38 @@ export type Media = {
|
|
|
126
144
|
/**
|
|
127
145
|
* The tags saved with the media
|
|
128
146
|
*/
|
|
129
|
-
tags
|
|
147
|
+
tags?: string[];
|
|
130
148
|
/**
|
|
131
|
-
* The
|
|
149
|
+
* The media format
|
|
132
150
|
* e.g. -> svg, jpg, png, ...
|
|
133
151
|
*/
|
|
134
|
-
format
|
|
152
|
+
format?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The dominant colors of the media. Computed by Cloudinary; empty (`[]`) for providers
|
|
155
|
+
* that don't compute them, e.g. Cloudflare.
|
|
156
|
+
*/
|
|
157
|
+
colors?: any[];
|
|
158
|
+
/**
|
|
159
|
+
* The predominant color information of the media. Computed by Cloudinary; empty (`{}`)
|
|
160
|
+
* for providers that don't compute it, e.g. Cloudflare.
|
|
161
|
+
*/
|
|
162
|
+
predominant?: object;
|
|
163
|
+
/**
|
|
164
|
+
* The media name
|
|
165
|
+
*/
|
|
166
|
+
name?: string;
|
|
167
|
+
/**
|
|
168
|
+
* The processing status of the media. Present when the media is read from a stored row
|
|
169
|
+
* (get / list). Newly requested uploads start as `MediaStatus.QUEUED`.
|
|
170
|
+
*/
|
|
171
|
+
status?: MediaStatus;
|
|
172
|
+
/**
|
|
173
|
+
* Streaming playback urls (hls / dash) for video media, when available.
|
|
174
|
+
*/
|
|
175
|
+
playback?: {
|
|
176
|
+
hls?: string;
|
|
177
|
+
dash?: string;
|
|
178
|
+
};
|
|
135
179
|
};
|
|
136
180
|
/**
|
|
137
181
|
* This type represent all possible filters used to retrieve a list of media gallery
|
|
@@ -309,6 +353,7 @@ export type ListMediaGalleryFoldersResponse = {
|
|
|
309
353
|
*/
|
|
310
354
|
folders: Folder[];
|
|
311
355
|
};
|
|
356
|
+
export type MediaStatusFilter = 'ALL' | 'QUEUED' | 'READY';
|
|
312
357
|
/**
|
|
313
358
|
* This type represent the data needed to make a list media API request
|
|
314
359
|
*/
|
|
@@ -341,6 +386,10 @@ export type ListMediaRequest = {
|
|
|
341
386
|
* The tags that the media have to contain to be searched
|
|
342
387
|
*/
|
|
343
388
|
tags?: string[];
|
|
389
|
+
/**
|
|
390
|
+
* Needed for filtering list depending on media status
|
|
391
|
+
*/
|
|
392
|
+
status?: MediaStatusFilter;
|
|
344
393
|
};
|
|
345
394
|
/**
|
|
346
395
|
* This type represent the response of a list media API request
|
|
@@ -355,13 +404,9 @@ export type GetMediaRequest = {
|
|
|
355
404
|
*/
|
|
356
405
|
mediaGalleryId: MediaGalleryId;
|
|
357
406
|
/**
|
|
358
|
-
* The
|
|
359
|
-
*/
|
|
360
|
-
parentFolder?: string;
|
|
361
|
-
/**
|
|
362
|
-
* The media public id
|
|
407
|
+
* The media entity unique id
|
|
363
408
|
*/
|
|
364
|
-
|
|
409
|
+
mediaId: MediaId;
|
|
365
410
|
};
|
|
366
411
|
/**
|
|
367
412
|
* This type represent the response of a get media API request
|
|
@@ -395,28 +440,41 @@ export type UploadMediaRequest = {
|
|
|
395
440
|
* The tags saved with the media
|
|
396
441
|
*/
|
|
397
442
|
tags?: string[];
|
|
443
|
+
/**
|
|
444
|
+
* mimeType of the file to upload
|
|
445
|
+
*/
|
|
446
|
+
mimeType: string;
|
|
398
447
|
};
|
|
399
448
|
/**
|
|
400
449
|
* This type represent the response of a upload media API request
|
|
401
450
|
*/
|
|
402
451
|
export type UploadMediaResponse = {
|
|
403
452
|
/**
|
|
404
|
-
*
|
|
453
|
+
* The provider that will handle this upload, determined server-side from the media
|
|
454
|
+
* gallery's per-mediaType provider defaults. Also selects the upload protocol:
|
|
455
|
+
* - `cloudflare`: R2 presigned upload — PUT the raw file to `uploadUrl`.
|
|
456
|
+
* - `cloudinary`: POST FormData(file) to `uploadUrl`; for large files (`largeUpload === true`)
|
|
457
|
+
* PUT the raw file to `writeUrl`, then POST FormData(file=readUrl) to `uploadUrl`.
|
|
405
458
|
*/
|
|
406
|
-
|
|
459
|
+
type: MediaProvider;
|
|
407
460
|
/**
|
|
408
|
-
* The
|
|
461
|
+
* The signed url where to perform the upload request.
|
|
462
|
+
*
|
|
463
|
+
* How to send the bytes depends on `type` (see {@link MediaProvider}):
|
|
409
464
|
*
|
|
410
465
|
* e.g.
|
|
411
466
|
* ``` js
|
|
412
|
-
* if (
|
|
413
|
-
* //
|
|
467
|
+
* if (type === 'cloudflare') {
|
|
468
|
+
* // R2 presigned PUT of the raw file
|
|
469
|
+
* await axios.put(uploadUrl, <THE_FILE>, { headers: { 'Content-Type': mimeType } });
|
|
470
|
+
* } else if (largeUpload) {
|
|
471
|
+
* // Cloudinary large file: PUT to the scratch bucket, then let Cloudinary fetch it
|
|
414
472
|
* await axios.put(writeUrl, <THE_FILE>);
|
|
415
473
|
* const formData = new FormData();
|
|
416
474
|
* formData.append('file', readUrl);
|
|
417
|
-
* await axios.post(uploadUrl, formData)
|
|
475
|
+
* await axios.post(uploadUrl, formData);
|
|
418
476
|
* } else {
|
|
419
|
-
* //
|
|
477
|
+
* // Cloudinary (small file): multipart POST of the raw file
|
|
420
478
|
* const formData = new FormData();
|
|
421
479
|
* formData.append('file', <THE_FILE>);
|
|
422
480
|
* await axios.post(uploadUrl, formData);
|
|
@@ -429,11 +487,22 @@ export type UploadMediaResponse = {
|
|
|
429
487
|
*/
|
|
430
488
|
mediaPublicId: string;
|
|
431
489
|
/**
|
|
432
|
-
*
|
|
490
|
+
* Id of the media entity, created server-side as soon as the upload is requested
|
|
491
|
+
*/
|
|
492
|
+
mediaId: number;
|
|
493
|
+
/**
|
|
494
|
+
* Cloudinary only. When `true` the media exceeds the direct-upload size limit and must be
|
|
495
|
+
* uploaded via the `writeUrl` + `readUrl` two-step. Undefined for cloudflare providers.
|
|
496
|
+
*/
|
|
497
|
+
largeUpload?: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* The url where to read the uploaded file. Present for cloudflare R2 uploads, and for
|
|
500
|
+
* cloudinary large uploads (`largeUpload === true`).
|
|
433
501
|
*/
|
|
434
502
|
readUrl?: string;
|
|
435
503
|
/**
|
|
436
|
-
*
|
|
504
|
+
* The url where to write the file. Present for cloudflare R2 uploads, and for
|
|
505
|
+
* cloudinary large uploads (`largeUpload === true`).
|
|
437
506
|
*/
|
|
438
507
|
writeUrl?: string;
|
|
439
508
|
};
|
package/dist/api/MediaGallery.js
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaStatus = exports.MediaProvider = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The media provider that stores and serves a media.
|
|
6
|
+
*/
|
|
7
|
+
var MediaProvider;
|
|
8
|
+
(function (MediaProvider) {
|
|
9
|
+
MediaProvider["CLOUDFLARE"] = "cloudflare";
|
|
10
|
+
MediaProvider["CLOUDINARY"] = "cloudinary";
|
|
11
|
+
})(MediaProvider || (exports.MediaProvider = MediaProvider = {}));
|
|
12
|
+
/**
|
|
13
|
+
* The processing status of a media. Numeric values match the backend `smallint` column:
|
|
14
|
+
* 0 = QUEUED (upload requested, bytes not processed yet), 1 = READY, 2 = ERROR.
|
|
15
|
+
* MIGRATING (3) is reserved for provider migrations.
|
|
16
|
+
*/
|
|
17
|
+
var MediaStatus;
|
|
18
|
+
(function (MediaStatus) {
|
|
19
|
+
MediaStatus[MediaStatus["QUEUED"] = 0] = "QUEUED";
|
|
20
|
+
MediaStatus[MediaStatus["READY"] = 1] = "READY";
|
|
21
|
+
MediaStatus[MediaStatus["ERROR"] = 2] = "ERROR";
|
|
22
|
+
MediaStatus[MediaStatus["MIGRATING"] = 3] = "MIGRATING";
|
|
23
|
+
})(MediaStatus || (exports.MediaStatus = MediaStatus = {}));
|
package/dist/api/Space.d.ts
CHANGED
|
@@ -240,3 +240,107 @@ export type UpdateSpacePublishingLocalesRequest = {
|
|
|
240
240
|
* Return type of `updateSpacePublishingLocales`
|
|
241
241
|
*/
|
|
242
242
|
export type UpdateSpacePublishingLocalesResponse = SpaceLocale;
|
|
243
|
+
/**
|
|
244
|
+
* This enum represent the lifecycle of a space deletion. A freshly requested deletion is
|
|
245
|
+
* `requested` and stays revocable until [[SpaceDeletionResponse.deleteAfter]], after which it
|
|
246
|
+
* becomes `running` and can no longer be withdrawn
|
|
247
|
+
*/
|
|
248
|
+
export declare enum SpaceDeletionStatus {
|
|
249
|
+
/**
|
|
250
|
+
* Asked for, inside the revocation window, still revocable
|
|
251
|
+
*/
|
|
252
|
+
REQUESTED = "requested",
|
|
253
|
+
/**
|
|
254
|
+
* Withdrawn inside the revocation window, nothing has been deleted
|
|
255
|
+
*/
|
|
256
|
+
REVOKED = "revoked",
|
|
257
|
+
RUNNING = "running",
|
|
258
|
+
DELETED = "deleted",
|
|
259
|
+
FAILED = "failed",
|
|
260
|
+
/**
|
|
261
|
+
* A dry run, only started by hand: it reports what it would delete and changes nothing
|
|
262
|
+
*/
|
|
263
|
+
INSPECTED = "inspected"
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* This type represent the model of a space deletion, the only record that outlives a deleted space
|
|
267
|
+
*/
|
|
268
|
+
export type SpaceDeletionResponse = {
|
|
269
|
+
/**
|
|
270
|
+
* The space the deletion refers to
|
|
271
|
+
*/
|
|
272
|
+
spaceId: string;
|
|
273
|
+
/**
|
|
274
|
+
* The current status of the deletion
|
|
275
|
+
*/
|
|
276
|
+
status: SpaceDeletionStatus;
|
|
277
|
+
/**
|
|
278
|
+
* The name the space had, captured when the deletion was requested because deleting the space
|
|
279
|
+
* destroys it
|
|
280
|
+
*/
|
|
281
|
+
spaceName?: string;
|
|
282
|
+
/**
|
|
283
|
+
* The subscription the space was claimed under, preserved for the same reason as [[spaceName]]
|
|
284
|
+
*/
|
|
285
|
+
subscriptionId?: string;
|
|
286
|
+
/**
|
|
287
|
+
* The account that requested the deletion
|
|
288
|
+
*/
|
|
289
|
+
requestedBy?: string;
|
|
290
|
+
/**
|
|
291
|
+
* The account that withdrew the deletion, only set when [[status]] is `revoked`
|
|
292
|
+
*/
|
|
293
|
+
revokedBy?: string;
|
|
294
|
+
/**
|
|
295
|
+
* The ISO date the revocation window shuts at: until then the deletion can be withdrawn with
|
|
296
|
+
* [[SystemFacade.revokeSpaceDeletion]], after it the deletion starts
|
|
297
|
+
*/
|
|
298
|
+
deleteAfter?: string;
|
|
299
|
+
/**
|
|
300
|
+
* The arn of the workflow execution performing the deletion
|
|
301
|
+
*/
|
|
302
|
+
executionArn?: string;
|
|
303
|
+
/**
|
|
304
|
+
* Whether the deletion only reported what it would delete, without deleting anything
|
|
305
|
+
*/
|
|
306
|
+
dryRun?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* How many rows have been deleted, per domain and per table. Written when the deletion ends
|
|
309
|
+
*/
|
|
310
|
+
counts?: {
|
|
311
|
+
[domain: string]: {
|
|
312
|
+
[table: string]: number;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* The message describing why the deletion failed, only set when [[status]] is `failed`
|
|
317
|
+
*/
|
|
318
|
+
error?: string;
|
|
319
|
+
/**
|
|
320
|
+
* The ISO date the deletion record was last written at
|
|
321
|
+
*/
|
|
322
|
+
updatedAt?: string;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* This type represent the response of a delete space API request. The deletion has not happened
|
|
326
|
+
* yet: it is only requested, and stays revocable for [[revocableForHours]]
|
|
327
|
+
*/
|
|
328
|
+
export type DeleteSpaceResponse = {
|
|
329
|
+
/**
|
|
330
|
+
* Always true, the request has been accepted
|
|
331
|
+
*/
|
|
332
|
+
requested: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* How long the deletion stays revocable, in hours
|
|
335
|
+
*/
|
|
336
|
+
revocableForHours: number;
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* Return type of `revokeSpaceDeletion`, the withdrawn deletion record
|
|
340
|
+
*/
|
|
341
|
+
export type RevokeSpaceDeletionResponse = SpaceDeletionResponse;
|
|
342
|
+
/**
|
|
343
|
+
* Return type of `getSpaceDeletionStatus`. It is null when the space has never had a deletion
|
|
344
|
+
* requested: no request is a normal answer, not a missing resource
|
|
345
|
+
*/
|
|
346
|
+
export type GetSpaceDeletionStatusResponse = SpaceDeletionResponse | null;
|
package/dist/api/Space.js
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpaceDeletionStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This enum represent the lifecycle of a space deletion. A freshly requested deletion is
|
|
6
|
+
* `requested` and stays revocable until [[SpaceDeletionResponse.deleteAfter]], after which it
|
|
7
|
+
* becomes `running` and can no longer be withdrawn
|
|
8
|
+
*/
|
|
9
|
+
var SpaceDeletionStatus;
|
|
10
|
+
(function (SpaceDeletionStatus) {
|
|
11
|
+
/**
|
|
12
|
+
* Asked for, inside the revocation window, still revocable
|
|
13
|
+
*/
|
|
14
|
+
SpaceDeletionStatus["REQUESTED"] = "requested";
|
|
15
|
+
/**
|
|
16
|
+
* Withdrawn inside the revocation window, nothing has been deleted
|
|
17
|
+
*/
|
|
18
|
+
SpaceDeletionStatus["REVOKED"] = "revoked";
|
|
19
|
+
SpaceDeletionStatus["RUNNING"] = "running";
|
|
20
|
+
SpaceDeletionStatus["DELETED"] = "deleted";
|
|
21
|
+
SpaceDeletionStatus["FAILED"] = "failed";
|
|
22
|
+
/**
|
|
23
|
+
* A dry run, only started by hand: it reports what it would delete and changes nothing
|
|
24
|
+
*/
|
|
25
|
+
SpaceDeletionStatus["INSPECTED"] = "inspected";
|
|
26
|
+
})(SpaceDeletionStatus || (exports.SpaceDeletionStatus = SpaceDeletionStatus = {}));
|
|
@@ -263,6 +263,11 @@ export type ContentImportOptions = {
|
|
|
263
263
|
* The separator the imported csv file is read with. Meaningless when [[format]] is `json`
|
|
264
264
|
*/
|
|
265
265
|
csvSeparator?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Whether payloads violating their content definition schema are applied anyway, with the
|
|
268
|
+
* violations logged instead of failing the row
|
|
269
|
+
*/
|
|
270
|
+
skipPayloadValidation?: boolean;
|
|
266
271
|
};
|
|
267
272
|
|
|
268
273
|
/**
|
|
@@ -351,6 +356,12 @@ export type CreateContentImportRequestRequest = {
|
|
|
351
356
|
* Ignored when [[format]] is `json`
|
|
352
357
|
*/
|
|
353
358
|
csvSeparator?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Whether to apply payloads that violate their content definition schema, recording the
|
|
361
|
+
* violations instead of failing the row. Defaults to false.
|
|
362
|
+
* [[ContentExportImportFacade.retryImport]] can turn it on for an already uploaded file
|
|
363
|
+
*/
|
|
364
|
+
skipPayloadValidation?: boolean;
|
|
354
365
|
};
|
|
355
366
|
};
|
|
356
367
|
|
|
@@ -378,6 +389,48 @@ export type CreateContentImportRequestResponse = {
|
|
|
378
389
|
expiresInSeconds: number;
|
|
379
390
|
};
|
|
380
391
|
|
|
392
|
+
/**
|
|
393
|
+
* This type represent the data needed to make a retry content import API request
|
|
394
|
+
*/
|
|
395
|
+
export type RetryContentImportRequest = {
|
|
396
|
+
/**
|
|
397
|
+
* The unique id of the import request to re-run the file of. It must have been uploaded:
|
|
398
|
+
* an import still `awaiting_upload` has nothing to retry
|
|
399
|
+
*/
|
|
400
|
+
importRequestId: ContentImportRequestId;
|
|
401
|
+
/**
|
|
402
|
+
* Whether to apply payloads that violate their content definition schema, recording the
|
|
403
|
+
* violations instead of failing the row. Use it to push through a run whose validation
|
|
404
|
+
* failures have been judged acceptable. Defaults to false
|
|
405
|
+
*/
|
|
406
|
+
skipPayloadValidation?: boolean;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* This type represent the response of a retry content import API request.
|
|
411
|
+
* A retry is a new import request re-running the whole original file, not only its failed rows:
|
|
412
|
+
* imports are update only and idempotent. Nothing has to be uploaded again, the file is copied
|
|
413
|
+
* server side, and that copy is what starts the new import
|
|
414
|
+
*/
|
|
415
|
+
export type RetryContentImportResponse = {
|
|
416
|
+
/**
|
|
417
|
+
* The unique id of the created import request, the one to follow from now on
|
|
418
|
+
*/
|
|
419
|
+
importRequestId: ContentImportRequestId;
|
|
420
|
+
/**
|
|
421
|
+
* The unique id of the import request being retried
|
|
422
|
+
*/
|
|
423
|
+
retryOf: ContentImportRequestId;
|
|
424
|
+
/**
|
|
425
|
+
* The storage key the original file has been copied to
|
|
426
|
+
*/
|
|
427
|
+
s3Key: string;
|
|
428
|
+
/**
|
|
429
|
+
* Whether the retry applies payloads violating their content definition schema
|
|
430
|
+
*/
|
|
431
|
+
skipPayloadValidation: boolean;
|
|
432
|
+
};
|
|
433
|
+
|
|
381
434
|
/**
|
|
382
435
|
* This type represent the data needed to make a list content import requests API request
|
|
383
436
|
*/
|
package/lib/api/MediaGallery.ts
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { AuthorResponse } from './Author';
|
|
2
2
|
import { PagedListResponse } from './common';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The media provider that stores and serves a media.
|
|
6
|
+
*/
|
|
7
|
+
export enum MediaProvider {
|
|
8
|
+
CLOUDFLARE = 'cloudflare',
|
|
9
|
+
CLOUDINARY = 'cloudinary'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The processing status of a media. Numeric values match the backend `smallint` column:
|
|
14
|
+
* 0 = QUEUED (upload requested, bytes not processed yet), 1 = READY, 2 = ERROR.
|
|
15
|
+
* MIGRATING (3) is reserved for provider migrations.
|
|
16
|
+
*/
|
|
17
|
+
export enum MediaStatus {
|
|
18
|
+
QUEUED = 0,
|
|
19
|
+
READY = 1,
|
|
20
|
+
ERROR = 2,
|
|
21
|
+
MIGRATING = 3
|
|
22
|
+
}
|
|
23
|
+
|
|
4
24
|
/**
|
|
5
25
|
* This type describe the result of a list request on media
|
|
6
26
|
* @template T The type of media requested
|
|
@@ -49,10 +69,6 @@ export type MediaGallery = {
|
|
|
49
69
|
* The chosen media gallery description
|
|
50
70
|
*/
|
|
51
71
|
description: string;
|
|
52
|
-
/**
|
|
53
|
-
* This is the media provider used to manage media
|
|
54
|
-
*/
|
|
55
|
-
provider: string;
|
|
56
72
|
/**
|
|
57
73
|
* The creation date of the media gallery
|
|
58
74
|
*/
|
|
@@ -84,6 +100,11 @@ export type MediaGallery = {
|
|
|
84
100
|
*/
|
|
85
101
|
export type MediaPublicId = string;
|
|
86
102
|
|
|
103
|
+
/**
|
|
104
|
+
* This is the media numeric unique id (the media entity id)
|
|
105
|
+
*/
|
|
106
|
+
export type MediaId = number;
|
|
107
|
+
|
|
87
108
|
/**
|
|
88
109
|
* This type represent a media information
|
|
89
110
|
*/
|
|
@@ -121,9 +142,9 @@ export type Media = {
|
|
|
121
142
|
*/
|
|
122
143
|
originalUrl: string;
|
|
123
144
|
/**
|
|
124
|
-
* The thumbnail public url of the media
|
|
145
|
+
* The thumbnail public url of the media (not provided for every resource type / provider)
|
|
125
146
|
*/
|
|
126
|
-
thumbnailUrl
|
|
147
|
+
thumbnailUrl?: string;
|
|
127
148
|
/**
|
|
128
149
|
* The type of the media
|
|
129
150
|
*/
|
|
@@ -131,12 +152,38 @@ export type Media = {
|
|
|
131
152
|
/**
|
|
132
153
|
* The tags saved with the media
|
|
133
154
|
*/
|
|
134
|
-
tags
|
|
155
|
+
tags?: string[];
|
|
135
156
|
/**
|
|
136
|
-
* The
|
|
157
|
+
* The media format
|
|
137
158
|
* e.g. -> svg, jpg, png, ...
|
|
138
159
|
*/
|
|
139
|
-
format
|
|
160
|
+
format?: string;
|
|
161
|
+
/**
|
|
162
|
+
* The dominant colors of the media. Computed by Cloudinary; empty (`[]`) for providers
|
|
163
|
+
* that don't compute them, e.g. Cloudflare.
|
|
164
|
+
*/
|
|
165
|
+
colors?: any[];
|
|
166
|
+
/**
|
|
167
|
+
* The predominant color information of the media. Computed by Cloudinary; empty (`{}`)
|
|
168
|
+
* for providers that don't compute it, e.g. Cloudflare.
|
|
169
|
+
*/
|
|
170
|
+
predominant?: object;
|
|
171
|
+
/**
|
|
172
|
+
* The media name
|
|
173
|
+
*/
|
|
174
|
+
name?: string;
|
|
175
|
+
/**
|
|
176
|
+
* The processing status of the media. Present when the media is read from a stored row
|
|
177
|
+
* (get / list). Newly requested uploads start as `MediaStatus.QUEUED`.
|
|
178
|
+
*/
|
|
179
|
+
status?: MediaStatus;
|
|
180
|
+
/**
|
|
181
|
+
* Streaming playback urls (hls / dash) for video media, when available.
|
|
182
|
+
*/
|
|
183
|
+
playback?: {
|
|
184
|
+
hls?: string;
|
|
185
|
+
dash?: string;
|
|
186
|
+
};
|
|
140
187
|
};
|
|
141
188
|
|
|
142
189
|
/**
|
|
@@ -327,6 +374,8 @@ export type ListMediaGalleryFoldersResponse = {
|
|
|
327
374
|
folders: Folder[];
|
|
328
375
|
};
|
|
329
376
|
|
|
377
|
+
export type MediaStatusFilter = 'ALL' | 'QUEUED' | 'READY';
|
|
378
|
+
|
|
330
379
|
/**
|
|
331
380
|
* This type represent the data needed to make a list media API request
|
|
332
381
|
*/
|
|
@@ -359,6 +408,11 @@ export type ListMediaRequest = {
|
|
|
359
408
|
* The tags that the media have to contain to be searched
|
|
360
409
|
*/
|
|
361
410
|
tags?: string[];
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Needed for filtering list depending on media status
|
|
414
|
+
*/
|
|
415
|
+
status?: MediaStatusFilter;
|
|
362
416
|
};
|
|
363
417
|
|
|
364
418
|
/**
|
|
@@ -375,13 +429,9 @@ export type GetMediaRequest = {
|
|
|
375
429
|
*/
|
|
376
430
|
mediaGalleryId: MediaGalleryId;
|
|
377
431
|
/**
|
|
378
|
-
* The
|
|
379
|
-
*/
|
|
380
|
-
parentFolder?: string;
|
|
381
|
-
/**
|
|
382
|
-
* The media public id
|
|
432
|
+
* The media entity unique id
|
|
383
433
|
*/
|
|
384
|
-
|
|
434
|
+
mediaId: MediaId;
|
|
385
435
|
};
|
|
386
436
|
|
|
387
437
|
/**
|
|
@@ -417,6 +467,11 @@ export type UploadMediaRequest = {
|
|
|
417
467
|
* The tags saved with the media
|
|
418
468
|
*/
|
|
419
469
|
tags?: string[];
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* mimeType of the file to upload
|
|
473
|
+
*/
|
|
474
|
+
mimeType: string;
|
|
420
475
|
};
|
|
421
476
|
|
|
422
477
|
/**
|
|
@@ -424,22 +479,31 @@ export type UploadMediaRequest = {
|
|
|
424
479
|
*/
|
|
425
480
|
export type UploadMediaResponse = {
|
|
426
481
|
/**
|
|
427
|
-
*
|
|
482
|
+
* The provider that will handle this upload, determined server-side from the media
|
|
483
|
+
* gallery's per-mediaType provider defaults. Also selects the upload protocol:
|
|
484
|
+
* - `cloudflare`: R2 presigned upload — PUT the raw file to `uploadUrl`.
|
|
485
|
+
* - `cloudinary`: POST FormData(file) to `uploadUrl`; for large files (`largeUpload === true`)
|
|
486
|
+
* PUT the raw file to `writeUrl`, then POST FormData(file=readUrl) to `uploadUrl`.
|
|
428
487
|
*/
|
|
429
|
-
|
|
488
|
+
type: MediaProvider;
|
|
430
489
|
/**
|
|
431
|
-
* The
|
|
490
|
+
* The signed url where to perform the upload request.
|
|
491
|
+
*
|
|
492
|
+
* How to send the bytes depends on `type` (see {@link MediaProvider}):
|
|
432
493
|
*
|
|
433
494
|
* e.g.
|
|
434
495
|
* ``` js
|
|
435
|
-
* if (
|
|
436
|
-
* //
|
|
496
|
+
* if (type === 'cloudflare') {
|
|
497
|
+
* // R2 presigned PUT of the raw file
|
|
498
|
+
* await axios.put(uploadUrl, <THE_FILE>, { headers: { 'Content-Type': mimeType } });
|
|
499
|
+
* } else if (largeUpload) {
|
|
500
|
+
* // Cloudinary large file: PUT to the scratch bucket, then let Cloudinary fetch it
|
|
437
501
|
* await axios.put(writeUrl, <THE_FILE>);
|
|
438
502
|
* const formData = new FormData();
|
|
439
503
|
* formData.append('file', readUrl);
|
|
440
|
-
* await axios.post(uploadUrl, formData)
|
|
504
|
+
* await axios.post(uploadUrl, formData);
|
|
441
505
|
* } else {
|
|
442
|
-
* //
|
|
506
|
+
* // Cloudinary (small file): multipart POST of the raw file
|
|
443
507
|
* const formData = new FormData();
|
|
444
508
|
* formData.append('file', <THE_FILE>);
|
|
445
509
|
* await axios.post(uploadUrl, formData);
|
|
@@ -452,11 +516,22 @@ export type UploadMediaResponse = {
|
|
|
452
516
|
*/
|
|
453
517
|
mediaPublicId: string;
|
|
454
518
|
/**
|
|
455
|
-
*
|
|
519
|
+
* Id of the media entity, created server-side as soon as the upload is requested
|
|
520
|
+
*/
|
|
521
|
+
mediaId: number;
|
|
522
|
+
/**
|
|
523
|
+
* Cloudinary only. When `true` the media exceeds the direct-upload size limit and must be
|
|
524
|
+
* uploaded via the `writeUrl` + `readUrl` two-step. Undefined for cloudflare providers.
|
|
525
|
+
*/
|
|
526
|
+
largeUpload?: boolean;
|
|
527
|
+
/**
|
|
528
|
+
* The url where to read the uploaded file. Present for cloudflare R2 uploads, and for
|
|
529
|
+
* cloudinary large uploads (`largeUpload === true`).
|
|
456
530
|
*/
|
|
457
531
|
readUrl?: string;
|
|
458
532
|
/**
|
|
459
|
-
*
|
|
533
|
+
* The url where to write the file. Present for cloudflare R2 uploads, and for
|
|
534
|
+
* cloudinary large uploads (`largeUpload === true`).
|
|
460
535
|
*/
|
|
461
536
|
writeUrl?: string;
|
|
462
537
|
};
|
package/lib/api/Space.ts
CHANGED
|
@@ -258,3 +258,108 @@ export type UpdateSpacePublishingLocalesRequest = {
|
|
|
258
258
|
* Return type of `updateSpacePublishingLocales`
|
|
259
259
|
*/
|
|
260
260
|
export type UpdateSpacePublishingLocalesResponse = SpaceLocale;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* This enum represent the lifecycle of a space deletion. A freshly requested deletion is
|
|
264
|
+
* `requested` and stays revocable until [[SpaceDeletionResponse.deleteAfter]], after which it
|
|
265
|
+
* becomes `running` and can no longer be withdrawn
|
|
266
|
+
*/
|
|
267
|
+
export enum SpaceDeletionStatus {
|
|
268
|
+
/**
|
|
269
|
+
* Asked for, inside the revocation window, still revocable
|
|
270
|
+
*/
|
|
271
|
+
REQUESTED = 'requested',
|
|
272
|
+
/**
|
|
273
|
+
* Withdrawn inside the revocation window, nothing has been deleted
|
|
274
|
+
*/
|
|
275
|
+
REVOKED = 'revoked',
|
|
276
|
+
RUNNING = 'running',
|
|
277
|
+
DELETED = 'deleted',
|
|
278
|
+
FAILED = 'failed',
|
|
279
|
+
/**
|
|
280
|
+
* A dry run, only started by hand: it reports what it would delete and changes nothing
|
|
281
|
+
*/
|
|
282
|
+
INSPECTED = 'inspected'
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* This type represent the model of a space deletion, the only record that outlives a deleted space
|
|
287
|
+
*/
|
|
288
|
+
export type SpaceDeletionResponse = {
|
|
289
|
+
/**
|
|
290
|
+
* The space the deletion refers to
|
|
291
|
+
*/
|
|
292
|
+
spaceId: string;
|
|
293
|
+
/**
|
|
294
|
+
* The current status of the deletion
|
|
295
|
+
*/
|
|
296
|
+
status: SpaceDeletionStatus;
|
|
297
|
+
/**
|
|
298
|
+
* The name the space had, captured when the deletion was requested because deleting the space
|
|
299
|
+
* destroys it
|
|
300
|
+
*/
|
|
301
|
+
spaceName?: string;
|
|
302
|
+
/**
|
|
303
|
+
* The subscription the space was claimed under, preserved for the same reason as [[spaceName]]
|
|
304
|
+
*/
|
|
305
|
+
subscriptionId?: string;
|
|
306
|
+
/**
|
|
307
|
+
* The account that requested the deletion
|
|
308
|
+
*/
|
|
309
|
+
requestedBy?: string;
|
|
310
|
+
/**
|
|
311
|
+
* The account that withdrew the deletion, only set when [[status]] is `revoked`
|
|
312
|
+
*/
|
|
313
|
+
revokedBy?: string;
|
|
314
|
+
/**
|
|
315
|
+
* The ISO date the revocation window shuts at: until then the deletion can be withdrawn with
|
|
316
|
+
* [[SystemFacade.revokeSpaceDeletion]], after it the deletion starts
|
|
317
|
+
*/
|
|
318
|
+
deleteAfter?: string;
|
|
319
|
+
/**
|
|
320
|
+
* The arn of the workflow execution performing the deletion
|
|
321
|
+
*/
|
|
322
|
+
executionArn?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Whether the deletion only reported what it would delete, without deleting anything
|
|
325
|
+
*/
|
|
326
|
+
dryRun?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* How many rows have been deleted, per domain and per table. Written when the deletion ends
|
|
329
|
+
*/
|
|
330
|
+
counts?: { [domain: string]: { [table: string]: number; }; };
|
|
331
|
+
/**
|
|
332
|
+
* The message describing why the deletion failed, only set when [[status]] is `failed`
|
|
333
|
+
*/
|
|
334
|
+
error?: string;
|
|
335
|
+
/**
|
|
336
|
+
* The ISO date the deletion record was last written at
|
|
337
|
+
*/
|
|
338
|
+
updatedAt?: string;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* This type represent the response of a delete space API request. The deletion has not happened
|
|
343
|
+
* yet: it is only requested, and stays revocable for [[revocableForHours]]
|
|
344
|
+
*/
|
|
345
|
+
export type DeleteSpaceResponse = {
|
|
346
|
+
/**
|
|
347
|
+
* Always true, the request has been accepted
|
|
348
|
+
*/
|
|
349
|
+
requested: boolean;
|
|
350
|
+
/**
|
|
351
|
+
* How long the deletion stays revocable, in hours
|
|
352
|
+
*/
|
|
353
|
+
revocableForHours: number;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Return type of `revokeSpaceDeletion`, the withdrawn deletion record
|
|
358
|
+
*/
|
|
359
|
+
export type RevokeSpaceDeletionResponse = SpaceDeletionResponse;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Return type of `getSpaceDeletionStatus`. It is null when the space has never had a deletion
|
|
363
|
+
* requested: no request is a normal answer, not a missing resource
|
|
364
|
+
*/
|
|
365
|
+
export type GetSpaceDeletionStatusResponse = SpaceDeletionResponse | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentchef/contentchef-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-alpha.0",
|
|
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": "2e427740786a96ee2e1d8262371799287a33dc88"
|
|
38
38
|
}
|