@buildinternet/releases-api-types 0.5.0 → 0.7.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 +6 -5
- package/package.json +1 -1
- package/src/api-types.ts +145 -2
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 {
|
|
18
|
+
import type { OrgListResponse } from "@buildinternet/releases-api-types";
|
|
19
19
|
|
|
20
|
-
async function listOrgs(): Promise<
|
|
20
|
+
async function listOrgs(): Promise<OrgListResponse> {
|
|
21
21
|
const res = await fetch("https://api.releases.sh/v1/orgs");
|
|
22
|
-
|
|
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
|
-
|
|
27
|
-
`@buildinternet/releases-core/cli-contracts
|
|
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
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:
|
|
93
|
+
accounts: OrgAccountItem[];
|
|
68
94
|
products: Array<{
|
|
69
95
|
id: string;
|
|
70
96
|
slug: string;
|
|
@@ -238,13 +264,40 @@ export interface SourceDetail {
|
|
|
238
264
|
lastPolledAt: string | null;
|
|
239
265
|
trackingSince: string;
|
|
240
266
|
releases: ReleaseItem[];
|
|
241
|
-
pagination:
|
|
267
|
+
pagination: Pagination;
|
|
242
268
|
summaries: {
|
|
243
269
|
rolling: ReleaseSummaryItem | null;
|
|
244
270
|
monthly: ReleaseSummaryItem[];
|
|
245
271
|
};
|
|
246
272
|
}
|
|
247
273
|
|
|
274
|
+
// ── Admin telemetry: orgs rollup ──
|
|
275
|
+
|
|
276
|
+
export interface OrgsRollupRow {
|
|
277
|
+
/** Org slug, or "—" for sources without an org. */
|
|
278
|
+
orgSlug: string;
|
|
279
|
+
sourceCount: number;
|
|
280
|
+
/** Sources with no release on file or `latestDate` older than `staleDays`. */
|
|
281
|
+
staleCount: number;
|
|
282
|
+
/** Most-recent release across all of the org's sources, or null. */
|
|
283
|
+
mostRecentRelease: string | null;
|
|
284
|
+
mostRecentAgeDays: number | null;
|
|
285
|
+
/** True iff every source in the org is stale (and the org has at least one source). */
|
|
286
|
+
allStale: boolean;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface OrgsRollupResponse extends ListResponse<OrgsRollupRow> {
|
|
290
|
+
meta: {
|
|
291
|
+
/** Stale cutoff used server-side, in days. */
|
|
292
|
+
staleDays: number;
|
|
293
|
+
totalOrgs: number;
|
|
294
|
+
/** Orgs where every source is stale. */
|
|
295
|
+
dormantOrgs: number;
|
|
296
|
+
/** Orgs with at least one stale source. */
|
|
297
|
+
anyStaleOrgs: number;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
248
301
|
// ── Releases ──
|
|
249
302
|
|
|
250
303
|
/**
|
|
@@ -520,6 +573,51 @@ export interface OverviewPageItem {
|
|
|
520
573
|
/** @deprecated Use OverviewPageItem */
|
|
521
574
|
export type KnowledgePageItem = OverviewPageItem;
|
|
522
575
|
|
|
576
|
+
// ── Overview Manifest (admin planning) ──
|
|
577
|
+
|
|
578
|
+
export type OverviewStaleness = "missing" | "behind" | "fresh";
|
|
579
|
+
export type OverviewPlanAction = "missing" | "refresh" | "skip";
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Per-org row returned by GET /v1/admin/overviews. Designed for orchestrators
|
|
583
|
+
* planning a maintenance sweep — `releasesSinceOverview` is the freshness
|
|
584
|
+
* signal that matters, not date diff alone.
|
|
585
|
+
*/
|
|
586
|
+
export interface OverviewManifestRow {
|
|
587
|
+
orgSlug: string;
|
|
588
|
+
orgName: string;
|
|
589
|
+
discovery: "curated" | "agent" | "on_demand";
|
|
590
|
+
overviewUpdatedAt: string | null;
|
|
591
|
+
overviewGeneratedAt: string | null;
|
|
592
|
+
lastContributingReleaseAt: string | null;
|
|
593
|
+
orgLastActivity: string | null;
|
|
594
|
+
releasesSinceOverview: number;
|
|
595
|
+
recentReleaseCount: number;
|
|
596
|
+
staleness: OverviewStaleness;
|
|
597
|
+
/** Only populated when ?format=plan. */
|
|
598
|
+
action?: OverviewPlanAction;
|
|
599
|
+
/** Only populated when ?format=plan. */
|
|
600
|
+
needsFetch?: boolean;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export type OverviewManifestResponse = ListResponse<OverviewManifestRow>;
|
|
604
|
+
|
|
605
|
+
// ── Overview inputs (?check=true) ──
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Lightweight pre-flight payload returned by GET /v1/orgs/:slug/overview/inputs?check=true.
|
|
609
|
+
* Skips the heavy release-content hydration so an orchestrator can decide whether
|
|
610
|
+
* to dispatch without paying for the full payload.
|
|
611
|
+
*/
|
|
612
|
+
export interface OverviewInputsCheck {
|
|
613
|
+
orgSlug: string;
|
|
614
|
+
selected: number;
|
|
615
|
+
totalAvailable: number;
|
|
616
|
+
hasExistingContent: boolean;
|
|
617
|
+
wouldRegenerate: boolean;
|
|
618
|
+
windowDays: number;
|
|
619
|
+
}
|
|
620
|
+
|
|
523
621
|
/** @deprecated Use UnifiedSearchResponse */
|
|
524
622
|
export type SearchResult = SearchReleaseHit;
|
|
525
623
|
/** @deprecated Use UnifiedSearchResponse */
|
|
@@ -614,6 +712,8 @@ export interface ProductListItem {
|
|
|
614
712
|
sourceCount: number;
|
|
615
713
|
}
|
|
616
714
|
|
|
715
|
+
export type ProductListResponse = ListResponse<ProductListItem>;
|
|
716
|
+
|
|
617
717
|
export interface ProductDetail {
|
|
618
718
|
id: string;
|
|
619
719
|
name: string;
|
|
@@ -799,6 +899,29 @@ export interface Session {
|
|
|
799
899
|
cancelRequested?: boolean;
|
|
800
900
|
}
|
|
801
901
|
|
|
902
|
+
export type SessionListResponse = ListResponse<Session>;
|
|
903
|
+
|
|
904
|
+
// ── Admin URL Lists ──
|
|
905
|
+
|
|
906
|
+
export interface IgnoredUrlItem {
|
|
907
|
+
id: string;
|
|
908
|
+
url: string;
|
|
909
|
+
orgId: string;
|
|
910
|
+
reason: string | null;
|
|
911
|
+
ignoredAt: string;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
export interface BlockedUrlItem {
|
|
915
|
+
id: string;
|
|
916
|
+
pattern: string;
|
|
917
|
+
type: "exact" | "domain";
|
|
918
|
+
reason: string | null;
|
|
919
|
+
createdAt: string;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export type IgnoredUrlListResponse = ListResponse<IgnoredUrlItem>;
|
|
923
|
+
export type BlockedUrlListResponse = ListResponse<BlockedUrlItem>;
|
|
924
|
+
|
|
802
925
|
// ── Embed (admin) ──
|
|
803
926
|
|
|
804
927
|
export interface EmbedBackfillResponse {
|
|
@@ -843,3 +966,23 @@ export interface EmbedStatusResponse {
|
|
|
843
966
|
};
|
|
844
967
|
chunks: { total: number; embedded: number; unembedded: number };
|
|
845
968
|
}
|
|
969
|
+
|
|
970
|
+
// ── Evaluate (URL recommendation) ──
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Returned verbatim by GET /v1/evaluate. Lives in the public api-types package
|
|
974
|
+
* so external consumers (CLI, third-party clients) can import the shape
|
|
975
|
+
* without depending on worker-internal AI helpers.
|
|
976
|
+
*/
|
|
977
|
+
export interface EvaluationResult {
|
|
978
|
+
recommendedMethod: "feed" | "github" | "markdown" | "scrape" | "crawl";
|
|
979
|
+
recommendedUrl: string;
|
|
980
|
+
feedUrl?: string;
|
|
981
|
+
feedType?: "rss" | "atom" | "jsonfeed";
|
|
982
|
+
githubRepo?: string;
|
|
983
|
+
pageStructure: "single-page" | "index" | "unknown";
|
|
984
|
+
alternatives: Array<{ url: string; method: string; note: string }>;
|
|
985
|
+
confidence: "high" | "medium" | "low";
|
|
986
|
+
provider?: string;
|
|
987
|
+
notes?: string;
|
|
988
|
+
}
|