@buildinternet/releases-api-types 0.38.0 → 0.40.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.38.0",
3
+ "version": "0.40.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
@@ -334,6 +334,37 @@ export type {
334
334
  ReleasesJsonRepo,
335
335
  ReleasesJsonRepoRelease,
336
336
  } from "./schemas/well-known.js";
337
+ export {
338
+ ListingValidateBodySchema,
339
+ ListingActivateBodySchema,
340
+ ListingIssueSchema,
341
+ ListingLocationSchema,
342
+ ListingOrgPointerSchema,
343
+ ListingValidationResultSchema,
344
+ ListingActivateResultSchema,
345
+ ListingClaimBodySchema,
346
+ ListingClaimVerifyBodySchema,
347
+ OrgClaimStatusSchema,
348
+ ClaimMethodSchema,
349
+ OrgClaimSchema,
350
+ ClaimCheckOutcomeSchema,
351
+ ClaimVerifyResultSchema,
352
+ ListingClaimsResultSchema,
353
+ type ListingValidateBody,
354
+ type ListingActivateBody,
355
+ type ListingIssue,
356
+ type ListingLocation,
357
+ type ListingValidationResult,
358
+ type ListingActivateResult,
359
+ type ListingClaimBody,
360
+ type ListingClaimVerifyBody,
361
+ type OrgClaimStatus,
362
+ type ClaimMethod,
363
+ type OrgClaim,
364
+ type ClaimCheckOutcome,
365
+ type ClaimVerifyResult,
366
+ type ListingClaimsResult,
367
+ } from "./schemas/listing.js";
337
368
  export {
338
369
  SourceListItemSchema,
339
370
  SourceWithOrgSchema,
@@ -0,0 +1,138 @@
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>;
77
+
78
+ /**
79
+ * Ownership claim flow (#1947 epic item 2): a signed-in user proves control
80
+ * of a listed domain via a well-known token file OR a DNS TXT record.
81
+ */
82
+
83
+ export const ListingClaimBodySchema = z.strictObject({
84
+ domain: z.string().min(1).max(255),
85
+ });
86
+ export type ListingClaimBody = z.infer<typeof ListingClaimBodySchema>;
87
+
88
+ export const ListingClaimVerifyBodySchema = z.strictObject({
89
+ claimId: z.string().min(1),
90
+ });
91
+ export type ListingClaimVerifyBody = z.infer<typeof ListingClaimVerifyBodySchema>;
92
+
93
+ export const OrgClaimStatusSchema = z.enum(["pending", "verified", "expired"]);
94
+ export type OrgClaimStatus = z.infer<typeof OrgClaimStatusSchema>;
95
+
96
+ export const ClaimMethodSchema = z.enum(["well-known", "dns-txt"]);
97
+ export type ClaimMethod = z.infer<typeof ClaimMethodSchema>;
98
+
99
+ /**
100
+ * `token` + `instructions` are only present while the claim is `pending` (or
101
+ * on mint) — once verified there's nothing left to prove, and an expired
102
+ * claim's token is stale.
103
+ */
104
+ export const OrgClaimSchema = z.strictObject({
105
+ id: z.string(),
106
+ org: ListingOrgPointerSchema,
107
+ status: OrgClaimStatusSchema,
108
+ method: ClaimMethodSchema.optional(),
109
+ token: z.string().optional(),
110
+ createdAt: z.string(),
111
+ verifiedAt: z.string().optional(),
112
+ expiresAt: z.string(),
113
+ instructions: z
114
+ .strictObject({
115
+ wellKnownUrl: z.string(),
116
+ dnsRecordName: z.string(),
117
+ })
118
+ .optional(),
119
+ });
120
+ export type OrgClaim = z.infer<typeof OrgClaimSchema>;
121
+
122
+ export const ClaimCheckOutcomeSchema = z.enum(["ok", "mismatch", "unreachable"]);
123
+ export type ClaimCheckOutcome = z.infer<typeof ClaimCheckOutcomeSchema>;
124
+
125
+ export const ClaimVerifyResultSchema = z.strictObject({
126
+ verified: z.boolean(),
127
+ checked: z.strictObject({
128
+ wellKnown: ClaimCheckOutcomeSchema,
129
+ dnsTxt: ClaimCheckOutcomeSchema,
130
+ }),
131
+ claim: OrgClaimSchema,
132
+ });
133
+ export type ClaimVerifyResult = z.infer<typeof ClaimVerifyResultSchema>;
134
+
135
+ export const ListingClaimsResultSchema = z.strictObject({
136
+ claims: z.array(OrgClaimSchema),
137
+ });
138
+ export type ListingClaimsResult = z.infer<typeof ListingClaimsResultSchema>;
@@ -38,6 +38,12 @@ export const OrgListItemSchema = z.object({
38
38
  lastActivity: z.string().nullable(),
39
39
  topProducts: z.array(z.string()),
40
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(),
41
47
  });
42
48
 
43
49
  /**
@@ -171,6 +171,8 @@ export const SourceDetailSchema = z.object({
171
171
  latestDate: z.string().nullable(),
172
172
  lastFetchedAt: z.string().nullable(),
173
173
  lastPolledAt: z.string().nullable(),
174
+ // #1969: additive so pinned old workers/clients degrade gracefully.
175
+ changeDetectedAt: z.string().nullable().optional(),
174
176
  trackingSince: z.string(),
175
177
  releases: z.array(ReleaseItemSchema),
176
178
  pagination: SourceFeedPaginationSchema,