@buildinternet/releases-api-types 0.59.0 → 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 (126) 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 -5
  102. package/src/api-types.ts +0 -2229
  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/datasets.ts +0 -31
  108. package/src/schemas/errors.test.ts +0 -55
  109. package/src/schemas/errors.ts +0 -81
  110. package/src/schemas/feedback.ts +0 -56
  111. package/src/schemas/listing.ts +0 -226
  112. package/src/schemas/orgs.ts +0 -533
  113. package/src/schemas/recommendations.ts +0 -39
  114. package/src/schemas/related.ts +0 -126
  115. package/src/schemas/releases.ts +0 -449
  116. package/src/schemas/search.ts +0 -274
  117. package/src/schemas/semantic-alert-summary.ts +0 -65
  118. package/src/schemas/shared.notice.test.ts +0 -36
  119. package/src/schemas/shared.ts +0 -267
  120. package/src/schemas/site-notice.test.ts +0 -67
  121. package/src/schemas/sitemap.ts +0 -117
  122. package/src/schemas/sources.ts +0 -674
  123. package/src/schemas/stats.ts +0 -62
  124. package/src/schemas/well-known.test.ts +0 -264
  125. package/src/schemas/well-known.ts +0 -252
  126. package/src/schemas/workspace-integrations.ts +0 -26
