@buildinternet/releases-api-types 0.2.0 → 0.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api-types.ts +103 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/releases-api-types",
3
- "version": "0.2.0",
3
+ "version": "0.4.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
@@ -92,6 +92,12 @@ export interface SourceListItem {
92
92
  latestAddedAt?: string | null;
93
93
  isPrimary?: boolean;
94
94
  isHidden?: boolean;
95
+ /**
96
+ * How the row was created. Optional on the wire so older API responses
97
+ * (mid-deploy or pinned old workers) degrade gracefully — consumers that
98
+ * see `undefined` should treat it as `"curated"`.
99
+ */
100
+ discovery?: "curated" | "agent" | "on_demand";
95
101
  fetchPriority?: "normal" | "low" | "paused" | null;
96
102
  lastFetchedAt?: string | null;
97
103
  lastPolledAt?: string | null;
@@ -123,6 +129,7 @@ export interface SourceWithOrg {
123
129
  productSlug: string | null;
124
130
  isPrimary: boolean;
125
131
  isHidden: boolean | null;
132
+ discovery?: "curated" | "agent" | "on_demand";
126
133
  metadata: string | null;
127
134
  releaseCount: number;
128
135
  latestVersion: string | null;
@@ -207,6 +214,18 @@ export interface SourceDetail {
207
214
  name: string;
208
215
  type: string;
209
216
  url: string;
217
+ /**
218
+ * Hidden sources are reachable by direct URL but excluded from listings,
219
+ * sitemap, and AI features. Set on on-demand lookups and admin-suppressed
220
+ * rows; absent on canonical curated/agent sources.
221
+ */
222
+ isHidden?: boolean;
223
+ /**
224
+ * Pairs with `isHidden` to distinguish admin-suppressed rows (`curated` /
225
+ * `agent` + hidden) from rows materialized by `/v1/lookups` (`on_demand`).
226
+ * Optional for graceful degradation against older API responses.
227
+ */
228
+ discovery?: "curated" | "agent" | "on_demand";
210
229
  changelogUrl?: string | null;
211
230
  hasChangelogFile?: boolean;
212
231
  org: { slug: string; name: string } | null;
@@ -228,6 +247,13 @@ export interface SourceDetail {
228
247
 
229
248
  // ── Releases ──
230
249
 
250
+ /**
251
+ * Release type — mirrors `RELEASE_TYPES` in `@buildinternet/releases-core/schema`.
252
+ * Optional on the wire so older API responses (mid-deploy or pinned old workers)
253
+ * degrade gracefully — consumers that see `undefined` should treat it as `"feature"`.
254
+ */
255
+ export type ReleaseType = "feature" | "rollup";
256
+
231
257
  export interface ReleaseItem {
232
258
  id?: string;
233
259
  version: string | null;
@@ -237,6 +263,8 @@ export interface ReleaseItem {
237
263
  publishedAt: string | null;
238
264
  url: string | null;
239
265
  media?: MediaItem[];
266
+ /** Release type. See {@link ReleaseType}. */
267
+ type?: ReleaseType;
240
268
  }
241
269
 
242
270
  export interface ReleaseDetail {
@@ -254,6 +282,8 @@ export interface ReleaseDetail {
254
282
  sourceSlug: string;
255
283
  sourceType: string;
256
284
  org: { slug: string; name: string } | null;
285
+ /** Release type. See {@link ReleaseType}. */
286
+ type?: ReleaseType;
257
287
  }
258
288
 
259
289
  export interface ReleaseCoverageRow {
@@ -391,6 +421,8 @@ export interface SearchReleaseHit {
391
421
  * use this to interleave release and chunk hits into a single ranked list.
392
422
  */
393
423
  score?: number;
424
+ /** Release type. See {@link ReleaseType}. */
425
+ type?: ReleaseType;
394
426
  }
395
427
 
396
428
  /**
@@ -412,6 +444,42 @@ export interface SearchChunkHit {
412
444
  score: number;
413
445
  }
414
446
 
447
+ // ── Lookup (on-demand GitHub index) ──
448
+
449
+ export type LookupStatus = "indexed" | "existing" | "empty" | "not_found" | "deferred";
450
+
451
+ /**
452
+ * Slim wire payload embedded in a search response when the query is a GitHub
453
+ * coordinate (org/repo) and no existing entity matched. The server performs an
454
+ * on-demand lookup and includes the result here so the client can surface a
455
+ * "just indexed" or "not found" rail without a second round trip.
456
+ */
457
+ export interface LookupResultPayload {
458
+ status: LookupStatus;
459
+ source?: {
460
+ id: string;
461
+ slug: string;
462
+ name: string;
463
+ url: string;
464
+ discovery: "curated" | "agent" | "on_demand";
465
+ };
466
+ releases?: Array<{
467
+ id: string;
468
+ version: string | null;
469
+ title: string;
470
+ publishedAt: string | null;
471
+ }>;
472
+ /**
473
+ * Unambiguous "did you mean" rail: the curated org that owns GitHub repos
474
+ * under the same org segment, plus its top sources. Null when the org
475
+ * segment matches multiple curated orgs or none.
476
+ */
477
+ relatedOrg: {
478
+ org: { id: string; slug: string; name: string };
479
+ sources: Array<{ id: string; slug: string; name: string; url: string }>;
480
+ } | null;
481
+ }
482
+
415
483
  export interface UnifiedSearchResponse {
416
484
  query: string;
417
485
  orgs: SearchOrgHit[];
@@ -429,6 +497,11 @@ export interface UnifiedSearchResponse {
429
497
  degraded?: boolean;
430
498
  /** Human-readable reason for degradation (e.g., missing Vectorize binding). */
431
499
  degradedReason?: string;
500
+ /**
501
+ * On-demand lookup result. Present when the query parsed as a GitHub
502
+ * `org/repo` coordinate and no existing entities matched. Null otherwise.
503
+ */
504
+ lookup?: LookupResultPayload | null;
432
505
  }
433
506
 
434
507
  // ── Overview Pages ──
@@ -561,6 +634,36 @@ export interface ProductAdoptResult {
561
634
  sourceOrgDeleted: string;
562
635
  }
563
636
 
637
+ // ── Taxonomy (categories + tags) ──
638
+
639
+ export interface TaxonomyOrg {
640
+ slug: string;
641
+ name: string;
642
+ domain: string | null;
643
+ avatarUrl: string | null;
644
+ }
645
+
646
+ export interface TaxonomyProduct {
647
+ slug: string;
648
+ name: string;
649
+ description: string | null;
650
+ orgSlug: string;
651
+ orgName: string;
652
+ }
653
+
654
+ export interface CategoryDetail {
655
+ slug: string;
656
+ orgs: TaxonomyOrg[];
657
+ products: TaxonomyProduct[];
658
+ }
659
+
660
+ export interface TagDetail {
661
+ slug: string;
662
+ name: string;
663
+ orgs: TaxonomyOrg[];
664
+ products: TaxonomyProduct[];
665
+ }
666
+
564
667
  // ── Releases (enriched) ──
565
668
 
566
669
  /** Flat release shape returned by GET /v1/releases/:id with source metadata. */