@buildinternet/releases-api-types 0.58.3 → 0.60.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.
Files changed (125) hide show
  1. package/README.md +14 -6
  2. package/dist/api-types.d.ts +1168 -0
  3. package/dist/api-types.d.ts.map +1 -0
  4. package/dist/api-types.js +134 -0
  5. package/dist/schemas/account-profile.d.ts +29 -0
  6. package/dist/schemas/account-profile.d.ts.map +1 -0
  7. package/dist/schemas/account-profile.js +24 -0
  8. package/dist/schemas/ai-models.d.ts +67 -0
  9. package/dist/schemas/ai-models.d.ts.map +1 -0
  10. package/{src/schemas/ai-models.ts → dist/schemas/ai-models.js} +25 -31
  11. package/dist/schemas/api-keys.d.ts +71 -0
  12. package/dist/schemas/api-keys.d.ts.map +1 -0
  13. package/dist/schemas/api-keys.js +32 -0
  14. package/dist/schemas/classifications.d.ts +134 -0
  15. package/dist/schemas/classifications.d.ts.map +1 -0
  16. package/dist/schemas/classifications.js +96 -0
  17. package/dist/schemas/collections.d.ts +605 -0
  18. package/dist/schemas/collections.d.ts.map +1 -0
  19. package/dist/schemas/collections.js +320 -0
  20. package/dist/schemas/datasets.d.ts +34 -0
  21. package/dist/schemas/datasets.d.ts.map +1 -0
  22. package/dist/schemas/datasets.js +11 -0
  23. package/dist/schemas/errors.d.ts +43 -0
  24. package/dist/schemas/errors.d.ts.map +1 -0
  25. package/dist/schemas/errors.js +61 -0
  26. package/dist/schemas/feedback.d.ts +134 -0
  27. package/dist/schemas/feedback.d.ts.map +1 -0
  28. package/dist/schemas/feedback.js +76 -0
  29. package/dist/schemas/follows.d.ts +154 -0
  30. package/dist/schemas/follows.d.ts.map +1 -0
  31. package/dist/schemas/follows.js +42 -0
  32. package/dist/schemas/listing.d.ts +374 -0
  33. package/dist/schemas/listing.d.ts.map +1 -0
  34. package/dist/schemas/listing.js +175 -0
  35. package/dist/schemas/lookups.d.ts +285 -0
  36. package/dist/schemas/lookups.d.ts.map +1 -0
  37. package/{src/schemas/lookups.ts → dist/schemas/lookups.js} +67 -80
  38. package/dist/schemas/marketing-classifier.d.ts +32 -0
  39. package/dist/schemas/marketing-classifier.d.ts.map +1 -0
  40. package/{src/schemas/marketing-classifier.ts → dist/schemas/marketing-classifier.js} +14 -18
  41. package/dist/schemas/orgs.d.ts +950 -0
  42. package/dist/schemas/orgs.d.ts.map +1 -0
  43. package/dist/schemas/orgs.js +473 -0
  44. package/dist/schemas/overviews.d.ts +205 -0
  45. package/dist/schemas/overviews.d.ts.map +1 -0
  46. package/{src/schemas/overviews.ts → dist/schemas/overviews.js} +41 -54
  47. package/dist/schemas/products.d.ts +595 -0
  48. package/dist/schemas/products.d.ts.map +1 -0
  49. package/{src/schemas/products.ts → dist/schemas/products.js} +113 -136
  50. package/dist/schemas/publish-tokens.d.ts +55 -0
  51. package/dist/schemas/publish-tokens.d.ts.map +1 -0
  52. package/{src/schemas/publish-tokens.ts → dist/schemas/publish-tokens.js} +18 -29
  53. package/dist/schemas/recommendations.d.ts +52 -0
  54. package/dist/schemas/recommendations.d.ts.map +1 -0
  55. package/dist/schemas/recommendations.js +58 -0
  56. package/dist/schemas/related.d.ts +331 -0
  57. package/dist/schemas/related.d.ts.map +1 -0
  58. package/dist/schemas/related.js +115 -0
  59. package/dist/schemas/releases.d.ts +623 -0
  60. package/dist/schemas/releases.d.ts.map +1 -0
  61. package/dist/schemas/releases.js +414 -0
  62. package/dist/schemas/resolve.d.ts +259 -0
  63. package/dist/schemas/resolve.d.ts.map +1 -0
  64. package/{src/schemas/resolve.ts → dist/schemas/resolve.js} +2 -5
  65. package/dist/schemas/search.d.ts +475 -0
  66. package/dist/schemas/search.d.ts.map +1 -0
  67. package/dist/schemas/search.js +258 -0
  68. package/dist/schemas/semantic-alert-summary.d.ts +54 -0
  69. package/dist/schemas/semantic-alert-summary.d.ts.map +1 -0
  70. package/dist/schemas/semantic-alert-summary.js +57 -0
  71. package/dist/schemas/semantic-alerts.d.ts +41 -0
  72. package/dist/schemas/semantic-alerts.d.ts.map +1 -0
  73. package/dist/schemas/semantic-alerts.js +42 -0
  74. package/dist/schemas/shared.d.ts +247 -0
  75. package/dist/schemas/shared.d.ts.map +1 -0
  76. package/dist/schemas/shared.js +248 -0
  77. package/dist/schemas/site-notice.d.ts +35 -0
  78. package/dist/schemas/site-notice.d.ts.map +1 -0
  79. package/{src/schemas/site-notice.ts → dist/schemas/site-notice.js} +14 -18
  80. package/dist/schemas/sitemap.d.ts +97 -0
  81. package/dist/schemas/sitemap.d.ts.map +1 -0
  82. package/dist/schemas/sitemap.js +107 -0
  83. package/dist/schemas/sources.d.ts +1145 -0
  84. package/dist/schemas/sources.d.ts.map +1 -0
  85. package/dist/schemas/sources.js +645 -0
  86. package/dist/schemas/stats.d.ts +82 -0
  87. package/dist/schemas/stats.d.ts.map +1 -0
  88. package/dist/schemas/stats.js +59 -0
  89. package/dist/schemas/taxonomy.d.ts +344 -0
  90. package/dist/schemas/taxonomy.d.ts.map +1 -0
  91. package/{src/schemas/taxonomy.ts → dist/schemas/taxonomy.js} +47 -58
  92. package/dist/schemas/webhooks.d.ts +618 -0
  93. package/dist/schemas/webhooks.d.ts.map +1 -0
  94. package/dist/schemas/webhooks.js +191 -0
  95. package/dist/schemas/well-known.d.ts +302 -0
  96. package/dist/schemas/well-known.d.ts.map +1 -0
  97. package/dist/schemas/well-known.js +192 -0
  98. package/dist/schemas/workspace-integrations.d.ts +27 -0
  99. package/dist/schemas/workspace-integrations.d.ts.map +1 -0
  100. package/dist/schemas/workspace-integrations.js +22 -0
  101. package/package.json +16 -4
  102. package/src/api-types.ts +0 -2223
  103. package/src/schemas/account-profile.ts +0 -28
  104. package/src/schemas/ai-models.test.ts +0 -29
  105. package/src/schemas/classifications.ts +0 -109
  106. package/src/schemas/collections.ts +0 -346
  107. package/src/schemas/errors.test.ts +0 -55
  108. package/src/schemas/errors.ts +0 -81
  109. package/src/schemas/feedback.ts +0 -56
  110. package/src/schemas/listing.ts +0 -226
  111. package/src/schemas/orgs.ts +0 -533
  112. package/src/schemas/recommendations.ts +0 -39
  113. package/src/schemas/related.ts +0 -126
  114. package/src/schemas/releases.ts +0 -436
  115. package/src/schemas/search.ts +0 -274
  116. package/src/schemas/semantic-alert-summary.ts +0 -65
  117. package/src/schemas/shared.notice.test.ts +0 -36
  118. package/src/schemas/shared.ts +0 -267
  119. package/src/schemas/site-notice.test.ts +0 -67
  120. package/src/schemas/sitemap.ts +0 -114
  121. package/src/schemas/sources.ts +0 -674
  122. package/src/schemas/stats.ts +0 -62
  123. package/src/schemas/well-known.test.ts +0 -264
  124. package/src/schemas/well-known.ts +0 -252
  125. package/src/schemas/workspace-integrations.ts +0 -26
