@headroom-cms/admin-api 0.1.1
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/auth.cjs +73 -0
- package/dist/auth.d.cts +23 -0
- package/dist/auth.d.ts +23 -0
- package/dist/auth.js +36 -0
- package/dist/index.cjs +640 -0
- package/dist/index.d.cts +757 -0
- package/dist/index.d.ts +757 -0
- package/dist/index.js +601 -0
- package/dist/node.cjs +78 -0
- package/dist/node.d.cts +644 -0
- package/dist/node.d.ts +644 -0
- package/dist/node.js +41 -0
- package/dist/seed.cjs +175 -0
- package/dist/seed.d.cts +415 -0
- package/dist/seed.d.ts +415 -0
- package/dist/seed.js +143 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,757 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides JWT tokens for API authentication.
|
|
3
|
+
* Implementations handle token acquisition, caching, and refresh.
|
|
4
|
+
*/
|
|
5
|
+
interface TokenProvider {
|
|
6
|
+
/** Return a valid JWT access token. May refresh if expired. */
|
|
7
|
+
getToken(): Promise<string>;
|
|
8
|
+
/** Called when the API returns 401. Return a new token to retry, or throw. */
|
|
9
|
+
onUnauthorized?(): Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Simple token provider that returns a fixed token.
|
|
13
|
+
* Use for scripts and CLI tools that authenticate once upfront.
|
|
14
|
+
*/
|
|
15
|
+
declare class StaticTokenProvider implements TokenProvider {
|
|
16
|
+
private token;
|
|
17
|
+
constructor(token: string);
|
|
18
|
+
getToken(): Promise<string>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface components {
|
|
22
|
+
schemas: {
|
|
23
|
+
APIKeyCreateResult: {
|
|
24
|
+
/** Format: int64 */
|
|
25
|
+
createdAt: number;
|
|
26
|
+
key: string;
|
|
27
|
+
keyId: string;
|
|
28
|
+
label: string;
|
|
29
|
+
};
|
|
30
|
+
APIKeyList: {
|
|
31
|
+
keys?: components["schemas"]["APIKeyMetadata"][];
|
|
32
|
+
};
|
|
33
|
+
APIKeyMetadata: {
|
|
34
|
+
/** Format: int64 */
|
|
35
|
+
createdAt: number;
|
|
36
|
+
keyId: string;
|
|
37
|
+
label: string;
|
|
38
|
+
/** Format: int64 */
|
|
39
|
+
lastUsedAt?: number | null;
|
|
40
|
+
};
|
|
41
|
+
AdminBlockTypeList: {
|
|
42
|
+
blockTypes?: components["schemas"]["BlockType"][];
|
|
43
|
+
};
|
|
44
|
+
AdminCollectionList: {
|
|
45
|
+
collections?: components["schemas"]["Collection"][];
|
|
46
|
+
};
|
|
47
|
+
AdminContentList: {
|
|
48
|
+
cursor?: string;
|
|
49
|
+
hasMore: boolean;
|
|
50
|
+
items: components["schemas"]["ContentMetadata"][];
|
|
51
|
+
};
|
|
52
|
+
AuditEvent: {
|
|
53
|
+
action: string;
|
|
54
|
+
adminId: string;
|
|
55
|
+
/** Format: int64 */
|
|
56
|
+
createdAt: number;
|
|
57
|
+
details?: string;
|
|
58
|
+
errorMsg?: string;
|
|
59
|
+
eventId: string;
|
|
60
|
+
host?: string;
|
|
61
|
+
status: string;
|
|
62
|
+
/** Format: int64 */
|
|
63
|
+
updatedAt?: number;
|
|
64
|
+
};
|
|
65
|
+
AuditEventList: {
|
|
66
|
+
hasMore: boolean;
|
|
67
|
+
items: components["schemas"]["AuditEvent"][];
|
|
68
|
+
};
|
|
69
|
+
BlockType: {
|
|
70
|
+
fields?: components["schemas"]["FieldDef"][];
|
|
71
|
+
icon?: string;
|
|
72
|
+
label: string;
|
|
73
|
+
name: string;
|
|
74
|
+
previewTemplate?: string;
|
|
75
|
+
};
|
|
76
|
+
Collection: {
|
|
77
|
+
fields?: components["schemas"]["FieldDef"][];
|
|
78
|
+
label: string;
|
|
79
|
+
labelSingular: string;
|
|
80
|
+
name: string;
|
|
81
|
+
singleton?: boolean;
|
|
82
|
+
slug?: string;
|
|
83
|
+
version?: number;
|
|
84
|
+
};
|
|
85
|
+
CompleteUploadRequest: {
|
|
86
|
+
alt?: string;
|
|
87
|
+
caption?: string;
|
|
88
|
+
filename: string;
|
|
89
|
+
};
|
|
90
|
+
Content: {
|
|
91
|
+
body?: {
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
};
|
|
94
|
+
collection: string;
|
|
95
|
+
contentId: string;
|
|
96
|
+
coverUrl?: string;
|
|
97
|
+
/** Format: int64 */
|
|
98
|
+
lastPublishedAt?: number;
|
|
99
|
+
/** Format: int64 */
|
|
100
|
+
publishedAt?: number;
|
|
101
|
+
slug?: string;
|
|
102
|
+
snippet?: string;
|
|
103
|
+
tags?: string[];
|
|
104
|
+
title: string;
|
|
105
|
+
};
|
|
106
|
+
ContentDetail: {
|
|
107
|
+
content: components["schemas"]["Content"];
|
|
108
|
+
draft?: components["schemas"]["DraftContent"];
|
|
109
|
+
publishedBlockId?: string;
|
|
110
|
+
};
|
|
111
|
+
ContentMetadata: {
|
|
112
|
+
collection: string;
|
|
113
|
+
contentId: string;
|
|
114
|
+
coverUrl?: string;
|
|
115
|
+
/** Format: int64 */
|
|
116
|
+
lastDraftAt?: number;
|
|
117
|
+
lastDraftBlockId?: string;
|
|
118
|
+
/** Format: int64 */
|
|
119
|
+
lastPublishedAt?: number;
|
|
120
|
+
/** Format: int64 */
|
|
121
|
+
publishedAt?: number;
|
|
122
|
+
publishedBlockId?: string;
|
|
123
|
+
slug?: string;
|
|
124
|
+
snippet?: string;
|
|
125
|
+
tags?: string[];
|
|
126
|
+
title: string;
|
|
127
|
+
};
|
|
128
|
+
CreateAPIKeyRequest: {
|
|
129
|
+
label: string;
|
|
130
|
+
};
|
|
131
|
+
CreateContentRequest: {
|
|
132
|
+
collection: string;
|
|
133
|
+
params: components["schemas"]["SaveDraftParams"];
|
|
134
|
+
};
|
|
135
|
+
CreateSiteRequest: {
|
|
136
|
+
host: string;
|
|
137
|
+
name: string;
|
|
138
|
+
};
|
|
139
|
+
CreateWebhookRequest: {
|
|
140
|
+
description?: string;
|
|
141
|
+
enabled?: boolean;
|
|
142
|
+
events: string[];
|
|
143
|
+
url: string;
|
|
144
|
+
};
|
|
145
|
+
DraftContent: {
|
|
146
|
+
blockId: string;
|
|
147
|
+
body?: {
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
};
|
|
150
|
+
collection: string;
|
|
151
|
+
contentId: string;
|
|
152
|
+
coverUrl?: string;
|
|
153
|
+
/** Format: int64 */
|
|
154
|
+
createdAt: number;
|
|
155
|
+
createdBy: string;
|
|
156
|
+
slug?: string;
|
|
157
|
+
snippet?: string;
|
|
158
|
+
tags?: string[];
|
|
159
|
+
title?: string;
|
|
160
|
+
};
|
|
161
|
+
DraftVersion: {
|
|
162
|
+
/** Format: int64 */
|
|
163
|
+
createdAt: number;
|
|
164
|
+
createdBy: string;
|
|
165
|
+
title?: string;
|
|
166
|
+
};
|
|
167
|
+
DraftVersionList: {
|
|
168
|
+
versions?: components["schemas"]["DraftVersion"][];
|
|
169
|
+
};
|
|
170
|
+
Error: {
|
|
171
|
+
code: string;
|
|
172
|
+
error: string;
|
|
173
|
+
};
|
|
174
|
+
FieldDef: {
|
|
175
|
+
label: string;
|
|
176
|
+
name: string;
|
|
177
|
+
options?: {
|
|
178
|
+
[key: string]: unknown;
|
|
179
|
+
};
|
|
180
|
+
type: string;
|
|
181
|
+
};
|
|
182
|
+
Media: {
|
|
183
|
+
alt?: string;
|
|
184
|
+
caption?: string;
|
|
185
|
+
filename: string;
|
|
186
|
+
height?: number;
|
|
187
|
+
mediaId: string;
|
|
188
|
+
mimeType: string;
|
|
189
|
+
/** Format: int64 */
|
|
190
|
+
size: number;
|
|
191
|
+
/** Format: int64 */
|
|
192
|
+
uploadedAt: number;
|
|
193
|
+
url: string;
|
|
194
|
+
width?: number;
|
|
195
|
+
};
|
|
196
|
+
MediaList: {
|
|
197
|
+
cursor?: string;
|
|
198
|
+
hasMore: boolean;
|
|
199
|
+
items: components["schemas"]["Media"][];
|
|
200
|
+
};
|
|
201
|
+
RetryDeliveryResult: {
|
|
202
|
+
deliveryId: string;
|
|
203
|
+
};
|
|
204
|
+
RotateSecretResult: {
|
|
205
|
+
secret: string;
|
|
206
|
+
};
|
|
207
|
+
SaveDraftParams: {
|
|
208
|
+
body: {
|
|
209
|
+
[key: string]: unknown;
|
|
210
|
+
};
|
|
211
|
+
coverUrl?: string;
|
|
212
|
+
slug?: string;
|
|
213
|
+
snippet?: string;
|
|
214
|
+
tags?: string[];
|
|
215
|
+
title?: string;
|
|
216
|
+
};
|
|
217
|
+
SaveDraftResult: {
|
|
218
|
+
blockId: string;
|
|
219
|
+
contentId: string;
|
|
220
|
+
/** Format: int64 */
|
|
221
|
+
createdAt: number;
|
|
222
|
+
};
|
|
223
|
+
Site: {
|
|
224
|
+
admins?: components["schemas"]["SiteAdmin"][];
|
|
225
|
+
/** Format: int64 */
|
|
226
|
+
createdAt: number;
|
|
227
|
+
host: string;
|
|
228
|
+
name: string;
|
|
229
|
+
schemaVersion: number;
|
|
230
|
+
status: string;
|
|
231
|
+
/** Format: int64 */
|
|
232
|
+
updatedAt: number;
|
|
233
|
+
};
|
|
234
|
+
SiteAdmin: {
|
|
235
|
+
id: string;
|
|
236
|
+
/** @enum {string} */
|
|
237
|
+
role: "admin" | "editor";
|
|
238
|
+
};
|
|
239
|
+
SiteList: {
|
|
240
|
+
items?: components["schemas"]["Site"][];
|
|
241
|
+
};
|
|
242
|
+
UpdateAPIKeyRequest: {
|
|
243
|
+
label: string;
|
|
244
|
+
};
|
|
245
|
+
UpdateAdminsRequest: {
|
|
246
|
+
admins: components["schemas"]["SiteAdmin"][];
|
|
247
|
+
};
|
|
248
|
+
UpdateMediaRequest: {
|
|
249
|
+
alt?: string;
|
|
250
|
+
caption?: string;
|
|
251
|
+
};
|
|
252
|
+
UpdateSiteRequest: {
|
|
253
|
+
name?: string;
|
|
254
|
+
status?: string;
|
|
255
|
+
};
|
|
256
|
+
UpdateWebhookRequest: {
|
|
257
|
+
description?: string;
|
|
258
|
+
enabled?: boolean;
|
|
259
|
+
events?: string[];
|
|
260
|
+
url?: string;
|
|
261
|
+
};
|
|
262
|
+
UploadURLRequest: {
|
|
263
|
+
contentType: string;
|
|
264
|
+
filename: string;
|
|
265
|
+
/** Format: int64 */
|
|
266
|
+
size: number;
|
|
267
|
+
};
|
|
268
|
+
UploadURLResult: {
|
|
269
|
+
/** Format: int64 */
|
|
270
|
+
expiresAt: number;
|
|
271
|
+
mediaId: string;
|
|
272
|
+
uploadUrl: string;
|
|
273
|
+
};
|
|
274
|
+
Webhook: {
|
|
275
|
+
/** Format: int64 */
|
|
276
|
+
createdAt: number;
|
|
277
|
+
description?: string;
|
|
278
|
+
enabled: boolean;
|
|
279
|
+
events: string[];
|
|
280
|
+
host?: string;
|
|
281
|
+
secret?: string;
|
|
282
|
+
/** Format: int64 */
|
|
283
|
+
updatedAt?: number;
|
|
284
|
+
url: string;
|
|
285
|
+
webhookId: string;
|
|
286
|
+
};
|
|
287
|
+
WebhookDelivery: {
|
|
288
|
+
attempts?: number;
|
|
289
|
+
/** Format: int64 */
|
|
290
|
+
createdAt: number;
|
|
291
|
+
deliveryId: string;
|
|
292
|
+
/** Format: int64 */
|
|
293
|
+
duration?: number;
|
|
294
|
+
error?: string;
|
|
295
|
+
event: string;
|
|
296
|
+
payload?: string;
|
|
297
|
+
responseBody?: string;
|
|
298
|
+
responseStatus?: number;
|
|
299
|
+
status: string;
|
|
300
|
+
webhookId: string;
|
|
301
|
+
};
|
|
302
|
+
WebhookDeliveryList: {
|
|
303
|
+
deliveries: components["schemas"]["WebhookDelivery"][];
|
|
304
|
+
hasMore: boolean;
|
|
305
|
+
};
|
|
306
|
+
WebhookList: {
|
|
307
|
+
webhooks?: components["schemas"]["Webhook"][];
|
|
308
|
+
};
|
|
309
|
+
WebhookTestResult: {
|
|
310
|
+
/** Format: int64 */
|
|
311
|
+
durationMs: number;
|
|
312
|
+
error?: string;
|
|
313
|
+
requestPayload: string;
|
|
314
|
+
responseBody?: string;
|
|
315
|
+
statusCode?: number;
|
|
316
|
+
success: boolean;
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
responses: never;
|
|
320
|
+
parameters: never;
|
|
321
|
+
requestBodies: never;
|
|
322
|
+
headers: never;
|
|
323
|
+
pathItems: never;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
type Site = components["schemas"]["Site"];
|
|
327
|
+
type SiteAdmin = components["schemas"]["SiteAdmin"];
|
|
328
|
+
type Collection = components["schemas"]["Collection"] & {
|
|
329
|
+
relationships?: RelationshipDef[];
|
|
330
|
+
singletonContentId?: string;
|
|
331
|
+
};
|
|
332
|
+
type FieldDefinition = components["schemas"]["FieldDef"];
|
|
333
|
+
type BlockType = components["schemas"]["BlockType"] & {
|
|
334
|
+
previewData?: Record<string, unknown>;
|
|
335
|
+
};
|
|
336
|
+
type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
337
|
+
coverMediaId?: string;
|
|
338
|
+
relationships?: Record<string, ContentRef[]>;
|
|
339
|
+
};
|
|
340
|
+
type ContentDetail = components["schemas"]["ContentDetail"];
|
|
341
|
+
type DraftContent = components["schemas"]["DraftContent"] & {
|
|
342
|
+
relationships?: Record<string, ContentRef[]>;
|
|
343
|
+
};
|
|
344
|
+
type SaveDraftResult = components["schemas"]["SaveDraftResult"];
|
|
345
|
+
type MediaItem = components["schemas"]["Media"];
|
|
346
|
+
type UploadURLRequest = components["schemas"]["UploadURLRequest"];
|
|
347
|
+
type UploadURLResult = components["schemas"]["UploadURLResult"];
|
|
348
|
+
type CompleteUploadRequest = components["schemas"]["CompleteUploadRequest"];
|
|
349
|
+
type ApiKeyItem = components["schemas"]["APIKeyMetadata"];
|
|
350
|
+
type ApiKeyCreateResponse = components["schemas"]["APIKeyCreateResult"];
|
|
351
|
+
type Webhook = components["schemas"]["Webhook"];
|
|
352
|
+
type WebhookDelivery = components["schemas"]["WebhookDelivery"];
|
|
353
|
+
type AuditEvent = components["schemas"]["AuditEvent"];
|
|
354
|
+
interface AdminMediaItem {
|
|
355
|
+
mediaId: string;
|
|
356
|
+
filename: string;
|
|
357
|
+
mimeType: string;
|
|
358
|
+
size: number;
|
|
359
|
+
width?: number;
|
|
360
|
+
height?: number;
|
|
361
|
+
uploadedAt: number;
|
|
362
|
+
url: string;
|
|
363
|
+
alt?: string;
|
|
364
|
+
caption?: string;
|
|
365
|
+
tags: string[];
|
|
366
|
+
userTags: string[];
|
|
367
|
+
folderId?: string;
|
|
368
|
+
urls?: Record<string, string>;
|
|
369
|
+
}
|
|
370
|
+
interface MediaFolder {
|
|
371
|
+
folderId: string;
|
|
372
|
+
name: string;
|
|
373
|
+
createdAt: number;
|
|
374
|
+
count: number;
|
|
375
|
+
}
|
|
376
|
+
interface RelationshipDef {
|
|
377
|
+
name: string;
|
|
378
|
+
label: string;
|
|
379
|
+
targetCollection: string;
|
|
380
|
+
multiple: boolean;
|
|
381
|
+
}
|
|
382
|
+
interface ContentRef {
|
|
383
|
+
contentId: string;
|
|
384
|
+
collection: string;
|
|
385
|
+
slug: string;
|
|
386
|
+
title: string;
|
|
387
|
+
}
|
|
388
|
+
interface ReferencesResult {
|
|
389
|
+
count: number;
|
|
390
|
+
items: {
|
|
391
|
+
contentId: string;
|
|
392
|
+
collection: string;
|
|
393
|
+
title: string;
|
|
394
|
+
fieldName: string;
|
|
395
|
+
type?: string;
|
|
396
|
+
}[];
|
|
397
|
+
}
|
|
398
|
+
interface BulkMediaRequest {
|
|
399
|
+
mediaIds: string[];
|
|
400
|
+
action: "delete" | "move" | "addTags" | "removeTags";
|
|
401
|
+
folderId?: string;
|
|
402
|
+
tags?: string[];
|
|
403
|
+
}
|
|
404
|
+
interface BulkMediaResult {
|
|
405
|
+
succeeded: string[];
|
|
406
|
+
failed: {
|
|
407
|
+
mediaId: string;
|
|
408
|
+
error: string;
|
|
409
|
+
}[];
|
|
410
|
+
}
|
|
411
|
+
interface MediaUsageResponse {
|
|
412
|
+
references: {
|
|
413
|
+
contentId: string;
|
|
414
|
+
collection: string;
|
|
415
|
+
title: string;
|
|
416
|
+
}[];
|
|
417
|
+
note: string;
|
|
418
|
+
}
|
|
419
|
+
interface DuplicateCheckResponse {
|
|
420
|
+
duplicates: AdminMediaItem[];
|
|
421
|
+
}
|
|
422
|
+
interface CollectionInput {
|
|
423
|
+
name: string;
|
|
424
|
+
label: string;
|
|
425
|
+
labelSingular?: string;
|
|
426
|
+
slug?: string;
|
|
427
|
+
singleton?: boolean;
|
|
428
|
+
fields: FieldDefinition[];
|
|
429
|
+
relationships?: RelationshipDef[];
|
|
430
|
+
}
|
|
431
|
+
interface BlockTypeInput {
|
|
432
|
+
name: string;
|
|
433
|
+
label: string;
|
|
434
|
+
icon?: string;
|
|
435
|
+
fields: FieldDefinition[];
|
|
436
|
+
}
|
|
437
|
+
interface CreateContentParams {
|
|
438
|
+
collection: string;
|
|
439
|
+
params: SaveDraftParams;
|
|
440
|
+
}
|
|
441
|
+
interface SaveDraftParams {
|
|
442
|
+
title?: string;
|
|
443
|
+
slug?: string;
|
|
444
|
+
snippet?: string;
|
|
445
|
+
tags?: string[];
|
|
446
|
+
coverUrl?: string;
|
|
447
|
+
coverMediaId?: string;
|
|
448
|
+
coverWidth?: number;
|
|
449
|
+
coverHeight?: number;
|
|
450
|
+
body?: Record<string, unknown>;
|
|
451
|
+
createVersion?: boolean;
|
|
452
|
+
relationships?: Record<string, string[]>;
|
|
453
|
+
}
|
|
454
|
+
interface ContentListParams {
|
|
455
|
+
collection?: string;
|
|
456
|
+
q?: string;
|
|
457
|
+
search?: "prefix" | "full";
|
|
458
|
+
tag?: string;
|
|
459
|
+
status?: "draft" | "published" | "changed" | "unpublished";
|
|
460
|
+
sort?: string;
|
|
461
|
+
relatedTo?: string;
|
|
462
|
+
limit?: number;
|
|
463
|
+
cursor?: string;
|
|
464
|
+
}
|
|
465
|
+
interface MediaListParams {
|
|
466
|
+
tag?: string;
|
|
467
|
+
folderId?: string;
|
|
468
|
+
q?: string;
|
|
469
|
+
sort?: string;
|
|
470
|
+
limit?: number;
|
|
471
|
+
cursor?: string;
|
|
472
|
+
}
|
|
473
|
+
interface MediaTransformParams {
|
|
474
|
+
w?: number;
|
|
475
|
+
h?: number;
|
|
476
|
+
fit?: string;
|
|
477
|
+
format?: string;
|
|
478
|
+
q?: number;
|
|
479
|
+
cx?: number;
|
|
480
|
+
cy?: number;
|
|
481
|
+
cw?: number;
|
|
482
|
+
ch?: number;
|
|
483
|
+
}
|
|
484
|
+
interface SaveTransformRequest {
|
|
485
|
+
width?: number;
|
|
486
|
+
height?: number;
|
|
487
|
+
fit?: string;
|
|
488
|
+
format?: string;
|
|
489
|
+
quality?: number;
|
|
490
|
+
cropX?: number;
|
|
491
|
+
cropY?: number;
|
|
492
|
+
cropW?: number;
|
|
493
|
+
cropH?: number;
|
|
494
|
+
filename?: string;
|
|
495
|
+
}
|
|
496
|
+
interface AuditListParams {
|
|
497
|
+
action?: string;
|
|
498
|
+
before?: number;
|
|
499
|
+
}
|
|
500
|
+
interface PaginatedResponse<T> {
|
|
501
|
+
items: T[];
|
|
502
|
+
cursor: string | null;
|
|
503
|
+
hasMore: boolean;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
declare class HeadroomAdminClient {
|
|
507
|
+
private baseUrl;
|
|
508
|
+
private tokenProvider;
|
|
509
|
+
constructor(baseUrl: string, tokenProvider: TokenProvider);
|
|
510
|
+
/**
|
|
511
|
+
* Low-level fetch — public so admin UI hooks can migrate incrementally.
|
|
512
|
+
* Prefer typed methods (listSites, createContent, etc.) in new code.
|
|
513
|
+
*/
|
|
514
|
+
apiFetch<T>(path: string, options?: RequestInit): Promise<T>;
|
|
515
|
+
private handleResponse;
|
|
516
|
+
listSites(includeArchived?: boolean): Promise<Site[]>;
|
|
517
|
+
createSite(host: string, name: string): Promise<Site>;
|
|
518
|
+
getSite(host: string): Promise<Site>;
|
|
519
|
+
updateSite(host: string, data: {
|
|
520
|
+
name?: string;
|
|
521
|
+
status?: string;
|
|
522
|
+
}): Promise<Site>;
|
|
523
|
+
deleteSite(host: string): Promise<void>;
|
|
524
|
+
updateSiteAdmins(host: string, admins: SiteAdmin[]): Promise<void>;
|
|
525
|
+
purgeSite(host: string): Promise<void>;
|
|
526
|
+
inviteToSite(host: string, email: string, adminUrl: string): Promise<{
|
|
527
|
+
email: string;
|
|
528
|
+
sub: string;
|
|
529
|
+
existed: boolean;
|
|
530
|
+
}>;
|
|
531
|
+
listCollections(host: string): Promise<Collection[]>;
|
|
532
|
+
createCollection(host: string, input: CollectionInput): Promise<Collection>;
|
|
533
|
+
getCollection(host: string, name: string): Promise<Collection>;
|
|
534
|
+
updateCollection(host: string, name: string, input: CollectionInput): Promise<Collection>;
|
|
535
|
+
deleteCollection(host: string, name: string): Promise<void>;
|
|
536
|
+
listBlockTypes(host: string): Promise<BlockType[]>;
|
|
537
|
+
createBlockType(host: string, input: BlockTypeInput): Promise<BlockType>;
|
|
538
|
+
getBlockType(host: string, name: string): Promise<BlockType>;
|
|
539
|
+
updateBlockType(host: string, name: string, input: BlockTypeInput): Promise<BlockType>;
|
|
540
|
+
deleteBlockType(host: string, name: string): Promise<void>;
|
|
541
|
+
listContent(host: string, params?: ContentListParams): Promise<PaginatedResponse<ContentItem>>;
|
|
542
|
+
createContent(host: string, params: CreateContentParams): Promise<SaveDraftResult>;
|
|
543
|
+
getContent(host: string, contentId: string): Promise<ContentDetail>;
|
|
544
|
+
deleteContent(host: string, contentId: string): Promise<void>;
|
|
545
|
+
saveDraft(host: string, contentId: string, draft: SaveDraftParams): Promise<SaveDraftResult>;
|
|
546
|
+
publishContent(host: string, contentId: string): Promise<ContentItem>;
|
|
547
|
+
unpublishContent(host: string, contentId: string): Promise<void>;
|
|
548
|
+
discardDraft(host: string, contentId: string): Promise<void>;
|
|
549
|
+
getPublishedContent(host: string, contentId: string): Promise<ContentItem & {
|
|
550
|
+
body?: Record<string, unknown>;
|
|
551
|
+
}>;
|
|
552
|
+
listVersions(host: string, contentId: string): Promise<{
|
|
553
|
+
versions: {
|
|
554
|
+
blockId: string;
|
|
555
|
+
createdAt: number;
|
|
556
|
+
createdBy: string;
|
|
557
|
+
}[];
|
|
558
|
+
}>;
|
|
559
|
+
getVersion(host: string, contentId: string, blockId: string): Promise<{
|
|
560
|
+
body: Record<string, unknown>;
|
|
561
|
+
}>;
|
|
562
|
+
getReferences(host: string, contentId: string): Promise<ReferencesResult>;
|
|
563
|
+
listMedia(host: string, params?: MediaListParams): Promise<PaginatedResponse<AdminMediaItem>>;
|
|
564
|
+
getMedia(host: string, mediaId: string): Promise<AdminMediaItem>;
|
|
565
|
+
updateMedia(host: string, mediaId: string, data: {
|
|
566
|
+
alt?: string;
|
|
567
|
+
caption?: string;
|
|
568
|
+
userTags?: string[];
|
|
569
|
+
folderId?: string | null;
|
|
570
|
+
}): Promise<AdminMediaItem>;
|
|
571
|
+
deleteMedia(host: string, mediaId: string): Promise<void>;
|
|
572
|
+
getUploadUrl(host: string, params: {
|
|
573
|
+
filename: string;
|
|
574
|
+
contentType: string;
|
|
575
|
+
size: number;
|
|
576
|
+
}): Promise<UploadURLResult>;
|
|
577
|
+
completeUpload(host: string, mediaId: string, params: {
|
|
578
|
+
filename: string;
|
|
579
|
+
alt?: string;
|
|
580
|
+
caption?: string;
|
|
581
|
+
folderId?: string;
|
|
582
|
+
}): Promise<AdminMediaItem>;
|
|
583
|
+
/**
|
|
584
|
+
* Convenience: download from URL and upload through the media pipeline.
|
|
585
|
+
* Works in both Node.js and browsers (uses fetch + Uint8Array, no Node APIs).
|
|
586
|
+
*/
|
|
587
|
+
uploadFromUrl(host: string, url: string, filename: string, alt?: string): Promise<AdminMediaItem>;
|
|
588
|
+
listMediaFolders(host: string): Promise<MediaFolder[]>;
|
|
589
|
+
createMediaFolder(host: string, name: string): Promise<MediaFolder>;
|
|
590
|
+
updateMediaFolder(host: string, folderId: string, name: string): Promise<MediaFolder>;
|
|
591
|
+
deleteMediaFolder(host: string, folderId: string): Promise<void>;
|
|
592
|
+
bulkMediaOperation(host: string, params: BulkMediaRequest): Promise<BulkMediaResult>;
|
|
593
|
+
checkDuplicate(host: string, filename: string, size: number): Promise<DuplicateCheckResponse>;
|
|
594
|
+
getTransformUrl(host: string, mediaId: string, params: MediaTransformParams): Promise<{
|
|
595
|
+
url: string;
|
|
596
|
+
}>;
|
|
597
|
+
saveTransform(host: string, mediaId: string, params: SaveTransformRequest): Promise<AdminMediaItem>;
|
|
598
|
+
getMediaUsage(host: string, mediaId: string): Promise<MediaUsageResponse>;
|
|
599
|
+
listApiKeys(host: string): Promise<ApiKeyItem[]>;
|
|
600
|
+
createApiKey(host: string, label: string): Promise<ApiKeyCreateResponse>;
|
|
601
|
+
updateApiKey(host: string, keyId: string, label: string): Promise<ApiKeyItem>;
|
|
602
|
+
deleteApiKey(host: string, keyId: string): Promise<void>;
|
|
603
|
+
listWebhooks(host: string): Promise<Webhook[]>;
|
|
604
|
+
createWebhook(host: string, data: {
|
|
605
|
+
url: string;
|
|
606
|
+
events: string[];
|
|
607
|
+
}): Promise<Webhook>;
|
|
608
|
+
getWebhook(host: string, webhookId: string): Promise<Webhook>;
|
|
609
|
+
updateWebhook(host: string, webhookId: string, data: {
|
|
610
|
+
url?: string;
|
|
611
|
+
events?: string[];
|
|
612
|
+
}): Promise<Webhook>;
|
|
613
|
+
deleteWebhook(host: string, webhookId: string): Promise<void>;
|
|
614
|
+
testWebhook(host: string, webhookId: string): Promise<void>;
|
|
615
|
+
rotateWebhookSecret(host: string, webhookId: string): Promise<{
|
|
616
|
+
secret: string;
|
|
617
|
+
}>;
|
|
618
|
+
listWebhookDeliveries(host: string, webhookId: string): Promise<PaginatedResponse<WebhookDelivery>>;
|
|
619
|
+
getWebhookDelivery(host: string, webhookId: string, deliveryId: string): Promise<WebhookDelivery>;
|
|
620
|
+
retryDelivery(host: string, webhookId: string, deliveryId: string): Promise<void>;
|
|
621
|
+
listTags(host: string): Promise<{
|
|
622
|
+
tags: {
|
|
623
|
+
tag: string;
|
|
624
|
+
count: number;
|
|
625
|
+
}[];
|
|
626
|
+
}>;
|
|
627
|
+
createTag(host: string, tag: string): Promise<void>;
|
|
628
|
+
deleteTag(host: string, tag: string): Promise<void>;
|
|
629
|
+
listAuditEvents(host: string, params?: AuditListParams): Promise<PaginatedResponse<AuditEvent>>;
|
|
630
|
+
listUsers(): Promise<{
|
|
631
|
+
users: {
|
|
632
|
+
sub: string;
|
|
633
|
+
email: string;
|
|
634
|
+
status: string;
|
|
635
|
+
createdAt: number;
|
|
636
|
+
mfaEnabled: boolean;
|
|
637
|
+
}[];
|
|
638
|
+
}>;
|
|
639
|
+
deleteUser(sub: string): Promise<void>;
|
|
640
|
+
disableUserMfa(sub: string): Promise<void>;
|
|
641
|
+
resolveAdmins(subs: string[]): Promise<{
|
|
642
|
+
users: Record<string, {
|
|
643
|
+
sub: string;
|
|
644
|
+
email: string;
|
|
645
|
+
} | null>;
|
|
646
|
+
}>;
|
|
647
|
+
listSuperAdmins(): Promise<{
|
|
648
|
+
superAdminIds: string[];
|
|
649
|
+
}>;
|
|
650
|
+
updateSuperAdmins(superAdminIds: string[]): Promise<void>;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
declare class HeadroomApiError extends Error {
|
|
654
|
+
status: number;
|
|
655
|
+
code: string;
|
|
656
|
+
constructor(status: number, code: string, message: string);
|
|
657
|
+
/** Alias for `message` — eases migration from admin's ApiError which used `detail`. */
|
|
658
|
+
get detail(): string;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
declare function text(t: string, styles?: Record<string, boolean | string>): {
|
|
662
|
+
type: "text";
|
|
663
|
+
text: string;
|
|
664
|
+
styles: Record<string, string | boolean>;
|
|
665
|
+
};
|
|
666
|
+
declare function link(href: string, label: string): {
|
|
667
|
+
type: "link";
|
|
668
|
+
href: string;
|
|
669
|
+
content: {
|
|
670
|
+
type: "text";
|
|
671
|
+
text: string;
|
|
672
|
+
styles: Record<string, string | boolean>;
|
|
673
|
+
}[];
|
|
674
|
+
};
|
|
675
|
+
declare function block(type: string, content?: unknown[], props?: Record<string, unknown>, children?: unknown[]): {
|
|
676
|
+
id: string;
|
|
677
|
+
type: string;
|
|
678
|
+
props: {
|
|
679
|
+
textAlignment: string;
|
|
680
|
+
};
|
|
681
|
+
content: unknown[];
|
|
682
|
+
children: unknown[];
|
|
683
|
+
};
|
|
684
|
+
declare function heading(level: number, ...content: unknown[]): {
|
|
685
|
+
id: string;
|
|
686
|
+
type: string;
|
|
687
|
+
props: {
|
|
688
|
+
textAlignment: string;
|
|
689
|
+
};
|
|
690
|
+
content: unknown[];
|
|
691
|
+
children: unknown[];
|
|
692
|
+
};
|
|
693
|
+
declare function paragraph(...content: unknown[]): {
|
|
694
|
+
id: string;
|
|
695
|
+
type: string;
|
|
696
|
+
props: {
|
|
697
|
+
textAlignment: string;
|
|
698
|
+
};
|
|
699
|
+
content: unknown[];
|
|
700
|
+
children: unknown[];
|
|
701
|
+
};
|
|
702
|
+
declare function bulletItem(...content: unknown[]): {
|
|
703
|
+
id: string;
|
|
704
|
+
type: string;
|
|
705
|
+
props: {
|
|
706
|
+
textAlignment: string;
|
|
707
|
+
};
|
|
708
|
+
content: unknown[];
|
|
709
|
+
children: unknown[];
|
|
710
|
+
};
|
|
711
|
+
declare function numberedItem(...content: unknown[]): {
|
|
712
|
+
id: string;
|
|
713
|
+
type: string;
|
|
714
|
+
props: {
|
|
715
|
+
textAlignment: string;
|
|
716
|
+
};
|
|
717
|
+
content: unknown[];
|
|
718
|
+
children: unknown[];
|
|
719
|
+
};
|
|
720
|
+
declare function checkItem(checked: boolean, ...content: unknown[]): {
|
|
721
|
+
id: string;
|
|
722
|
+
type: string;
|
|
723
|
+
props: {
|
|
724
|
+
textAlignment: string;
|
|
725
|
+
};
|
|
726
|
+
content: unknown[];
|
|
727
|
+
children: unknown[];
|
|
728
|
+
};
|
|
729
|
+
declare function codeBlock(language: string, code: string): {
|
|
730
|
+
id: string;
|
|
731
|
+
type: string;
|
|
732
|
+
props: {
|
|
733
|
+
textAlignment: string;
|
|
734
|
+
};
|
|
735
|
+
content: unknown[];
|
|
736
|
+
children: unknown[];
|
|
737
|
+
};
|
|
738
|
+
interface ImageProps {
|
|
739
|
+
url?: string;
|
|
740
|
+
mediaId?: string;
|
|
741
|
+
filename?: string;
|
|
742
|
+
width?: number;
|
|
743
|
+
height?: number;
|
|
744
|
+
caption?: string;
|
|
745
|
+
alt?: string;
|
|
746
|
+
}
|
|
747
|
+
declare function image(props: ImageProps): {
|
|
748
|
+
id: string;
|
|
749
|
+
type: string;
|
|
750
|
+
props: {
|
|
751
|
+
textAlignment: string;
|
|
752
|
+
};
|
|
753
|
+
content: unknown[];
|
|
754
|
+
children: unknown[];
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
export { type AdminMediaItem, type ApiKeyCreateResponse, type ApiKeyItem, type AuditEvent, type AuditListParams, type BlockType, type BlockTypeInput, type BulkMediaRequest, type BulkMediaResult, type Collection, type CollectionInput, type CompleteUploadRequest, type ContentDetail, type ContentItem, type ContentListParams, type ContentRef, type CreateContentParams, type DraftContent, type DuplicateCheckResponse, type FieldDefinition, HeadroomAdminClient, HeadroomApiError, type ImageProps, type MediaFolder, type MediaItem, type MediaListParams, type MediaTransformParams, type MediaUsageResponse, type PaginatedResponse, type ReferencesResult, type RelationshipDef, type SaveDraftParams, type SaveDraftResult, type SaveTransformRequest, type Site, type SiteAdmin, StaticTokenProvider, type TokenProvider, type UploadURLRequest, type UploadURLResult, type Webhook, type WebhookDelivery, block, bulletItem, checkItem, codeBlock, heading, image, link, numberedItem, paragraph, text };
|