@buildinternet/releases-api-types 0.54.0 → 0.56.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 +2 -0
- package/package.json +2 -2
- package/src/api-types.ts +13 -1
- package/src/schemas/collections.ts +8 -1
- package/src/schemas/publish-tokens.ts +51 -0
- package/src/schemas/search.ts +1 -1
- package/src/schemas/taxonomy.ts +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @buildinternet/releases-api-types
|
|
2
2
|
|
|
3
|
+
**Scope:** request/response wire types for the public API worker — types only, zero runtime dependencies. No request logic, no client code, no server handlers.
|
|
4
|
+
|
|
3
5
|
Wire protocol types for the [Releases](https://releases.sh) registry API.
|
|
4
6
|
|
|
5
7
|
Pure TypeScript types — zero runtime dependencies — describing request/response
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildinternet/releases-api-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.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",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@buildinternet/releases-core": "^0.
|
|
20
|
+
"@buildinternet/releases-core": "^0.32.0",
|
|
21
21
|
"zod": "^4.4.3"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
package/src/api-types.ts
CHANGED
|
@@ -433,6 +433,18 @@ export {
|
|
|
433
433
|
type ListingPromoteResult,
|
|
434
434
|
type ListingCapabilities,
|
|
435
435
|
} from "./schemas/listing.js";
|
|
436
|
+
export {
|
|
437
|
+
CreatePublishTokenBodySchema,
|
|
438
|
+
CreatedPublishTokenSchema,
|
|
439
|
+
PublishTokenSchema,
|
|
440
|
+
ListPublishTokensResponseSchema,
|
|
441
|
+
RevokePublishTokenResponseSchema,
|
|
442
|
+
type CreatePublishTokenBody,
|
|
443
|
+
type CreatedPublishToken,
|
|
444
|
+
type PublishToken,
|
|
445
|
+
type ListPublishTokensResponse,
|
|
446
|
+
type RevokePublishTokenResponse,
|
|
447
|
+
} from "./schemas/publish-tokens.js";
|
|
436
448
|
export {
|
|
437
449
|
SourceListItemSchema,
|
|
438
450
|
SourceWithOrgSchema,
|
|
@@ -1770,7 +1782,7 @@ export type TagDetail = z.infer<typeof TagDetailSchema>;
|
|
|
1770
1782
|
/**
|
|
1771
1783
|
* Aggregated release feed row for a category rollup — same wire shape as
|
|
1772
1784
|
* `CollectionReleaseItem` (both surfaces use `formatAggregateReleaseRow` in
|
|
1773
|
-
* `
|
|
1785
|
+
* `apps/api/src/utils.ts`). Aliased rather than duplicated so renderers
|
|
1774
1786
|
* can treat them as one.
|
|
1775
1787
|
*/
|
|
1776
1788
|
export type CategoryReleaseItem = CollectionReleaseItem;
|
|
@@ -302,9 +302,16 @@ export const DigestSectionSchema = z.object({
|
|
|
302
302
|
lede: z.string(),
|
|
303
303
|
/** Cited release ids in first-seen order; resolve against the detail's `releases`. */
|
|
304
304
|
releaseIds: z.array(z.string()),
|
|
305
|
+
/**
|
|
306
|
+
* The section's cited releases, resolved server-side in `releaseIds` order.
|
|
307
|
+
* Ids that no longer resolve are dropped, so `releases.length` can be less
|
|
308
|
+
* than `releaseIds.length`. Optional for older servers.
|
|
309
|
+
*/
|
|
310
|
+
releases: z.array(DigestCoveredReleaseSchema).optional(),
|
|
305
311
|
});
|
|
306
312
|
|
|
307
|
-
/** Full row returned by `GET /v1/collections/:slug/digests/:weekStart
|
|
313
|
+
/** Full row returned by `GET /v1/collections/:slug/digests/:weekStart` and
|
|
314
|
+
* `GET /v1/collections/:slug/digests/latest`. */
|
|
308
315
|
export const CollectionWeeklyDigestDetailSchema = z.object({
|
|
309
316
|
id: z.string(),
|
|
310
317
|
weekStart: z.string(),
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Owner-minted publish tokens (#2373): a verified domain owner mints a `relk_`
|
|
5
|
+
* token bound to ONE source, usable only on that source's
|
|
6
|
+
* `POST …/releases/batch` route (e.g. from the publish-changelog GitHub Action).
|
|
7
|
+
* Served by the session-only `/v1/me/publish-tokens` routes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** POST /v1/me/publish-tokens request body. */
|
|
11
|
+
export const CreatePublishTokenBodySchema = z.strictObject({
|
|
12
|
+
sourceId: z.string().min(1).max(64),
|
|
13
|
+
name: z.string().trim().min(1).max(200),
|
|
14
|
+
});
|
|
15
|
+
export type CreatePublishTokenBody = z.infer<typeof CreatePublishTokenBodySchema>;
|
|
16
|
+
|
|
17
|
+
/** POST /v1/me/publish-tokens 201 response. `token` is shown exactly once. */
|
|
18
|
+
export const CreatedPublishTokenSchema = z.strictObject({
|
|
19
|
+
token: z.string(),
|
|
20
|
+
id: z.string(),
|
|
21
|
+
sourceId: z.string(),
|
|
22
|
+
name: z.string(),
|
|
23
|
+
createdAt: z.string(),
|
|
24
|
+
});
|
|
25
|
+
export type CreatedPublishToken = z.infer<typeof CreatedPublishTokenSchema>;
|
|
26
|
+
|
|
27
|
+
/** One publish token as listed back to its owner — never the secret. */
|
|
28
|
+
export const PublishTokenSchema = z.strictObject({
|
|
29
|
+
id: z.string(),
|
|
30
|
+
name: z.string(),
|
|
31
|
+
sourceId: z.string(),
|
|
32
|
+
sourceSlug: z.string().nullable(),
|
|
33
|
+
orgSlug: z.string().nullable(),
|
|
34
|
+
createdAt: z.string(),
|
|
35
|
+
lastUsedAt: z.string().nullable(),
|
|
36
|
+
revokedAt: z.string().nullable(),
|
|
37
|
+
});
|
|
38
|
+
export type PublishToken = z.infer<typeof PublishTokenSchema>;
|
|
39
|
+
|
|
40
|
+
/** GET /v1/me/publish-tokens response. */
|
|
41
|
+
export const ListPublishTokensResponseSchema = z.strictObject({
|
|
42
|
+
publishTokens: z.array(PublishTokenSchema),
|
|
43
|
+
});
|
|
44
|
+
export type ListPublishTokensResponse = z.infer<typeof ListPublishTokensResponseSchema>;
|
|
45
|
+
|
|
46
|
+
/** DELETE /v1/me/publish-tokens/:id response. */
|
|
47
|
+
export const RevokePublishTokenResponseSchema = z.strictObject({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
revokedAt: z.string(),
|
|
50
|
+
});
|
|
51
|
+
export type RevokePublishTokenResponse = z.infer<typeof RevokePublishTokenResponseSchema>;
|
package/src/schemas/search.ts
CHANGED
|
@@ -114,7 +114,7 @@ export const SearchReleaseHitSchema = z.object({
|
|
|
114
114
|
* The release's upstream source URL, when it has one. Lets the web link
|
|
115
115
|
* search/lookup hits straight to the original page instead of the
|
|
116
116
|
* noindexed `/release/<id>` stub — see `releaseLinkProps()` in
|
|
117
|
-
* `web/src/lib/release-link.ts`. Optional for older servers / mid-deploy
|
|
117
|
+
* `apps/web/src/lib/release-link.ts`. Optional for older servers / mid-deploy
|
|
118
118
|
* pin tolerance.
|
|
119
119
|
*/
|
|
120
120
|
url: z.string().nullable().optional(),
|
package/src/schemas/taxonomy.ts
CHANGED
|
@@ -95,7 +95,7 @@ export const UpdateCategoryResponseSchema = z.object({
|
|
|
95
95
|
/**
|
|
96
96
|
* Aggregated release row on `GET /v1/categories/:slug/releases`. Same wire
|
|
97
97
|
* shape as `CollectionReleaseItem` — both surfaces aggregate across orgs and
|
|
98
|
-
* use `formatAggregateReleaseRow` in `
|
|
98
|
+
* use `formatAggregateReleaseRow` in `apps/api/src/utils.ts` for the
|
|
99
99
|
* formatting. Re-exported here so the two endpoints describe one schema
|
|
100
100
|
* instead of two drifting copies.
|
|
101
101
|
*/
|