@spacefast/common 0.0.26 → 0.2.1

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 (302) hide show
  1. package/dist/agents/connect-targets.d.ts +6 -146
  2. package/dist/agents/connect-targets.js +63 -295
  3. package/dist/agents/private-key-oauth.d.ts +31 -1
  4. package/dist/agents/private-key-oauth.js +124 -33
  5. package/dist/agents/registry/core.d.ts +292 -0
  6. package/dist/agents/registry/core.js +1388 -0
  7. package/dist/agents/registry/deeplink-probes.d.ts +23 -0
  8. package/dist/agents/registry/deeplink-probes.js +18 -0
  9. package/dist/agents/registry/node.d.ts +56 -0
  10. package/dist/agents/registry/node.js +339 -0
  11. package/dist/brand-assets-build.js +1 -2
  12. package/dist/brand-assets.js +4 -7
  13. package/dist/brand.d.ts +17 -0
  14. package/dist/brand.js +24 -4
  15. package/dist/config/domains.d.ts +55 -28
  16. package/dist/config/domains.js +85 -41
  17. package/dist/config/index.js +1 -2
  18. package/dist/contracts/abuse.js +9 -24
  19. package/dist/contracts/access-profiles.d.ts +86 -0
  20. package/dist/contracts/access-profiles.js +89 -0
  21. package/dist/contracts/access.d.ts +21 -27
  22. package/dist/contracts/access.js +33 -64
  23. package/dist/contracts/activity.d.ts +18 -1
  24. package/dist/contracts/activity.js +70 -26
  25. package/dist/contracts/analytics.js +8 -10
  26. package/dist/contracts/api-keys.d.ts +77 -52
  27. package/dist/contracts/api-keys.js +44 -24
  28. package/dist/contracts/application-journal.d.ts +216 -0
  29. package/dist/contracts/application-journal.js +167 -0
  30. package/dist/contracts/auth.d.ts +90 -17
  31. package/dist/contracts/auth.js +86 -17
  32. package/dist/contracts/beta.d.ts +9 -4
  33. package/dist/contracts/beta.js +20 -16
  34. package/dist/contracts/billing.js +7 -11
  35. package/dist/contracts/bootstrap.d.ts +791 -0
  36. package/dist/contracts/bootstrap.js +51 -0
  37. package/dist/contracts/builds.d.ts +186 -7
  38. package/dist/contracts/builds.js +75 -21
  39. package/dist/contracts/channels.d.ts +43 -0
  40. package/dist/contracts/channels.js +25 -9
  41. package/dist/contracts/cli.d.ts +7 -0
  42. package/dist/contracts/cli.js +6 -0
  43. package/dist/contracts/collab-public.d.ts +1 -1
  44. package/dist/contracts/collab-public.js +5 -8
  45. package/dist/contracts/comments.d.ts +45 -35
  46. package/dist/contracts/comments.js +107 -77
  47. package/dist/contracts/commerce.d.ts +165 -0
  48. package/dist/contracts/commerce.js +146 -0
  49. package/dist/contracts/common.d.ts +3 -3
  50. package/dist/contracts/common.js +18 -29
  51. package/dist/contracts/content-contract-verification.d.ts +521 -0
  52. package/dist/contracts/content-contract-verification.js +320 -0
  53. package/dist/contracts/content-platform-fixture.d.ts +1278 -0
  54. package/dist/contracts/content-platform-fixture.js +44 -0
  55. package/dist/contracts/content-program.d.ts +994 -0
  56. package/dist/contracts/content-program.js +658 -0
  57. package/dist/contracts/content-sync.d.ts +290 -0
  58. package/dist/contracts/content-sync.js +167 -0
  59. package/dist/contracts/content.d.ts +432 -0
  60. package/dist/contracts/content.js +303 -0
  61. package/dist/contracts/continuation.d.ts +17 -1
  62. package/dist/contracts/continuation.js +23 -23
  63. package/dist/contracts/countries.js +3 -4
  64. package/dist/contracts/crons.d.ts +17 -0
  65. package/dist/contracts/crons.js +33 -15
  66. package/dist/contracts/dashboard-prefs.d.ts +56 -0
  67. package/dist/contracts/dashboard-prefs.js +51 -0
  68. package/dist/contracts/device-auth.d.ts +234 -37
  69. package/dist/contracts/device-auth.js +267 -53
  70. package/dist/contracts/docs.d.ts +6 -10
  71. package/dist/contracts/docs.js +5 -13
  72. package/dist/contracts/domains.d.ts +499 -102
  73. package/dist/contracts/domains.js +169 -58
  74. package/dist/contracts/email-preferences.d.ts +3 -3
  75. package/dist/contracts/email-preferences.js +6 -7
  76. package/dist/contracts/enums.d.ts +26 -26
  77. package/dist/contracts/enums.js +61 -54
  78. package/dist/contracts/error-code-meta.d.ts +269 -7
  79. package/dist/contracts/error-code-meta.js +80 -5
  80. package/dist/contracts/error-codes.d.ts +5 -5
  81. package/dist/contracts/error-codes.js +78 -16
  82. package/dist/contracts/events.d.ts +100 -20
  83. package/dist/contracts/events.js +107 -20
  84. package/dist/contracts/execution.d.ts +47 -66
  85. package/dist/contracts/execution.js +51 -64
  86. package/dist/contracts/feature-lifecycle.d.ts +70 -14
  87. package/dist/contracts/feature-lifecycle.js +86 -15
  88. package/dist/contracts/features.d.ts +100 -37
  89. package/dist/contracts/features.js +21 -27
  90. package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
  91. package/dist/contracts/frame-session.d.ts +192 -0
  92. package/dist/contracts/frame-session.js +164 -0
  93. package/dist/contracts/functions.d.ts +218 -211
  94. package/dist/contracts/functions.js +273 -260
  95. package/dist/contracts/grant-copy.d.ts +43 -0
  96. package/dist/contracts/grant-copy.js +44 -0
  97. package/dist/contracts/grants.d.ts +64 -56
  98. package/dist/contracts/grants.js +124 -23
  99. package/dist/contracts/ids.d.ts +4 -1
  100. package/dist/contracts/ids.js +4 -1
  101. package/dist/contracts/internal.d.ts +5 -4
  102. package/dist/contracts/internal.js +12 -3
  103. package/dist/contracts/mcp.d.ts +17 -0
  104. package/dist/contracts/mcp.js +23 -0
  105. package/dist/contracts/me.d.ts +6 -1
  106. package/dist/contracts/me.js +12 -6
  107. package/dist/contracts/notifications.d.ts +27 -29
  108. package/dist/contracts/notifications.js +9 -4
  109. package/dist/contracts/oauth-resources.d.ts +112 -10
  110. package/dist/contracts/oauth-resources.js +116 -11
  111. package/dist/contracts/oauth-scope-actions.d.ts +90 -0
  112. package/dist/contracts/oauth-scope-actions.js +126 -0
  113. package/dist/contracts/operations.d.ts +27 -4
  114. package/dist/contracts/operations.js +11 -5
  115. package/dist/contracts/pages.d.ts +29 -5
  116. package/dist/contracts/pages.js +22 -5
  117. package/dist/contracts/partner-notifications.d.ts +3 -0
  118. package/dist/contracts/partner-notifications.js +65 -0
  119. package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
  120. package/dist/contracts/{platform.js → partner.js} +27 -40
  121. package/dist/contracts/plan-policy.d.ts +1 -1
  122. package/dist/contracts/principal-assertion.d.ts +43 -0
  123. package/dist/contracts/principal-assertion.js +67 -0
  124. package/dist/contracts/principals.d.ts +73 -0
  125. package/dist/contracts/principals.js +59 -0
  126. package/dist/contracts/privacy.d.ts +11 -0
  127. package/dist/contracts/privacy.js +17 -0
  128. package/dist/contracts/problem-document.js +3 -4
  129. package/dist/contracts/publish-archive.d.ts +116 -18
  130. package/dist/contracts/publish-archive.js +6 -3
  131. package/dist/contracts/push-new.d.ts +4 -4
  132. package/dist/contracts/quotas.js +3 -3
  133. package/dist/contracts/realtime.d.ts +52 -0
  134. package/dist/contracts/realtime.js +54 -0
  135. package/dist/contracts/repository-connections.d.ts +1 -1
  136. package/dist/contracts/repository-connections.js +6 -2
  137. package/dist/contracts/resources.d.ts +105 -14
  138. package/dist/contracts/resources.js +145 -21
  139. package/dist/contracts/route-inventory.d.ts +358 -0
  140. package/dist/contracts/route-inventory.js +141 -0
  141. package/dist/contracts/runtime-api.d.ts +112 -35
  142. package/dist/contracts/runtime-api.js +86 -66
  143. package/dist/contracts/runtime-app.d.ts +11 -21
  144. package/dist/contracts/runtime-app.js +39 -24
  145. package/dist/contracts/runtime-components.d.ts +143 -0
  146. package/dist/contracts/runtime-components.js +199 -0
  147. package/dist/contracts/runtime-db.d.ts +45 -19
  148. package/dist/contracts/runtime-db.js +85 -20
  149. package/dist/contracts/runtime-purge.js +3 -5
  150. package/dist/contracts/runtime-services.d.ts +43 -75
  151. package/dist/contracts/runtime-services.js +29 -49
  152. package/dist/contracts/runtime-storage.d.ts +14 -14
  153. package/dist/contracts/runtime-storage.js +28 -13
  154. package/dist/contracts/sf-config-v1.d.ts +14 -18
  155. package/dist/contracts/slugs.js +13 -4
  156. package/dist/contracts/space-config.d.ts +235 -28
  157. package/dist/contracts/space-config.js +246 -91
  158. package/dist/contracts/spaces.d.ts +360 -255
  159. package/dist/contracts/spaces.js +190 -122
  160. package/dist/contracts/superadmin-activity.d.ts +3 -43
  161. package/dist/contracts/superadmin-activity.js +6 -30
  162. package/dist/contracts/superadmin-emails.d.ts +1 -0
  163. package/dist/contracts/superadmin-emails.js +17 -1
  164. package/dist/contracts/superadmin-runtime.d.ts +199 -0
  165. package/dist/contracts/superadmin-runtime.js +141 -0
  166. package/dist/contracts/superadmin-search.d.ts +22 -2
  167. package/dist/contracts/superadmin-search.js +14 -6
  168. package/dist/contracts/superadmin-spaces.d.ts +435 -186
  169. package/dist/contracts/superadmin-spaces.js +131 -25
  170. package/dist/contracts/superadmin-teams.d.ts +3 -0
  171. package/dist/contracts/superadmin-teams.js +1 -2
  172. package/dist/contracts/superadmin-tenants.d.ts +627 -6
  173. package/dist/contracts/superadmin-tenants.js +32 -7
  174. package/dist/contracts/superadmin.d.ts +98 -16
  175. package/dist/contracts/superadmin.js +63 -10
  176. package/dist/contracts/tags.d.ts +85 -58
  177. package/dist/contracts/tags.js +44 -34
  178. package/dist/contracts/teams.d.ts +72 -9
  179. package/dist/contracts/teams.js +84 -25
  180. package/dist/contracts/tenants.d.ts +135 -0
  181. package/dist/contracts/tenants.js +120 -0
  182. package/dist/contracts/test-triggers.d.ts +70 -0
  183. package/dist/contracts/test-triggers.js +116 -0
  184. package/dist/contracts/theme-json.js +3 -8
  185. package/dist/contracts/transfers.d.ts +1 -0
  186. package/dist/contracts/transfers.js +1 -0
  187. package/dist/contracts/usage.d.ts +209 -0
  188. package/dist/contracts/usage.js +124 -12
  189. package/dist/contracts/variables.d.ts +2 -2
  190. package/dist/contracts/variables.js +9 -13
  191. package/dist/contracts/webhooks.d.ts +13 -5
  192. package/dist/contracts/webhooks.js +3 -1
  193. package/dist/contracts/zero.d.ts +57 -64
  194. package/dist/contracts/zero.js +68 -66
  195. package/dist/dashboard-paths/index.d.ts +24 -21
  196. package/dist/dashboard-paths/index.js +35 -47
  197. package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
  198. package/dist/dashboard-paths/route-reservations.generated.js +36 -0
  199. package/dist/docs/agent-arrival.d.ts +92 -0
  200. package/dist/docs/agent-arrival.js +227 -0
  201. package/dist/docs/agent-output-policy.d.ts +6 -0
  202. package/dist/docs/agent-output-policy.js +22 -0
  203. package/dist/docs/agent-prose.d.ts +11 -17
  204. package/dist/docs/agent-prose.js +62 -37
  205. package/dist/docs/agent-setup.d.ts +72 -41
  206. package/dist/docs/agent-setup.js +336 -436
  207. package/dist/docs/catalog.d.ts +147 -89
  208. package/dist/docs/catalog.js +157 -42
  209. package/dist/docs/error-docs.d.ts +2098 -1
  210. package/dist/docs/error-docs.js +281 -16
  211. package/dist/docs/index-build.d.ts +0 -1
  212. package/dist/docs/index-build.js +2 -3
  213. package/dist/docs/page-context-prompt.d.ts +77 -0
  214. package/dist/docs/page-context-prompt.js +131 -0
  215. package/dist/docs/reference-urls.d.ts +46 -0
  216. package/dist/docs/reference-urls.js +79 -0
  217. package/dist/docs/search.d.ts +6 -8
  218. package/dist/docs/search.js +10 -13
  219. package/dist/docs/skill-distribution.d.ts +4 -1
  220. package/dist/docs/skill-distribution.js +10 -5
  221. package/dist/docs/skills.d.ts +117 -117
  222. package/dist/docs/skills.js +120 -72
  223. package/dist/docs/start-prompts.d.ts +45 -0
  224. package/dist/docs/start-prompts.js +62 -0
  225. package/dist/domain-exploration.js +9 -13
  226. package/dist/og-template.d.ts +56 -0
  227. package/dist/og-template.js +56 -0
  228. package/dist/slug-policy/index.js +5 -11
  229. package/dist/utils/browser-credential.d.ts +13 -6
  230. package/dist/utils/browser-credential.js +14 -7
  231. package/dist/utils/build-settings.d.ts +16 -0
  232. package/dist/utils/build-settings.js +63 -17
  233. package/dist/utils/canonical-json.d.ts +3 -5
  234. package/dist/utils/canonical-json.js +3 -5
  235. package/dist/utils/cast-transport.d.ts +5 -17
  236. package/dist/utils/cast-transport.js +6 -19
  237. package/dist/utils/claim-token.js +1 -2
  238. package/dist/utils/comment-avatars.js +4 -6
  239. package/dist/utils/concurrency.js +2 -3
  240. package/dist/utils/content-type.d.ts +7 -6
  241. package/dist/utils/content-type.js +73 -51
  242. package/dist/utils/credential-policy.d.ts +50 -6
  243. package/dist/utils/credential-policy.js +123 -57
  244. package/dist/utils/egress-policy.fixtures.json +1 -1
  245. package/dist/utils/generate-space-name.d.ts +3 -8
  246. package/dist/utils/generate-space-name.js +3 -8
  247. package/dist/utils/grants.d.ts +0 -1
  248. package/dist/utils/grants.js +4 -7
  249. package/dist/utils/gravatar.d.ts +2 -4
  250. package/dist/utils/gravatar.js +6 -12
  251. package/dist/utils/id-hints.js +14 -23
  252. package/dist/utils/idempotency.d.ts +3 -3
  253. package/dist/utils/idempotency.js +6 -7
  254. package/dist/utils/local-space-state.d.ts +15 -15
  255. package/dist/utils/local-space-state.js +34 -23
  256. package/dist/utils/oauth-signed-query.d.ts +3 -5
  257. package/dist/utils/oauth-signed-query.js +6 -9
  258. package/dist/utils/one-shot-replay.d.ts +3 -5
  259. package/dist/utils/one-shot-replay.js +3 -5
  260. package/dist/utils/page-colors.d.ts +4 -10
  261. package/dist/utils/page-colors.js +11 -35
  262. package/dist/utils/page-fonts.js +6 -11
  263. package/dist/utils/page-preview.d.ts +0 -1
  264. package/dist/utils/page-preview.js +0 -1
  265. package/dist/utils/pages.d.ts +22 -11
  266. package/dist/utils/pages.js +70 -30
  267. package/dist/utils/privacy-regions.d.ts +19 -0
  268. package/dist/utils/privacy-regions.js +91 -0
  269. package/dist/utils/publish-form-data.d.ts +4 -5
  270. package/dist/utils/publish-form-data.js +2 -3
  271. package/dist/utils/publish-policy.d.ts +10 -23
  272. package/dist/utils/publish-policy.js +63 -116
  273. package/dist/utils/query-client.d.ts +2 -0
  274. package/dist/utils/query-client.js +10 -1
  275. package/dist/utils/runtime-paths.d.ts +4 -4
  276. package/dist/utils/runtime-paths.js +6 -8
  277. package/dist/utils/runtime-upload.d.ts +4 -0
  278. package/dist/utils/runtime-upload.js +5 -0
  279. package/dist/utils/secure-local-file.d.ts +3 -3
  280. package/dist/utils/secure-local-file.js +18 -24
  281. package/dist/utils/space-config.d.ts +11 -14
  282. package/dist/utils/space-config.js +10 -16
  283. package/dist/utils/static-runtime-policy.d.ts +5 -8
  284. package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
  285. package/dist/utils/static-runtime-policy.generated.js +70 -0
  286. package/dist/utils/static-runtime-policy.js +17 -84
  287. package/dist/utils/storage-policy.js +1 -2
  288. package/dist/utils/upload-session.js +8 -14
  289. package/dist/utils/version-path.js +11 -19
  290. package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
  291. package/dist/utils/wpcom-auth-redirects.js +1 -4
  292. package/dist/vocabulary.d.ts +7 -7
  293. package/dist/vocabulary.js +30 -16
  294. package/package.json +14 -2
  295. package/dist/agents/client-registry.d.ts +0 -22
  296. package/dist/agents/client-registry.js +0 -41
  297. package/dist/docs/agent-handoff-document.d.ts +0 -15
  298. package/dist/docs/agent-handoff-document.js +0 -180
  299. package/dist/docs/agent-solutions.d.ts +0 -110
  300. package/dist/docs/agent-solutions.js +0 -183
  301. package/dist/utils/query-keys.d.ts +0 -84
  302. package/dist/utils/query-keys.js +0 -108
