@spacefast/common 0.0.23 → 0.0.26

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 (224) hide show
  1. package/brand-assets/LICENSE-Haskoy.txt +93 -0
  2. package/brand-assets/haskoy-latin-variable.woff2 +0 -0
  3. package/brand-assets/spacefast-favicon.svg +4 -4
  4. package/brand-assets/spacefast-sf-full-bleed.svg +3 -3
  5. package/brand-assets/spacefast-wordmark.svg +2 -4
  6. package/dist/agents/connect-targets.js +1 -1
  7. package/dist/agents/private-key-oauth.d.ts +0 -1
  8. package/dist/agents/private-key-oauth.js +46 -63
  9. package/dist/brand-assets-build.js +4 -6
  10. package/dist/brand-assets.d.ts +5 -15
  11. package/dist/brand-assets.js +15 -14
  12. package/dist/config/domains.d.ts +47 -7
  13. package/dist/config/domains.js +66 -10
  14. package/dist/config/index.d.ts +0 -1
  15. package/dist/config/index.js +0 -1
  16. package/dist/contracts/abuse.d.ts +2 -0
  17. package/dist/contracts/abuse.js +12 -0
  18. package/dist/contracts/access.d.ts +124 -12
  19. package/dist/contracts/access.js +73 -9
  20. package/dist/contracts/activity.d.ts +1 -1
  21. package/dist/contracts/activity.js +5 -12
  22. package/dist/contracts/api-keys.d.ts +21 -21
  23. package/dist/contracts/api-keys.js +2 -2
  24. package/dist/contracts/beta.js +1 -1
  25. package/dist/contracts/billing.d.ts +3 -35
  26. package/dist/contracts/billing.js +33 -52
  27. package/dist/contracts/builds.d.ts +30 -18
  28. package/dist/contracts/builds.js +28 -9
  29. package/dist/contracts/channels.js +1 -1
  30. package/dist/contracts/cli.d.ts +10 -0
  31. package/dist/contracts/cli.js +10 -0
  32. package/dist/contracts/collab-public.d.ts +63 -0
  33. package/dist/contracts/collab-public.js +46 -0
  34. package/dist/contracts/comments.d.ts +282 -53
  35. package/dist/contracts/comments.js +173 -52
  36. package/dist/contracts/common.d.ts +3 -3
  37. package/dist/contracts/common.js +5 -5
  38. package/dist/contracts/crons.d.ts +35 -0
  39. package/dist/contracts/crons.js +42 -0
  40. package/dist/contracts/device-auth.d.ts +6 -6
  41. package/dist/contracts/device-auth.js +2 -2
  42. package/dist/contracts/docs.js +2 -2
  43. package/dist/contracts/domains.d.ts +38 -27
  44. package/dist/contracts/domains.js +29 -2
  45. package/dist/contracts/enums.d.ts +34 -30
  46. package/dist/contracts/enums.js +62 -48
  47. package/dist/contracts/error-code-meta.d.ts +50 -125
  48. package/dist/contracts/error-code-meta.js +29 -41
  49. package/dist/contracts/error-codes.d.ts +1 -1
  50. package/dist/contracts/error-codes.js +14 -33
  51. package/dist/contracts/execution.d.ts +47 -66
  52. package/dist/contracts/execution.js +53 -49
  53. package/dist/contracts/feature-lifecycle-core.d.ts +0 -6
  54. package/dist/contracts/feature-lifecycle-core.js +2 -31
  55. package/dist/contracts/feature-lifecycle.d.ts +12 -52
  56. package/dist/contracts/feature-lifecycle.js +16 -59
  57. package/dist/contracts/features.d.ts +48 -60
  58. package/dist/contracts/features.js +59 -51
  59. package/dist/contracts/functions.d.ts +266 -72
  60. package/dist/contracts/functions.js +260 -37
  61. package/dist/contracts/git.d.ts +28 -34
  62. package/dist/contracts/git.js +10 -11
  63. package/dist/contracts/grants.d.ts +9 -5
  64. package/dist/contracts/grants.js +18 -9
  65. package/dist/contracts/ids.js +2 -2
  66. package/dist/contracts/internal.d.ts +8 -6
  67. package/dist/contracts/internal.js +12 -12
  68. package/dist/contracts/mcp.d.ts +11 -0
  69. package/dist/contracts/mcp.js +5 -0
  70. package/dist/contracts/me.js +1 -1
  71. package/dist/contracts/oauth-resources.d.ts +4 -3
  72. package/dist/contracts/oauth-resources.js +12 -3
  73. package/dist/contracts/operations.d.ts +90 -5
  74. package/dist/contracts/operations.js +77 -3
  75. package/dist/contracts/pages.d.ts +12 -7
  76. package/dist/contracts/pages.js +24 -1
  77. package/dist/contracts/plan-policy.d.ts +0 -2
  78. package/dist/contracts/plan-policy.js +2 -3
  79. package/dist/contracts/platform.d.ts +61 -148
  80. package/dist/contracts/platform.js +70 -126
  81. package/dist/contracts/publish-archive.d.ts +508 -0
  82. package/dist/contracts/publish-archive.js +32 -0
  83. package/dist/contracts/push-new.d.ts +4 -4
  84. package/dist/contracts/quotas.js +2 -2
  85. package/dist/contracts/repository-connections.d.ts +43 -30
  86. package/dist/contracts/repository-connections.js +11 -3
  87. package/dist/contracts/resources.d.ts +12 -24
  88. package/dist/contracts/resources.js +36 -16
  89. package/dist/contracts/runtime-api.d.ts +433 -192
  90. package/dist/contracts/runtime-api.js +421 -356
  91. package/dist/contracts/runtime-app.d.ts +127 -120
  92. package/dist/contracts/runtime-app.js +19 -10
  93. package/dist/contracts/runtime-db.d.ts +5 -5
  94. package/dist/contracts/runtime-db.js +2 -2
  95. package/dist/contracts/runtime-purge.d.ts +8 -0
  96. package/dist/contracts/runtime-purge.js +7 -0
  97. package/dist/contracts/runtime-services.d.ts +219 -0
  98. package/dist/contracts/runtime-services.js +437 -0
  99. package/dist/contracts/runtime-storage.d.ts +46 -32
  100. package/dist/contracts/runtime-storage.js +31 -8
  101. package/dist/contracts/sf-config-v1.d.ts +48 -10
  102. package/dist/contracts/space-config.d.ts +69 -18
  103. package/dist/contracts/space-config.js +226 -27
  104. package/dist/contracts/spaces.d.ts +236 -450
  105. package/dist/contracts/spaces.js +131 -151
  106. package/dist/contracts/superadmin-activity.d.ts +57 -4
  107. package/dist/contracts/superadmin-activity.js +48 -2
  108. package/dist/contracts/superadmin-search.d.ts +126 -0
  109. package/dist/contracts/superadmin-search.js +61 -0
  110. package/dist/contracts/superadmin-spaces.d.ts +361 -92
  111. package/dist/contracts/superadmin-spaces.js +97 -24
  112. package/dist/contracts/superadmin-teams.d.ts +28 -10
  113. package/dist/contracts/superadmin-teams.js +5 -8
  114. package/dist/contracts/superadmin-tenants.d.ts +0 -6
  115. package/dist/contracts/superadmin-tenants.js +1 -7
  116. package/dist/contracts/superadmin.d.ts +135 -54
  117. package/dist/contracts/superadmin.js +46 -23
  118. package/dist/contracts/tags.d.ts +12 -12
  119. package/dist/contracts/tags.js +3 -3
  120. package/dist/contracts/teams.d.ts +49 -14
  121. package/dist/contracts/teams.js +40 -22
  122. package/dist/contracts/transfers.d.ts +0 -49
  123. package/dist/contracts/transfers.js +4 -8
  124. package/dist/contracts/usage.d.ts +61 -0
  125. package/dist/contracts/usage.js +64 -0
  126. package/dist/contracts/variables.d.ts +2 -7
  127. package/dist/contracts/variables.js +9 -8
  128. package/dist/contracts/webhooks.d.ts +2 -2
  129. package/dist/contracts/zero.d.ts +102 -73
  130. package/dist/contracts/zero.js +94 -32
  131. package/dist/dashboard-paths/index.d.ts +1 -1
  132. package/dist/dashboard-paths/index.js +1 -0
  133. package/dist/docs/agent-prose.d.ts +2 -2
  134. package/dist/docs/agent-prose.js +63 -70
  135. package/dist/docs/agent-setup.js +45 -15
  136. package/dist/docs/catalog.d.ts +24 -24
  137. package/dist/docs/catalog.js +35 -24
  138. package/dist/docs/error-docs.js +194 -270
  139. package/dist/docs/skills.d.ts +12 -12
  140. package/dist/docs/skills.js +4 -4
  141. package/dist/test-helpers/fetch-stub.d.ts +16 -0
  142. package/dist/test-helpers/fetch-stub.js +25 -0
  143. package/dist/utils/build-settings.d.ts +5 -1
  144. package/dist/utils/build-settings.js +91 -13
  145. package/dist/utils/canonical-json.d.ts +10 -0
  146. package/dist/utils/canonical-json.js +22 -0
  147. package/dist/utils/cast-transport.d.ts +28 -0
  148. package/dist/utils/cast-transport.js +52 -0
  149. package/dist/utils/claim-token.d.ts +0 -8
  150. package/dist/utils/claim-token.js +3 -15
  151. package/dist/utils/concurrency.js +1 -0
  152. package/dist/utils/credential-policy.d.ts +1 -1
  153. package/dist/utils/credential-policy.js +4 -3
  154. package/dist/utils/dns-instructions.js +9 -9
  155. package/dist/utils/env-file.d.ts +17 -0
  156. package/dist/utils/env-file.js +96 -0
  157. package/dist/utils/error-code.d.ts +2 -0
  158. package/dist/utils/error-code.js +8 -0
  159. package/dist/utils/generate-space-name.d.ts +8 -10
  160. package/dist/utils/generate-space-name.js +206 -21
  161. package/dist/utils/grant-decision.fixtures.json +2938 -0
  162. package/dist/utils/grants.d.ts +2 -0
  163. package/dist/utils/grants.js +26 -1
  164. package/dist/utils/gravatar.d.ts +9 -0
  165. package/dist/utils/gravatar.js +31 -0
  166. package/dist/utils/idempotency.d.ts +6 -0
  167. package/dist/utils/idempotency.js +28 -0
  168. package/dist/utils/local-space-state.d.ts +9 -16
  169. package/dist/utils/local-space-state.js +20 -50
  170. package/dist/utils/one-shot-replay.d.ts +4 -1
  171. package/dist/utils/page-colors.d.ts +14 -12
  172. package/dist/utils/page-colors.js +15 -13
  173. package/dist/utils/page-fonts.d.ts +2 -2
  174. package/dist/utils/page-fonts.js +15 -4
  175. package/dist/utils/pages.d.ts +21 -3
  176. package/dist/utils/pages.js +42 -13
  177. package/dist/utils/publish-form-data.d.ts +12 -0
  178. package/dist/utils/publish-form-data.js +10 -0
  179. package/dist/utils/publish-policy.d.ts +27 -0
  180. package/dist/utils/publish-policy.fixtures.json +403 -0
  181. package/dist/utils/publish-policy.js +45 -20
  182. package/dist/utils/push-new.d.ts +7 -0
  183. package/dist/utils/push-new.js +7 -0
  184. package/dist/utils/query-keys.d.ts +4 -5
  185. package/dist/utils/query-keys.js +2 -3
  186. package/dist/utils/runtime-paths.d.ts +5 -0
  187. package/dist/utils/runtime-paths.js +5 -0
  188. package/dist/utils/runtime-upload-batch.d.ts +0 -5
  189. package/dist/utils/runtime-upload-batch.js +1 -27
  190. package/dist/utils/runtime-upload.d.ts +6 -11
  191. package/dist/utils/runtime-upload.js +10 -13
  192. package/dist/utils/secure-local-file.js +5 -16
  193. package/dist/utils/space-config.d.ts +1 -34
  194. package/dist/utils/space-config.js +8 -326
  195. package/dist/utils/static-runtime-policy.d.ts +9 -3
  196. package/dist/utils/static-runtime-policy.fixtures.json +38 -41
  197. package/dist/utils/static-runtime-policy.js +22 -56
  198. package/dist/utils/storage-policy.d.ts +1 -1
  199. package/dist/utils/storage-policy.js +3 -1
  200. package/dist/utils/structured-error.d.ts +14 -0
  201. package/dist/utils/structured-error.js +22 -0
  202. package/dist/utils/upload-session.d.ts +4 -1
  203. package/dist/utils/upload-session.js +33 -5
  204. package/dist/utils/version-path.js +13 -4
  205. package/dist/vocabulary.d.ts +13 -11
  206. package/dist/vocabulary.js +42 -28
  207. package/package.json +7 -17
  208. package/dist/config/postgres-budget.d.ts +0 -129
  209. package/dist/config/postgres-budget.js +0 -140
  210. package/dist/config/postgres-budget.json +0 -51
  211. package/dist/contracts/archives.d.ts +0 -331
  212. package/dist/contracts/archives.js +0 -120
  213. package/dist/contracts/deployments.d.ts +0 -574
  214. package/dist/contracts/deployments.js +0 -97
  215. package/dist/contracts/sites.d.ts +0 -416
  216. package/dist/contracts/sites.js +0 -168
  217. package/dist/contracts/superadmin-queues.d.ts +0 -414
  218. package/dist/contracts/superadmin-queues.js +0 -202
  219. package/dist/contracts/superadmin-runtime.d.ts +0 -27
  220. package/dist/contracts/superadmin-runtime.js +0 -38
  221. package/dist/index.d.ts +0 -1
  222. package/dist/index.js +0 -1
  223. package/dist/utils/api.d.ts +0 -4
  224. package/dist/utils/api.js +0 -13