@@ -0,0 +1,192 @@
1
+ import { z } from "zod";
2
+ const MAX_PRODUCTS = 24;
3
+ const MAX_PRODUCT_RELEASES = 8;
4
+ const MAX_FILE_RELEASES = 32;
5
+ /** A single social handle/URL. Bare handles are intentionally accepted. */
6
+ const SocialValueSchema = z.string().min(1).max(200);
7
+ const SocialSchema = z.record(z.string().min(1).max(40), SocialValueSchema);
8
+ // `z.url().startsWith(...)` keeps the runtime URL + https check AND serializes to
9
+ // JSON Schema as `format: "uri"` + `pattern: "^https://"` — so the generated
10
+ // public schema rejects non-https schemes too (a plain `.refine()` would be
11
+ // silently dropped by z.toJSONSchema).
12
+ const HttpsUrlSchema = z.url().startsWith("https://", "locator must be an https URL");
13
+ /** Shared tag-array bounds — kept identical for org-level and product-level tags. */
14
+ const TagsSchema = z.array(z.string().min(1).max(60)).max(50);
15
+ /**
16
+ * Changelog file or glob inside the declared repo (Action `changelog-path` /
17
+ * `changelog-glob`). Relative only — no scheme, no leading slash, no `..`.
18
+ */
19
+ const PublishPathSchema = z
20
+ .string()
21
+ .min(1)
22
+ .max(200)
23
+ .regex(/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9._~@%+\-/*?[\]{}]+$/, "path must be a relative changelog file or glob");
24
+ const ReleaseLocationFields = {
25
+ url: HttpsUrlSchema.optional(),
26
+ feed: HttpsUrlSchema.optional(),
27
+ appstore: HttpsUrlSchema.optional(),
28
+ file: HttpsUrlSchema.optional(),
29
+ title: z.string().min(1).max(200).optional(),
30
+ canonical: z.boolean().optional(),
31
+ /**
32
+ * `"push"` means the owner publishes this changelog (GitHub Action / publish
33
+ * token) instead of us polling it. Requires `github` + `path`.
34
+ */
35
+ publish: z.literal("push").optional(),
36
+ /** Required with `publish: "push"`. The file or glob the Action watches. */
37
+ path: PublishPathSchema.optional(),
38
+ };
39
+ function hasLocator(value) {
40
+ return Boolean(value.url || value.feed || value.github || value.appstore || value.file);
41
+ }
42
+ /** `publish: "push"` is a mode on a github locator, not a locator by itself. */
43
+ function pushPublishComplete(value) {
44
+ if (value.publish === "push")
45
+ return Boolean(value.github && value.path);
46
+ return value.path === undefined;
47
+ }
48
+ /** A domain manifest can name a concrete GitHub repository, but never `self`. */
49
+ export const ReleasesJsonDomainReleaseSchema = z
50
+ .strictObject({
51
+ ...ReleaseLocationFields,
52
+ github: z
53
+ .string()
54
+ .regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/, "github must be owner/repo")
55
+ .optional(),
56
+ })
57
+ .refine(hasLocator, "at least one release locator is required")
58
+ .refine(pushPublishComplete, 'publish: "push" requires github (owner/repo) and path (changelog file or glob)');
59
+ /** A repo manifest additionally accepts `github: "self"`. */
60
+ export const ReleasesJsonRepoReleaseSchema = z
61
+ .strictObject({
62
+ ...ReleaseLocationFields,
63
+ github: z
64
+ .union([
65
+ z.literal("self"),
66
+ z.string().regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/, "github must be owner/repo"),
67
+ ])
68
+ .optional(),
69
+ })
70
+ .refine(hasLocator, "at least one release locator is required")
71
+ .refine(pushPublishComplete, 'publish: "push" requires github (owner/repo or "self") and path (changelog file or glob)');
72
+ function releasesArray(item, max) {
73
+ return z
74
+ .array(item)
75
+ .max(max)
76
+ .refine((items) => items.filter((entry) => Boolean(entry.canonical)).length <= 1, "at most one canonical release location is allowed per scope");
77
+ }
78
+ const DomainProductReleasesSchema = releasesArray(ReleasesJsonDomainReleaseSchema, MAX_PRODUCT_RELEASES);
79
+ const RepoReleasesSchema = releasesArray(ReleasesJsonRepoReleaseSchema, MAX_FILE_RELEASES);
80
+ const DomainReleasesSchema = releasesArray(ReleasesJsonDomainReleaseSchema, MAX_FILE_RELEASES);
81
+ /**
82
+ * Product declaration in a domain manifest. Taxonomy strings are deliberately
83
+ * lenient here; the reconciler resolves known values and ignores the rest.
84
+ */
85
+ export const ReleasesJsonProductSchema = z.strictObject({
86
+ name: z.string().min(1).max(120),
87
+ slug: z.string().min(1).max(120).optional(),
88
+ kind: z.string().min(1).max(120).optional(),
89
+ category: z.string().min(1).max(120).optional(),
90
+ description: z.string().max(2000).optional(),
91
+ website: z.url().optional(),
92
+ docs: z.url().optional(),
93
+ support: z.url().optional(),
94
+ social: SocialSchema.optional(),
95
+ tags: TagsSchema.optional(),
96
+ archived: z.boolean().optional(),
97
+ releases: DomainProductReleasesSchema.optional(),
98
+ });
99
+ /** Repo-scope product binding. Slug is only a creation suggestion. */
100
+ export const ReleasesJsonRepoProductSchema = z.strictObject({
101
+ name: z.string().min(1).max(120),
102
+ slug: z.string().min(1).max(120).optional(),
103
+ });
104
+ const ReleasesRegistrySchema = z
105
+ .object({
106
+ org: z
107
+ .string()
108
+ .regex(/^org_[A-Za-z0-9]+$/)
109
+ .optional(),
110
+ product: z
111
+ .string()
112
+ .regex(/^prd_[A-Za-z0-9]+$/)
113
+ .optional(),
114
+ verification: z.string().min(1).max(500).optional(),
115
+ })
116
+ .catchall(z.unknown());
117
+ /** Registry-specific extensions are forward-compatible by design. */
118
+ export const ReleasesJsonRegistriesSchema = z
119
+ .object({
120
+ "releases.sh": ReleasesRegistrySchema.optional(),
121
+ })
122
+ .catchall(z.unknown());
123
+ /** Top-level fields shared by every manifest scope. */
124
+ const BaseFields = {
125
+ $schema: z.url().optional(),
126
+ version: z.literal(2),
127
+ registries: ReleasesJsonRegistriesSchema.optional(),
128
+ };
129
+ const CommonFields = {
130
+ ...BaseFields,
131
+ releases: DomainReleasesSchema.optional(),
132
+ };
133
+ /** Domain-hosted variant: flat org identity plus product and release declarations. */
134
+ export const ReleasesJsonDomainSchema = z
135
+ .strictObject({
136
+ ...CommonFields,
137
+ name: z.string().min(1).max(120).optional(),
138
+ description: z.string().max(2000).optional(),
139
+ category: z.string().min(1).max(120).optional(),
140
+ avatar: HttpsUrlSchema.optional(),
141
+ tags: TagsSchema.optional(),
142
+ social: SocialSchema.optional(),
143
+ products: z.array(ReleasesJsonProductSchema).max(MAX_PRODUCTS).optional(),
144
+ })
145
+ .refine((manifest) => (manifest.releases?.length ?? 0) +
146
+ (manifest.products?.reduce((sum, product) => sum + (product.releases?.length ?? 0), 0) ??
147
+ 0) <=
148
+ MAX_FILE_RELEASES, `at most ${MAX_FILE_RELEASES} release locations are allowed per file`);
149
+ /** Repo-root variant: product binding plus repo-scoped release declarations. */
150
+ export const ReleasesJsonRepoSchema = z.strictObject({
151
+ ...BaseFields,
152
+ product: ReleasesJsonRepoProductSchema.optional(),
153
+ releases: RepoReleasesSchema.optional(),
154
+ });
155
+ /** Public schema accepts either hosting scope; reconcilers use the scoped schema. */
156
+ export const ReleasesJsonConfigSchema = z.union([ReleasesJsonDomainSchema, ReleasesJsonRepoSchema]);
157
+ /**
158
+ * Body for `POST /v1/orgs/stub` — curator-authored stub org (#1947). Mirrors
159
+ * the domain-manifest identity + product + locator shape (so a curator can hand
160
+ * the same declaration a manifest would carry), minus manifest-transport fields
161
+ * (`version`/`$schema`/`registries`) and plus the registry-identity fields a
162
+ * stub org needs to be resolvable (`slug`/`domain`). Locators are optional — an
163
+ * identity-only stub (locations TBD) is valid. `category`/taxonomy strings stay
164
+ * lenient; the route resolves them and ignores the rest, same as the reconciler.
165
+ */
166
+ export const CreateStubOrgBodySchema = z.strictObject({
167
+ name: z.string().min(1).max(120),
168
+ slug: z.string().min(1).max(120).optional(),
169
+ domain: z.string().min(1).max(255).optional(),
170
+ description: z.string().max(2000).optional(),
171
+ category: z.string().min(1).max(120).optional(),
172
+ avatar: HttpsUrlSchema.optional(),
173
+ tags: TagsSchema.optional(),
174
+ social: SocialSchema.optional(),
175
+ products: z.array(ReleasesJsonProductSchema).max(MAX_PRODUCTS).optional(),
176
+ releases: DomainReleasesSchema.optional(),
177
+ });
178
+ /**
179
+ * Body for `POST /v1/orgs/stub-from-domain` (#1947) — the unlisted-domain path.
180
+ * The worker fetches https://{domain}/.well-known/releases.json and, if valid
181
+ * and the domain has no org yet, creates a stub org + declared locators.
182
+ */
183
+ export const StubFromDomainBodySchema = z.strictObject({
184
+ domain: z.string().min(1).max(255),
185
+ });
186
+ /** Response shape of POST /v1/orgs/:slug/sync-well-known. */
187
+ export const SyncWellKnownResponseSchema = z.object({
188
+ fetched: z.boolean(),
189
+ applied: z.boolean(),
190
+ skippedReason: z.string().optional(),
191
+ plan: z.unknown().optional(),
192
+ });
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ export declare const UploadsIntegrationStatusSchema: z.ZodObject<{
3
+ provider: z.ZodLiteral<"uploads">;
4
+ connected: z.ZodBoolean;
5
+ configured: z.ZodBoolean;
6
+ connectedAt: z.ZodNullable<z.ZodString>;
7
+ scope: z.ZodNullable<z.ZodString>;
8
+ uploadsWorkspace: z.ZodNullable<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ export declare const UploadsOAuthConnectResponseSchema: z.ZodObject<{
11
+ authorizeUrl: z.ZodString;
12
+ redirectUri: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export declare const UploadsOAuthCallbackBodySchema: z.ZodObject<{
15
+ code: z.ZodString;
16
+ state: z.ZodString;
17
+ }, z.core.$strip>;
18
+ export declare const UploadsOAuthCallbackResponseSchema: z.ZodObject<{
19
+ provider: z.ZodLiteral<"uploads">;
20
+ connected: z.ZodBoolean;
21
+ configured: z.ZodBoolean;
22
+ connectedAt: z.ZodNullable<z.ZodString>;
23
+ scope: z.ZodNullable<z.ZodString>;
24
+ uploadsWorkspace: z.ZodNullable<z.ZodString>;
25
+ workspaceId: z.ZodString;
26
+ }, z.core.$strip>;
27
+ //# sourceMappingURL=workspace-integrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-integrations.d.ts","sourceRoot":"","sources":["../../src/schemas/workspace-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,8BAA8B;;;;;;;iBASzC,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;iBAG5C,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;iBAE7C,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ export const UploadsIntegrationStatusSchema = z.object({
3
+ provider: z.literal("uploads"),
4
+ connected: z.boolean(),
5
+ /** False when the token-encryption key is missing. */
6
+ configured: z.boolean(),
7
+ connectedAt: z.string().nullable(),
8
+ scope: z.string().nullable(),
9
+ /** uploads.sh workspace slug from the access-token JWT (`workspace`, else `workspaces[]`). */
10
+ uploadsWorkspace: z.string().nullable(),
11
+ });
12
+ export const UploadsOAuthConnectResponseSchema = z.object({
13
+ authorizeUrl: z.string(),
14
+ redirectUri: z.string(),
15
+ });
16
+ export const UploadsOAuthCallbackBodySchema = z.object({
17
+ code: z.string().min(1),
18
+ state: z.string().min(1),
19
+ });
20
+ export const UploadsOAuthCallbackResponseSchema = UploadsIntegrationStatusSchema.extend({
21
+ workspaceId: z.string(),
22
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/releases-api-types",
3
- "version": "0.59.0",
3
+ "version": "0.60.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,15 +10,26 @@
10
10
  "directory": "packages/api-types"
11
11
  },
12
12
  "exports": {
13
- ".": "./src/api-types.ts",
14
- "./datasets": "./src/schemas/datasets.ts"
13
+ ".": {
14
+ "types": "./dist/api-types.d.ts",
15
+ "default": "./dist/api-types.js"
16
+ },
17
+ "./datasets": {
18
+ "types": "./dist/schemas/datasets.d.ts",
19
+ "default": "./dist/schemas/datasets.js"
20
+ }
15
21
  },
16
22
  "files": [
17
- "src",
23
+ "dist",
18
24
  "README.md"
19
25
  ],
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.build.json",
28
+ "prepack": "bun ../../scripts/pack-dist.ts prepack ../core",
29
+ "postpack": "bun ../../scripts/pack-dist.ts postpack"
30
+ },
20
31
  "dependencies": {
21
- "@buildinternet/releases-core": "^0.35.0",
32
+ "@buildinternet/releases-core": "^0.36.0",
22
33
  "zod": "^4.4.3"
23
34
  },
24
35
  "publishConfig": {