@@ -0,0 +1,175 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Public wire contract for the self-serve listing lane (#1947):
4
+ * POST /v1/listing/validate and POST /v1/listing/activate. This projection is
5
+ * deliberately independent of the internal materialization plan — it is the
6
+ * stable shape web/CLI consume while internals stay free to change.
7
+ */
8
+ export const ListingValidateBodySchema = z.strictObject({
9
+ domain: z.string().min(1).max(255),
10
+ });
11
+ export const ListingActivateBodySchema = z.strictObject({
12
+ domain: z.string().min(1).max(255),
13
+ requestTracking: z.boolean().optional(),
14
+ });
15
+ export const ListingIssueSchema = z.strictObject({
16
+ path: z.string(),
17
+ message: z.string(),
18
+ });
19
+ /** One follow-up the owner takes after declaring `publish: "push"`. */
20
+ export const ListingSetupStepSchema = z.strictObject({
21
+ id: z.enum(["verify", "token", "action"]),
22
+ title: z.string(),
23
+ detail: z.string(),
24
+ });
25
+ export const ListingLocationSchema = z.strictObject({
26
+ /** The declared locator value (feed URL, github ref, url, appstore id, file). */
27
+ locator: z.string(),
28
+ kind: z.enum(["feed", "github", "appstore", "url", "file", "push"]),
29
+ classification: z.enum(["tier1-live", "tier2-paused-review", "push-setup"]),
30
+ /** Plain-English "what this becomes" for the preview UI. */
31
+ becomes: z.string(),
32
+ /** Present when the locator is nested under a manifest product. */
33
+ productName: z.string().optional(),
34
+ /** Changelog file or glob. Present on `kind: "push"`. */
35
+ path: z.string().optional(),
36
+ /** Present on `kind: "push"`: verify ownership, mint a token, add the Action. */
37
+ setupSteps: z.array(ListingSetupStepSchema).optional(),
38
+ });
39
+ export const ListingOrgPointerSchema = z.strictObject({
40
+ slug: z.string(),
41
+ name: z.string(),
42
+ webUrl: z.string(),
43
+ });
44
+ export const ListingValidationResultSchema = z.strictObject({
45
+ valid: z.boolean(),
46
+ errors: z.array(ListingIssueSchema),
47
+ domainStatus: z.enum(["unlisted", "listed", "stub"]),
48
+ /** Present when domainStatus is "listed" or "stub". */
49
+ org: ListingOrgPointerSchema.optional(),
50
+ /** Present when valid: identity fields as they would land. */
51
+ identity: z
52
+ .strictObject({
53
+ name: z.string(),
54
+ slug: z.string(),
55
+ domain: z.string(),
56
+ })
57
+ .optional(),
58
+ products: z.array(z.strictObject({ name: z.string(), locationCount: z.number() })).optional(),
59
+ locations: z.array(ListingLocationSchema),
60
+ });
61
+ export const ListingActivateResultSchema = z.strictObject({
62
+ /** True when this call created the stub; false for the existing-stub carve-out. */
63
+ activated: z.boolean(),
64
+ org: z.strictObject({
65
+ slug: z.string(),
66
+ name: z.string(),
67
+ status: z.enum(["stub", "tracked"]),
68
+ webUrl: z.string(),
69
+ }),
70
+ trackingRequested: z.boolean(),
71
+ });
72
+ /**
73
+ * Ownership claim flow (#1947 epic item 2): a signed-in user proves control
74
+ * of a listed domain via a well-known token file OR a DNS TXT record.
75
+ */
76
+ export const ListingClaimBodySchema = z.strictObject({
77
+ domain: z.string().min(1).max(255),
78
+ });
79
+ export const ListingClaimVerifyBodySchema = z.strictObject({
80
+ claimId: z.string().min(1),
81
+ });
82
+ export const OrgClaimStatusSchema = z.enum(["pending", "verified", "expired", "revoked"]);
83
+ export const ClaimMethodSchema = z.enum(["well-known", "dns-txt"]);
84
+ /**
85
+ * `token` + `instructions` are only present while the claim is `pending` (or
86
+ * on mint) — once verified there's nothing left to prove, and an expired
87
+ * claim's token is stale.
88
+ */
89
+ export const OrgClaimSchema = z.strictObject({
90
+ id: z.string(),
91
+ org: ListingOrgPointerSchema,
92
+ status: OrgClaimStatusSchema,
93
+ method: ClaimMethodSchema.optional(),
94
+ token: z.string().optional(),
95
+ createdAt: z.string(),
96
+ verifiedAt: z.string().optional(),
97
+ /** Set once the claim was ended by its owner or an admin (#2389). */
98
+ revokedAt: z.string().optional(),
99
+ expiresAt: z.string(),
100
+ instructions: z
101
+ .strictObject({
102
+ wellKnownUrl: z.string(),
103
+ dnsRecordName: z.string(),
104
+ })
105
+ .optional(),
106
+ });
107
+ export const ClaimCheckOutcomeSchema = z.enum(["ok", "mismatch", "unreachable"]);
108
+ export const ClaimVerifyResultSchema = z.strictObject({
109
+ verified: z.boolean(),
110
+ checked: z.strictObject({
111
+ wellKnown: ClaimCheckOutcomeSchema,
112
+ dnsTxt: ClaimCheckOutcomeSchema,
113
+ }),
114
+ claim: OrgClaimSchema,
115
+ });
116
+ export const ListingClaimsResultSchema = z.strictObject({
117
+ claims: z.array(OrgClaimSchema),
118
+ });
119
+ /**
120
+ * Admin view of every claim on an org (`GET /v1/orgs/:slug/claims`, #2389).
121
+ * Never includes the proof token.
122
+ */
123
+ export const AdminOrgClaimSchema = z.strictObject({
124
+ id: z.string(),
125
+ userId: z.string(),
126
+ status: OrgClaimStatusSchema,
127
+ method: ClaimMethodSchema.nullable(),
128
+ createdAt: z.string(),
129
+ verifiedAt: z.string().nullable(),
130
+ expiresAt: z.string(),
131
+ revokedAt: z.string().nullable(),
132
+ revokedBy: z.string().nullable(),
133
+ revokeReason: z.string().nullable(),
134
+ });
135
+ export const ListOrgClaimsResponseSchema = z.strictObject({
136
+ claims: z.array(AdminOrgClaimSchema),
137
+ });
138
+ /** `DELETE /v1/orgs/:slug/claims/:id` body — admins must say why. */
139
+ export const RevokeOrgClaimBodySchema = z.strictObject({
140
+ reason: z.string().trim().min(1).max(500),
141
+ });
142
+ /**
143
+ * Self-serve Tier-1 promotion (#1947): a verified owner
144
+ * promotes their claimed stub to `tracked`. Independent of the internal
145
+ * materialization plan — this is the stable public projection.
146
+ */
147
+ export const ListingPromoteBodySchema = z.strictObject({
148
+ domain: z.string().min(1).max(255),
149
+ });
150
+ export const ListingPromoteLocatorOutcomeSchema = z.enum(["live", "queued-for-review"]);
151
+ export const ListingPromoteLocatorSchema = z.strictObject({
152
+ locator: z.string(),
153
+ outcome: ListingPromoteLocatorOutcomeSchema,
154
+ });
155
+ export const ListingPromoteResultSchema = z.strictObject({
156
+ promoted: z.boolean(),
157
+ /** Present and true only for the idempotent already-`tracked` no-op. */
158
+ alreadyTracked: z.boolean().optional(),
159
+ sources: z.strictObject({
160
+ created: z.number(),
161
+ matched: z.number(),
162
+ }),
163
+ locators: z.array(ListingPromoteLocatorSchema),
164
+ });
165
+ /**
166
+ * Public capability flags for the listing lane. Anonymous + always reachable
167
+ * (does NOT 404 when either kill switch is off) so the web UI can hide CTAs
168
+ * instead of offering a button that fails with "Not found".
169
+ */
170
+ export const ListingCapabilitiesSchema = z.strictObject({
171
+ /** `listing-self-serve-enabled` — validate / activate / claim / verify. */
172
+ selfServeEnabled: z.boolean(),
173
+ /** `listing-self-serve-promotion-enabled` — POST /v1/listing/promote. */
174
+ promotionEnabled: z.boolean(),
175
+ });
@@ -0,0 +1,285 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Status flags returned by `POST /v1/lookups`:
4
+ * - `indexed` — the source was just materialized and releases were ingested.
5
+ * - `existing` — the source already lives in the registry; we returned it as-is.
6
+ * - `empty` — the repo exists but has no releases or CHANGELOG to ingest. A
7
+ * hidden stub row is left behind so the next cron pass can pick it up.
8
+ * - `not_found` — the repo doesn't exist, is archived, or isn't reachable.
9
+ * - `deferred` — GitHub probe rate-limited or 5xx'd; the next cron pass retries.
10
+ */
11
+ export declare const LookupStatusSchema: z.ZodEnum<{
12
+ deferred: "deferred";
13
+ empty: "empty";
14
+ existing: "existing";
15
+ indexed: "indexed";
16
+ not_found: "not_found";
17
+ }>;
18
+ /** Body accepted by `POST /v1/lookups`. v1 only supports GitHub coordinates. */
19
+ export declare const LookupBodySchema: z.ZodObject<{
20
+ provider: z.ZodLiteral<"github">;
21
+ coordinate: z.ZodString;
22
+ }, z.core.$strip>;
23
+ /**
24
+ * Source row embedded in `LookupResponse`. The handler returns the full
25
+ * Drizzle row, so `z.looseObject(...)` lets stable fields stay typed while
26
+ * letting timestamps/counters that aren't load-bearing for callers ride
27
+ * along unmodelled. Same pattern as `SourceMutationResponseSchema`.
28
+ */
29
+ export declare const LookupSourceSchema: z.ZodObject<{
30
+ id: z.ZodString;
31
+ slug: z.ZodString;
32
+ name: z.ZodString;
33
+ type: z.ZodString;
34
+ url: z.ZodString;
35
+ orgId: z.ZodNullable<z.ZodString>;
36
+ productId: z.ZodNullable<z.ZodString>;
37
+ isHidden: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
38
+ discovery: z.ZodOptional<z.ZodEnum<{
39
+ agent: "agent";
40
+ curated: "curated";
41
+ on_demand: "on_demand";
42
+ }>>;
43
+ metadata: z.ZodNullable<z.ZodString>;
44
+ stars: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
45
+ starsFetchedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ createdAt: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$loose>;
48
+ /** Release row embedded in `LookupResponse.releases`. Loose for the same reason as `LookupSourceSchema`. */
49
+ export declare const LookupReleaseSchema: z.ZodObject<{
50
+ id: z.ZodString;
51
+ sourceId: z.ZodString;
52
+ version: z.ZodNullable<z.ZodString>;
53
+ title: z.ZodString;
54
+ url: z.ZodNullable<z.ZodString>;
55
+ publishedAt: z.ZodNullable<z.ZodString>;
56
+ }, z.core.$loose>;
57
+ /** "Did you mean" rail returned alongside not_found / empty / deferred outcomes. */
58
+ export declare const LookupRelatedOrgSchema: z.ZodNullable<z.ZodObject<{
59
+ org: z.ZodObject<{
60
+ id: z.ZodString;
61
+ slug: z.ZodString;
62
+ name: z.ZodString;
63
+ }, z.core.$strip>;
64
+ sources: z.ZodArray<z.ZodObject<{
65
+ id: z.ZodString;
66
+ slug: z.ZodString;
67
+ name: z.ZodString;
68
+ url: z.ZodString;
69
+ }, z.core.$strip>>;
70
+ }, z.core.$strip>>;
71
+ /**
72
+ * Response returned by `POST /v1/lookups`. The `source` and `releases` fields
73
+ * are populated for `indexed` / `existing` outcomes; `empty` populates only
74
+ * `source`; `not_found` / `deferred` populate neither.
75
+ */
76
+ export declare const LookupResponseSchema: z.ZodObject<{
77
+ status: z.ZodEnum<{
78
+ deferred: "deferred";
79
+ empty: "empty";
80
+ existing: "existing";
81
+ indexed: "indexed";
82
+ not_found: "not_found";
83
+ }>;
84
+ source: z.ZodOptional<z.ZodObject<{
85
+ id: z.ZodString;
86
+ slug: z.ZodString;
87
+ name: z.ZodString;
88
+ type: z.ZodString;
89
+ url: z.ZodString;
90
+ orgId: z.ZodNullable<z.ZodString>;
91
+ productId: z.ZodNullable<z.ZodString>;
92
+ isHidden: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
93
+ discovery: z.ZodOptional<z.ZodEnum<{
94
+ agent: "agent";
95
+ curated: "curated";
96
+ on_demand: "on_demand";
97
+ }>>;
98
+ metadata: z.ZodNullable<z.ZodString>;
99
+ stars: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
100
+ starsFetchedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
+ createdAt: z.ZodOptional<z.ZodString>;
102
+ }, z.core.$loose>>;
103
+ releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
104
+ id: z.ZodString;
105
+ sourceId: z.ZodString;
106
+ version: z.ZodNullable<z.ZodString>;
107
+ title: z.ZodString;
108
+ url: z.ZodNullable<z.ZodString>;
109
+ publishedAt: z.ZodNullable<z.ZodString>;
110
+ }, z.core.$loose>>>;
111
+ relatedOrg: z.ZodNullable<z.ZodObject<{
112
+ org: z.ZodObject<{
113
+ id: z.ZodString;
114
+ slug: z.ZodString;
115
+ name: z.ZodString;
116
+ }, z.core.$strip>;
117
+ sources: z.ZodArray<z.ZodObject<{
118
+ id: z.ZodString;
119
+ slug: z.ZodString;
120
+ name: z.ZodString;
121
+ url: z.ZodString;
122
+ }, z.core.$strip>>;
123
+ }, z.core.$strip>>;
124
+ }, z.core.$strip>;
125
+ /** Response from `GET /v1/lookups/source-by-slug?slug=…`. */
126
+ export declare const LookupSourceBySlugResponseSchema: z.ZodObject<{
127
+ sourceId: z.ZodString;
128
+ sourceSlug: z.ZodString;
129
+ orgSlug: z.ZodString;
130
+ }, z.core.$strip>;
131
+ /** Response from `GET /v1/lookups/product-by-slug?slug=…`. */
132
+ export declare const LookupProductBySlugResponseSchema: z.ZodObject<{
133
+ productId: z.ZodString;
134
+ productSlug: z.ZodString;
135
+ orgSlug: z.ZodString;
136
+ }, z.core.$strip>;
137
+ /**
138
+ * Response from `GET /v1/lookups/by-domain?domain=…`. Resolves against the
139
+ * registry; on a complete miss may just-in-time materialize a stub from
140
+ * `/.well-known/releases.json` when listing is enabled (#2030). Both an org
141
+ * and product list can be present when a product alias points at the same
142
+ * domain its parent org owns.
143
+ */
144
+ export declare const DomainLookupOrgSchema: z.ZodObject<{
145
+ id: z.ZodString;
146
+ slug: z.ZodString;
147
+ name: z.ZodString;
148
+ domain: z.ZodNullable<z.ZodString>;
149
+ description: z.ZodNullable<z.ZodString>;
150
+ category: z.ZodNullable<z.ZodString>;
151
+ avatarUrl: z.ZodNullable<z.ZodString>;
152
+ matchedVia: z.ZodEnum<{
153
+ alias: "alias";
154
+ primary: "primary";
155
+ }>;
156
+ status: z.ZodOptional<z.ZodEnum<{
157
+ stub: "stub";
158
+ tracked: "tracked";
159
+ }>>;
160
+ locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
161
+ url: z.ZodOptional<z.ZodString>;
162
+ feed: z.ZodOptional<z.ZodString>;
163
+ github: z.ZodOptional<z.ZodString>;
164
+ appstore: z.ZodOptional<z.ZodString>;
165
+ file: z.ZodOptional<z.ZodString>;
166
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
+ canonical: z.ZodBoolean;
168
+ basis: z.ZodEnum<{
169
+ curator: "curator";
170
+ declared: "declared";
171
+ detected: "detected";
172
+ generated: "generated";
173
+ }>;
174
+ productId: z.ZodNullable<z.ZodString>;
175
+ sourceId: z.ZodNullable<z.ZodString>;
176
+ publish: z.ZodOptional<z.ZodLiteral<"push">>;
177
+ path: z.ZodOptional<z.ZodString>;
178
+ }, z.core.$strip>>>;
179
+ }, z.core.$strip>;
180
+ export declare const DomainLookupProductSchema: z.ZodObject<{
181
+ id: z.ZodString;
182
+ slug: z.ZodString;
183
+ name: z.ZodString;
184
+ orgId: z.ZodString;
185
+ orgSlug: z.ZodString;
186
+ orgName: z.ZodString;
187
+ category: z.ZodNullable<z.ZodEnum<{
188
+ ai: "ai";
189
+ cloud: "cloud";
190
+ commerce: "commerce";
191
+ crm: "crm";
192
+ database: "database";
193
+ design: "design";
194
+ "developer-tools": "developer-tools";
195
+ devops: "devops";
196
+ finance: "finance";
197
+ framework: "framework";
198
+ infrastructure: "infrastructure";
199
+ observability: "observability";
200
+ productivity: "productivity";
201
+ security: "security";
202
+ }>>;
203
+ kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
204
+ desktop: "desktop";
205
+ docs: "docs";
206
+ integration: "integration";
207
+ mobile: "mobile";
208
+ platform: "platform";
209
+ sdk: "sdk";
210
+ tool: "tool";
211
+ }>>>;
212
+ }, z.core.$strip>;
213
+ export declare const DomainLookupResponseSchema: z.ZodObject<{
214
+ domain: z.ZodString;
215
+ org: z.ZodNullable<z.ZodObject<{
216
+ id: z.ZodString;
217
+ slug: z.ZodString;
218
+ name: z.ZodString;
219
+ domain: z.ZodNullable<z.ZodString>;
220
+ description: z.ZodNullable<z.ZodString>;
221
+ category: z.ZodNullable<z.ZodString>;
222
+ avatarUrl: z.ZodNullable<z.ZodString>;
223
+ matchedVia: z.ZodEnum<{
224
+ alias: "alias";
225
+ primary: "primary";
226
+ }>;
227
+ status: z.ZodOptional<z.ZodEnum<{
228
+ stub: "stub";
229
+ tracked: "tracked";
230
+ }>>;
231
+ locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
232
+ url: z.ZodOptional<z.ZodString>;
233
+ feed: z.ZodOptional<z.ZodString>;
234
+ github: z.ZodOptional<z.ZodString>;
235
+ appstore: z.ZodOptional<z.ZodString>;
236
+ file: z.ZodOptional<z.ZodString>;
237
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
238
+ canonical: z.ZodBoolean;
239
+ basis: z.ZodEnum<{
240
+ curator: "curator";
241
+ declared: "declared";
242
+ detected: "detected";
243
+ generated: "generated";
244
+ }>;
245
+ productId: z.ZodNullable<z.ZodString>;
246
+ sourceId: z.ZodNullable<z.ZodString>;
247
+ publish: z.ZodOptional<z.ZodLiteral<"push">>;
248
+ path: z.ZodOptional<z.ZodString>;
249
+ }, z.core.$strip>>>;
250
+ }, z.core.$strip>>;
251
+ products: z.ZodArray<z.ZodObject<{
252
+ id: z.ZodString;
253
+ slug: z.ZodString;
254
+ name: z.ZodString;
255
+ orgId: z.ZodString;
256
+ orgSlug: z.ZodString;
257
+ orgName: z.ZodString;
258
+ category: z.ZodNullable<z.ZodEnum<{
259
+ ai: "ai";
260
+ cloud: "cloud";
261
+ commerce: "commerce";
262
+ crm: "crm";
263
+ database: "database";
264
+ design: "design";
265
+ "developer-tools": "developer-tools";
266
+ devops: "devops";
267
+ finance: "finance";
268
+ framework: "framework";
269
+ infrastructure: "infrastructure";
270
+ observability: "observability";
271
+ productivity: "productivity";
272
+ security: "security";
273
+ }>>;
274
+ kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
275
+ desktop: "desktop";
276
+ docs: "docs";
277
+ integration: "integration";
278
+ mobile: "mobile";
279
+ platform: "platform";
280
+ sdk: "sdk";
281
+ tool: "tool";
282
+ }>>>;
283
+ }, z.core.$strip>>;
284
+ }, z.core.$strip>;
285
+ //# sourceMappingURL=lookups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookups.d.ts","sourceRoot":"","sources":["../../src/schemas/lookups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;EAAoE,CAAC;AAEpG,gFAAgF;AAChF,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;iBAc7B,CAAC;AAEH,4GAA4G;AAC5G,eAAO,MAAM,mBAAmB;;;;;;;iBAO9B,CAAC;AAEH,oFAAoF;AACpF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;kBAOtB,CAAC;AAEd;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,6DAA6D;AAC7D,eAAO,MAAM,gCAAgC;;;;iBAI3C,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,iCAAiC;;;;iBAI5C,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBhC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYpC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIrC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { KIND_VALUES } from "@buildinternet/releases-core/kinds";
3
3
  import { CategorySchema, OrgStatusSchema, ReleaseLocationItemSchema } from "./shared.js";