@@ -1,6 +1,9 @@
1
1
  import { z } from "zod";
2
+ import { BuildSettingsSchema, BuildTargetSchema } from "./builds.js";
3
+ import { baseDiagnosticSchema } from "./common.js";
2
4
  import { makeOffsetListSchema } from "./common.js";
3
- import { buildStatus, siteClass } from "./enums.js";
5
+ import { buildStatus } from "./enums.js";
6
+ import { versionLogEntrySchema } from "./spaces.js";
4
7
  // Operator-only offset pagination. The platform API uses opaque cursors exclusively
5
8
  // (contracts/common.ts); the superadmin surface is the one sanctioned exception.
6
9
  export const superadminPaginationSchema = z.object({
@@ -61,11 +64,12 @@ export const superadminBuildInventoryQuerySchema = z.object({
61
64
  status: z.union([z.literal("all"), buildStatus]).default("all"),
62
65
  driver: z.enum(["all", "e2b", "local"]).default("all"),
63
66
  repository: z.string().trim().optional(),
67
+ spaceId: z.string().trim().min(1).optional(),
64
68
  });
65
69
  export const SuperadminBuildInventoryItemSchema = z.object({
66
70
  id: z.string(),
67
71
  ref: z.string(),
68
- status: z.string(),
72
+ status: buildStatus,
69
73
  spaceId: z.string(),
70
74
  spaceSlug: z.string().nullable(),
71
75
  teamId: z.string().nullable(),
@@ -83,22 +87,49 @@ export const SuperadminBuildInventoryItemSchema = z.object({
83
87
  failureMessage: z.string().nullable(),
84
88
  durationMs: z.number().nullable(),
85
89
  outputBytes: z.number().nullable(),
86
- updatedAt: z.string().datetime(),
87
- });
88
- export const SuperadminWebhookDeliverySchema = z.object({
89
- id: z.string(),
90
- deliveryId: z.string(),
91
- eventName: z.string(),
92
- action: z.string().nullable(),
93
- repositoryFullName: z.string().nullable(),
94
- status: z.string(),
95
- statusMessage: z.string().nullable(),
96
90
  createdAt: z.string().datetime(),
91
+ startedAt: z.string().datetime().nullable(),
92
+ finishedAt: z.string().datetime().nullable(),
97
93
  updatedAt: z.string().datetime(),
98
94
  });
95
+ export const SuperadminBuildDetailSchema = z.object({
96
+ build: SuperadminBuildInventoryItemSchema.extend({
97
+ inputKind: z.string(),
98
+ command: z.string().nullable(),
99
+ retryOfBuildId: z.string().nullable(),
100
+ producedVersionId: z.string().nullable(),
101
+ reusedVersionId: z.string().nullable(),
102
+ settings: BuildSettingsSchema,
103
+ target: BuildTargetSchema,
104
+ }),
105
+ execution: z
106
+ .object({
107
+ logOffset: z.number().int().nonnegative().nullable(),
108
+ exitCode: z.number().int().min(0).max(255).nullable(),
109
+ terminationReason: z.enum(["command", "timeout"]).nullable(),
110
+ artifactDeadlineAt: z.string().datetime().nullable(),
111
+ launch: z
112
+ .object({
113
+ state: z.enum(["starting", "started", "rejected"]),
114
+ requestedAt: z.string().datetime(),
115
+ startedAt: z.string().datetime().nullable(),
116
+ pid: z.number().int().nullable(),
117
+ rejectedReason: z.string().nullable(),
118
+ })
119
+ .nullable(),
120
+ phases: z.array(z.object({
121
+ phase: z.string(),
122
+ at: z.string().datetime(),
123
+ })),
124
+ })
125
+ .nullable(),
126
+ diagnostics: z.array(baseDiagnosticSchema),
127
+ // Newest first, capped server-side; logCount is the uncapped total.
128
+ logs: z.array(versionLogEntrySchema),
129
+ logCount: z.number().int().nonnegative(),
130
+ });
99
131
  export const SuperadminBuildInventorySchema = z.object({
100
132
  builds: z.array(SuperadminBuildInventoryItemSchema),
101
- webhookDeliveries: z.array(SuperadminWebhookDeliverySchema),
102
133
  });
103
134
  // Superadmin-assigned subscriptions ("plan grants"): operator-issued plan
104
135
  // entitlements with no payment provider and no transactions behind them.
@@ -183,7 +214,7 @@ export const SuperadminBillingTransactionSchema = z.object({
183
214
  teamId: z.string().nullable(),
184
215
  teamSlug: z.string().nullable(),
185
216
  teamName: z.string().nullable(),
186
- provider: z.enum(["stripe", "app_store", "google_play"]),
217
+ provider: z.enum(["stripe"]),
187
218
  kind: z.enum(["purchase", "renewal", "refund", "adjustment"]),
188
219
  scope: z.enum(["plan", "seats", "domain", "other"]),
189
220
  planCode: z.string().nullable(),
@@ -210,7 +241,7 @@ export const SuperadminTeamBillingOverviewSchema = z.object({
210
241
  }),
211
242
  planCode: z.string(),
212
243
  sources: z.array(z.object({
213
- provider: z.enum(["stripe", "app_store", "google_play", "grant"]),
244
+ provider: z.enum(["stripe", "grant"]),
214
245
  planCode: z.string(),
215
246
  active: z.boolean(),
216
247
  detail: z.string(),
@@ -221,20 +252,12 @@ export const SuperadminTeamBillingOverviewSchema = z.object({
221
252
  export const SuperadminWpCloudSiteSchema = z.object({
222
253
  providerSiteId: z.string(),
223
254
  placementId: z.string().nullable(),
224
- // Reuses `siteClass` (enums.ts) rather than a private legacy-only literal
225
- // union — this echoes the site's raw placementMode column, which Deploy T
226
- // still tolerates in both legacy (anonymous_pool/shared_org/dedicated_space)
227
- // and normalized (shared/dedicated) form.
228
- placementKind: siteClass.nullable(),
229
255
  placementState: z.string().nullable().optional(),
230
256
  placementStatus: z.string().nullable().optional(),
231
257
  placementPrimaryHostname: z.string().nullable(),
232
258
  placementDatacenterId: z.string().nullable().optional(),
233
259
  placementRegion: z.string().nullable().optional(),
234
260
  placementGeoAffinity: z.string().nullable(),
235
- anonymousPoolId: z.string().nullable(),
236
- anonymousPoolState: z.enum(["active", "draining", "disabled"]).nullable(),
237
- anonymousPoolAssignedSpaceCount: z.number().int().nonnegative().nullable(),
238
261
  assignedSpaceCount: z.number().int().nonnegative(),
239
262
  assignedSpaces: z.array(z.object({
240
263
  id: z.string(),
@@ -88,7 +88,7 @@ export declare const tagConsentPolicySchema: z.ZodObject<{
88
88
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
89
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
90
90
  registrar: "registrar";
91
- wpcloud: "wpcloud";
91
+ infra: "infra";
92
92
  dns: "dns";
93
93
  runtime: "runtime";
94
94
  }>>>;
@@ -149,7 +149,7 @@ export declare const tagValidationResultSchema: z.ZodObject<{
149
149
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
150
150
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
151
151
  registrar: "registrar";
152
- wpcloud: "wpcloud";
152
+ infra: "infra";
153
153
  dns: "dns";
154
154
  runtime: "runtime";
155
155
  }>>>;
@@ -198,7 +198,7 @@ export declare const tagVersionSchema: z.ZodObject<{
198
198
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
199
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
200
200
  registrar: "registrar";
201
- wpcloud: "wpcloud";
201
+ infra: "infra";
202
202
  dns: "dns";
203
203
  runtime: "runtime";
204
204
  }>>>;
@@ -268,7 +268,7 @@ export declare const tagVersionListResponseSchema: z.ZodObject<{
268
268
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
269
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
270
270
  registrar: "registrar";
271
- wpcloud: "wpcloud";
271
+ infra: "infra";
272
272
  dns: "dns";
273
273
  runtime: "runtime";
274
274
  }>>>;
@@ -331,7 +331,7 @@ export declare const tagVersionResponseSchema: z.ZodObject<{
331
331
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
332
332
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
333
333
  registrar: "registrar";
334
- wpcloud: "wpcloud";
334
+ infra: "infra";
335
335
  dns: "dns";
336
336
  runtime: "runtime";
337
337
  }>>>;
@@ -426,7 +426,7 @@ export declare const tagValidateResponseSchema: z.ZodObject<{
426
426
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
427
427
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
428
428
  registrar: "registrar";
429
- wpcloud: "wpcloud";
429
+ infra: "infra";
430
430
  dns: "dns";
431
431
  runtime: "runtime";
432
432
  }>>>;
@@ -647,7 +647,7 @@ export declare const tagApplyResponseSchema: z.ZodObject<{
647
647
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
648
648
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
649
649
  registrar: "registrar";
650
- wpcloud: "wpcloud";
650
+ infra: "infra";
651
651
  dns: "dns";
652
652
  runtime: "runtime";
653
653
  }>>>;
@@ -680,7 +680,7 @@ export declare const tagApplyResponseSchema: z.ZodObject<{
680
680
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
681
681
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
682
682
  registrar: "registrar";
683
- wpcloud: "wpcloud";
683
+ infra: "infra";
684
684
  dns: "dns";
685
685
  runtime: "runtime";
686
686
  }>>>;
@@ -856,8 +856,8 @@ export declare const tagTemplateDefinitionSchema: z.ZodObject<{
856
856
  kind: z.ZodDefault<z.ZodEnum<{
857
857
  boolean: "boolean";
858
858
  text: "text";
859
- url: "url";
860
859
  secret: "secret";
860
+ url: "url";
861
861
  textarea: "textarea";
862
862
  }>>;
863
863
  required: z.ZodDefault<z.ZodBoolean>;
@@ -965,8 +965,8 @@ export declare const tagTemplateListResponseSchema: z.ZodObject<{
965
965
  kind: z.ZodDefault<z.ZodEnum<{
966
966
  boolean: "boolean";
967
967
  text: "text";
968
- url: "url";
969
968
  secret: "secret";
969
+ url: "url";
970
970
  textarea: "textarea";
971
971
  }>>;
972
972
  required: z.ZodDefault<z.ZodBoolean>;
@@ -1029,7 +1029,7 @@ export declare const tagConsentPolicyResponseSchema: z.ZodObject<{
1029
1029
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1030
1030
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1031
1031
  registrar: "registrar";
1032
- wpcloud: "wpcloud";
1032
+ infra: "infra";
1033
1033
  dns: "dns";
1034
1034
  runtime: "runtime";
1035
1035
  }>>>;
@@ -1114,7 +1114,7 @@ export declare function listTagTemplates(): {
1114
1114
  fields: {
1115
1115
  key: string;
1116
1116
  label: string;
1117
- kind: "boolean" | "text" | "url" | "secret" | "textarea";
1117
+ kind: "boolean" | "text" | "secret" | "url" | "textarea";
1118
1118
  required: boolean;
1119
1119
  placeholder?: string | undefined;
1120
1120
  help?: string | undefined;
@@ -336,7 +336,7 @@ export const tagGraphSchema = z
336
336
  consentPolicy: z.record(z.string(), z.unknown()).optional(),
337
337
  })
338
338
  .passthrough();
339
- const tagGraphBudgetedShape = {
339
+ const tagGraphBudgetedFields = {
340
340
  format: z.literal("spacefast.tag_graph.v1").default("spacefast.tag_graph.v1"),
341
341
  tags: z.array(z.record(z.string(), z.unknown())).max(TAG_GRAPH_MAX_TAGS).default([]),
342
342
  triggers: z.array(z.record(z.string(), z.unknown())).max(TAG_GRAPH_MAX_TRIGGERS).default([]),
@@ -350,11 +350,11 @@ const tagGraphBudgetedShape = {
350
350
  consentPolicy: z.record(z.string(), z.unknown()).optional(),
351
351
  };
352
352
  export const tagGraphCloneSchema = z
353
- .object(tagGraphBudgetedShape)
353
+ .object(tagGraphBudgetedFields)
354
354
  .passthrough()
355
355
  .superRefine(refineTagGraphBudget);
356
356
  export const tagGraphWriteSchema = z
357
- .object(tagGraphBudgetedShape)
357
+ .object(tagGraphBudgetedFields)
358
358
  .strict()
359
359
  .superRefine(refineTagGraphBudget)
360
360
  .describe(`Tag graph v1 write input. The server enforces these limits: ${TAG_GRAPH_MAX_ENCODED_BYTES} encoded bytes, ${TAG_GRAPH_MAX_TAGS} tags, ${TAG_GRAPH_MAX_TRIGGERS} triggers, ${TAG_GRAPH_MAX_VARIABLES} variables, and ${TAG_GRAPH_MAX_SYSTEM_MODULES} system modules. The server also enforces ${TAG_GRAPH_MAX_ARRAY_ITEMS} items per nested array, ${TAG_GRAPH_MAX_OBJECT_KEYS} keys per object, ${TAG_GRAPH_MAX_STRING_BYTES} encoded bytes per string, and ${TAG_GRAPH_MAX_DEPTH} nested levels. Unknown top-level fields are rejected.`);
@@ -1,15 +1,21 @@
1
1
  import { z } from "zod";
2
2
  export declare const TEAM_ROLE_VALUES: readonly ["owner", "admin", "member"];
3
3
  export declare const teamMemberRole: z.ZodEnum<{
4
- owner: "owner";
5
4
  admin: "admin";
5
+ owner: "owner";
6
6
  member: "member";
7
7
  }>;
8
+ /**
9
+ * Better Auth stores the member role as free text, so every surface that reads
10
+ * it back has to land on the same canonical value. Unknown roles carry no
11
+ * privilege, so they read as the least-privileged one.
12
+ */
13
+ export declare function normalizeTeamMemberRole(role: string | null | undefined): "admin" | "owner" | "member";
8
14
  export declare const teamInvitationCreateSchema: z.ZodObject<{
9
15
  email: z.ZodString;
10
16
  role: z.ZodDefault<z.ZodEnum<{
11
- owner: "owner";
12
17
  admin: "admin";
18
+ owner: "owner";
13
19
  member: "member";
14
20
  }>>;
15
21
  }, z.core.$strip>;
@@ -29,19 +35,51 @@ export declare const teamSpaceListQuerySchema: z.ZodObject<{
29
35
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
30
36
  cursor: z.ZodOptional<z.ZodString>;
31
37
  }, z.core.$strip>;
38
+ export declare const TeamMemberUserSchema: z.ZodObject<{
39
+ id: z.ZodString;
40
+ name: z.ZodString;
41
+ email: z.ZodString;
42
+ image: z.ZodNullable<z.ZodString>;
43
+ }, z.core.$strip>;
44
+ export declare const TeamMemberSchema: z.ZodObject<{
45
+ id: z.ZodString;
46
+ teamId: z.ZodString;
47
+ userId: z.ZodString;
48
+ role: z.ZodEnum<{
49
+ admin: "admin";
50
+ owner: "owner";
51
+ member: "member";
52
+ }>;
53
+ createdAt: z.ZodString;
54
+ user: z.ZodNullable<z.ZodObject<{
55
+ id: z.ZodString;
56
+ name: z.ZodString;
57
+ email: z.ZodString;
58
+ image: z.ZodNullable<z.ZodString>;
59
+ }, z.core.$strip>>;
60
+ }, z.core.$strip>;
61
+ export declare const teamMemberRoleUpdateSchema: z.ZodObject<{
62
+ role: z.ZodEnum<{
63
+ admin: "admin";
64
+ owner: "owner";
65
+ member: "member";
66
+ }>;
67
+ }, z.core.$strip>;
68
+ export type TeamMember = z.infer<typeof TeamMemberSchema>;
32
69
  export declare const TeamInvitationSchema: z.ZodObject<{
33
70
  id: z.ZodString;
34
71
  teamId: z.ZodString;
35
72
  email: z.ZodString;
36
73
  role: z.ZodEnum<{
37
- owner: "owner";
38
74
  admin: "admin";
75
+ owner: "owner";
39
76
  member: "member";
40
77
  }>;
41
78
  status: z.ZodString;
42
79
  expiresAt: z.ZodString;
43
80
  createdAt: z.ZodString;
44
81
  }, z.core.$strip>;
82
+ export type TeamInvitation = z.infer<typeof TeamInvitationSchema>;
45
83
  export declare const teamPlanCode: z.ZodEnum<{
46
84
  free: "free";
47
85
  internal: "internal";
@@ -55,8 +93,8 @@ export declare const TeamSummarySchema: z.ZodObject<{
55
93
  name: z.ZodString;
56
94
  slug: z.ZodString;
57
95
  role: z.ZodEnum<{
58
- owner: "owner";
59
96
  admin: "admin";
97
+ owner: "owner";
60
98
  member: "member";
61
99
  }>;
62
100
  plan: z.ZodEnum<{
@@ -76,8 +114,8 @@ export declare const TeamDetailSchema: z.ZodObject<{
76
114
  name: z.ZodString;
77
115
  slug: z.ZodString;
78
116
  role: z.ZodEnum<{
79
- owner: "owner";
80
117
  admin: "admin";
118
+ owner: "owner";
81
119
  member: "member";
82
120
  }>;
83
121
  plan: z.ZodEnum<{
@@ -101,8 +139,8 @@ export declare const teamListResponseSchema: z.ZodObject<{
101
139
  name: z.ZodString;
102
140
  slug: z.ZodString;
103
141
  role: z.ZodEnum<{
104
- owner: "owner";
105
142
  admin: "admin";
143
+ owner: "owner";
106
144
  member: "member";
107
145
  }>;
108
146
  plan: z.ZodEnum<{
@@ -127,8 +165,8 @@ export declare const teamMemberListResponseSchema: z.ZodObject<{
127
165
  teamId: z.ZodString;
128
166
  userId: z.ZodString;
129
167
  role: z.ZodEnum<{
130
- owner: "owner";
131
168
  admin: "admin";
169
+ owner: "owner";
132
170
  member: "member";
133
171
  }>;
134
172
  createdAt: z.ZodString;
@@ -160,8 +198,8 @@ export declare const teamInvitationAcceptResponseSchema: z.ZodObject<{
160
198
  teamSlug: z.ZodString;
161
199
  userId: z.ZodString;
162
200
  role: z.ZodEnum<{
163
- owner: "owner";
164
201
  admin: "admin";
202
+ owner: "owner";
165
203
  member: "member";
166
204
  }>;
167
205
  }, z.core.$strip>;
@@ -172,8 +210,8 @@ export declare const teamInvitationListResponseSchema: z.ZodObject<{
172
210
  teamId: z.ZodString;
173
211
  email: z.ZodString;
174
212
  role: z.ZodEnum<{
175
- owner: "owner";
176
213
  admin: "admin";
214
+ owner: "owner";
177
215
  member: "member";
178
216
  }>;
179
217
  status: z.ZodString;
@@ -196,15 +234,12 @@ export declare const teamSettingsResponseSchema: z.ZodObject<{
196
234
  id: z.ZodString;
197
235
  label: z.ZodString;
198
236
  }, z.core.$strip>>;
199
- wpCloudCapabilities: z.ZodObject<{
237
+ infraCapabilities: z.ZodObject<{
200
238
  datacenters: z.ZodArray<z.ZodObject<{
201
239
  id: z.ZodString;
202
240
  label: z.ZodString;
203
241
  }, z.core.$strip>>;
204
- phpVersions: z.ZodArray<z.ZodObject<{
205
- id: z.ZodString;
206
- label: z.ZodString;
207
- }, z.core.$strip>>;
242
+ phpVersion: z.ZodLiteral<"8.5">;
208
243
  }, z.core.$strip>;
209
244
  }, z.core.$strip>;
210
245
  export declare const teamUsageResponseSchema: z.ZodObject<{
@@ -3,6 +3,15 @@ import { CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
3
  import { planCodeSchema, planLimitValueSchema } from "./features.js";
4
4
  export const TEAM_ROLE_VALUES = ["owner", "admin", "member"];
5
5
  export const teamMemberRole = z.enum(TEAM_ROLE_VALUES);
6
+ /**
7
+ * Better Auth stores the member role as free text, so every surface that reads
8
+ * it back has to land on the same canonical value. Unknown roles carry no
9
+ * privilege, so they read as the least-privileged one.
10
+ */
11
+ export function normalizeTeamMemberRole(role) {
12
+ const parsed = teamMemberRole.safeParse(role ?? "member");
13
+ return parsed.success ? parsed.data : "member";
14
+ }
6
15
  export const teamInvitationCreateSchema = z.object({
7
16
  email: z.string().trim().email().toLowerCase(),
8
17
  role: teamMemberRole.default("member"),
@@ -11,19 +20,26 @@ export const teamMemberListQuerySchema = cursorListQuerySchema;
11
20
  export const teamInvitationListQuerySchema = cursorListQuerySchema;
12
21
  export const teamListQuerySchema = cursorListQuerySchema;
13
22
  export const teamSpaceListQuerySchema = cursorListQuerySchema;
14
- const TeamMemberUserSchema = z.object({
15
- id: z.string(),
16
- name: z.string(),
17
- email: z.string().email(),
18
- image: z.string().nullable(),
19
- });
20
- const TeamMemberSchema = z.object({
21
- id: z.string(),
22
- teamId: z.string(),
23
- userId: z.string(),
24
- role: teamMemberRole,
25
- createdAt: z.string().datetime(),
26
- user: TeamMemberUserSchema.nullable(),
23
+ export const TeamMemberUserSchema = z.object({
24
+ id: z.string().describe("The member's user id."),
25
+ name: z.string().describe("The member's display name."),
26
+ email: z.string().email().describe("The member's email address."),
27
+ image: z.string().nullable().describe("Avatar URL, or null when the user has none."),
28
+ });
29
+ // The one membership shape: every surface that shows or edits a team member
30
+ // (dashboard, superadmin, CLI, MCP) types from this. Better Auth's
31
+ // organization plugin owns the underlying rows, but its plugin-inferred types
32
+ // never cross an app boundary.
33
+ export const TeamMemberSchema = z.object({
34
+ id: z.string().describe("The membership id, stable for the life of the membership."),
35
+ teamId: z.string().describe("The team this membership belongs to."),
36
+ userId: z.string().describe("The member's user id."),
37
+ role: teamMemberRole.describe("The member's role on the team."),
38
+ createdAt: z.string().datetime().describe("Instant the member joined the team."),
39
+ user: TeamMemberUserSchema.nullable().describe("The member's user record; null when the user row is unavailable."),
40
+ });
41
+ export const teamMemberRoleUpdateSchema = z.object({
42
+ role: teamMemberRole.describe("The role to grant this member."),
27
43
  });
28
44
  export const TeamInvitationSchema = z.object({
29
45
  id: z.string(),
@@ -34,7 +50,7 @@ export const TeamInvitationSchema = z.object({
34
50
  expiresAt: z.string().datetime(),
35
51
  createdAt: z.string().datetime(),
36
52
  });
37
- // Team (internal-docs/platform.md "Team"): Better Auth team in the main
53
+ // Team (the platform spec "Team"): Better Auth team in the main
38
54
  // tenant, carrying the resolved plan and default data location.
39
55
  export const teamPlanCode = planCodeSchema;
40
56
  export const TeamSummarySchema = z.object({
@@ -107,7 +123,7 @@ export const teamDataLocationSchema = z
107
123
  export const teamSettingsUpdateSchema = z.object({
108
124
  defaultDataLocation: teamDataLocationSchema,
109
125
  });
110
- const wpCloudCapabilityOptionSchema = z.object({
126
+ const infraCapabilityOptionSchema = z.object({
111
127
  id: z.string(),
112
128
  label: z.string(),
113
129
  });
@@ -117,12 +133,12 @@ export const teamSettingsResponseSchema = z.object({
117
133
  teamId: z.string().describe("The team id the settings belong to."),
118
134
  defaultDataLocation: teamDataLocationSchema,
119
135
  regionOptions: z
120
- .array(wpCloudCapabilityOptionSchema)
136
+ .array(infraCapabilityOptionSchema)
121
137
  .describe("Placement regions currently available for new spaces."),
122
- wpCloudCapabilities: z
138
+ infraCapabilities: z
123
139
  .object({
124
- datacenters: z.array(wpCloudCapabilityOptionSchema),
125
- phpVersions: z.array(wpCloudCapabilityOptionSchema),
140
+ datacenters: z.array(infraCapabilityOptionSchema),
141
+ phpVersion: z.literal("8.5"),
126
142
  })
127
143
  .describe("Live capabilities for the team's infra provider account."),
128
144
  });
@@ -135,7 +151,9 @@ export const teamUsageResponseSchema = z.object({
135
151
  spaces: z.number().int().describe("Live spaces in the team."),
136
152
  domains: z.number().int().describe("External domain groups counted against the plan."),
137
153
  members: z.number().int().describe("Team members."),
138
- storageBytes: z.number().describe("Stored bytes across the team's spaces."),
154
+ storageBytes: z
155
+ .number()
156
+ .describe("Disk actually occupied across the team's spaces, as measured by the serving infrastructure. Nothing is deduplicated: a file present in two spaces sits on two disks and counts twice."),
139
157
  storageQuotaBytes: z
140
158
  .union([z.number(), z.literal("unlimited")])
141
159
  .describe('Plan storage quota; "unlimited" when unbounded.'),
@@ -143,7 +161,7 @@ export const teamUsageResponseSchema = z.object({
143
161
  storageCalculatedAt: z
144
162
  .string()
145
163
  .nullable()
146
- .describe("Instant when storage was last accounted."),
164
+ .describe("How far back the weakest measurement behind this total reaches. Null when the team's storage has not been measured yet. This is a lagging meter — expect it to trail the present by about an hour."),
147
165
  buildsDeploysThisMonth: z
148
166
  .number()
149
167
  .int()
@@ -162,7 +180,7 @@ export const teamUsageResponseSchema = z.object({
162
180
  title: z.string().describe("Space display title."),
163
181
  storageBytes: z
164
182
  .number()
165
- .describe("Deduplicated bytes this space's ready versions hold. Spaces sharing files each count them, so the sum can exceed the team total."),
183
+ .describe("Disk this space occupies, as measured by the infrastructure serving it. Zero for a space that has not been measured yet."),
166
184
  }))
167
185
  .describe("Per-space storage breakdown for spaces the caller can read."),
168
186
  });
@@ -45,59 +45,10 @@ export declare const spaceTransferSchema: z.ZodObject<{
45
45
  }, z.core.$strip>;
46
46
  status: z.ZodEnum<{
47
47
  pending_confirmation: "pending_confirmation";
48
- confirming_domains: "confirming_domains";
49
48
  completed: "completed";
50
49
  canceled: "canceled";
51
50
  expired: "expired";
52
51
  }>;
53
- requiredActions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
54
- type: z.ZodLiteral<"dns">;
55
- instructions: z.ZodArray<z.ZodObject<{
56
- type: z.ZodEnum<{
57
- A: "A";
58
- AAAA: "AAAA";
59
- CNAME: "CNAME";
60
- TXT: "TXT";
61
- ALIAS: "ALIAS";
62
- }>;
63
- name: z.ZodString;
64
- value: z.ZodString;
65
- ttl: z.ZodOptional<z.ZodNumber>;
66
- purpose: z.ZodEnum<{
67
- verification: "verification";
68
- routing: "routing";
69
- ssl: "ssl";
70
- }>;
71
- }, z.core.$strip>>;
72
- }, z.core.$strip>, z.ZodObject<{
73
- type: z.ZodLiteral<"confirm_move">;
74
- conflictId: z.ZodString;
75
- }, z.core.$strip>, z.ZodObject<{
76
- type: z.ZodLiteral<"verify_domain">;
77
- domainId: z.ZodString;
78
- }, z.core.$strip>, z.ZodObject<{
79
- type: z.ZodLiteral<"renew">;
80
- domainId: z.ZodString;
81
- }, z.core.$strip>], "type">>;
82
- diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
83
- code: z.ZodString;
84
- severity: z.ZodEnum<{
85
- info: "info";
86
- error: "error";
87
- warning: "warning";
88
- }>;
89
- message: z.ZodString;
90
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
92
- registrar: "registrar";
93
- wpcloud: "wpcloud";
94
- dns: "dns";
95
- runtime: "runtime";
96
- }>>>;
97
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
98
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
100
- }, z.core.$strip>>>;
101
52
  expiresAt: z.ZodString;
102
53
  createdAt: z.ZodString;
103
54
  updatedAt: z.ZodString;
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
- import { baseDiagnosticSchema, requiredActionsSchema } from "./common.js";
3
2
  import { spaceTransferStatus } from "./enums.js";
4
- // Tenant-local external principal id grammar (internal-docs/platform.md
3
+ // Tenant-local external principal id grammar (the platform spec
5
4
  // "Principal"): 1-256 chars, no whitespace, no `/` or `\`, no
6
5
  // control/non-printable characters. Team principal ids are Better Auth team
7
6
  // ids and trivially satisfy the same grammar.
@@ -16,7 +15,7 @@ export const principalIdSchema = z
16
15
  }))
17
16
  .describe("Tenant-local principal id: a team id or an integrator external customer id.");
18
17
  // Request `to` omits tenantId: transfers are tenant-local and the tenant is
19
- // inferred from the space (internal-docs/platform.md "Transfer semantics").
18
+ // inferred from the space (the platform spec "Transfer semantics").
20
19
  export const transferPrincipalInputSchema = z.object({
21
20
  principalType: z
22
21
  .enum(["team", "external"])
@@ -34,11 +33,8 @@ export const spaceTransferSchema = z.object({
34
33
  id: z.string().describe("SpaceTransfer id (`trf_`)."),
35
34
  spaceId: z.string().describe("Space being transferred."),
36
35
  from: transferPrincipalSchema.describe("Current owner. Keeps full control, serving, and billing attribution until `completed`."),
37
- to: transferPrincipalSchema.describe("Receiving principal. Confirm is a to-side action."),
38
- status: spaceTransferStatus.describe("Transfer state. `confirming_domains` waits on re-confirmation of bound domains; a failed move reverts to `pending_confirmation` with a diagnostic (there is no failed state)."),
39
- // Domain confirmations the receiving principal must complete before the move.
40
- requiredActions: requiredActionsSchema,
41
- diagnostics: z.array(baseDiagnosticSchema).default([]),
36
+ to: transferPrincipalSchema.describe("Receiving principal. Accept is a to-side action."),
37
+ status: spaceTransferStatus.describe("Transfer state. Accepting moves ownership in one transaction, so a transfer is either still `pending_confirmation` or already terminal."),
42
38
  expiresAt: z
43
39
  .string()
44
40
  .datetime()