@headroom-cms/admin-api 0.1.3 → 0.1.5
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/index.cjs +42 -0
- package/dist/index.d.cts +80 -3
- package/dist/index.d.ts +80 -3
- package/dist/index.js +42 -0
- package/dist/node.d.cts +79 -2
- package/dist/node.d.ts +79 -2
- package/dist/seed.d.cts +30 -1
- package/dist/seed.d.ts +30 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -531,11 +531,53 @@ var HeadroomAdminClient = class {
|
|
|
531
531
|
{ method: "DELETE" }
|
|
532
532
|
);
|
|
533
533
|
}
|
|
534
|
+
// ── Site Users (site-scoped) ──────────────────────
|
|
535
|
+
async listSiteUsers(host, params) {
|
|
536
|
+
const qs = new URLSearchParams();
|
|
537
|
+
if (params?.cursor) qs.set("cursor", params.cursor);
|
|
538
|
+
if (params?.limit) qs.set("limit", String(params.limit));
|
|
539
|
+
if (params?.tag) qs.set("tag", params.tag);
|
|
540
|
+
const query = qs.toString();
|
|
541
|
+
return this.apiFetch(
|
|
542
|
+
`/v1/admin/sites/${encodeURIComponent(host)}/site-users${query ? `?${query}` : ""}`
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
async getSiteUser(host, userId) {
|
|
546
|
+
return this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}`);
|
|
547
|
+
}
|
|
548
|
+
async createSiteUser(host, data) {
|
|
549
|
+
return this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users`, {
|
|
550
|
+
method: "POST",
|
|
551
|
+
body: JSON.stringify(data)
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
async updateSiteUser(host, userId, data) {
|
|
555
|
+
return this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}`, {
|
|
556
|
+
method: "PUT",
|
|
557
|
+
body: JSON.stringify(data)
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
async deleteSiteUser(host, userId) {
|
|
561
|
+
await this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}`, {
|
|
562
|
+
method: "DELETE"
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
async changeSiteUserEmail(host, userId, data) {
|
|
566
|
+
return this.apiFetch(
|
|
567
|
+
`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}/email`,
|
|
568
|
+
{
|
|
569
|
+
method: "PUT",
|
|
570
|
+
body: JSON.stringify(data)
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
}
|
|
534
574
|
// ── Audit ──────────────────────────────────────────
|
|
535
575
|
async listAuditEvents(host, params) {
|
|
536
576
|
const qs = new URLSearchParams();
|
|
537
577
|
if (params?.action) qs.set("action", params.action);
|
|
538
578
|
if (params?.before) qs.set("before", String(params.before));
|
|
579
|
+
if (params?.limit) qs.set("limit", String(params.limit));
|
|
580
|
+
if (params?.admin) qs.set("admin", params.admin);
|
|
539
581
|
const q = qs.toString();
|
|
540
582
|
return this.apiFetch(
|
|
541
583
|
`/v1/admin/sites/${encodeURIComponent(host)}/audit${q ? `?${q}` : ""}`
|
package/dist/index.d.cts
CHANGED
|
@@ -323,11 +323,17 @@ interface components {
|
|
|
323
323
|
pathItems: never;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
type Site = components["schemas"]["Site"]
|
|
326
|
+
type Site = components["schemas"]["Site"] & {
|
|
327
|
+
auth?: SiteAuthConfig;
|
|
328
|
+
};
|
|
327
329
|
type SiteAdmin = components["schemas"]["SiteAdmin"];
|
|
328
330
|
type Collection = components["schemas"]["Collection"] & {
|
|
329
331
|
relationships?: RelationshipDef[];
|
|
330
332
|
singletonContentId?: string;
|
|
333
|
+
mobileNavPriority?: number;
|
|
334
|
+
icon?: string;
|
|
335
|
+
mode?: string;
|
|
336
|
+
requireAuth?: boolean;
|
|
331
337
|
};
|
|
332
338
|
type FieldDefinition = components["schemas"]["FieldDef"];
|
|
333
339
|
type BlockType = components["schemas"]["BlockType"] & {
|
|
@@ -338,6 +344,14 @@ type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
|
338
344
|
relationships?: Record<string, ContentRef[]>;
|
|
339
345
|
scheduledAt?: number;
|
|
340
346
|
scheduledFailed?: boolean;
|
|
347
|
+
mode?: string;
|
|
348
|
+
siteUserId?: string;
|
|
349
|
+
siteUser?: {
|
|
350
|
+
userId: string;
|
|
351
|
+
name?: string;
|
|
352
|
+
email: string;
|
|
353
|
+
};
|
|
354
|
+
fields?: Record<string, unknown>;
|
|
341
355
|
};
|
|
342
356
|
type ContentDetail = components["schemas"]["ContentDetail"];
|
|
343
357
|
type DraftContent = components["schemas"]["DraftContent"] & {
|
|
@@ -352,7 +366,42 @@ type ApiKeyItem = components["schemas"]["APIKeyMetadata"];
|
|
|
352
366
|
type ApiKeyCreateResponse = components["schemas"]["APIKeyCreateResult"];
|
|
353
367
|
type Webhook = components["schemas"]["Webhook"];
|
|
354
368
|
type WebhookDelivery = components["schemas"]["WebhookDelivery"];
|
|
355
|
-
|
|
369
|
+
interface AuditDetails {
|
|
370
|
+
resourceType?: string;
|
|
371
|
+
resourceId?: string;
|
|
372
|
+
title?: string;
|
|
373
|
+
collection?: string;
|
|
374
|
+
blockId?: string;
|
|
375
|
+
prevBlockId?: string;
|
|
376
|
+
extra?: string;
|
|
377
|
+
}
|
|
378
|
+
type AuditEvent = Omit<components["schemas"]["AuditEvent"], "details"> & {
|
|
379
|
+
resourceType?: string;
|
|
380
|
+
resourceId?: string;
|
|
381
|
+
details?: AuditDetails;
|
|
382
|
+
};
|
|
383
|
+
interface SiteUser {
|
|
384
|
+
userId: string;
|
|
385
|
+
email: string;
|
|
386
|
+
status: "active" | "disabled";
|
|
387
|
+
name?: string;
|
|
388
|
+
tags?: string[];
|
|
389
|
+
fields?: Record<string, unknown>;
|
|
390
|
+
sessionVersion: number;
|
|
391
|
+
createdAt: number;
|
|
392
|
+
lastLogin?: number;
|
|
393
|
+
}
|
|
394
|
+
interface SiteAuthConfig {
|
|
395
|
+
enabled: boolean;
|
|
396
|
+
sessionTtl: number;
|
|
397
|
+
allowSignup: boolean;
|
|
398
|
+
otpRateLimit?: number;
|
|
399
|
+
fromName?: string;
|
|
400
|
+
emailSubject?: string;
|
|
401
|
+
emailBody?: string;
|
|
402
|
+
emailTextBody?: string;
|
|
403
|
+
userFields?: FieldDefinition[];
|
|
404
|
+
}
|
|
356
405
|
interface AdminMediaItem {
|
|
357
406
|
mediaId: string;
|
|
358
407
|
filename: string;
|
|
@@ -429,6 +478,10 @@ interface CollectionInput {
|
|
|
429
478
|
singleton?: boolean;
|
|
430
479
|
fields: FieldDefinition[];
|
|
431
480
|
relationships?: RelationshipDef[];
|
|
481
|
+
mobileNavPriority?: number;
|
|
482
|
+
icon?: string;
|
|
483
|
+
mode?: string;
|
|
484
|
+
requireAuth?: boolean;
|
|
432
485
|
}
|
|
433
486
|
interface BlockTypeInput {
|
|
434
487
|
name: string;
|
|
@@ -498,6 +551,8 @@ interface SaveTransformRequest {
|
|
|
498
551
|
interface AuditListParams {
|
|
499
552
|
action?: string;
|
|
500
553
|
before?: number;
|
|
554
|
+
limit?: number;
|
|
555
|
+
admin?: string;
|
|
501
556
|
}
|
|
502
557
|
interface PaginatedResponse<T> {
|
|
503
558
|
items: T[];
|
|
@@ -628,6 +683,28 @@ declare class HeadroomAdminClient {
|
|
|
628
683
|
}>;
|
|
629
684
|
createTag(host: string, tag: string): Promise<void>;
|
|
630
685
|
deleteTag(host: string, tag: string): Promise<void>;
|
|
686
|
+
listSiteUsers(host: string, params?: {
|
|
687
|
+
cursor?: string;
|
|
688
|
+
limit?: number;
|
|
689
|
+
tag?: string;
|
|
690
|
+
}): Promise<PaginatedResponse<SiteUser>>;
|
|
691
|
+
getSiteUser(host: string, userId: string): Promise<SiteUser>;
|
|
692
|
+
createSiteUser(host: string, data: {
|
|
693
|
+
email: string;
|
|
694
|
+
name?: string;
|
|
695
|
+
tags?: string[];
|
|
696
|
+
fields?: Record<string, unknown>;
|
|
697
|
+
}): Promise<SiteUser>;
|
|
698
|
+
updateSiteUser(host: string, userId: string, data: {
|
|
699
|
+
name?: string;
|
|
700
|
+
status?: string;
|
|
701
|
+
tags?: string[];
|
|
702
|
+
fields?: Record<string, unknown>;
|
|
703
|
+
}): Promise<SiteUser>;
|
|
704
|
+
deleteSiteUser(host: string, userId: string): Promise<void>;
|
|
705
|
+
changeSiteUserEmail(host: string, userId: string, data: {
|
|
706
|
+
email: string;
|
|
707
|
+
}): Promise<SiteUser>;
|
|
631
708
|
listAuditEvents(host: string, params?: AuditListParams): Promise<PaginatedResponse<AuditEvent>>;
|
|
632
709
|
listUsers(): Promise<{
|
|
633
710
|
users: {
|
|
@@ -756,4 +833,4 @@ declare function image(props: ImageProps): {
|
|
|
756
833
|
children: unknown[];
|
|
757
834
|
};
|
|
758
835
|
|
|
759
|
-
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 };
|
|
836
|
+
export { type AdminMediaItem, type ApiKeyCreateResponse, type ApiKeyItem, type AuditDetails, 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, type SiteAuthConfig, type SiteUser, StaticTokenProvider, type TokenProvider, type UploadURLRequest, type UploadURLResult, type Webhook, type WebhookDelivery, block, bulletItem, checkItem, codeBlock, heading, image, link, numberedItem, paragraph, text };
|
package/dist/index.d.ts
CHANGED
|
@@ -323,11 +323,17 @@ interface components {
|
|
|
323
323
|
pathItems: never;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
type Site = components["schemas"]["Site"]
|
|
326
|
+
type Site = components["schemas"]["Site"] & {
|
|
327
|
+
auth?: SiteAuthConfig;
|
|
328
|
+
};
|
|
327
329
|
type SiteAdmin = components["schemas"]["SiteAdmin"];
|
|
328
330
|
type Collection = components["schemas"]["Collection"] & {
|
|
329
331
|
relationships?: RelationshipDef[];
|
|
330
332
|
singletonContentId?: string;
|
|
333
|
+
mobileNavPriority?: number;
|
|
334
|
+
icon?: string;
|
|
335
|
+
mode?: string;
|
|
336
|
+
requireAuth?: boolean;
|
|
331
337
|
};
|
|
332
338
|
type FieldDefinition = components["schemas"]["FieldDef"];
|
|
333
339
|
type BlockType = components["schemas"]["BlockType"] & {
|
|
@@ -338,6 +344,14 @@ type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
|
338
344
|
relationships?: Record<string, ContentRef[]>;
|
|
339
345
|
scheduledAt?: number;
|
|
340
346
|
scheduledFailed?: boolean;
|
|
347
|
+
mode?: string;
|
|
348
|
+
siteUserId?: string;
|
|
349
|
+
siteUser?: {
|
|
350
|
+
userId: string;
|
|
351
|
+
name?: string;
|
|
352
|
+
email: string;
|
|
353
|
+
};
|
|
354
|
+
fields?: Record<string, unknown>;
|
|
341
355
|
};
|
|
342
356
|
type ContentDetail = components["schemas"]["ContentDetail"];
|
|
343
357
|
type DraftContent = components["schemas"]["DraftContent"] & {
|
|
@@ -352,7 +366,42 @@ type ApiKeyItem = components["schemas"]["APIKeyMetadata"];
|
|
|
352
366
|
type ApiKeyCreateResponse = components["schemas"]["APIKeyCreateResult"];
|
|
353
367
|
type Webhook = components["schemas"]["Webhook"];
|
|
354
368
|
type WebhookDelivery = components["schemas"]["WebhookDelivery"];
|
|
355
|
-
|
|
369
|
+
interface AuditDetails {
|
|
370
|
+
resourceType?: string;
|
|
371
|
+
resourceId?: string;
|
|
372
|
+
title?: string;
|
|
373
|
+
collection?: string;
|
|
374
|
+
blockId?: string;
|
|
375
|
+
prevBlockId?: string;
|
|
376
|
+
extra?: string;
|
|
377
|
+
}
|
|
378
|
+
type AuditEvent = Omit<components["schemas"]["AuditEvent"], "details"> & {
|
|
379
|
+
resourceType?: string;
|
|
380
|
+
resourceId?: string;
|
|
381
|
+
details?: AuditDetails;
|
|
382
|
+
};
|
|
383
|
+
interface SiteUser {
|
|
384
|
+
userId: string;
|
|
385
|
+
email: string;
|
|
386
|
+
status: "active" | "disabled";
|
|
387
|
+
name?: string;
|
|
388
|
+
tags?: string[];
|
|
389
|
+
fields?: Record<string, unknown>;
|
|
390
|
+
sessionVersion: number;
|
|
391
|
+
createdAt: number;
|
|
392
|
+
lastLogin?: number;
|
|
393
|
+
}
|
|
394
|
+
interface SiteAuthConfig {
|
|
395
|
+
enabled: boolean;
|
|
396
|
+
sessionTtl: number;
|
|
397
|
+
allowSignup: boolean;
|
|
398
|
+
otpRateLimit?: number;
|
|
399
|
+
fromName?: string;
|
|
400
|
+
emailSubject?: string;
|
|
401
|
+
emailBody?: string;
|
|
402
|
+
emailTextBody?: string;
|
|
403
|
+
userFields?: FieldDefinition[];
|
|
404
|
+
}
|
|
356
405
|
interface AdminMediaItem {
|
|
357
406
|
mediaId: string;
|
|
358
407
|
filename: string;
|
|
@@ -429,6 +478,10 @@ interface CollectionInput {
|
|
|
429
478
|
singleton?: boolean;
|
|
430
479
|
fields: FieldDefinition[];
|
|
431
480
|
relationships?: RelationshipDef[];
|
|
481
|
+
mobileNavPriority?: number;
|
|
482
|
+
icon?: string;
|
|
483
|
+
mode?: string;
|
|
484
|
+
requireAuth?: boolean;
|
|
432
485
|
}
|
|
433
486
|
interface BlockTypeInput {
|
|
434
487
|
name: string;
|
|
@@ -498,6 +551,8 @@ interface SaveTransformRequest {
|
|
|
498
551
|
interface AuditListParams {
|
|
499
552
|
action?: string;
|
|
500
553
|
before?: number;
|
|
554
|
+
limit?: number;
|
|
555
|
+
admin?: string;
|
|
501
556
|
}
|
|
502
557
|
interface PaginatedResponse<T> {
|
|
503
558
|
items: T[];
|
|
@@ -628,6 +683,28 @@ declare class HeadroomAdminClient {
|
|
|
628
683
|
}>;
|
|
629
684
|
createTag(host: string, tag: string): Promise<void>;
|
|
630
685
|
deleteTag(host: string, tag: string): Promise<void>;
|
|
686
|
+
listSiteUsers(host: string, params?: {
|
|
687
|
+
cursor?: string;
|
|
688
|
+
limit?: number;
|
|
689
|
+
tag?: string;
|
|
690
|
+
}): Promise<PaginatedResponse<SiteUser>>;
|
|
691
|
+
getSiteUser(host: string, userId: string): Promise<SiteUser>;
|
|
692
|
+
createSiteUser(host: string, data: {
|
|
693
|
+
email: string;
|
|
694
|
+
name?: string;
|
|
695
|
+
tags?: string[];
|
|
696
|
+
fields?: Record<string, unknown>;
|
|
697
|
+
}): Promise<SiteUser>;
|
|
698
|
+
updateSiteUser(host: string, userId: string, data: {
|
|
699
|
+
name?: string;
|
|
700
|
+
status?: string;
|
|
701
|
+
tags?: string[];
|
|
702
|
+
fields?: Record<string, unknown>;
|
|
703
|
+
}): Promise<SiteUser>;
|
|
704
|
+
deleteSiteUser(host: string, userId: string): Promise<void>;
|
|
705
|
+
changeSiteUserEmail(host: string, userId: string, data: {
|
|
706
|
+
email: string;
|
|
707
|
+
}): Promise<SiteUser>;
|
|
631
708
|
listAuditEvents(host: string, params?: AuditListParams): Promise<PaginatedResponse<AuditEvent>>;
|
|
632
709
|
listUsers(): Promise<{
|
|
633
710
|
users: {
|
|
@@ -756,4 +833,4 @@ declare function image(props: ImageProps): {
|
|
|
756
833
|
children: unknown[];
|
|
757
834
|
};
|
|
758
835
|
|
|
759
|
-
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 };
|
|
836
|
+
export { type AdminMediaItem, type ApiKeyCreateResponse, type ApiKeyItem, type AuditDetails, 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, type SiteAuthConfig, type SiteUser, StaticTokenProvider, type TokenProvider, type UploadURLRequest, type UploadURLResult, type Webhook, type WebhookDelivery, block, bulletItem, checkItem, codeBlock, heading, image, link, numberedItem, paragraph, text };
|
package/dist/index.js
CHANGED
|
@@ -493,11 +493,53 @@ var HeadroomAdminClient = class {
|
|
|
493
493
|
{ method: "DELETE" }
|
|
494
494
|
);
|
|
495
495
|
}
|
|
496
|
+
// ── Site Users (site-scoped) ──────────────────────
|
|
497
|
+
async listSiteUsers(host, params) {
|
|
498
|
+
const qs = new URLSearchParams();
|
|
499
|
+
if (params?.cursor) qs.set("cursor", params.cursor);
|
|
500
|
+
if (params?.limit) qs.set("limit", String(params.limit));
|
|
501
|
+
if (params?.tag) qs.set("tag", params.tag);
|
|
502
|
+
const query = qs.toString();
|
|
503
|
+
return this.apiFetch(
|
|
504
|
+
`/v1/admin/sites/${encodeURIComponent(host)}/site-users${query ? `?${query}` : ""}`
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
async getSiteUser(host, userId) {
|
|
508
|
+
return this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}`);
|
|
509
|
+
}
|
|
510
|
+
async createSiteUser(host, data) {
|
|
511
|
+
return this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users`, {
|
|
512
|
+
method: "POST",
|
|
513
|
+
body: JSON.stringify(data)
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
async updateSiteUser(host, userId, data) {
|
|
517
|
+
return this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}`, {
|
|
518
|
+
method: "PUT",
|
|
519
|
+
body: JSON.stringify(data)
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
async deleteSiteUser(host, userId) {
|
|
523
|
+
await this.apiFetch(`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}`, {
|
|
524
|
+
method: "DELETE"
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
async changeSiteUserEmail(host, userId, data) {
|
|
528
|
+
return this.apiFetch(
|
|
529
|
+
`/v1/admin/sites/${encodeURIComponent(host)}/site-users/${userId}/email`,
|
|
530
|
+
{
|
|
531
|
+
method: "PUT",
|
|
532
|
+
body: JSON.stringify(data)
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
496
536
|
// ── Audit ──────────────────────────────────────────
|
|
497
537
|
async listAuditEvents(host, params) {
|
|
498
538
|
const qs = new URLSearchParams();
|
|
499
539
|
if (params?.action) qs.set("action", params.action);
|
|
500
540
|
if (params?.before) qs.set("before", String(params.before));
|
|
541
|
+
if (params?.limit) qs.set("limit", String(params.limit));
|
|
542
|
+
if (params?.admin) qs.set("admin", params.admin);
|
|
501
543
|
const q = qs.toString();
|
|
502
544
|
return this.apiFetch(
|
|
503
545
|
`/v1/admin/sites/${encodeURIComponent(host)}/audit${q ? `?${q}` : ""}`
|
package/dist/node.d.cts
CHANGED
|
@@ -314,11 +314,17 @@ interface components {
|
|
|
314
314
|
pathItems: never;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
type Site = components["schemas"]["Site"]
|
|
317
|
+
type Site = components["schemas"]["Site"] & {
|
|
318
|
+
auth?: SiteAuthConfig;
|
|
319
|
+
};
|
|
318
320
|
type SiteAdmin = components["schemas"]["SiteAdmin"];
|
|
319
321
|
type Collection = components["schemas"]["Collection"] & {
|
|
320
322
|
relationships?: RelationshipDef[];
|
|
321
323
|
singletonContentId?: string;
|
|
324
|
+
mobileNavPriority?: number;
|
|
325
|
+
icon?: string;
|
|
326
|
+
mode?: string;
|
|
327
|
+
requireAuth?: boolean;
|
|
322
328
|
};
|
|
323
329
|
type FieldDefinition = components["schemas"]["FieldDef"];
|
|
324
330
|
type BlockType = components["schemas"]["BlockType"] & {
|
|
@@ -329,6 +335,14 @@ type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
|
329
335
|
relationships?: Record<string, ContentRef[]>;
|
|
330
336
|
scheduledAt?: number;
|
|
331
337
|
scheduledFailed?: boolean;
|
|
338
|
+
mode?: string;
|
|
339
|
+
siteUserId?: string;
|
|
340
|
+
siteUser?: {
|
|
341
|
+
userId: string;
|
|
342
|
+
name?: string;
|
|
343
|
+
email: string;
|
|
344
|
+
};
|
|
345
|
+
fields?: Record<string, unknown>;
|
|
332
346
|
};
|
|
333
347
|
type ContentDetail = components["schemas"]["ContentDetail"];
|
|
334
348
|
type SaveDraftResult = components["schemas"]["SaveDraftResult"];
|
|
@@ -337,7 +351,42 @@ type ApiKeyItem = components["schemas"]["APIKeyMetadata"];
|
|
|
337
351
|
type ApiKeyCreateResponse = components["schemas"]["APIKeyCreateResult"];
|
|
338
352
|
type Webhook = components["schemas"]["Webhook"];
|
|
339
353
|
type WebhookDelivery = components["schemas"]["WebhookDelivery"];
|
|
340
|
-
|
|
354
|
+
interface AuditDetails {
|
|
355
|
+
resourceType?: string;
|
|
356
|
+
resourceId?: string;
|
|
357
|
+
title?: string;
|
|
358
|
+
collection?: string;
|
|
359
|
+
blockId?: string;
|
|
360
|
+
prevBlockId?: string;
|
|
361
|
+
extra?: string;
|
|
362
|
+
}
|
|
363
|
+
type AuditEvent = Omit<components["schemas"]["AuditEvent"], "details"> & {
|
|
364
|
+
resourceType?: string;
|
|
365
|
+
resourceId?: string;
|
|
366
|
+
details?: AuditDetails;
|
|
367
|
+
};
|
|
368
|
+
interface SiteUser {
|
|
369
|
+
userId: string;
|
|
370
|
+
email: string;
|
|
371
|
+
status: "active" | "disabled";
|
|
372
|
+
name?: string;
|
|
373
|
+
tags?: string[];
|
|
374
|
+
fields?: Record<string, unknown>;
|
|
375
|
+
sessionVersion: number;
|
|
376
|
+
createdAt: number;
|
|
377
|
+
lastLogin?: number;
|
|
378
|
+
}
|
|
379
|
+
interface SiteAuthConfig {
|
|
380
|
+
enabled: boolean;
|
|
381
|
+
sessionTtl: number;
|
|
382
|
+
allowSignup: boolean;
|
|
383
|
+
otpRateLimit?: number;
|
|
384
|
+
fromName?: string;
|
|
385
|
+
emailSubject?: string;
|
|
386
|
+
emailBody?: string;
|
|
387
|
+
emailTextBody?: string;
|
|
388
|
+
userFields?: FieldDefinition[];
|
|
389
|
+
}
|
|
341
390
|
interface AdminMediaItem {
|
|
342
391
|
mediaId: string;
|
|
343
392
|
filename: string;
|
|
@@ -414,6 +463,10 @@ interface CollectionInput {
|
|
|
414
463
|
singleton?: boolean;
|
|
415
464
|
fields: FieldDefinition[];
|
|
416
465
|
relationships?: RelationshipDef[];
|
|
466
|
+
mobileNavPriority?: number;
|
|
467
|
+
icon?: string;
|
|
468
|
+
mode?: string;
|
|
469
|
+
requireAuth?: boolean;
|
|
417
470
|
}
|
|
418
471
|
interface BlockTypeInput {
|
|
419
472
|
name: string;
|
|
@@ -483,6 +536,8 @@ interface SaveTransformRequest {
|
|
|
483
536
|
interface AuditListParams {
|
|
484
537
|
action?: string;
|
|
485
538
|
before?: number;
|
|
539
|
+
limit?: number;
|
|
540
|
+
admin?: string;
|
|
486
541
|
}
|
|
487
542
|
interface PaginatedResponse<T> {
|
|
488
543
|
items: T[];
|
|
@@ -613,6 +668,28 @@ declare class HeadroomAdminClient {
|
|
|
613
668
|
}>;
|
|
614
669
|
createTag(host: string, tag: string): Promise<void>;
|
|
615
670
|
deleteTag(host: string, tag: string): Promise<void>;
|
|
671
|
+
listSiteUsers(host: string, params?: {
|
|
672
|
+
cursor?: string;
|
|
673
|
+
limit?: number;
|
|
674
|
+
tag?: string;
|
|
675
|
+
}): Promise<PaginatedResponse<SiteUser>>;
|
|
676
|
+
getSiteUser(host: string, userId: string): Promise<SiteUser>;
|
|
677
|
+
createSiteUser(host: string, data: {
|
|
678
|
+
email: string;
|
|
679
|
+
name?: string;
|
|
680
|
+
tags?: string[];
|
|
681
|
+
fields?: Record<string, unknown>;
|
|
682
|
+
}): Promise<SiteUser>;
|
|
683
|
+
updateSiteUser(host: string, userId: string, data: {
|
|
684
|
+
name?: string;
|
|
685
|
+
status?: string;
|
|
686
|
+
tags?: string[];
|
|
687
|
+
fields?: Record<string, unknown>;
|
|
688
|
+
}): Promise<SiteUser>;
|
|
689
|
+
deleteSiteUser(host: string, userId: string): Promise<void>;
|
|
690
|
+
changeSiteUserEmail(host: string, userId: string, data: {
|
|
691
|
+
email: string;
|
|
692
|
+
}): Promise<SiteUser>;
|
|
616
693
|
listAuditEvents(host: string, params?: AuditListParams): Promise<PaginatedResponse<AuditEvent>>;
|
|
617
694
|
listUsers(): Promise<{
|
|
618
695
|
users: {
|
package/dist/node.d.ts
CHANGED
|
@@ -314,11 +314,17 @@ interface components {
|
|
|
314
314
|
pathItems: never;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
type Site = components["schemas"]["Site"]
|
|
317
|
+
type Site = components["schemas"]["Site"] & {
|
|
318
|
+
auth?: SiteAuthConfig;
|
|
319
|
+
};
|
|
318
320
|
type SiteAdmin = components["schemas"]["SiteAdmin"];
|
|
319
321
|
type Collection = components["schemas"]["Collection"] & {
|
|
320
322
|
relationships?: RelationshipDef[];
|
|
321
323
|
singletonContentId?: string;
|
|
324
|
+
mobileNavPriority?: number;
|
|
325
|
+
icon?: string;
|
|
326
|
+
mode?: string;
|
|
327
|
+
requireAuth?: boolean;
|
|
322
328
|
};
|
|
323
329
|
type FieldDefinition = components["schemas"]["FieldDef"];
|
|
324
330
|
type BlockType = components["schemas"]["BlockType"] & {
|
|
@@ -329,6 +335,14 @@ type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
|
329
335
|
relationships?: Record<string, ContentRef[]>;
|
|
330
336
|
scheduledAt?: number;
|
|
331
337
|
scheduledFailed?: boolean;
|
|
338
|
+
mode?: string;
|
|
339
|
+
siteUserId?: string;
|
|
340
|
+
siteUser?: {
|
|
341
|
+
userId: string;
|
|
342
|
+
name?: string;
|
|
343
|
+
email: string;
|
|
344
|
+
};
|
|
345
|
+
fields?: Record<string, unknown>;
|
|
332
346
|
};
|
|
333
347
|
type ContentDetail = components["schemas"]["ContentDetail"];
|
|
334
348
|
type SaveDraftResult = components["schemas"]["SaveDraftResult"];
|
|
@@ -337,7 +351,42 @@ type ApiKeyItem = components["schemas"]["APIKeyMetadata"];
|
|
|
337
351
|
type ApiKeyCreateResponse = components["schemas"]["APIKeyCreateResult"];
|
|
338
352
|
type Webhook = components["schemas"]["Webhook"];
|
|
339
353
|
type WebhookDelivery = components["schemas"]["WebhookDelivery"];
|
|
340
|
-
|
|
354
|
+
interface AuditDetails {
|
|
355
|
+
resourceType?: string;
|
|
356
|
+
resourceId?: string;
|
|
357
|
+
title?: string;
|
|
358
|
+
collection?: string;
|
|
359
|
+
blockId?: string;
|
|
360
|
+
prevBlockId?: string;
|
|
361
|
+
extra?: string;
|
|
362
|
+
}
|
|
363
|
+
type AuditEvent = Omit<components["schemas"]["AuditEvent"], "details"> & {
|
|
364
|
+
resourceType?: string;
|
|
365
|
+
resourceId?: string;
|
|
366
|
+
details?: AuditDetails;
|
|
367
|
+
};
|
|
368
|
+
interface SiteUser {
|
|
369
|
+
userId: string;
|
|
370
|
+
email: string;
|
|
371
|
+
status: "active" | "disabled";
|
|
372
|
+
name?: string;
|
|
373
|
+
tags?: string[];
|
|
374
|
+
fields?: Record<string, unknown>;
|
|
375
|
+
sessionVersion: number;
|
|
376
|
+
createdAt: number;
|
|
377
|
+
lastLogin?: number;
|
|
378
|
+
}
|
|
379
|
+
interface SiteAuthConfig {
|
|
380
|
+
enabled: boolean;
|
|
381
|
+
sessionTtl: number;
|
|
382
|
+
allowSignup: boolean;
|
|
383
|
+
otpRateLimit?: number;
|
|
384
|
+
fromName?: string;
|
|
385
|
+
emailSubject?: string;
|
|
386
|
+
emailBody?: string;
|
|
387
|
+
emailTextBody?: string;
|
|
388
|
+
userFields?: FieldDefinition[];
|
|
389
|
+
}
|
|
341
390
|
interface AdminMediaItem {
|
|
342
391
|
mediaId: string;
|
|
343
392
|
filename: string;
|
|
@@ -414,6 +463,10 @@ interface CollectionInput {
|
|
|
414
463
|
singleton?: boolean;
|
|
415
464
|
fields: FieldDefinition[];
|
|
416
465
|
relationships?: RelationshipDef[];
|
|
466
|
+
mobileNavPriority?: number;
|
|
467
|
+
icon?: string;
|
|
468
|
+
mode?: string;
|
|
469
|
+
requireAuth?: boolean;
|
|
417
470
|
}
|
|
418
471
|
interface BlockTypeInput {
|
|
419
472
|
name: string;
|
|
@@ -483,6 +536,8 @@ interface SaveTransformRequest {
|
|
|
483
536
|
interface AuditListParams {
|
|
484
537
|
action?: string;
|
|
485
538
|
before?: number;
|
|
539
|
+
limit?: number;
|
|
540
|
+
admin?: string;
|
|
486
541
|
}
|
|
487
542
|
interface PaginatedResponse<T> {
|
|
488
543
|
items: T[];
|
|
@@ -613,6 +668,28 @@ declare class HeadroomAdminClient {
|
|
|
613
668
|
}>;
|
|
614
669
|
createTag(host: string, tag: string): Promise<void>;
|
|
615
670
|
deleteTag(host: string, tag: string): Promise<void>;
|
|
671
|
+
listSiteUsers(host: string, params?: {
|
|
672
|
+
cursor?: string;
|
|
673
|
+
limit?: number;
|
|
674
|
+
tag?: string;
|
|
675
|
+
}): Promise<PaginatedResponse<SiteUser>>;
|
|
676
|
+
getSiteUser(host: string, userId: string): Promise<SiteUser>;
|
|
677
|
+
createSiteUser(host: string, data: {
|
|
678
|
+
email: string;
|
|
679
|
+
name?: string;
|
|
680
|
+
tags?: string[];
|
|
681
|
+
fields?: Record<string, unknown>;
|
|
682
|
+
}): Promise<SiteUser>;
|
|
683
|
+
updateSiteUser(host: string, userId: string, data: {
|
|
684
|
+
name?: string;
|
|
685
|
+
status?: string;
|
|
686
|
+
tags?: string[];
|
|
687
|
+
fields?: Record<string, unknown>;
|
|
688
|
+
}): Promise<SiteUser>;
|
|
689
|
+
deleteSiteUser(host: string, userId: string): Promise<void>;
|
|
690
|
+
changeSiteUserEmail(host: string, userId: string, data: {
|
|
691
|
+
email: string;
|
|
692
|
+
}): Promise<SiteUser>;
|
|
616
693
|
listAuditEvents(host: string, params?: AuditListParams): Promise<PaginatedResponse<AuditEvent>>;
|
|
617
694
|
listUsers(): Promise<{
|
|
618
695
|
users: {
|
package/dist/seed.d.cts
CHANGED
|
@@ -303,10 +303,16 @@ interface components {
|
|
|
303
303
|
pathItems: never;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
type Site = components["schemas"]["Site"]
|
|
306
|
+
type Site = components["schemas"]["Site"] & {
|
|
307
|
+
auth?: SiteAuthConfig;
|
|
308
|
+
};
|
|
307
309
|
type Collection = components["schemas"]["Collection"] & {
|
|
308
310
|
relationships?: RelationshipDef[];
|
|
309
311
|
singletonContentId?: string;
|
|
312
|
+
mobileNavPriority?: number;
|
|
313
|
+
icon?: string;
|
|
314
|
+
mode?: string;
|
|
315
|
+
requireAuth?: boolean;
|
|
310
316
|
};
|
|
311
317
|
type FieldDefinition = components["schemas"]["FieldDef"];
|
|
312
318
|
type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
@@ -314,10 +320,29 @@ type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
|
314
320
|
relationships?: Record<string, ContentRef[]>;
|
|
315
321
|
scheduledAt?: number;
|
|
316
322
|
scheduledFailed?: boolean;
|
|
323
|
+
mode?: string;
|
|
324
|
+
siteUserId?: string;
|
|
325
|
+
siteUser?: {
|
|
326
|
+
userId: string;
|
|
327
|
+
name?: string;
|
|
328
|
+
email: string;
|
|
329
|
+
};
|
|
330
|
+
fields?: Record<string, unknown>;
|
|
317
331
|
};
|
|
318
332
|
type SaveDraftResult = components["schemas"]["SaveDraftResult"];
|
|
319
333
|
type ApiKeyItem = components["schemas"]["APIKeyMetadata"];
|
|
320
334
|
type ApiKeyCreateResponse = components["schemas"]["APIKeyCreateResult"];
|
|
335
|
+
interface SiteAuthConfig {
|
|
336
|
+
enabled: boolean;
|
|
337
|
+
sessionTtl: number;
|
|
338
|
+
allowSignup: boolean;
|
|
339
|
+
otpRateLimit?: number;
|
|
340
|
+
fromName?: string;
|
|
341
|
+
emailSubject?: string;
|
|
342
|
+
emailBody?: string;
|
|
343
|
+
emailTextBody?: string;
|
|
344
|
+
userFields?: FieldDefinition[];
|
|
345
|
+
}
|
|
321
346
|
interface AdminMediaItem {
|
|
322
347
|
mediaId: string;
|
|
323
348
|
filename: string;
|
|
@@ -354,6 +379,10 @@ interface CollectionInput {
|
|
|
354
379
|
singleton?: boolean;
|
|
355
380
|
fields: FieldDefinition[];
|
|
356
381
|
relationships?: RelationshipDef[];
|
|
382
|
+
mobileNavPriority?: number;
|
|
383
|
+
icon?: string;
|
|
384
|
+
mode?: string;
|
|
385
|
+
requireAuth?: boolean;
|
|
357
386
|
}
|
|
358
387
|
interface SaveDraftParams {
|
|
359
388
|
title?: string;
|
package/dist/seed.d.ts
CHANGED
|
@@ -303,10 +303,16 @@ interface components {
|
|
|
303
303
|
pathItems: never;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
type Site = components["schemas"]["Site"]
|
|
306
|
+
type Site = components["schemas"]["Site"] & {
|
|
307
|
+
auth?: SiteAuthConfig;
|
|
308
|
+
};
|
|
307
309
|
type Collection = components["schemas"]["Collection"] & {
|
|
308
310
|
relationships?: RelationshipDef[];
|
|
309
311
|
singletonContentId?: string;
|
|
312
|
+
mobileNavPriority?: number;
|
|
313
|
+
icon?: string;
|
|
314
|
+
mode?: string;
|
|
315
|
+
requireAuth?: boolean;
|
|
310
316
|
};
|
|
311
317
|
type FieldDefinition = components["schemas"]["FieldDef"];
|
|
312
318
|
type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
@@ -314,10 +320,29 @@ type ContentItem = components["schemas"]["ContentMetadata"] & {
|
|
|
314
320
|
relationships?: Record<string, ContentRef[]>;
|
|
315
321
|
scheduledAt?: number;
|
|
316
322
|
scheduledFailed?: boolean;
|
|
323
|
+
mode?: string;
|
|
324
|
+
siteUserId?: string;
|
|
325
|
+
siteUser?: {
|
|
326
|
+
userId: string;
|
|
327
|
+
name?: string;
|
|
328
|
+
email: string;
|
|
329
|
+
};
|
|
330
|
+
fields?: Record<string, unknown>;
|
|
317
331
|
};
|
|
318
332
|
type SaveDraftResult = components["schemas"]["SaveDraftResult"];
|
|
319
333
|
type ApiKeyItem = components["schemas"]["APIKeyMetadata"];
|
|
320
334
|
type ApiKeyCreateResponse = components["schemas"]["APIKeyCreateResult"];
|
|
335
|
+
interface SiteAuthConfig {
|
|
336
|
+
enabled: boolean;
|
|
337
|
+
sessionTtl: number;
|
|
338
|
+
allowSignup: boolean;
|
|
339
|
+
otpRateLimit?: number;
|
|
340
|
+
fromName?: string;
|
|
341
|
+
emailSubject?: string;
|
|
342
|
+
emailBody?: string;
|
|
343
|
+
emailTextBody?: string;
|
|
344
|
+
userFields?: FieldDefinition[];
|
|
345
|
+
}
|
|
321
346
|
interface AdminMediaItem {
|
|
322
347
|
mediaId: string;
|
|
323
348
|
filename: string;
|
|
@@ -354,6 +379,10 @@ interface CollectionInput {
|
|
|
354
379
|
singleton?: boolean;
|
|
355
380
|
fields: FieldDefinition[];
|
|
356
381
|
relationships?: RelationshipDef[];
|
|
382
|
+
mobileNavPriority?: number;
|
|
383
|
+
icon?: string;
|
|
384
|
+
mode?: string;
|
|
385
|
+
requireAuth?: boolean;
|
|
357
386
|
}
|
|
358
387
|
interface SaveDraftParams {
|
|
359
388
|
title?: string;
|