4
-
5
4
  /**
6
5
  * Status flags returned by `POST /v1/lookups`:
7
6
  * - `indexed` — the source was just materialized and releases were ingested.
@@ -12,15 +11,13 @@ import { CategorySchema, OrgStatusSchema, ReleaseLocationItemSchema } from "./sh
12
11
  * - `deferred` — GitHub probe rate-limited or 5xx'd; the next cron pass retries.
13
12
  */
14
13
  export const LookupStatusSchema = z.enum(["indexed", "existing", "empty", "not_found", "deferred"]);
15
-
16
14
  /** Body accepted by `POST /v1/lookups`. v1 only supports GitHub coordinates. */
17
15
  export const LookupBodySchema = z.object({
18
- provider: z.literal("github"),
19
- coordinate: z.string().regex(/^[^/\s]+\/[^/\s]+$/, {
20
- message: "coordinate must match {org}/{repo}",
21
- }),
16
+ provider: z.literal("github"),
17
+ coordinate: z.string().regex(/^[^/\s]+\/[^/\s]+$/, {
18
+ message: "coordinate must match {org}/{repo}",
19
+ }),
22
20
  });
23
-
24
21
  /**
25
22
  * Source row embedded in `LookupResponse`. The handler returns the full
26
23
  * Drizzle row, so `z.looseObject(...)` lets stable fields stay typed while
@@ -28,67 +25,59 @@ export const LookupBodySchema = z.object({
28
25
  * along unmodelled. Same pattern as `SourceMutationResponseSchema`.
29
26
  */
