@spacefast/common 0.0.21 → 0.0.24

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 (182) hide show
  1. package/dist/agents/connect-targets.d.ts +9 -6
  2. package/dist/agents/connect-targets.js +9 -6
  3. package/dist/config/domains.d.ts +1 -1
  4. package/dist/config/domains.js +1 -0
  5. package/dist/config/index.d.ts +0 -1
  6. package/dist/config/index.js +0 -1
  7. package/dist/contracts/abuse.d.ts +2 -0
  8. package/dist/contracts/abuse.js +12 -0
  9. package/dist/contracts/access.d.ts +121 -9
  10. package/dist/contracts/access.js +73 -9
  11. package/dist/contracts/activity.d.ts +1 -1
  12. package/dist/contracts/activity.js +0 -9
  13. package/dist/contracts/api-keys.d.ts +21 -21
  14. package/dist/contracts/beta.js +1 -1
  15. package/dist/contracts/billing.d.ts +1 -34
  16. package/dist/contracts/billing.js +4 -53
  17. package/dist/contracts/builds.d.ts +8 -8
  18. package/dist/contracts/builds.js +10 -3
  19. package/dist/contracts/cli.d.ts +10 -0
  20. package/dist/contracts/cli.js +10 -0
  21. package/dist/contracts/collab-public.d.ts +63 -0
  22. package/dist/contracts/collab-public.js +46 -0
  23. package/dist/contracts/comments.d.ts +283 -54
  24. package/dist/contracts/comments.js +173 -52
  25. package/dist/contracts/common.d.ts +3 -3
  26. package/dist/contracts/device-auth.d.ts +6 -6
  27. package/dist/contracts/device-auth.js +1 -1
  28. package/dist/contracts/docs.d.ts +5 -5
  29. package/dist/contracts/domains.d.ts +36 -36
  30. package/dist/contracts/enums.d.ts +33 -30
  31. package/dist/contracts/enums.js +52 -38
  32. package/dist/contracts/error-code-meta.d.ts +37 -126
  33. package/dist/contracts/error-code-meta.js +12 -41
  34. package/dist/contracts/error-codes.d.ts +1 -1
  35. package/dist/contracts/error-codes.js +10 -32
  36. package/dist/contracts/execution.d.ts +35 -57
  37. package/dist/contracts/execution.js +41 -40
  38. package/dist/contracts/feature-lifecycle-core.d.ts +0 -6
  39. package/dist/contracts/feature-lifecycle-core.js +2 -31
  40. package/dist/contracts/feature-lifecycle.d.ts +8 -38
  41. package/dist/contracts/feature-lifecycle.js +16 -48
  42. package/dist/contracts/features.d.ts +15 -13
  43. package/dist/contracts/features.js +39 -38
  44. package/dist/contracts/functions.d.ts +97 -70
  45. package/dist/contracts/functions.js +101 -34
  46. package/dist/contracts/git.d.ts +1 -1
  47. package/dist/contracts/grants.d.ts +7 -3
  48. package/dist/contracts/grants.js +18 -9
  49. package/dist/contracts/internal.d.ts +14 -1
  50. package/dist/contracts/internal.js +17 -7
  51. package/dist/contracts/oauth-resources.d.ts +4 -3
  52. package/dist/contracts/oauth-resources.js +12 -3
  53. package/dist/contracts/operations.d.ts +90 -5
  54. package/dist/contracts/operations.js +75 -1
  55. package/dist/contracts/pages.d.ts +6 -1
  56. package/dist/contracts/pages.js +24 -1
  57. package/dist/contracts/plan-policy.d.ts +1 -3
  58. package/dist/contracts/plan-policy.js +1 -2
  59. package/dist/contracts/platform.d.ts +61 -148
  60. package/dist/contracts/platform.js +70 -126
  61. package/dist/contracts/publish-archive.d.ts +498 -0
  62. package/dist/contracts/publish-archive.js +25 -0
  63. package/dist/contracts/resources.d.ts +12 -24
  64. package/dist/contracts/resources.js +32 -12
  65. package/dist/contracts/runtime-api.d.ts +369 -175
  66. package/dist/contracts/runtime-api.js +372 -348
  67. package/dist/contracts/runtime-app.d.ts +127 -120
  68. package/dist/contracts/runtime-app.js +19 -10
  69. package/dist/contracts/runtime-db.d.ts +1 -1
  70. package/dist/contracts/runtime-services.d.ts +219 -0
  71. package/dist/contracts/runtime-services.js +437 -0
  72. package/dist/contracts/runtime-storage.d.ts +45 -32
  73. package/dist/contracts/runtime-storage.js +30 -8
  74. package/dist/contracts/space-config.d.ts +10 -16
  75. package/dist/contracts/space-config.js +14 -10
  76. package/dist/contracts/spaces.d.ts +241 -436
  77. package/dist/contracts/spaces.js +128 -145
  78. package/dist/contracts/superadmin-activity.d.ts +57 -4
  79. package/dist/contracts/superadmin-activity.js +48 -2
  80. package/dist/contracts/superadmin-search.d.ts +126 -0
  81. package/dist/contracts/superadmin-search.js +61 -0
  82. package/dist/contracts/superadmin-spaces.d.ts +358 -89
  83. package/dist/contracts/superadmin-spaces.js +97 -24
  84. package/dist/contracts/superadmin-teams.d.ts +28 -10
  85. package/dist/contracts/superadmin-teams.js +5 -8
  86. package/dist/contracts/superadmin.d.ts +0 -32
  87. package/dist/contracts/superadmin.js +3 -11
  88. package/dist/contracts/tags.d.ts +9 -9
  89. package/dist/contracts/teams.d.ts +44 -2
  90. package/dist/contracts/teams.js +43 -23
  91. package/dist/contracts/transfers.d.ts +0 -49
  92. package/dist/contracts/transfers.js +2 -6
  93. package/dist/contracts/usage.d.ts +61 -0
  94. package/dist/contracts/usage.js +64 -0
  95. package/dist/contracts/variables.d.ts +2 -7
  96. package/dist/contracts/variables.js +6 -5
  97. package/dist/contracts/webhooks.d.ts +2 -2
  98. package/dist/contracts/zero.d.ts +87 -56
  99. package/dist/contracts/zero.js +82 -20
  100. package/dist/dashboard-paths/index.d.ts +1 -1
  101. package/dist/dashboard-paths/index.js +1 -0
  102. package/dist/docs/agent-prose.d.ts +1 -1
  103. package/dist/docs/agent-prose.js +62 -66
  104. package/dist/docs/agent-setup.js +49 -23
  105. package/dist/docs/agent-solutions.d.ts +4 -4
  106. package/dist/docs/agent-solutions.js +8 -8
  107. package/dist/docs/catalog.d.ts +19 -19
  108. package/dist/docs/catalog.js +30 -19
  109. package/dist/docs/error-docs.js +63 -151
  110. package/dist/docs/skills.d.ts +3 -3
  111. package/dist/docs/skills.js +1 -1
  112. package/dist/test-helpers/fetch-stub.d.ts +16 -0
  113. package/dist/test-helpers/fetch-stub.js +24 -0
  114. package/dist/utils/build-settings.js +9 -3
  115. package/dist/utils/canonical-json.d.ts +10 -0
  116. package/dist/utils/canonical-json.js +21 -0
  117. package/dist/utils/cast-transport.d.ts +28 -0
  118. package/dist/utils/cast-transport.js +52 -0
  119. package/dist/utils/claim-token.d.ts +0 -8
  120. package/dist/utils/claim-token.js +3 -15
  121. package/dist/utils/credential-policy.d.ts +1 -1
  122. package/dist/utils/env-file.d.ts +17 -0
  123. package/dist/utils/env-file.js +96 -0
  124. package/dist/utils/error-code.d.ts +2 -0
  125. package/dist/utils/error-code.js +7 -0
  126. package/dist/utils/generate-space-name.d.ts +8 -10
  127. package/dist/utils/generate-space-name.js +206 -21
  128. package/dist/utils/grant-decision.fixtures.json +2938 -0
  129. package/dist/utils/grants.d.ts +2 -0
  130. package/dist/utils/grants.js +25 -2
  131. package/dist/utils/gravatar.d.ts +9 -0
  132. package/dist/utils/gravatar.js +31 -0
  133. package/dist/utils/idempotency.d.ts +6 -0
  134. package/dist/utils/idempotency.js +28 -0
  135. package/dist/utils/local-space-state.d.ts +1 -5
  136. package/dist/utils/local-space-state.js +7 -26
  137. package/dist/utils/page-fonts.d.ts +2 -2
  138. package/dist/utils/page-fonts.js +22 -4
  139. package/dist/utils/pages.d.ts +1 -2
  140. package/dist/utils/pages.js +21 -5
  141. package/dist/utils/publish-form-data.d.ts +12 -0
  142. package/dist/utils/publish-form-data.js +10 -0
  143. package/dist/utils/publish-policy.d.ts +20 -0
  144. package/dist/utils/publish-policy.fixtures.json +397 -0
  145. package/dist/utils/publish-policy.js +36 -19
  146. package/dist/utils/push-new.d.ts +7 -0
  147. package/dist/utils/push-new.js +7 -0
  148. package/dist/utils/query-keys.d.ts +0 -1
  149. package/dist/utils/query-keys.js +0 -1
  150. package/dist/utils/runtime-paths.d.ts +5 -0
  151. package/dist/utils/runtime-paths.js +5 -0
  152. package/dist/utils/runtime-upload-batch.d.ts +0 -5
  153. package/dist/utils/runtime-upload-batch.js +1 -27
  154. package/dist/utils/runtime-upload.d.ts +3 -13
  155. package/dist/utils/runtime-upload.js +4 -14
  156. package/dist/utils/space-config.d.ts +0 -33
  157. package/dist/utils/space-config.js +5 -326
  158. package/dist/utils/storage-policy.d.ts +1 -1
  159. package/dist/utils/storage-policy.js +3 -1
  160. package/dist/utils/structured-error.d.ts +14 -0
  161. package/dist/utils/structured-error.js +22 -0
  162. package/dist/utils/version-path.js +12 -3
  163. package/dist/vocabulary.d.ts +5 -3
  164. package/dist/vocabulary.js +13 -10
  165. package/package.json +10 -5
  166. package/dist/config/postgres-budget.d.ts +0 -129
  167. package/dist/config/postgres-budget.js +0 -140
  168. package/dist/config/postgres-budget.json +0 -51
  169. package/dist/contracts/archives.d.ts +0 -331
  170. package/dist/contracts/archives.js +0 -120
  171. package/dist/contracts/deployments.d.ts +0 -574
  172. package/dist/contracts/deployments.js +0 -97
  173. package/dist/contracts/sites.d.ts +0 -416
  174. package/dist/contracts/sites.js +0 -168
  175. package/dist/contracts/superadmin-queues.d.ts +0 -414
  176. package/dist/contracts/superadmin-queues.js +0 -202
  177. package/dist/contracts/superadmin-runtime.d.ts +0 -27
  178. package/dist/contracts/superadmin-runtime.js +0 -38
  179. package/dist/index.d.ts +0 -1
  180. package/dist/index.js +0 -1
  181. package/dist/utils/api.d.ts +0 -4
  182. package/dist/utils/api.js +0 -13
