@buildinternet/releases-api-types 0.37.0 → 0.39.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 +1 -1
- package/src/api-types.ts +28 -0
- package/src/schemas/listing.ts +76 -0
- package/src/schemas/lookups.ts +9 -1
- package/src/schemas/orgs.ts +26 -0
- package/src/schemas/overviews.ts +12 -16
- package/src/schemas/shared.ts +52 -8
- package/src/schemas/well-known.ts +35 -0
package/package.json
CHANGED
package/src/api-types.ts
CHANGED
|
@@ -24,6 +24,8 @@ import type {
|
|
|
24
24
|
ReleaseSummaryItemSchema,
|
|
25
25
|
OverviewPageItemSchema,
|
|
26
26
|
OverviewCitationSchema,
|
|
27
|
+
OrgStatusSchema,
|
|
28
|
+
ReleaseLocationItemSchema,
|
|
27
29
|
} from "./schemas/shared.js";
|
|
28
30
|
import type {
|
|
29
31
|
OrgListItemSchema,
|
|
@@ -263,6 +265,8 @@ export {
|
|
|
263
265
|
ReleaseSummaryItemSchema,
|
|
264
266
|
OverviewPageItemSchema,
|
|
265
267
|
OverviewCitationSchema,
|
|
268
|
+
OrgStatusSchema,
|
|
269
|
+
ReleaseLocationItemSchema,
|
|
266
270
|
CategorySchema,
|
|
267
271
|
NoticeSchema,
|
|
268
272
|
} from "./schemas/shared.js";
|
|
@@ -308,6 +312,8 @@ export {
|
|
|
308
312
|
WorkspaceProfileResponseSchema,
|
|
309
313
|
} from "./schemas/account-profile.js";
|
|
310
314
|
export {
|
|
315
|
+
CreateStubOrgBodySchema,
|
|
316
|
+
StubFromDomainBodySchema,
|
|
311
317
|
ReleasesJsonConfigSchema,
|
|
312
318
|
ReleasesJsonDomainReleaseSchema,
|
|
313
319
|
ReleasesJsonDomainSchema,
|
|
@@ -319,6 +325,8 @@ export {
|
|
|
319
325
|
SyncWellKnownResponseSchema,
|
|
320
326
|
} from "./schemas/well-known.js";
|
|
321
327
|
export type {
|
|
328
|
+
CreateStubOrgBody,
|
|
329
|
+
StubFromDomainBody,
|
|
322
330
|
ReleasesJsonConfig,
|
|
323
331
|
ReleasesJsonDomain,
|
|
324
332
|
ReleasesJsonDomainRelease,
|
|
@@ -326,6 +334,21 @@ export type {
|
|
|
326
334
|
ReleasesJsonRepo,
|
|
327
335
|
ReleasesJsonRepoRelease,
|
|
328
336
|
} from "./schemas/well-known.js";
|
|
337
|
+
export {
|
|
338
|
+
ListingValidateBodySchema,
|
|
339
|
+
ListingActivateBodySchema,
|
|
340
|
+
ListingIssueSchema,
|
|
341
|
+
ListingLocationSchema,
|
|
342
|
+
ListingOrgPointerSchema,
|
|
343
|
+
ListingValidationResultSchema,
|
|
344
|
+
ListingActivateResultSchema,
|
|
345
|
+
type ListingValidateBody,
|
|
346
|
+
type ListingActivateBody,
|
|
347
|
+
type ListingIssue,
|
|
348
|
+
type ListingLocation,
|
|
349
|
+
type ListingValidationResult,
|
|
350
|
+
type ListingActivateResult,
|
|
351
|
+
} from "./schemas/listing.js";
|
|
329
352
|
export {
|
|
330
353
|
SourceListItemSchema,
|
|
331
354
|
SourceWithOrgSchema,
|
|
@@ -522,6 +545,11 @@ export type { ResolveResponse } from "./schemas/resolve.js";
|
|
|
522
545
|
|
|
523
546
|
export type MediaItem = z.infer<typeof MediaItemSchema>;
|
|
524
547
|
|
|
548
|
+
// ── Stub tier (#1947) ──
|
|
549
|
+
|
|
550
|
+
export type OrgStatus = z.infer<typeof OrgStatusSchema>;
|
|
551
|
+
export type ReleaseLocationItem = z.infer<typeof ReleaseLocationItemSchema>;
|
|
552
|
+
|
|
525
553
|
// ── Stats ──
|
|
526
554
|
|
|
527
555
|
export type Stats = z.infer<typeof StatsSchema>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Public wire contract for the self-serve listing lane (#1947 phase 2):
|
|
5
|
+
* POST /v1/listing/validate and POST /v1/listing/activate. This projection is
|
|
6
|
+
* deliberately independent of the internal materialization plan — it is the
|
|
7
|
+
* stable shape web/CLI consume while internals stay free to change.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const ListingValidateBodySchema = z.strictObject({
|
|
11
|
+
domain: z.string().min(1).max(255),
|
|
12
|
+
});
|
|
13
|
+
export type ListingValidateBody = z.infer<typeof ListingValidateBodySchema>;
|
|
14
|
+
|
|
15
|
+
export const ListingActivateBodySchema = z.strictObject({
|
|
16
|
+
domain: z.string().min(1).max(255),
|
|
17
|
+
requestTracking: z.boolean().optional(),
|
|
18
|
+
});
|
|
19
|
+
export type ListingActivateBody = z.infer<typeof ListingActivateBodySchema>;
|
|
20
|
+
|
|
21
|
+
export const ListingIssueSchema = z.strictObject({
|
|
22
|
+
path: z.string(),
|
|
23
|
+
message: z.string(),
|
|
24
|
+
});
|
|
25
|
+
export type ListingIssue = z.infer<typeof ListingIssueSchema>;
|
|
26
|
+
|
|
27
|
+
export const ListingLocationSchema = z.strictObject({
|
|
28
|
+
/** The declared locator value (feed URL, github ref, url, appstore id, file). */
|
|
29
|
+
locator: z.string(),
|
|
30
|
+
kind: z.enum(["feed", "github", "appstore", "url", "file"]),
|
|
31
|
+
classification: z.enum(["tier1-live", "tier2-paused-review"]),
|
|
32
|
+
/** Plain-English "what this becomes" for the preview UI. */
|
|
33
|
+
becomes: z.string(),
|
|
34
|
+
/** Present when the locator is nested under a manifest product. */
|
|
35
|
+
productName: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
export type ListingLocation = z.infer<typeof ListingLocationSchema>;
|
|
38
|
+
|
|
39
|
+
export const ListingOrgPointerSchema = z.strictObject({
|
|
40
|
+
slug: z.string(),
|
|
41
|
+
name: z.string(),
|
|
42
|
+
webUrl: z.string(),
|
|
43
|
+
});
|
|
44
|
+
export type ListingOrgPointer = z.infer<typeof ListingOrgPointerSchema>;
|
|
45
|
+
|
|
46
|
+
export const ListingValidationResultSchema = z.strictObject({
|
|
47
|
+
valid: z.boolean(),
|
|
48
|
+
errors: z.array(ListingIssueSchema),
|
|
49
|
+
domainStatus: z.enum(["unlisted", "listed", "stub"]),
|
|
50
|
+
/** Present when domainStatus is "listed" or "stub". */
|
|
51
|
+
org: ListingOrgPointerSchema.optional(),
|
|
52
|
+
/** Present when valid: identity fields as they would land. */
|
|
53
|
+
identity: z
|
|
54
|
+
.strictObject({
|
|
55
|
+
name: z.string(),
|
|
56
|
+
slug: z.string(),
|
|
57
|
+
domain: z.string(),
|
|
58
|
+
})
|
|
59
|
+
.optional(),
|
|
60
|
+
products: z.array(z.strictObject({ name: z.string(), locationCount: z.number() })).optional(),
|
|
61
|
+
locations: z.array(ListingLocationSchema),
|
|
62
|
+
});
|
|
63
|
+
export type ListingValidationResult = z.infer<typeof ListingValidationResultSchema>;
|
|
64
|
+
|
|
65
|
+
export const ListingActivateResultSchema = z.strictObject({
|
|
66
|
+
/** True when this call created the stub; false for the existing-stub carve-out. */
|
|
67
|
+
activated: z.boolean(),
|
|
68
|
+
org: z.strictObject({
|
|
69
|
+
slug: z.string(),
|
|
70
|
+
name: z.string(),
|
|
71
|
+
status: z.enum(["stub", "tracked"]),
|
|
72
|
+
webUrl: z.string(),
|
|
73
|
+
}),
|
|
74
|
+
trackingRequested: z.boolean(),
|
|
75
|
+
});
|
|
76
|
+
export type ListingActivateResult = z.infer<typeof ListingActivateResultSchema>;
|
package/src/schemas/lookups.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { KIND_VALUES } from "@buildinternet/releases-core/kinds";
|
|
3
|
-
import { CategorySchema } from "./shared.js";
|
|
3
|
+
import { CategorySchema, OrgStatusSchema, ReleaseLocationItemSchema } from "./shared.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Status flags returned by `POST /v1/lookups`:
|
|
@@ -104,6 +104,14 @@ export const DomainLookupOrgSchema = z.object({
|
|
|
104
104
|
category: z.string().nullable(),
|
|
105
105
|
avatarUrl: z.string().nullable(),
|
|
106
106
|
matchedVia: z.enum(["primary", "alias"]),
|
|
107
|
+
/** Org tier (#1947). Optional for mid-deploy tolerance; absent ⇒ `"tracked"`. */
|
|
108
|
+
status: OrgStatusSchema.optional(),
|
|
109
|
+
/**
|
|
110
|
+
* Declared release locations (#1947) for a stub org — the "check these
|
|
111
|
+
* locations" answer when the domain resolves to an org with no sources yet.
|
|
112
|
+
* Omitted/empty for a tracked org.
|
|
113
|
+
*/
|
|
114
|
+
locations: z.array(ReleaseLocationItemSchema).optional(),
|
|
107
115
|
});
|
|
108
116
|
|
|
109
117
|
export const DomainLookupProductSchema = z.object({
|
package/src/schemas/orgs.ts
CHANGED
|
@@ -6,9 +6,11 @@ import {
|
|
|
6
6
|
CategorySchema,
|
|
7
7
|
ListResponseSchema,
|
|
8
8
|
NoticeSchema,
|
|
9
|
+
OrgStatusSchema,
|
|
9
10
|
OverviewPageItemSchema,
|
|
10
11
|
PaginationSchema,
|
|
11
12
|
ReleaseItemSchema,
|
|
13
|
+
ReleaseLocationItemSchema,
|
|
12
14
|
VideoSourceInfoSchema,
|
|
13
15
|
} from "./shared.js";
|
|
14
16
|
import { SourceListItemSchema } from "./sources.js";
|
|
@@ -24,12 +26,24 @@ export const OrgListItemSchema = z.object({
|
|
|
24
26
|
category: CategorySchema.nullable(),
|
|
25
27
|
avatarUrl: z.string().nullable(),
|
|
26
28
|
featured: z.boolean(),
|
|
29
|
+
/**
|
|
30
|
+
* Org tier (#1947). Optional for mid-deploy tolerance; absent ⇒ `"tracked"`.
|
|
31
|
+
* A `"stub"` org has no processed sources yet — the UI renders a badge and a
|
|
32
|
+
* stub is excluded from release-ranked surfaces.
|
|
33
|
+
*/
|
|
34
|
+
status: OrgStatusSchema.optional(),
|
|
27
35
|
sourceCount: z.number().int().min(0),
|
|
28
36
|
releaseCount: z.number().int().min(0),
|
|
29
37
|
recentReleaseCount: z.number().int().min(0),
|
|
30
38
|
lastActivity: z.string().nullable(),
|
|
31
39
|
topProducts: z.array(z.string()),
|
|
32
40
|
sparkline: z.array(z.number().int().min(0)).length(30),
|
|
41
|
+
/**
|
|
42
|
+
* Additive, admin-only field (#1947 phase 2). Only populated on the
|
|
43
|
+
* `GET /v1/orgs?trackingRequested=1` demand-queue projection — absent on
|
|
44
|
+
* the public catalog listing.
|
|
45
|
+
*/
|
|
46
|
+
trackingRequestedAt: z.string().nullable().optional(),
|
|
33
47
|
});
|
|
34
48
|
|
|
35
49
|
/**
|
|
@@ -480,6 +494,18 @@ export const OrgDetailSchema = z.object({
|
|
|
480
494
|
fetchPaused: z.boolean().optional(),
|
|
481
495
|
/** How the org row was created. `on_demand` orgs are excluded from overview generation regardless of `autoGenerateContent`. */
|
|
482
496
|
discovery: z.enum(["curated", "agent", "on_demand"]).optional(),
|
|
497
|
+
/**
|
|
498
|
+
* Org tier (#1947). Optional for mid-deploy tolerance; absent ⇒ `"tracked"`.
|
|
499
|
+
* A `"stub"` org's `sources` array is empty — `locations` carries the declared
|
|
500
|
+
* release locations instead.
|
|
501
|
+
*/
|
|
502
|
+
status: OrgStatusSchema.optional(),
|
|
503
|
+
/**
|
|
504
|
+
* Declared release locations (#1947), present (and non-empty) for stub orgs.
|
|
505
|
+
* Same shape as a releases.json `releases[]` entry plus `basis`/`sourceId`.
|
|
506
|
+
* Omitted or empty for a tracked org with no locators.
|
|
507
|
+
*/
|
|
508
|
+
locations: z.array(ReleaseLocationItemSchema).optional(),
|
|
483
509
|
tags: z.array(z.string()).optional(),
|
|
484
510
|
sourceCount: z.number().int().min(0),
|
|
485
511
|
releaseCount: z.number().int().min(0),
|
package/src/schemas/overviews.ts
CHANGED
|
@@ -11,23 +11,19 @@ export const OrgOverviewResponseSchema = OverviewPageItemSchema.extend({
|
|
|
11
11
|
}).nullable();
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Incoming citation row attached to `POST /v1/orgs/:slug/overview`.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* Incoming citation row attached to `POST /v1/orgs/:slug/overview`. A source the
|
|
15
|
+
* overview drew on — just `sourceUrl` (+ optional display `title`); `releaseId`
|
|
16
|
+
* is resolved server-side from `sourceUrl`. The legacy body-offset fields
|
|
17
|
+
* (`startIndex`/`endIndex`/`citedText`) are accepted-but-ignored for wire
|
|
18
|
+
* back-compat with older clients (#1934); they're no longer stored.
|
|
19
19
|
*/
|
|
20
|
-
export const IncomingOverviewCitationSchema = z
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
.refine((c) => c.endIndex > c.startIndex, {
|
|
29
|
-
message: "endIndex must be > startIndex",
|
|
30
|
-
});
|
|
20
|
+
export const IncomingOverviewCitationSchema = z.object({
|
|
21
|
+
sourceUrl: z.string().min(1),
|
|
22
|
+
title: z.string().nullable().optional(),
|
|
23
|
+
startIndex: z.number().int().min(0).optional(),
|
|
24
|
+
endIndex: z.number().int().min(0).optional(),
|
|
25
|
+
citedText: z.string().optional(),
|
|
26
|
+
});
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* Body accepted by `POST /v1/orgs/:slug/overview` — the agent-authored
|
package/src/schemas/shared.ts
CHANGED
|
@@ -44,6 +44,37 @@ export const VideoSourceInfoSchema = z.object({
|
|
|
44
44
|
provider: z.enum(["youtube", "vimeo", "wistia"]),
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Org tier surfaced on read paths (#1947). `stub` = known only by declared
|
|
49
|
+
* release locations (no processed sources yet); `tracked` = a normal org whose
|
|
50
|
+
* sources fetch. The column is `organizations.tier`; the wire name is `status`.
|
|
51
|
+
* Optional on the wire so a pinned client mid-deploy tolerates its absence —
|
|
52
|
+
* treat a missing value as `"tracked"`.
|
|
53
|
+
*/
|
|
54
|
+
export const OrgStatusSchema = z.enum(["stub", "tracked"]);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A declared release location (#1947) — one `release_locations` row on the
|
|
58
|
+
* wire, the same shape a releases.json `releases[]` entry carries plus its
|
|
59
|
+
* provenance `basis` and, once promoted, the `sourceId` it materialized into.
|
|
60
|
+
* Surfaced on stub orgs so an agent gets "release info is published at these
|
|
61
|
+
* locations" instead of an empty sources list.
|
|
62
|
+
*/
|
|
63
|
+
export const ReleaseLocationItemSchema = z.object({
|
|
64
|
+
url: z.string().optional(),
|
|
65
|
+
feed: z.string().optional(),
|
|
66
|
+
github: z.string().optional(),
|
|
67
|
+
appstore: z.string().optional(),
|
|
68
|
+
file: z.string().optional(),
|
|
69
|
+
title: z.string().nullable().optional(),
|
|
70
|
+
canonical: z.boolean(),
|
|
71
|
+
basis: z.enum(["curator", "declared", "detected", "generated"]),
|
|
72
|
+
/** Owning product id when the locator is product-scoped, else null. */
|
|
73
|
+
productId: z.string().nullable(),
|
|
74
|
+
/** Set once the locator has been promoted into a source, else null. */
|
|
75
|
+
sourceId: z.string().nullable(),
|
|
76
|
+
});
|
|
77
|
+
|
|
47
78
|
export const PaginationSchema = z.object({
|
|
48
79
|
page: z.number().int().min(1),
|
|
49
80
|
pageSize: z.number().int().min(1),
|
|
@@ -146,19 +177,32 @@ export const ReleaseSummaryItemSchema = z.object({
|
|
|
146
177
|
});
|
|
147
178
|
|
|
148
179
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
180
|
+
* A source attached to an overview page (#846, reshaped #1934). Each row names
|
|
181
|
+
* a source the overview drew on — `sourceUrl` plus, when it resolved to an
|
|
182
|
+
* on-registry release, `releaseId` + a canonical `releaseWebUrl`. This is a
|
|
183
|
+
* source *list*, not span-anchored provenance: the old body char offsets +
|
|
184
|
+
* verbatim quote are removed. Optional everywhere it appears — consumers should
|
|
185
|
+
* degrade gracefully.
|
|
154
186
|
*/
|
|
155
187
|
export const OverviewCitationSchema = z.object({
|
|
156
|
-
startIndex: z.number().int().min(0),
|
|
157
|
-
endIndex: z.number().int().min(0),
|
|
158
188
|
sourceUrl: z.string(),
|
|
159
189
|
title: z.string().nullable().optional(),
|
|
160
|
-
|
|
190
|
+
/** Best-effort link to the on-registry release this source maps to (resolved server-side). */
|
|
161
191
|
releaseId: z.string().nullable().optional(),
|
|
192
|
+
/**
|
|
193
|
+
* Canonical web URL of the on-registry release page for this source, when
|
|
194
|
+
* `releaseId` resolved (#1934). The Sources footer links here (internal,
|
|
195
|
+
* crawlable) in preference to the external `sourceUrl`.
|
|
196
|
+
*/
|
|
197
|
+
releaseWebUrl: z.string().nullable().optional(),
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated Body char offsets / verbatim quote — removed with span-anchored
|
|
200
|
+
* citations (#1934). Kept optional for wire back-compat; no producer emits
|
|
201
|
+
* them and no consumer should read them.
|
|
202
|
+
*/
|
|
203
|
+
startIndex: z.number().int().min(0).optional(),
|
|
204
|
+
endIndex: z.number().int().min(0).optional(),
|
|
205
|
+
citedText: z.string().optional(),
|
|
162
206
|
});
|
|
163
207
|
|
|
164
208
|
/**
|
|
@@ -168,6 +168,41 @@ export type ReleasesJsonProduct = z.infer<typeof ReleasesJsonProductSchema>;
|
|
|
168
168
|
export type ReleasesJsonDomainRelease = z.infer<typeof ReleasesJsonDomainReleaseSchema>;
|
|
169
169
|
export type ReleasesJsonRepoRelease = z.infer<typeof ReleasesJsonRepoReleaseSchema>;
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Body for `POST /v1/orgs/stub` — curator-authored stub org (#1947). Mirrors
|
|
173
|
+
* the domain-manifest identity + product + locator shape (so a curator can hand
|
|
174
|
+
* the same declaration a manifest would carry), minus manifest-transport fields
|
|
175
|
+
* (`version`/`$schema`/`registries`) and plus the registry-identity fields a
|
|
176
|
+
* stub org needs to be resolvable (`slug`/`domain`). Locators are optional — an
|
|
177
|
+
* identity-only stub (locations TBD) is valid. `category`/taxonomy strings stay
|
|
178
|
+
* lenient; the route resolves them and ignores the rest, same as the reconciler.
|
|
179
|
+
*/
|
|
180
|
+
export const CreateStubOrgBodySchema = z.strictObject({
|
|
181
|
+
name: z.string().min(1).max(120),
|
|
182
|
+
slug: z.string().min(1).max(120).optional(),
|
|
183
|
+
domain: z.string().min(1).max(255).optional(),
|
|
184
|
+
description: z.string().max(2000).optional(),
|
|
185
|
+
category: z.string().min(1).max(120).optional(),
|
|
186
|
+
avatar: HttpsUrlSchema.optional(),
|
|
187
|
+
tags: z.array(z.string().min(1).max(60)).max(50).optional(),
|
|
188
|
+
social: SocialSchema.optional(),
|
|
189
|
+
products: z.array(ReleasesJsonProductSchema).max(MAX_PRODUCTS).optional(),
|
|
190
|
+
releases: DomainReleasesSchema.optional(),
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
export type CreateStubOrgBody = z.infer<typeof CreateStubOrgBodySchema>;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Body for `POST /v1/orgs/stub-from-domain` (#1947) — the unlisted-domain path.
|
|
197
|
+
* The worker fetches https://{domain}/.well-known/releases.json and, if valid
|
|
198
|
+
* and the domain has no org yet, creates a stub org + declared locators.
|
|
199
|
+
*/
|
|
200
|
+
export const StubFromDomainBodySchema = z.strictObject({
|
|
201
|
+
domain: z.string().min(1).max(255),
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
export type StubFromDomainBody = z.infer<typeof StubFromDomainBodySchema>;
|
|
205
|
+
|
|
171
206
|
/** Response shape of POST /v1/orgs/:slug/sync-well-known. */
|
|
172
207
|
export const SyncWellKnownResponseSchema = z.object({
|
|
173
208
|
fetched: z.boolean(),
|