30
27
  export const LookupSourceSchema = z.looseObject({
31
- id: z.string(),
32
- slug: z.string(),
33
- name: z.string(),
34
- type: z.string(),
35
- url: z.string(),
36
- orgId: z.string().nullable(),
37
- productId: z.string().nullable(),
38
- isHidden: z.boolean().nullable().optional(),
39
- discovery: z.enum(["curated", "agent", "on_demand"]).optional(),
40
- metadata: z.string().nullable(),
41
- stars: z.number().int().min(0).nullable().optional(),
42
- starsFetchedAt: z.string().nullable().optional(),
43
- createdAt: z.string().optional(),
28
+ id: z.string(),
29
+ slug: z.string(),
30
+ name: z.string(),
31
+ type: z.string(),
32
+ url: z.string(),
33
+ orgId: z.string().nullable(),
34
+ productId: z.string().nullable(),
35
+ isHidden: z.boolean().nullable().optional(),
36
+ discovery: z.enum(["curated", "agent", "on_demand"]).optional(),
37
+ metadata: z.string().nullable(),
38
+ stars: z.number().int().min(0).nullable().optional(),
39
+ starsFetchedAt: z.string().nullable().optional(),
40
+ createdAt: z.string().optional(),
44
41
  });
45
-
46
42
  /** Release row embedded in `LookupResponse.releases`. Loose for the same reason as `LookupSourceSchema`. */