@@ -1,8 +1,10 @@
1
1
  import { z } from "zod";
2
2
  import { accessScopePathSchema } from "./access.js";
3
+ import { makeOffsetListSchema } from "./common.js";
4
+ import { spaceStatus } from "./enums.js";
3
5
  import { SpaceSchema } from "./resources.js";
6
+ import { superadminPaginationSchema } from "./superadmin.js";
4
7
  import { ZERO_RUNTIME_KIND } from "./zero.js";
5
- const zeroLogLevelSchema = z.enum(["debug", "info", "warn", "error"]);
6
8
  export const SuperadminSpaceHostnameSchema = z.object({
7
9
  hostname: z.string(),
8
10
  url: z.string(),
@@ -39,12 +41,13 @@ export const SuperadminSpaceVersionZeroSchema = z
39
41
  runnerCompatibilityTarget: z.string().nullable(),
40
42
  runnerSha256: z.string().nullable(),
41
43
  blockIncompatibleRollback: z.boolean(),
44
+ // No log counts. A capsule's output is the space's runtime log like any
45
+ // other tier's, and that lives in one place only — the provider's PHP error
46
+ // log, windowed and paged. Summarising it per version would mean scanning
47
+ // that window on every superadmin page load; read it on the log surface
48
+ // instead.
42
49
  operations: z
43
50
  .object({
44
- centralLogCount: z.number().int().nonnegative(),
45
- centralErrorLogCount: z.number().int().nonnegative(),
46
- latestLogAt: z.string().datetime().nullable(),
47
- latestLogLevel: zeroLogLevelSchema.nullable(),
48
51
  replayEventCount: z.number().int().nonnegative(),
49
52
  latestReplayEventAt: z.string().datetime().nullable(),
50
53
  latestReplayEventId: z.string().nullable(),
@@ -102,27 +105,97 @@ export const SuperadminSpaceViewLinkSchema = z
102
105
  url: z.string().url(),
103
106
  })
104
107
  .strict();
105
- export const SuperadminAnonymousSpaceSchema = z.object({
106
- id: z.string(),
107
- tenantId: z.string(),
108
- slug: z.string(),
109
- title: z.string(),
110
- status: z.string(),
111
- liveUrl: z.string().nullable(),
112
- defaultHostname: z.string().nullable(),
113
- claimExpiresAt: z.string().datetime().nullable(),
114
- createdAt: z.string().datetime().nullable(),
115
- updatedAt: z.string().datetime().nullable(),
116
- latestVersionId: z.string().nullable(),
117
- latestVersionStatus: z.string().nullable(),
118
- disabledReason: z.string().nullable(),
108
+ // The cross-tenant Space list. Same Space resource the customer API returns —
109
+ // operators need the identical shape, not a parallel projection — narrowed by
110
+ // the operator-only facets (tenant, team, ownership, lifecycle, serving).
111
+ export const SuperadminSpaceListSchema = makeOffsetListSchema("spaces", SpaceSchema, superadminPaginationSchema);
112
+ export const superadminSpaceListQuerySchema = z.object({
113
+ limit: z.coerce.number().int().min(1).max(100).default(25),
114
+ offset: z.coerce.number().int().min(0).default(0),
115
+ // Unscoped search is restricted to slug prefixes and exact ids so the query
116
+ // stays index-backed; substring search requires a scoping filter.
117
+ search: z.string().trim().optional(),
118
+ tenantId: z.string().trim().optional(),
119
+ teamId: z.string().trim().optional(),
120
+ // Customer-360: every space owned by any team this user is a member of.
121
+ memberUserId: z.string().trim().optional(),
122
+ ownership: z.enum(["team", "external", "anonymous"]).optional(),
123
+ status: spaceStatus.optional(),
124
+ // Serving axis, independent of lifecycle status: true selects spaces whose
125
+ // serving is currently disabled (takedown, suspension), false the rest.
126
+ disabled: z.stringbool().optional(),
119
127
  });
120
- export const SuperadminAnonymousSpaceListSchema = z.object({
121
- spaces: z.array(SuperadminAnonymousSpaceSchema),
128
+ // Per-space scan visibility. The evidence is content-addressed — one verdict
129
+ // per (digest, engine, signature DB version), shared by every version that
130
+ // published the same bytes — so this projects it back onto the version's
131
+ // manifest, which is the coordinate an operator actually has.
132
+ export const superadminSpaceScanResultsQuerySchema = z.object({
133
+ // Narrow to one version; otherwise the newest `versionLimit` are returned.
134
+ versionId: z.string().trim().min(1).optional(),
135
+ versionLimit: z.coerce.number().int().min(1).max(20).default(5),
122
136
  });
123
- export const superadminAnonymousSpaceAssignSchema = z.object({
137
+ export const SuperadminSpaceScanVerdictSchema = z
138
+ .object({
139
+ engine: z.string(),
140
+ signatureDbVersion: z.string(),
141
+ // The evidence row exactly as the engine wrote it. The hash allowlist never
142
+ // rewrites this — suppression is prospective, not a retraction.
143
+ verdict: z.enum(["clean", "flagged", "skipped"]),
144
+ // What enforcement acts on: an allowlisted media-hash flag reads clean.
145
+ effectiveVerdict: z.enum(["clean", "flagged", "skipped"]),
146
+ whitelisted: z.boolean(),
147
+ category: z.string().nullable(),
148
+ severity: z.number().int().nullable(),
149
+ signature: z.string().nullable(),
150
+ firstSeenAt: z.string().datetime().nullable(),
151
+ })
152
+ .strict();
153
+ export const SuperadminSpaceScanFileSchema = z
154
+ .object({
155
+ path: z.string(),
156
+ size: z.number().int().nonnegative(),
157
+ // Historical manifest rows and sourceUrl entries can lack a digest; those
158
+ // files are uncorrelatable and count as unscanned.
159
+ sha256: z.string().nullable(),
160
+ verdicts: z.array(SuperadminSpaceScanVerdictSchema),
161
+ })
162
+ .strict();
163
+ export const SuperadminSpaceScanVersionSchema = z
164
+ .object({
165
+ versionId: z.string(),
166
+ number: z.number().int().nullable(),
167
+ status: z.string(),
168
+ readyAt: z.string().datetime().nullable(),
169
+ files: z.array(SuperadminSpaceScanFileSchema),
170
+ // One bucket per manifest file, by the worst effective verdict it carries:
171
+ // flagged beats skipped beats clean, and a file with no evidence row at all
172
+ // is unscanned. The four always sum to the manifest file count.
173
+ summary: z
174
+ .object({
175
+ flagged: z.number().int().nonnegative(),
176
+ skipped: z.number().int().nonnegative(),
177
+ clean: z.number().int().nonnegative(),
178
+ unscanned: z.number().int().nonnegative(),
179
+ })
180
+ .strict(),
181
+ })
182
+ .strict();
183
+ export const SuperadminSpaceScanResultsSchema = z
184
+ .object({
185
+ // The aggregated space-level verdict the enforcement pipeline settled on.
186
+ spaceScanVerdict: z.string().nullable(),
187
+ versions: z.array(SuperadminSpaceScanVersionSchema),
188
+ })
189
+ .strict();
190
+ // Operator re-home: one assign for every space, claimed or not. The reason is
191
+ // the operator's own note on why ownership moved — it lands in the space's
192
+ // activity feed, so the customer can read it.
193
+ export const superadminSpaceAssignSchema = z
194
+ .object({
124
195
  teamId: z.string().min(1),
125
- });
126
- export const SuperadminAnonymousSpaceAssignResponseSchema = z.object({
196
+ reason: z.string().trim().min(1).max(500).optional(),
197
+ })
198
+ .strict();
199
+ export const SuperadminSpaceAssignResponseSchema = z.object({
127
200
  space: SpaceSchema,
128
201
  });
@@ -14,12 +14,21 @@ export declare const SuperadminTeamSchema: z.ZodObject<{
14
14
  updatedAt: z.ZodString;
15
15
  }, z.core.$strip>;
16
16
  export declare const SuperadminTeamMemberSchema: z.ZodObject<{
17
- membershipId: z.ZodString;
18
- role: z.ZodString;
19
- joinedAt: z.ZodString;
17
+ id: z.ZodString;
18
+ teamId: z.ZodString;
20
19
  userId: z.ZodString;
21
- userName: z.ZodString;
22
- userEmail: z.ZodString;
20
+ role: z.ZodEnum<{
21
+ owner: "owner";
22
+ admin: "admin";
23
+ member: "member";
24
+ }>;
25
+ createdAt: z.ZodString;
26
+ user: z.ZodNullable<z.ZodObject<{
27
+ id: z.ZodString;
28
+ name: z.ZodString;
29
+ email: z.ZodString;
30
+ image: z.ZodNullable<z.ZodString>;
31
+ }, z.core.$strip>>;
23
32
  userBanned: z.ZodBoolean;
24
33
  }, z.core.$strip>;
25
34
  export declare const SuperadminTeamDetailSchema: z.ZodObject<{
@@ -36,12 +45,21 @@ export declare const SuperadminTeamDetailSchema: z.ZodObject<{
36
45
  createdAt: z.ZodString;
37
46
  updatedAt: z.ZodString;
38
47
  members: z.ZodArray<z.ZodObject<{
39
- membershipId: z.ZodString;
40
- role: z.ZodString;
41
- joinedAt: z.ZodString;
48
+ id: z.ZodString;
49
+ teamId: z.ZodString;
42
50
  userId: z.ZodString;
43
- userName: z.ZodString;
44
- userEmail: z.ZodString;
51
+ role: z.ZodEnum<{
52
+ owner: "owner";
53
+ admin: "admin";
54
+ member: "member";
55
+ }>;
56
+ createdAt: z.ZodString;
57
+ user: z.ZodNullable<z.ZodObject<{
58
+ id: z.ZodString;
59
+ name: z.ZodString;
60
+ email: z.ZodString;
61
+ image: z.ZodNullable<z.ZodString>;
62
+ }, z.core.$strip>>;
45
63
  userBanned: z.ZodBoolean;
46
64
  }, z.core.$strip>>;
47
65
  }, z.core.$strip>;
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { makeOffsetListSchema } from "./common.js";
3
3
  import { superadminPaginationSchema } from "./superadmin.js";
4
+ import { TeamMemberSchema } from "./teams.js";
4
5
  export const SuperadminTeamSchema = z.object({
5
6
  id: z.string(),
6
7
  tenantId: z.string(),
@@ -15,14 +16,10 @@ export const SuperadminTeamSchema = z.object({
15
16
  createdAt: z.string().datetime(),
16
17
  updatedAt: z.string().datetime(),
17
18
  });
18
- export const SuperadminTeamMemberSchema = z.object({
19
- membershipId: z.string(),
20
- role: z.string(),
21
- joinedAt: z.string().datetime(),
22
- userId: z.string(),
23
- userName: z.string(),
24
- userEmail: z.string().email(),
25
- userBanned: z.boolean(),
19
+ // Superadmin reads the same membership shape every other surface does, plus
20
+ // the one operator-only fact the product API never exposes.
21
+ export const SuperadminTeamMemberSchema = TeamMemberSchema.extend({
22
+ userBanned: z.boolean().describe("Whether the member's user account is banned."),
26
23
  });
27
24
  export const SuperadminTeamDetailSchema = SuperadminTeamSchema.extend({
28
25
  members: z.array(SuperadminTeamMemberSchema),
@@ -314,8 +314,6 @@ export declare const SuperadminBillingTransactionSchema: z.ZodObject<{
314
314
  teamName: z.ZodNullable<z.ZodString>;
315
315
  provider: z.ZodEnum<{
316
316
  stripe: "stripe";
317
- app_store: "app_store";
318
- google_play: "google_play";
319
317
  }>;
320
318
  kind: z.ZodEnum<{
321
319
  purchase: "purchase";
@@ -356,8 +354,6 @@ export declare const SuperadminTeamBillingOverviewSchema: z.ZodObject<{
356
354
  provider: z.ZodEnum<{
357
355
  grant: "grant";
358
356
  stripe: "stripe";
359
- app_store: "app_store";
360
- google_play: "google_play";
361
357
  }>;
362
358
  planCode: z.ZodString;
363
359
  active: z.ZodBoolean;
@@ -369,26 +365,12 @@ export declare const SuperadminTeamBillingOverviewSchema: z.ZodObject<{
369
365
  export declare const SuperadminWpCloudSiteSchema: z.ZodObject<{
370
366
  providerSiteId: z.ZodString;
371
367
  placementId: z.ZodNullable<z.ZodString>;
372
- placementKind: z.ZodNullable<z.ZodEnum<{
373
- shared: "shared";
374
- dedicated: "dedicated";
375
- shared_org: "shared_org";
376
- anonymous_pool: "anonymous_pool";
377
- dedicated_space: "dedicated_space";
378
- }>>;
379
368
  placementState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
380
369
  placementStatus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
381
370
  placementPrimaryHostname: z.ZodNullable<z.ZodString>;
382
371
  placementDatacenterId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
383
372
  placementRegion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
384
373
  placementGeoAffinity: z.ZodNullable<z.ZodString>;
385
- anonymousPoolId: z.ZodNullable<z.ZodString>;
386
- anonymousPoolState: z.ZodNullable<z.ZodEnum<{
387
- active: "active";
388
- disabled: "disabled";
389
- draining: "draining";
390
- }>>;
391
- anonymousPoolAssignedSpaceCount: z.ZodNullable<z.ZodNumber>;
392
374
  assignedSpaceCount: z.ZodNumber;
393
375
  assignedSpaces: z.ZodArray<z.ZodObject<{
394
376
  id: z.ZodString;
@@ -437,26 +419,12 @@ export declare const SuperadminWpCloudSiteListSchema: z.ZodObject<{
437
419
  sites: z.ZodArray<z.ZodObject<{
438
420
  providerSiteId: z.ZodString;
439
421
  placementId: z.ZodNullable<z.ZodString>;
440
- placementKind: z.ZodNullable<z.ZodEnum<{
441
- shared: "shared";
442
- dedicated: "dedicated";
443
- shared_org: "shared_org";
444
- anonymous_pool: "anonymous_pool";
445
- dedicated_space: "dedicated_space";
446
- }>>;
447
422
  placementState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
448
423
  placementStatus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
449
424
  placementPrimaryHostname: z.ZodNullable<z.ZodString>;
450
425
  placementDatacenterId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
451
426
  placementRegion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
452
427
  placementGeoAffinity: z.ZodNullable<z.ZodString>;
453
- anonymousPoolId: z.ZodNullable<z.ZodString>;
454
- anonymousPoolState: z.ZodNullable<z.ZodEnum<{
455
- active: "active";
456
- disabled: "disabled";
457
- draining: "draining";
458
- }>>;
459
- anonymousPoolAssignedSpaceCount: z.ZodNullable<z.ZodNumber>;
460
428
  assignedSpaceCount: z.ZodNumber;
461
429
  assignedSpaces: z.ZodArray<z.ZodObject<{
462
430
  id: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { makeOffsetListSchema } from "./common.js";
3
- import { buildStatus, siteClass } from "./enums.js";
3
+ import { buildStatus } from "./enums.js";
4
4
  // Operator-only offset pagination. The platform API uses opaque cursors exclusively
5
5
  // (contracts/common.ts); the superadmin surface is the one sanctioned exception.
6
6
  export const superadminPaginationSchema = z.object({
@@ -183,7 +183,7 @@ export const SuperadminBillingTransactionSchema = z.object({
183
183
  teamId: z.string().nullable(),
184
184
  teamSlug: z.string().nullable(),
185
185
  teamName: z.string().nullable(),
186
- provider: z.enum(["stripe", "app_store", "google_play"]),
186
+ provider: z.enum(["stripe"]),
187
187
  kind: z.enum(["purchase", "renewal", "refund", "adjustment"]),
188
188
  scope: z.enum(["plan", "seats", "domain", "other"]),
189
189
  planCode: z.string().nullable(),
@@ -210,7 +210,7 @@ export const SuperadminTeamBillingOverviewSchema = z.object({
210
210
  }),
211
211
  planCode: z.string(),
212
212
  sources: z.array(z.object({
213
- provider: z.enum(["stripe", "app_store", "google_play", "grant"]),
213
+ provider: z.enum(["stripe", "grant"]),
214
214
  planCode: z.string(),
215
215
  active: z.boolean(),
216
216
  detail: z.string(),
@@ -221,20 +221,12 @@ export const SuperadminTeamBillingOverviewSchema = z.object({
221
221
  export const SuperadminWpCloudSiteSchema = z.object({
222
222
  providerSiteId: z.string(),
223
223
  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
224
  placementState: z.string().nullable().optional(),
230
225
  placementStatus: z.string().nullable().optional(),
231
226
  placementPrimaryHostname: z.string().nullable(),
232
227
  placementDatacenterId: z.string().nullable().optional(),
233
228
  placementRegion: z.string().nullable().optional(),
234
229
  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
230
  assignedSpaceCount: z.number().int().nonnegative(),
239
231
  assignedSpaces: z.array(z.object({
240
232
  id: z.string(),
@@ -81,8 +81,8 @@ export declare const tagConsentPolicySchema: z.ZodObject<{
81
81
  code: z.ZodString;
82
82
  severity: z.ZodEnum<{
83
83
  info: "info";
84
- error: "error";
85
84
  warning: "warning";
85
+ error: "error";
86
86
  }>;
87
87
  message: z.ZodString;
88
88
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -142,8 +142,8 @@ export declare const tagValidationResultSchema: z.ZodObject<{
142
142
  code: z.ZodString;
143
143
  severity: z.ZodEnum<{
144
144
  info: "info";
145
- error: "error";
146
145
  warning: "warning";
146
+ error: "error";
147
147
  }>;
148
148
  message: z.ZodString;
149
149
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -191,8 +191,8 @@ export declare const tagVersionSchema: z.ZodObject<{
191
191
  code: z.ZodString;
192
192
  severity: z.ZodEnum<{
193
193
  info: "info";
194
- error: "error";
195
194
  warning: "warning";
195
+ error: "error";
196
196
  }>;
197
197
  message: z.ZodString;
198
198
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -261,8 +261,8 @@ export declare const tagVersionListResponseSchema: z.ZodObject<{
261
261
  code: z.ZodString;
262
262
  severity: z.ZodEnum<{
263
263
  info: "info";
264
- error: "error";
265
264
  warning: "warning";
265
+ error: "error";
266
266
  }>;
267
267
  message: z.ZodString;
268
268
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -324,8 +324,8 @@ export declare const tagVersionResponseSchema: z.ZodObject<{
324
324
  code: z.ZodString;
325
325
  severity: z.ZodEnum<{
326
326
  info: "info";
327
- error: "error";
328
327
  warning: "warning";
328
+ error: "error";
329
329
  }>;
330
330
  message: z.ZodString;
331
331
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -419,8 +419,8 @@ export declare const tagValidateResponseSchema: z.ZodObject<{
419
419
  code: z.ZodString;
420
420
  severity: z.ZodEnum<{
421
421
  info: "info";
422
- error: "error";
423
422
  warning: "warning";
423
+ error: "error";
424
424
  }>;
425
425
  message: z.ZodString;
426
426
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -640,8 +640,8 @@ export declare const tagApplyResponseSchema: z.ZodObject<{
640
640
  code: z.ZodString;
641
641
  severity: z.ZodEnum<{
642
642
  info: "info";
643
- error: "error";
644
643
  warning: "warning";
644
+ error: "error";
645
645
  }>;
646
646
  message: z.ZodString;
647
647
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -673,8 +673,8 @@ export declare const tagApplyResponseSchema: z.ZodObject<{
673
673
  code: z.ZodString;
674
674
  severity: z.ZodEnum<{
675
675
  info: "info";
676
- error: "error";
677
676
  warning: "warning";
677
+ error: "error";
678
678
  }>;
679
679
  message: z.ZodString;
680
680
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1022,8 +1022,8 @@ export declare const tagConsentPolicyResponseSchema: z.ZodObject<{
1022
1022
  code: z.ZodString;
1023
1023
  severity: z.ZodEnum<{
1024
1024
  info: "info";
1025
- error: "error";
1026
1025
  warning: "warning";
1026
+ error: "error";
1027
1027
  }>;
1028
1028
  message: z.ZodString;
1029
1029
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -5,6 +5,12 @@ export declare const teamMemberRole: z.ZodEnum<{
5
5
  admin: "admin";
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): "owner" | "admin" | "member";
8
14
  export declare const teamInvitationCreateSchema: z.ZodObject<{
9
15
  email: z.ZodString;
10
16
  role: z.ZodDefault<z.ZodEnum<{
@@ -29,6 +35,37 @@ 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
+ owner: "owner";
50
+ admin: "admin";
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
+ owner: "owner";
64
+ admin: "admin";
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;
@@ -42,6 +79,7 @@ export declare const TeamInvitationSchema: z.ZodObject<{
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";
@@ -217,12 +255,16 @@ export declare const teamUsageResponseSchema: z.ZodObject<{
217
255
  storageQuotaBytes: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
218
256
  storageOverageBytes: z.ZodNumber;
219
257
  storageCalculatedAt: z.ZodNullable<z.ZodString>;
220
- storageOverQuotaSince: z.ZodNullable<z.ZodString>;
221
- storageWarningSentAt: z.ZodNullable<z.ZodString>;
222
258
  buildsDeploysThisMonth: z.ZodNumber;
223
259
  buildsDeploysMonthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
224
260
  meterStartedAt: z.ZodNullable<z.ZodString>;
225
261
  }, z.core.$strip>;
262
+ spaceStorage: z.ZodArray<z.ZodObject<{
263
+ spaceId: z.ZodString;
264
+ slug: z.ZodString;
265
+ title: z.ZodString;
266
+ storageBytes: z.ZodNumber;
267
+ }, z.core.$strip>>;
226
268
  }, z.core.$strip>;
227
269
  export declare const teamInvitationPreviewSchema: z.ZodObject<{
228
270
  id: z.ZodString;
@@ -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(),
@@ -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,15 +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."),
147
- storageOverQuotaSince: z
148
- .string()
149
- .nullable()
150
- .describe("Instant when the team first went over its storage quota."),
151
- storageWarningSentAt: z
152
- .string()
153
- .nullable()
154
- .describe("Instant when the over-quota warning went out."),
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."),
155
165
  buildsDeploysThisMonth: z
156
166
  .number()
157
167
  .int()
@@ -163,6 +173,16 @@ export const teamUsageResponseSchema = z.object({
163
173
  .describe("Instant when the current metering month started."),
164
174
  })
165
175
  .describe("Usage counters against the named plan limits."),
176
+ spaceStorage: z
177
+ .array(z.object({
178
+ spaceId: z.string().describe("Space id."),
179
+ slug: z.string().describe("Space slug."),
180
+ title: z.string().describe("Space display title."),
181
+ storageBytes: z
182
+ .number()
183
+ .describe("Disk this space occupies, as measured by the infrastructure serving it. Zero for a space that has not been measured yet."),
184
+ }))
185
+ .describe("Per-space storage breakdown for spaces the caller can read."),
166
186
  });
167
187
  // Served by `GET /v1/teams/invitations/{invitationId}/preview`: the unauthenticated
168
188
  // invite landing view (email is masked, never the full address).