@buildinternet/releases-api-types 0.20.0 → 0.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/releases-api-types",
3
- "version": "0.20.0",
3
+ "version": "0.21.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
@@ -60,6 +60,7 @@ import type {
60
60
  SourceListResponseSchema,
61
61
  SourceListResultSchema,
62
62
  SourceDetailSchema,
63
+ SourceFeedPaginationSchema,
63
64
  SourceMutationResponseSchema,
64
65
  SourceOrgRefSchema,
65
66
  SourcePatchInputSchema,
@@ -268,6 +269,7 @@ export {
268
269
  SourceListResponseSchema,
269
270
  SourceListResultSchema,
270
271
  SourceDetailSchema,
272
+ SourceFeedPaginationSchema,
271
273
  SourceMutationResponseSchema,
272
274
  SourceOrgRefSchema,
273
275
  SourcePatchInputSchema,
@@ -508,6 +510,7 @@ export type CreateSourceBody = z.infer<typeof CreateSourceBodySchema>;
508
510
  export type ChangelogFileSummary = z.infer<typeof ChangelogFileSummarySchema>;
509
511
  export type SourceChangelogResponse = z.infer<typeof SourceChangelogResponseSchema>;
510
512
  export type SourceDetail = z.infer<typeof SourceDetailSchema>;
513
+ export type SourceFeedPagination = z.infer<typeof SourceFeedPaginationSchema>;
511
514
  export type SourceMutationResponse = z.infer<typeof SourceMutationResponseSchema>;
512
515
  export type SourceOrgRef = z.infer<typeof SourceOrgRefSchema>;
513
516
  export type SourceActivityResponse = z.infer<typeof SourceActivityResponseSchema>;
@@ -3,6 +3,7 @@ import {
3
3
  CategorySchema,
4
4
  ListResponseSchema,
5
5
  OverviewPageItemSchema,
6
+ PaginationSchema,
6
7
  ReleaseItemSchema,
7
8
  } from "./shared.js";
8
9
  import { SourceListItemSchema } from "./sources.js";
@@ -25,7 +26,28 @@ export const OrgListItemSchema = z.object({
25
26
  sparkline: z.array(z.number().int().min(0)).length(30),
26
27
  });
27
28
 
28
- export const OrgListResponseSchema = ListResponseSchema(OrgListItemSchema);
29
+ /**
30
+ * Per-request side-channel for the orgs list (#746). `emptyOrgCount` is the
31
+ * number of orgs that match the same `q` filter but have zero indexed
32
+ * releases — used to label a "Show empty orgs" toggle without a second
33
+ * round-trip. The value is scoped by the search term but independent of
34
+ * `?includeEmpty=` so the toggle CTA can render a count whether the current
35
+ * response included empty orgs or not.
36
+ */
37
+ export const OrgListMetaSchema = z.object({
38
+ emptyOrgCount: z.number().int().min(0),
39
+ });
40
+
41
+ /**
42
+ * `meta` is optional on the wire so older workers / pinned clients mid-deploy
43
+ * don't trip the schema check. New clients can treat missing as
44
+ * `emptyOrgCount: 0` (the toggle just won't render a count).
45
+ */
46
+ export const OrgListResponseSchema = z.object({
47
+ items: z.array(OrgListItemSchema),
48
+ pagination: PaginationSchema,
49
+ meta: OrgListMetaSchema.optional(),
50
+ });
29
51
 
30
52
  export const OrgAccountItemSchema = z.object({
31
53
  platform: z.string(),
@@ -4,12 +4,7 @@ import {
4
4
  SOURCE_DISCOVERY,
5
5
  SOURCE_FETCH_PRIORITIES,
6
6
  } from "@buildinternet/releases-core/source-enums";
7
- import {
8
- ListResponseSchema,
9
- PaginationSchema,
10
- ReleaseItemSchema,
11
- ReleaseSummaryItemSchema,
12
- } from "./shared.js";
7
+ import { ListResponseSchema, ReleaseItemSchema, ReleaseSummaryItemSchema } from "./shared.js";
13
8
 
14
9
  export const SourceTypeSchema = z.enum(SOURCE_TYPES);
15
10
  export const SourceDiscoverySchema = z.enum(SOURCE_DISCOVERY);
@@ -105,6 +100,17 @@ const SourceDetailSummariesSchema = z.object({
105
100
  monthly: z.array(ReleaseSummaryItemSchema),
106
101
  });
107
102
 
103
+ /**
104
+ * Cursor pagination shape for the source detail's embedded release feed.
105
+ * Mirrors `OrgFeedPaginationSchema` and `CollectionFeedPaginationSchema` —
106
+ * release lists are feed-shaped (append-only, mutates between calls), so they
107
+ * use cursor pagination per the AGENTS.md convention.
108
+ */
109
+ export const SourceFeedPaginationSchema = z.object({
110
+ nextCursor: z.string().nullable(),
111
+ limit: z.number().int().min(1),
112
+ });
113
+
108
114
  /**
109
115
  * Resolved attribution block returned alongside a source row. `id` is
110
116
  * additive vs the legacy `{ slug, name }` shape — older clients that ignored
@@ -149,7 +155,7 @@ export const SourceDetailSchema = z.object({
149
155
  lastPolledAt: z.string().nullable(),
150
156
  trackingSince: z.string(),
151
157
  releases: z.array(ReleaseItemSchema),
152
- pagination: PaginationSchema,
158
+ pagination: SourceFeedPaginationSchema,
153
159
  summaries: SourceDetailSummariesSchema,
154
160
  });
155
161