47
43
  export const LookupReleaseSchema = z.looseObject({
48
- id: z.string(),
49
- sourceId: z.string(),
50
- version: z.string().nullable(),
51
- title: z.string(),
52
- url: z.string().nullable(),
53
- publishedAt: z.string().nullable(),
44
+ id: z.string(),
45
+ sourceId: z.string(),
46
+ version: z.string().nullable(),
47
+ title: z.string(),
48
+ url: z.string().nullable(),
49
+ publishedAt: z.string().nullable(),
54
50
  });
55
-
56
51
  /** "Did you mean" rail returned alongside not_found / empty / deferred outcomes. */
57
52
  export const LookupRelatedOrgSchema = z
58
- .object({
53
+ .object({
59
54
  org: z.object({ id: z.string(), slug: z.string(), name: z.string() }),
60
- sources: z.array(
61
- z.object({ id: z.string(), slug: z.string(), name: z.string(), url: z.string() }),
62
- ),
63
- })
64
- .nullable();
65
-
55
+ sources: z.array(z.object({ id: z.string(), slug: z.string(), name: z.string(), url: z.string() })),
56
+ })
57
+ .nullable();
66
58
  /**
67
59
  * Response returned by `POST /v1/lookups`. The `source` and `releases` fields
68
60
  * are populated for `indexed` / `existing` outcomes; `empty` populates only
69
61
  * `source`; `not_found` / `deferred` populate neither.
70
62
  */
