@buildinternet/releases-api-types 0.58.3 → 0.59.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 +3 -2
- package/src/api-types.ts +11 -5
- package/src/schemas/datasets.ts +31 -0
- package/src/schemas/releases.ts +19 -6
- package/src/schemas/sitemap.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildinternet/releases-api-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "Wire protocol — request/response types for the Releases Index API. Shared by web, workers, and clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"directory": "packages/api-types"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
|
-
".": "./src/api-types.ts"
|
|
13
|
+
".": "./src/api-types.ts",
|
|
14
|
+
"./datasets": "./src/schemas/datasets.ts"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"src",
|
package/src/api-types.ts
CHANGED
|
@@ -161,6 +161,7 @@ import type {
|
|
|
161
161
|
ReleasesWithMediaResponseSchema,
|
|
162
162
|
ReleaseDetailOrgSchema,
|
|
163
163
|
ReleaseDetailResponseSchema,
|
|
164
|
+
ReleaseUrlConflictDetailsSchema,
|
|
164
165
|
UpdateReleaseBodySchema,
|
|
165
166
|
ReleasePatchResponseSchema,
|
|
166
167
|
ReleaseDeleteResponseSchema,
|
|
@@ -555,6 +556,7 @@ export {
|
|
|
555
556
|
ReleasesWithMediaResponseSchema,
|
|
556
557
|
ReleaseDetailOrgSchema,
|
|
557
558
|
ReleaseDetailResponseSchema,
|
|
559
|
+
ReleaseUrlConflictDetailsSchema,
|
|
558
560
|
UpdateReleaseBodySchema,
|
|
559
561
|
ReleasePatchResponseSchema,
|
|
560
562
|
ReleaseDeleteResponseSchema,
|
|
@@ -997,11 +999,11 @@ export interface WhatsChangedEntry {
|
|
|
997
999
|
summary: string | null;
|
|
998
1000
|
breaking: BreakingLevel;
|
|
999
1001
|
migrationNotes: string | null;
|
|
1002
|
+
/** Original source URL. Primary citation link; prefer this over `webUrl`. */
|
|
1000
1003
|
url: string | null;
|
|
1001
1004
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
1004
|
-
* source URL); lets an upgrade-planning agent link the release detail page.
|
|
1005
|
+
* releases.sh detail page — the slugged `/release/<id>-<slug>` form (#1906),
|
|
1006
|
+
* built from `WEB_BASE_URL`. Secondary to `url` (the original source).
|
|
1005
1007
|
*/
|
|
1006
1008
|
webUrl: string | null;
|
|
1007
1009
|
}
|
|
@@ -1061,10 +1063,11 @@ export interface ReleaseDetail {
|
|
|
1061
1063
|
* scored. Additive — older servers omit it.
|
|
1062
1064
|
*/
|
|
1063
1065
|
importance?: number | null;
|
|
1066
|
+
/** Original source URL. Primary citation link; `webUrl` is the releases.sh copy. */
|
|
1064
1067
|
url: string | null;
|
|
1065
1068
|
/**
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1069
|
+
* releases.sh detail-page URL (friendly form: ID + current title slug).
|
|
1070
|
+
* Secondary to `url`. Additive — older servers omit it.
|
|
1068
1071
|
*/
|
|
1069
1072
|
webUrl?: string;
|
|
1070
1073
|
media: MediaItem[];
|
|
@@ -1124,6 +1127,7 @@ export type ReleasesWithMediaResponse = z.infer<typeof ReleasesWithMediaResponse
|
|
|
1124
1127
|
|
|
1125
1128
|
export type ReleaseDetailOrg = z.infer<typeof ReleaseDetailOrgSchema>;
|
|
1126
1129
|
export type ReleaseDetailResponse = z.infer<typeof ReleaseDetailResponseSchema>;
|
|
1130
|
+
export type ReleaseUrlConflictDetails = z.infer<typeof ReleaseUrlConflictDetailsSchema>;
|
|
1127
1131
|
export type UpdateReleaseBody = z.infer<typeof UpdateReleaseBodySchema>;
|
|
1128
1132
|
export type ReleasePatchResponse = z.infer<typeof ReleasePatchResponseSchema>;
|
|
1129
1133
|
export type ReleaseDeleteResponse = z.infer<typeof ReleaseDeleteResponseSchema>;
|
|
@@ -2221,3 +2225,5 @@ export interface TokenIdentity {
|
|
|
2221
2225
|
expiresAt?: string | null;
|
|
2222
2226
|
lastUsedAt?: string | null;
|
|
2223
2227
|
}
|
|
2228
|
+
|
|
2229
|
+
export * from "./schemas/datasets.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const DatasetDescriptionSchema = z.object({
|
|
4
|
+
name: z.string().trim().min(1).max(200),
|
|
5
|
+
description: z.string().trim().min(50).max(5000),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
/** Stored under source.metadata.dataset. Null removes the override. */
|
|
9
|
+
export const SourceDatasetSettingsSchema = DatasetDescriptionSchema.partial()
|
|
10
|
+
.extend({
|
|
11
|
+
enabled: z.boolean().optional(),
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
14
|
+
export type SourceDatasetSettings = z.infer<typeof SourceDatasetSettingsSchema>;
|
|
15
|
+
export type DatasetDescription = z.infer<typeof DatasetDescriptionSchema>;
|
|
16
|
+
export interface AdminDatasetSource {
|
|
17
|
+
id: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
name: string;
|
|
20
|
+
orgSlug: string | null;
|
|
21
|
+
orgName: string | null;
|
|
22
|
+
defaultEnabled: boolean;
|
|
23
|
+
settings: SourceDatasetSettings | null;
|
|
24
|
+
effective: DatasetDescription | null;
|
|
25
|
+
blockedReasons: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface AdminDatasetsResponse {
|
|
28
|
+
sources: AdminDatasetSource[];
|
|
29
|
+
pagination: { page: number; limit: number; hasMore: boolean };
|
|
30
|
+
query: string;
|
|
31
|
+
}
|
package/src/schemas/releases.ts
CHANGED
|
@@ -74,10 +74,11 @@ export const ReleaseLatestItemSchema = z.object({
|
|
|
74
74
|
breaking: z.enum(BREAKING_LEVELS).optional(),
|
|
75
75
|
importance: ImportanceScoreSchema,
|
|
76
76
|
publishedAt: z.string().nullable(),
|
|
77
|
+
/** Original source URL. Primary citation link; `webUrl` is the releases.sh copy. */
|
|
77
78
|
url: z.string().nullable(),
|
|
78
79
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
80
|
+
* releases.sh detail-page URL (friendly form: ID + current title slug).
|
|
81
|
+
* Secondary to `url`. Additive — older servers and the digest-cron path omit it.
|
|
81
82
|
*/
|
|
82
83
|
webUrl: z.string().optional(),
|
|
83
84
|
media: z.array(MediaItemSchema),
|
|
@@ -268,12 +269,12 @@ export const ReleaseDetailResponseSchema = z.object({
|
|
|
268
269
|
* when the body gives none. Detail-route-only — list paths never carry it.
|
|
269
270
|
*/
|
|
270
271
|
migrationNotes: z.string().nullable().optional(),
|
|
272
|
+
/** Original source URL. Primary citation link; `webUrl` is the releases.sh copy. */
|
|
271
273
|
url: z.string().nullable(),
|
|
272
274
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* Additive — older servers omit it.
|
|
275
|
+
* releases.sh detail-page URL, `https://releases.sh/release/rel_<id>-<slug>`
|
|
276
|
+
* (immutable ID + current title slug). Secondary to `url`. Additive — older
|
|
277
|
+
* servers omit it.
|
|
277
278
|
*/
|
|
278
279
|
webUrl: z.string().optional(),
|
|
279
280
|
contentHash: z.string().nullable(),
|
|
@@ -314,6 +315,18 @@ export const ReleaseDetailResponseSchema = z.object({
|
|
|
314
315
|
* via `.strict()` — the handler also re-runs the field-set check after
|
|
315
316
|
* sanitization so an empty update payload still 400s.
|
|
316
317
|
*/
|
|
318
|
+
/**
|
|
319
|
+
* `error.details` on a 409 from `PATCH /v1/releases/:id` when the new `url`
|
|
320
|
+
* collides with `UNIQUE(source_id, url)`. Additive: older servers omit `details`.
|
|
321
|
+
*/
|
|
322
|
+
export const ReleaseUrlConflictDetailsSchema = z
|
|
323
|
+
.object({
|
|
324
|
+
releaseId: z
|
|
325
|
+
.string()
|
|
326
|
+
.describe("Id of the existing release that already stores this URL on the same source."),
|
|
327
|
+
})
|
|
328
|
+
.describe("Structured details for a release URL conflict (409).");
|
|
329
|
+
|
|
317
330
|
export const UpdateReleaseBodySchema = z
|
|
318
331
|
.object({
|
|
319
332
|
title: z.string().optional(),
|
package/src/schemas/sitemap.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { DatasetDescriptionSchema } from "./datasets.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Per-source row in `GET /v1/sitemap`. `hasChangelog` and `hasHighlights`
|
|
@@ -12,6 +13,8 @@ export const SitemapSourceSchema = z.object({
|
|
|
12
13
|
* may omit it and the web degrades to the bare URL.
|
|
13
14
|
*/
|
|
14
15
|
id: z.string().optional(),
|
|
16
|
+
/** Null explicitly disables; absence supports older API deploys. */
|
|
17
|
+
dataset: DatasetDescriptionSchema.nullable().optional(),
|
|
15
18
|
orgSlug: z.string(),
|
|
16
19
|
slug: z.string(),
|
|
17
20
|
latestDate: z.string().nullable(),
|