@buildinternet/releases-api-types 0.4.0 → 0.6.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/README.md CHANGED
@@ -15,16 +15,17 @@ npm install @buildinternet/releases-api-types
15
15
  ## Usage
16
16
 
17
17
  ```ts
18
- import type { OrgListItem } from "@buildinternet/releases-api-types";
18
+ import type { OrgListResponse } from "@buildinternet/releases-api-types";
19
19
 
20
- async function listOrgs(): Promise<OrgListItem[]> {
20
+ async function listOrgs(): Promise<OrgListResponse> {
21
21
  const res = await fetch("https://api.releases.sh/v1/orgs");
22
- return (await res.json()) as OrgListItem[];
22
+ if (!res.ok) throw new Error(`API error: ${res.status}`);
23
+ return (await res.json()) as OrgListResponse;
23
24
  }
24
25
  ```
25
26
 
26
- Some list endpoints wrap results in a `ListResponse<T>` envelope (`{ items, pagination }`) — that contract lives in
27
- `@buildinternet/releases-core/cli-contracts`. Check the route docs at [releases.sh/docs/api](https://releases.sh/docs/api) for the exact shape per endpoint.
27
+ Paginated list endpoints return a `ListResponse<T>` envelope (`{ items, pagination }`). The shared pagination semantics also live in
28
+ `@buildinternet/releases-core/cli-contracts` for CLI callers.
28
29
 
29
30
  ## Versioning
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/releases-api-types",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Wire protocol — request/response types for the Releases registry API. Shared by web, workers, and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/api-types.ts CHANGED
@@ -23,6 +23,22 @@ export interface Stats {
23
23
  products: number;
24
24
  }
25
25
 
26
+ // ── Pagination ──
27
+
28
+ export interface Pagination {
29
+ page: number;
30
+ pageSize: number;
31
+ returned: number;
32
+ totalItems?: number;
33
+ totalPages?: number;
34
+ hasMore: boolean;
35
+ }
36
+
37
+ export interface ListResponse<T> {
38
+ items: T[];
39
+ pagination: Pagination;
40
+ }
41
+
26
42
  // ── Sitemap (bulk URL emission) ──
27
43
 
28
44
  export interface SitemapPayload {
@@ -47,6 +63,16 @@ export interface OrgListItem {
47
63
  sparkline: number[];
48
64
  }
49
65
 
66
+ export type OrgListResponse = ListResponse<OrgListItem>;
67
+
68
+ export interface OrgAccountItem {
69
+ platform: string;
70
+ handle: string;
71
+ }
72
+
73
+ export type OrgAccountsResponse = ListResponse<OrgAccountItem>;
74
+ export type OrgTagsResponse = ListResponse<string>;
75
+
50
76
  export interface OrgDetail {
51
77
  id?: string;
52
78
  slug: string;
@@ -64,7 +90,7 @@ export interface OrgDetail {
64
90
  lastPolledAt: string | null;
65
91
  trackingSince: string;
66
92
  aliases?: string[];
67
- accounts: { platform: string; handle: string }[];
93
+ accounts: OrgAccountItem[];
68
94
  products: Array<{
69
95
  id: string;
70
96
  slug: string;
@@ -520,6 +546,51 @@ export interface OverviewPageItem {
520
546
  /** @deprecated Use OverviewPageItem */
521
547
  export type KnowledgePageItem = OverviewPageItem;
522
548
 
549
+ // ── Overview Manifest (admin planning) ──
550
+
551
+ export type OverviewStaleness = "missing" | "behind" | "fresh";
552
+ export type OverviewPlanAction = "missing" | "refresh" | "skip";
553
+
554
+ /**
555
+ * Per-org row returned by GET /v1/admin/overviews. Designed for orchestrators
556
+ * planning a maintenance sweep — `releasesSinceOverview` is the freshness
557
+ * signal that matters, not date diff alone.
558
+ */
559
+ export interface OverviewManifestRow {
560
+ orgSlug: string;
561
+ orgName: string;
562
+ discovery: "curated" | "agent" | "on_demand";
563
+ overviewUpdatedAt: string | null;
564
+ overviewGeneratedAt: string | null;
565
+ lastContributingReleaseAt: string | null;
566
+ orgLastActivity: string | null;
567
+ releasesSinceOverview: number;
568
+ recentReleaseCount: number;
569
+ staleness: OverviewStaleness;
570
+ /** Only populated when ?format=plan. */
571
+ action?: OverviewPlanAction;
572
+ /** Only populated when ?format=plan. */
573
+ needsFetch?: boolean;
574
+ }
575
+
576
+ export type OverviewManifestResponse = ListResponse<OverviewManifestRow>;
577
+
578
+ // ── Overview inputs (?check=true) ──
579
+
580
+ /**
581
+ * Lightweight pre-flight payload returned by GET /v1/orgs/:slug/overview/inputs?check=true.
582
+ * Skips the heavy release-content hydration so an orchestrator can decide whether
583
+ * to dispatch without paying for the full payload.
584
+ */
585
+ export interface OverviewInputsCheck {
586
+ orgSlug: string;
587
+ selected: number;
588
+ totalAvailable: number;
589
+ hasExistingContent: boolean;
590
+ wouldRegenerate: boolean;
591
+ windowDays: number;
592
+ }
593
+
523
594
  /** @deprecated Use UnifiedSearchResponse */
524
595
  export type SearchResult = SearchReleaseHit;
525
596
  /** @deprecated Use UnifiedSearchResponse */
@@ -614,6 +685,8 @@ export interface ProductListItem {
614
685
  sourceCount: number;
615
686
  }
616
687
 
688
+ export type ProductListResponse = ListResponse<ProductListItem>;
689
+
617
690
  export interface ProductDetail {
618
691
  id: string;
619
692
  name: string;
@@ -799,6 +872,29 @@ export interface Session {
799
872
  cancelRequested?: boolean;
800
873
  }
801
874
 
875
+ export type SessionListResponse = ListResponse<Session>;
876
+
877
+ // ── Admin URL Lists ──
878
+
879
+ export interface IgnoredUrlItem {
880
+ id: string;
881
+ url: string;
882
+ orgId: string;
883
+ reason: string | null;
884
+ ignoredAt: string;
885
+ }
886
+
887
+ export interface BlockedUrlItem {
888
+ id: string;
889
+ pattern: string;
890
+ type: "exact" | "domain";
891
+ reason: string | null;
892
+ createdAt: string;
893
+ }
894
+
895
+ export type IgnoredUrlListResponse = ListResponse<IgnoredUrlItem>;
896
+ export type BlockedUrlListResponse = ListResponse<BlockedUrlItem>;
897
+
802
898
  // ── Embed (admin) ──
803
899
 
804
900
  export interface EmbedBackfillResponse {
@@ -809,6 +905,26 @@ export interface EmbedBackfillResponse {
809
905
  dryRun?: boolean;
810
906
  }
811
907
 
908
+ /**
909
+ * Cascade-scope preview returned by `GET /v1/admin/orgs/:slug/dependents`.
910
+ * Backs the confirmation prompt in CLI/web before a hard-delete on an org —
911
+ * post-#690 Phase C, hard-deleting an org cascades into every source row
912
+ * tied to it and every per-source dependent table listed below.
913
+ */
914
+ export interface OrgDependentsResponse {
915
+ org: { id: string; slug: string; name: string };
916
+ counts: {
917
+ sources: number;
918
+ releases: number;
919
+ fetchLog: number;
920
+ sourceChangelogFiles: number;
921
+ sourceChangelogChunks: number;
922
+ releaseSummaries: number;
923
+ mediaAssets: number;
924
+ webhookSubscriptions: number;
925
+ };
926
+ }
927
+
812
928
  export interface EmbedStatusResponse {
813
929
  releases: { total: number; embedded: number; unembedded: number };
814
930
  entities: {