71
63
  export const LookupResponseSchema = z.object({
72
- status: LookupStatusSchema,
73
- source: LookupSourceSchema.optional(),
74
- releases: z.array(LookupReleaseSchema).optional(),
75
- relatedOrg: LookupRelatedOrgSchema,
64
+ status: LookupStatusSchema,
65
+ source: LookupSourceSchema.optional(),
66
+ releases: z.array(LookupReleaseSchema).optional(),
67
+ relatedOrg: LookupRelatedOrgSchema,
76
68
  });
77
-
78
69
  /** Response from `GET /v1/lookups/source-by-slug?slug=…`. */
79
70
  export const LookupSourceBySlugResponseSchema = z.object({
80
- sourceId: z.string(),
81
- sourceSlug: z.string(),
82
- orgSlug: z.string(),
71
+ sourceId: z.string(),
72
+ sourceSlug: z.string(),
73
+ orgSlug: z.string(),
83
74
  });
84
-
85
75
  /** Response from `GET /v1/lookups/product-by-slug?slug=…`. */
86
76
  export const LookupProductBySlugResponseSchema = z.object({
87
- productId: z.string(),
88
- productSlug: z.string(),
89
- orgSlug: z.string(),
77
+ productId: z.string(),
78
+ productSlug: z.string(),
79
+ orgSlug: z.string(),
90
80
  });