@@ -1,12 +1,19 @@
1
1
  import { z } from "zod";
2
2
  import { AnyObjectSchema, baseDiagnosticSchema, CursorPaginationSchema, cursorListQuerySchema, DnsInstructionSchema, mutationEnvelope, requiredActionsSchema, } from "./common.js";
3
+ import {} from "./enums.js";
3
4
  import { PrincipalRefSchema } from "./resources.js";
5
+ /**
6
+ * Whether a name is the registrable domain itself or a hostname beneath one.
7
+ * Only the server can answer it — the Public Suffix List is what separates
8
+ * `example.co.uk` (apex) from `www.example.com` (hostname), and shipping the
9
+ * list to a browser costs more than the answer is worth.
10
+ */
11
+ export const domainKindSchema = z.enum(["hostname", "apex"]);
4
12
  // ---------------------------------------------------------------------------
5
- // Domain resource (the platform spec). A canonical name
6
- // owned by a tenant-local principal, plus its registrar/DNS facets and THE
7
- // serving pointer/whole-host redirect intent.
13
+ // Domain resource (the platform spec): a canonical name owned by a
14
+ // tenant-local principal, plus its registrar/DNS facets and serving intent.
8
15
  // ---------------------------------------------------------------------------
9
- // Registration (who you pay) facet — present only on apex records.
16
+ // Registration facet: who you pay.
10
17
  export const domainRegistrarFacetSchema = z.object({
11
18
  mode: z
12
19
  .enum(["stattic", "external"])
@@ -31,8 +38,8 @@ export const domainRegistrarFacetSchema = z.object({
31
38
  .optional()
32
39
  .describe("Whether outbound transfers are locked at the registrar."),
33
40
  });
34
- // DNS hosting (who answers queries) facet — present only on zone-cut-owning
35
- // records: the apex, or a hostname with verified NS delegation.
41
+ // DNS hosting facet: who answers queries. Zone-cut-owning records are the
42
+ // apex, or a hostname with verified NS delegation.
36
43
  export const domainDnsFacetSchema = z.object({
37
44
  mode: z
38
45
  .enum(["stattic", "external"])
@@ -172,8 +179,8 @@ export const domainRedirectTargetSchema = z
172
179
  export const domainRedirectStatusSchema = z
173
180
  .union([z.literal(301), z.literal(302), z.literal(307), z.literal(308)])
174
181
  .describe("HTTP redirect status. Defaults to 308.");
175
- // A domain either serves its Space or redirects away from it whole-host
176
- // only. Path-level routing belongs in the serving Space's `_redirects`.
182
+ // A domain either serves its Space or redirects away from it, whole-host only.
183
+ // Path-level routing belongs in the serving Space's `_redirects`.
177
184
  export const domainRedirectSchema = z.object({
178
185
  to: domainRedirectTargetSchema,
179
186
  status: domainRedirectStatusSchema,
@@ -181,7 +188,7 @@ export const domainRedirectSchema = z.object({
181
188
  export const DomainSchema = z.object({
182
189
  id: z.string().describe("Domain inventory record id (`dom_...`)."),
183
190
  tenantId: z.string().describe("Tenant that owns this record (`ten_...`)."),
184
- principal: PrincipalRefSchema.describe("Tenant-local principal that owns this domain: a team in the main tenant, an external customer in platform integrations."),
191
+ principal: PrincipalRefSchema.describe("Tenant-local principal that owns this domain: a team in the main tenant, an external customer in partner integrations."),
185
192
  name: z
186
193
  .string()
187
194
  .describe("Canonical lowercase ASCII A-labels (IDNA2008/punycode), no trailing dot, no wildcard label."),
@@ -189,9 +196,7 @@ export const DomainSchema = z.object({
189
196
  .string()
190
197
  .optional()
191
198
  .describe("Read-only U-label form, present only when it differs from `name`."),
192
- kind: z
193
- .enum(["hostname", "apex"])
194
- .describe("Derived field, never create input: `apex` if and only if `name` equals `derivedGroup`."),
199
+ kind: domainKindSchema.describe("Derived field, never create input: `apex` if and only if `name` equals `derivedGroup`."),
195
200
  wildcardEnabled: z
196
201
  .boolean()
197
202
  .describe("Whether wildcard hostnames can be derived from this record."),
@@ -257,23 +262,42 @@ export const spaceDomainSchema = z.discriminatedUnion("source", [
257
262
  spaceManagedDomainSchema,
258
263
  spaceCustomDomainSchema,
259
264
  ]);
265
+ // A space's serving addresses are a bounded set the API returns whole; there is
266
+ // no cursor to accept, so there is no `pagination` to advertise.
260
267
  export const spaceDomainListResponseSchema = z.object({
261
268
  data: z.array(spaceDomainSchema),
262
- pagination: CursorPaginationSchema,
263
269
  });
264
- export const teamManagedDomainSchema = spaceManagedDomainSchema.extend({
270
+ export const spaceDomainCreateRequestSchema = z
271
+ .object({
272
+ name: z
273
+ .string()
274
+ .trim()
275
+ .min(1)
276
+ .max(253)
277
+ .describe("Apex or concrete hostname to add and assign; the server canonicalizes it."),
278
+ primary: z
279
+ .boolean()
280
+ .default(false)
281
+ .describe("Whether this domain becomes the space's primary hostname."),
282
+ })
283
+ .strict();
284
+ // One item of `/v1/managed-domains`: a space's managed hostname plus the fields
285
+ // that name its owning space. The `teamId` query only filters which spaces are
286
+ // in scope, so this is not a team-shaped variant.
287
+ export const managedDomainListItemSchema = spaceManagedDomainSchema.extend({
265
288
  spaceId: z.string().describe("Space that owns this managed hostname."),
266
289
  spaceSlug: z.string().describe("Current project slug for the owning space."),
267
290
  spaceTitle: z.string().describe("Current title for the owning space."),
268
291
  });
269
- export const teamManagedDomainListResponseSchema = z.object({
270
- data: z.array(teamManagedDomainSchema),
271
- pagination: CursorPaginationSchema,
292
+ // Managed hostnames are derived from the caller's accessible spaces and
293
+ // returned whole — `/v1/managed-domains` accepts no cursor, so it declares no
294
+ // pagination.
295
+ export const managedDomainListResponseSchema = z.object({
296
+ data: z.array(managedDomainListItemSchema),
272
297
  });
273
- // Pre-add advisory check. `canHost` mirrors the hosting provider's
274
- // hostability verdict: `false` often means the domain is blocklisted or
275
- // already attached to other provider infrastructure (which a later TXT
276
- // ownership proof can still claim), so clients warn — they never hard-block.
298
+ // Pre-add advisory check. A `false` verdict usually means the domain is
299
+ // blocklisted or attached to other provider infrastructure, which a later TXT
300
+ // ownership proof can still claim, so clients warn instead of hard-blocking.
277
301
  export const domainPreflightQuerySchema = z.object({
278
302
  name: z
279
303
  .string()
@@ -281,6 +305,11 @@ export const domainPreflightQuerySchema = z.object({
281
305
  .min(1)
282
306
  .max(253)
283
307
  .describe("Apex or concrete hostname to preflight; canonicalized server-side."),
308
+ teamId: z
309
+ .string()
310
+ .min(1)
311
+ .optional()
312
+ .describe("Team the domain would be added to. Defaults the same way `POST /v1/domains` does."),
284
313
  });
285
314
  export const domainPreflightSchema = z.object({
286
315
  name: z.string().describe("Canonical lowercase ASCII form of the requested hostname."),
@@ -288,6 +317,7 @@ export const domainPreflightSchema = z.object({
288
317
  .string()
289
318
  .optional()
290
319
  .describe("Read-only U-label form, present only when it differs from `name`."),
320
+ kind: domainKindSchema.describe("Whether the name is the registrable domain itself or a hostname under one. Decided server-side against the Public Suffix List, so `example.co.uk` is an apex and `www.example.com` is not."),
291
321
  canHost: z
292
322
  .boolean()
293
323
  .nullable()
@@ -310,19 +340,62 @@ export const domainCreateRequestSchema = z.object({
310
340
  .optional()
311
341
  .describe("Owning team. Defaults to the active team for sessions and the API key's team."),
312
342
  });
343
+ // One PATCH, one intent. The strict branches keep metadata, assignment,
344
+ // unassignment, and whole-host redirect on the domain resource without ever
345
+ // accepting a partial or ambiguous combination.
346
+ //
313
347
  // Facet modes are never PATCHable: `dns.mode` changes only via POST /dns and
314
- // `registrar.mode` only via POST /registration. The PATCHable surface is
315
- // `wildcardEnabled` (and future metadata) only.
316
- export const domainPatchSchema = z
348
+ // `registrar.mode` only via POST /registration.
349
+ const domainMetadataPatchSchema = z
317
350
  .object({
318
351
  wildcardEnabled: z
319
352
  .boolean()
320
- .optional()
321
353
  .describe("Pass `true` to allow wildcard bindings under this domain record. Pass `false` to disallow them."),
322
354
  })
323
- .refine((value) => Object.keys(value).length > 0, {
324
- message: "At least one domain field is required.",
355
+ .strict();
356
+ const domainAssignPatchSchema = z
357
+ .object({
358
+ spaceId: z.string().trim().min(1).describe("Space this hostname should select."),
359
+ primary: z.boolean().describe("Whether this domain becomes its Space's primary hostname."),
360
+ redirect: domainRedirectSchema
361
+ .nullable()
362
+ .optional()
363
+ .describe("Whole-host redirect target, or null to clear it."),
364
+ })
365
+ .strict();
366
+ const domainUnassignPatchSchema = z
367
+ .object({ spaceId: z.null().describe("Pass null to unassign the domain from its Space.") })
368
+ .strict();
369
+ const domainRedirectPatchSchema = z
370
+ .object({
371
+ redirect: domainRedirectSchema
372
+ .nullable()
373
+ .describe("Whole-host redirect target, or null to clear it."),
374
+ })
375
+ .strict();
376
+ export const domainPatchSchema = z
377
+ .union([
378
+ domainMetadataPatchSchema,
379
+ domainAssignPatchSchema,
380
+ domainUnassignPatchSchema,
381
+ domainRedirectPatchSchema,
382
+ ])
383
+ .superRefine((value, context) => {
384
+ if ("redirect" in value && value.redirect && "primary" in value && value.primary) {
385
+ context.addIssue({
386
+ code: "custom",
387
+ path: ["primary"],
388
+ message: "A redirecting domain cannot be the Space's primary hostname.",
389
+ });
390
+ }
325
391
  });
392
+ export function domainPatchIntent(body) {
393
+ if ("wildcardEnabled" in body)
394
+ return { kind: "metadata", body };
395
+ if (!("spaceId" in body))
396
+ return { kind: "redirect", body };
397
+ return body.spaceId === null ? { kind: "unassign" } : { kind: "assign", body };
398
+ }
326
399
  // ---------------------------------------------------------------------------
327
400
  // Registrar facet routes (feature-flagged dev-only per charter D5).
328
401
  // ---------------------------------------------------------------------------
@@ -455,17 +528,14 @@ export const domainNameserverUpdateSchema = z.object({
455
528
  .max(13)
456
529
  .describe("Nameserver hostnames to delegate to (2-13)."),
457
530
  });
458
- // Facet modes change only here, never via PATCH. The response is the
459
- // post-mutation Domain plus an operation for callers watching the work item.
531
+ // Facet modes change only here, never via PATCH.
460
532
  export const domainDnsModeRequestSchema = z.object({
461
533
  mode: z
462
534
  .enum(["stattic", "external"])
463
535
  .describe("Target DNS hosting mode. On `external` to `stattic`, the server snapshots observed records first."),
464
536
  });
465
- // The transition receipt rides inside `data` (envelope law: `{data}` plus
466
- // `operation` only): the post-mutation Domain plus the transition diagnostics
467
- // (import visibility limits on external→stattic, exported records to re-create
468
- // on stattic→external).
537
+ // The transition receipt rides inside `data`; the envelope law allows `{data}`
538
+ // plus `operation` only.
469
539
  export const domainDnsModeResponseSchema = mutationEnvelope(z.object({
470
540
  domain: DomainSchema.describe("The post-mutation Domain."),
471
541
  diagnostics: z
@@ -645,12 +715,8 @@ export const domainDnsProviderWriteStrategySchema = z.enum([
645
715
  "batch_transaction",
646
716
  "replace_all_record_sets",
647
717
  ]);
648
- // Hybrid DNS mode (both available at launch). `authoritative` = Spacefast hosts
649
- // the zone and answers queries (registrar_dns / stattic_nameservers backends);
650
- // `adapter` = Spacefast manages records on the user's existing DNS host through
651
- // that host's API (connected_provider) or only observes them and emits
652
- // instructions (unmanaged_external). Additive read-model label derived from
653
- // `managementKind`; it never changes how records are applied.
718
+ // Additive read-model label derived from `managementKind` (see
719
+ // `deriveDnsHybridMode`). It never changes how records are applied.
654
720
  export const domainDnsHybridModeSchema = z
655
721
  .enum(["authoritative", "adapter"])
656
722
  .describe("Whether Spacefast hosts the authoritative zone (`authoritative`) or manages/observes records on the user's existing DNS host (`adapter`).");
@@ -660,9 +726,7 @@ const DNS_MANAGEMENT_KINDS = [
660
726
  "registrar_dns",
661
727
  "stattic_nameservers",
662
728
  ];
663
- // Single source of truth mapping management kind -> hybrid mode. Spacefast-hosted
664
- // zones (registrar_dns, stattic_nameservers) are authoritative; provider and
665
- // external backends are adapter-mode.
729
+ // Single source of truth mapping management kind to hybrid mode.
666
730
  export function deriveDnsHybridMode(managementKind) {
667
731
  return managementKind === "registrar_dns" || managementKind === "stattic_nameservers"
668
732
  ? "authoritative"
@@ -736,7 +800,13 @@ export const domainProviderConnectionStatusSchema = z.enum([
736
800
  "reconnect_required",
737
801
  "disabled",
738
802
  ]);
739
- export const domainDnsProviderSchema = z.enum([
803
+ /**
804
+ * The DNS providers a Domain can name on the wire: the internal column
805
+ * vocabulary (`domainDnsProviderValues`) minus the two values that never leave
806
+ * the control plane — `none` (an unset column) and `dsapi` (our registrar's own
807
+ * DNS, which surfaces as `stattic`).
808
+ */
809
+ export const DOMAIN_DNS_PROVIDERS = [
740
810
  "cloudflare",
741
811
  "vercel",
742
812
  "wpcom",
@@ -744,7 +814,8 @@ export const domainDnsProviderSchema = z.enum([
744
814
  "route53",
745
815
  "stattic",
746
816
  "manual",
747
- ]);
817
+ ];
818
+ export const domainDnsProviderSchema = z.enum(DOMAIN_DNS_PROVIDERS);
748
819
  export const domainProviderConnectionSchema = z.object({
749
820
  id: z.string().describe("Provider connection id (`dpc_...`)."),
750
821
  tenantId: z.string().describe("Tenant that owns this connection."),
@@ -816,19 +887,50 @@ export const domainProviderZoneAttachSchema = z.object({
816
887
  providerZoneId: z.string().min(1).max(255),
817
888
  providerZoneName: z.string().trim().min(1).max(255).optional(),
818
889
  });
819
- export const domainConnectDiscoverySchema = z.object({
820
- supported: z.boolean(),
821
- gated: z.boolean().optional(),
822
- provider: z
823
- .object({
824
- urlSyncUX: z.string().url().optional(),
825
- urlAPI: z.string().url().optional(),
826
- urlControlPanel: z.string().url().optional(),
827
- providerName: z.string().optional(),
828
- })
829
- .optional(),
830
- checkedAt: z.string().datetime(),
890
+ const domainConnectProviderSchema = z.object({
891
+ id: z.string().describe("DNS provider identifier returned by Domain Connect discovery."),
892
+ name: z.string().describe("DNS provider name returned by Domain Connect discovery."),
893
+ displayName: z.string().optional(),
894
+ controlPanelUrl: z.string().url().optional(),
831
895
  });
896
+ const domainConnectUnavailableReasonSchema = z.enum([
897
+ "domain_not_bound",
898
+ "configuration_unsupported",
899
+ "discovery_not_advertised",
900
+ "discovery_ambiguous",
901
+ "settings_not_found",
902
+ "settings_invalid",
903
+ "sync_flow_unsupported",
904
+ "template_unsupported",
905
+ "provider_unavailable",
906
+ "signing_unavailable",
907
+ ]);
908
+ export const domainConnectDiscoverySchema = z.discriminatedUnion("status", [
909
+ z.object({
910
+ status: z.literal("available"),
911
+ checkedAt: z.string().datetime(),
912
+ provider: domainConnectProviderSchema,
913
+ template: z.object({
914
+ providerId: z.string(),
915
+ serviceId: z.string(),
916
+ version: z.number().int().nullable(),
917
+ }),
918
+ applyUrl: z.string().url().describe("Signed DNS-provider approval URL."),
919
+ }),
920
+ z.object({
921
+ status: z.literal("unsupported"),
922
+ reason: domainConnectUnavailableReasonSchema,
923
+ checkedAt: z.string().datetime(),
924
+ provider: domainConnectProviderSchema.optional(),
925
+ gated: z.boolean().optional(),
926
+ }),
927
+ z.object({
928
+ status: z.literal("unavailable"),
929
+ reason: domainConnectUnavailableReasonSchema,
930
+ checkedAt: z.string().datetime(),
931
+ provider: domainConnectProviderSchema.optional(),
932
+ }),
933
+ ]);
832
934
  export const domainConnectDiscoveryResponseSchema = z.object({
833
935
  data: domainConnectDiscoverySchema,
834
936
  });
@@ -1127,8 +1229,7 @@ export const domainDnsRecordPatchSchema = domainDnsRecordPatchableFields
1127
1229
  message: "At least one DNS record field is required.",
1128
1230
  })
1129
1231
  .superRefine(requireMxSrvPriority);
1130
- // Executed in exactly this order deletes, patches, puts, posts as one
1131
- // atomic transaction; any failure rejects the whole batch with an RFC 6901
1232
+ // One atomic transaction. Any failure rejects the whole batch with an RFC 6901
1132
1233
  // JSON Pointer to the failing entry in the problem document's `pointer`.
1133
1234
  export const domainDnsRecordBatchSchema = z
1134
1235
  .object({
@@ -1226,3 +1327,13 @@ export const domainDiagnosticsResponseSchema = z.object({
1226
1327
  .array(domainHostnameDiagnosticsSchema)
1227
1328
  .describe("Per-hostname DNS and SSL connectivity diagnostics."),
1228
1329
  });
1330
+ export const domainSslRetrySchema = z.object({
1331
+ requestedAt: z.string().datetime(),
1332
+ retries: z.array(z.object({
1333
+ hostname: z.string(),
1334
+ queued: z.boolean(),
1335
+ error: z.enum(["not_hosted_here"]).nullable(),
1336
+ })),
1337
+ hostnameDiagnostics: z.array(domainHostnameDiagnosticsSchema),
1338
+ });
1339
+ export const domainSslRetryResponseSchema = mutationEnvelope(domainSslRetrySchema);
@@ -2,9 +2,9 @@ import { z } from "zod";
2
2
  export declare const emailCategoryValues: readonly ["transactional", "announcements", "offers", "system", "invites"];
3
3
  export type EmailCategory = (typeof emailCategoryValues)[number];
4
4
  /**
5
- * Recipient controls are deliberately independent from the mail category.
6
- * A transactional notification can still belong to a controllable topic,
7
- * while essential authentication mail has no topic at all.
5
+ * Recipient controls are independent from the mail category: a transactional
6
+ * notification can belong to a controllable topic, and essential auth mail has
7
+ * no topic at all.
8
8
  */
9
9
  export declare const emailPreferenceTopicValues: readonly ["system", "invites", "announcements", "offers"];
10
10
  export type EmailPreferenceTopic = (typeof emailPreferenceTopicValues)[number];
@@ -1,8 +1,7 @@
1
1
  import { z } from "zod";
2
- // The canonical category set. superadmin-emails.ts re-exports this as
3
- // superadminEmailCategoryValues email-preferences must stay import-free
4
- // within contracts (it is the foundational email contract; importing back
5
- // from superadmin-emails created a circular-init TDZ crash in dist).
2
+ // The canonical category set; superadmin-emails.ts re-exports it. This file
3
+ // must not import from other contracts: importing back from superadmin-emails
4
+ // created a circular-init TDZ crash in dist.
6
5
  export const emailCategoryValues = [
7
6
  "transactional",
8
7
  "announcements",
@@ -11,9 +10,9 @@ export const emailCategoryValues = [
11
10
  "invites",
12
11
  ];
13
12
  /**
14
- * Recipient controls are deliberately independent from the mail category.
15
- * A transactional notification can still belong to a controllable topic,
16
- * while essential authentication mail has no topic at all.
13
+ * Recipient controls are independent from the mail category: a transactional
14
+ * notification can belong to a controllable topic, and essential auth mail has
15
+ * no topic at all.
17
16
  */
18
17
  export const emailPreferenceTopicValues = ["system", "invites", "announcements", "offers"];
19
18
  export const emailPreferenceTopicPolicy = {
@@ -2,10 +2,10 @@ import { z } from "zod";
2
2
  export declare const spaceStatusValues: readonly ["provisioning", "active", "updating", "deleting", "failed"];
3
3
  export declare const spaceStatus: z.ZodEnum<{
4
4
  active: "active";
5
+ failed: "failed";
5
6
  provisioning: "provisioning";
6
7
  updating: "updating";
7
8
  deleting: "deleting";
8
- failed: "failed";
9
9
  }>;
10
10
  export declare const spaceDisabledReasonCodeValues: readonly ["anonymous_expired", "abuse_takedown", "tenant_suspended", "site_suspended", "author_removed"];
11
11
  export declare const spaceDisabledReasonCode: z.ZodEnum<{
@@ -22,13 +22,17 @@ export declare const spaceTransferStatus: z.ZodEnum<{
22
22
  canceled: "canceled";
23
23
  expired: "expired";
24
24
  }>;
25
- export declare const tenantKindValues: readonly ["main", "platform", "partner", "internal"];
25
+ export declare const tenantKindValues: readonly ["main", "partner", "internal"];
26
26
  export declare const tenantKind: z.ZodEnum<{
27
27
  internal: "internal";
28
28
  main: "main";
29
- platform: "platform";
30
29
  partner: "partner";
31
30
  }>;
31
+ export declare const tenantModeValues: readonly ["live", "test"];
32
+ export declare const tenantMode: z.ZodEnum<{
33
+ live: "live";
34
+ test: "test";
35
+ }>;
32
36
  export declare const tenantStatusValues: readonly ["active", "past_due", "suspended", "deleted"];
33
37
  export declare const tenantStatus: z.ZodEnum<{
34
38
  active: "active";
@@ -41,30 +45,13 @@ export declare const providerClientStatus: z.ZodEnum<{
41
45
  active: "active";
42
46
  disabled: "disabled";
43
47
  }>;
44
- export declare const siteKindValues: readonly ["static_runtime"];
45
- export declare const siteKind: z.ZodEnum<{
46
- static_runtime: "static_runtime";
47
- }>;
48
- export declare const siteIsolationValues: readonly ["site", "space"];
49
- export declare const siteIsolation: z.ZodEnum<{
50
- site: "site";
51
- space: "space";
52
- }>;
53
- export declare const siteStatusValues: readonly ["ready_pool", "active", "provisioning", "degraded", "suspended", "deleted"];
54
- export declare const siteStatus: z.ZodEnum<{
55
- active: "active";
56
- provisioning: "provisioning";
57
- suspended: "suspended";
58
- deleted: "deleted";
59
- ready_pool: "ready_pool";
60
- degraded: "degraded";
61
- }>;
62
- export declare const poolSiteStatusValues: readonly ["provisioning", "ready_pool", "degraded", "retired"];
48
+ export declare const poolSiteStatusValues: readonly ["provisioning", "ready_pool", "degraded", "retired", "cleanup_pending"];
63
49
  export declare const poolSiteStatus: z.ZodEnum<{
64
50
  provisioning: "provisioning";
65
51
  ready_pool: "ready_pool";
66
52
  degraded: "degraded";
67
53
  retired: "retired";
54
+ cleanup_pending: "cleanup_pending";
68
55
  }>;
69
56
  export declare const publishSourceKindValues: readonly ["direct_upload", "cli", "dashboard", "api", "git", "import", "agent", "build", "variable_update", "config_update"];
70
57
  export declare const publishSourceKind: z.ZodEnum<{
@@ -72,9 +59,9 @@ export declare const publishSourceKind: z.ZodEnum<{
72
59
  agent: "agent";
73
60
  api: "api";
74
61
  dashboard: "dashboard";
75
- direct_upload: "direct_upload";
76
62
  cli: "cli";
77
63
  git: "git";
64
+ direct_upload: "direct_upload";
78
65
  import: "import";
79
66
  variable_update: "variable_update";
80
67
  config_update: "config_update";
@@ -112,10 +99,23 @@ export declare const buildStatus: z.ZodEnum<{
112
99
  skipped: "skipped";
113
100
  }>;
114
101
  export type BuildStatus = z.infer<typeof buildStatus>;
102
+ /**
103
+ * The one authoritative "this build can still change on its own" set. Poll
104
+ * cadences, cancelability, activity checks and webhook re-enqueue gates all
105
+ * derive from it — never restate it.
106
+ */
107
+ export declare const BUILD_IN_FLIGHT_STATUSES: readonly ["waiting_for_source", "uploading_source", "queued", "running"];
108
+ /**
109
+ * Its complement: a build that has settled and will never move again.
110
+ * `skipped` is terminal — a build the runner decided not to run at all.
111
+ */
112
+ export declare const BUILD_TERMINAL_STATUSES: ("failed" | "canceled" | "succeeded" | "skipped")[];
113
+ export declare function buildIsInFlight(status: string): boolean;
114
+ export declare function buildIsTerminal(status: string): boolean;
115
115
  export declare const diagnosticSeverity: z.ZodEnum<{
116
116
  info: "info";
117
- error: "error";
118
117
  warning: "warning";
118
+ error: "error";
119
119
  }>;
120
120
  export declare const diagnosticProvider: z.ZodEnum<{
121
121
  registrar: "registrar";
@@ -127,6 +127,7 @@ export declare const domainOwnershipTypeValues: readonly ["external", "registere
127
127
  export declare const domainDnsModeValues: readonly ["external", "stattic_nameservers", "registrar_dns"];
128
128
  export declare const domainRegistrarProviderValues: readonly ["none", "dsapi", "manual"];
129
129
  export declare const domainDnsProviderValues: readonly ["none", "stattic", "route53", "cloudflare", "vercel", "wpcom", "pressable", "dsapi", "manual"];
130
+ export type DomainDnsProviderValue = (typeof domainDnsProviderValues)[number];
130
131
  export declare const domainLifecycleStatusValues: readonly ["active", "pending_registration", "pending_transfer", "expired", "suspended", "redemption", "failed"];
131
132
  export declare const safetyCategoryValues: readonly ["csam", "malware", "phishing", "spam", "copyright", "fraud", "hateful_content", "extremism", "illegal_content", "privacy_violation", "compromised_account", "other_violation"];
132
133
  export declare const safetyCategory: z.ZodEnum<{
@@ -180,9 +181,8 @@ export declare const operationStatus: z.ZodEnum<{
180
181
  export type GitProvider = z.infer<typeof gitProvider>;
181
182
  export type PublishSourceKind = z.infer<typeof publishSourceKind>;
182
183
  export type PoolSiteStatus = z.infer<typeof poolSiteStatus>;
183
- export type SiteKind = z.infer<typeof siteKind>;
184
- export type SiteIsolation = z.infer<typeof siteIsolation>;
185
184
  export type TenantStatus = z.infer<typeof tenantStatus>;
185
+ export type TenantMode = z.infer<typeof tenantMode>;
186
186
  export type OperationStatus = z.infer<typeof operationStatus>;
187
187
  export type SafetyCategory = z.infer<typeof safetyCategory>;
188
188
  export type SafetyResolutionReason = z.infer<typeof safetyResolutionReason>;