91
-
92
81
  /**
93
82
  * Response from `GET /v1/lookups/by-domain?domain=…`. Resolves against the
94
83
  * registry; on a complete miss may just-in-time materialize a stub from
@@ -97,40 +86,38 @@ export const LookupProductBySlugResponseSchema = z.object({
97
86
  * domain its parent org owns.
98
87
  */
99
88
  export const DomainLookupOrgSchema = z.object({
100
- id: z.string(),
101
- slug: z.string(),
102
- name: z.string(),
103
- domain: z.string().nullable(),
104
- description: z.string().nullable(),
105
- category: z.string().nullable(),
106
- avatarUrl: z.string().nullable(),
107
- matchedVia: z.enum(["primary", "alias"]),
108
- /** Org tier (#1947). Optional for mid-deploy tolerance; absent ⇒ `"tracked"`. */
109
- status: OrgStatusSchema.optional(),
110
- /**
111
- * Declared release locations (#1947) for a stub org — the "check these
112
- * locations" answer when the domain resolves to an org with no sources yet.
113
- * Omitted/empty for a tracked org.
114
- */
115
- locations: z.array(ReleaseLocationItemSchema).optional(),
89
+ id: z.string(),
90
+ slug: z.string(),
91
+ name: z.string(),
92
+ domain: z.string().nullable(),
93
+ description: z.string().nullable(),
94
+ category: z.string().nullable(),
95
+ avatarUrl: z.string().nullable(),
96
+ matchedVia: z.enum(["primary", "alias"]),
97
+ /** Org tier (#1947). Optional for mid-deploy tolerance; absent ⇒ `"tracked"`. */
98
+ status: OrgStatusSchema.optional(),
99
+ /**
100
+ * Declared release locations (#1947) for a stub org — the "check these
101
+ * locations" answer when the domain resolves to an org with no sources yet.
102
+ * Omitted/empty for a tracked org.
103
+ */
104
+ locations: z.array(ReleaseLocationItemSchema).optional(),
116
105
  });
117
-
118
106
  export const DomainLookupProductSchema = z.object({
119
- id: z.string(),
120
- slug: z.string(),
121
- name: z.string(),
122
- orgId: z.string(),
123
- orgSlug: z.string(),
124
- orgName: z.string(),
125
- // Reuses the canonical `CategorySchema` enum because the products read
126
- // path resolves through `resolveCategoryInput` before persisting — unlike
127
- // the search catalog category, which passes the column through raw.
128
- category: CategorySchema.nullable(),
129
- kind: z.enum(KIND_VALUES).nullable().optional(),
107
+ id: z.string(),
108
+ slug: z.string(),
109
+ name: z.string(),
110
+ orgId: z.string(),
111
+ orgSlug: z.string(),
112
+ orgName: z.string(),
113
+ // Reuses the canonical `CategorySchema` enum because the products read
114
+ // path resolves through `resolveCategoryInput` before persisting — unlike
115
+ // the search catalog category, which passes the column through raw.
116
+ category: CategorySchema.nullable(),
117
+ kind: z.enum(KIND_VALUES).nullable().optional(),
130
118
  });
131
-
132
119
  export const DomainLookupResponseSchema = z.object({
133
- domain: z.string(),
134
- org: DomainLookupOrgSchema.nullable(),
135
- products: z.array(DomainLookupProductSchema),
120
+ domain: z.string(),
121
+ org: DomainLookupOrgSchema.nullable(),
122
+ products: z.array(DomainLookupProductSchema),
136
123
  });