@spacefast/common 0.0.2

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 (202) hide show
  1. package/README.md +42 -0
  2. package/dist/brand.d.ts +15 -0
  3. package/dist/brand.js +24 -0
  4. package/dist/config/domains.d.ts +30 -0
  5. package/dist/config/domains.js +75 -0
  6. package/dist/config/index.d.ts +1 -0
  7. package/dist/config/index.js +3 -0
  8. package/dist/contracts/abuse.d.ts +93 -0
  9. package/dist/contracts/abuse.js +50 -0
  10. package/dist/contracts/access.d.ts +409 -0
  11. package/dist/contracts/access.js +396 -0
  12. package/dist/contracts/account.d.ts +28 -0
  13. package/dist/contracts/account.js +54 -0
  14. package/dist/contracts/activity.d.ts +118 -0
  15. package/dist/contracts/activity.js +180 -0
  16. package/dist/contracts/analytics.d.ts +56 -0
  17. package/dist/contracts/analytics.js +91 -0
  18. package/dist/contracts/annotations.d.ts +327 -0
  19. package/dist/contracts/annotations.js +234 -0
  20. package/dist/contracts/api-keys.d.ts +517 -0
  21. package/dist/contracts/api-keys.js +235 -0
  22. package/dist/contracts/archives.d.ts +332 -0
  23. package/dist/contracts/archives.js +120 -0
  24. package/dist/contracts/auth.d.ts +86 -0
  25. package/dist/contracts/auth.js +82 -0
  26. package/dist/contracts/beta.d.ts +106 -0
  27. package/dist/contracts/beta.js +104 -0
  28. package/dist/contracts/billing.d.ts +328 -0
  29. package/dist/contracts/billing.js +203 -0
  30. package/dist/contracts/builds.d.ts +504 -0
  31. package/dist/contracts/builds.js +248 -0
  32. package/dist/contracts/channels.d.ts +49 -0
  33. package/dist/contracts/channels.js +51 -0
  34. package/dist/contracts/common.d.ts +238 -0
  35. package/dist/contracts/common.js +175 -0
  36. package/dist/contracts/deployments.d.ts +574 -0
  37. package/dist/contracts/deployments.js +97 -0
  38. package/dist/contracts/device-auth.d.ts +194 -0
  39. package/dist/contracts/device-auth.js +162 -0
  40. package/dist/contracts/domains.d.ts +6115 -0
  41. package/dist/contracts/domains.js +1435 -0
  42. package/dist/contracts/enums.d.ts +196 -0
  43. package/dist/contracts/enums.js +211 -0
  44. package/dist/contracts/error-code-meta.d.ts +1560 -0
  45. package/dist/contracts/error-code-meta.js +400 -0
  46. package/dist/contracts/error-codes.d.ts +13 -0
  47. package/dist/contracts/error-codes.js +416 -0
  48. package/dist/contracts/events.d.ts +398 -0
  49. package/dist/contracts/events.js +320 -0
  50. package/dist/contracts/fast-domain-search.d.ts +19 -0
  51. package/dist/contracts/fast-domain-search.js +22 -0
  52. package/dist/contracts/features.d.ts +240 -0
  53. package/dist/contracts/features.js +406 -0
  54. package/dist/contracts/git.d.ts +288 -0
  55. package/dist/contracts/git.js +116 -0
  56. package/dist/contracts/ids.d.ts +35 -0
  57. package/dist/contracts/ids.js +45 -0
  58. package/dist/contracts/intercom.d.ts +6 -0
  59. package/dist/contracts/intercom.js +5 -0
  60. package/dist/contracts/internal.d.ts +103 -0
  61. package/dist/contracts/internal.js +92 -0
  62. package/dist/contracts/mcp.d.ts +788 -0
  63. package/dist/contracts/mcp.js +161 -0
  64. package/dist/contracts/me.d.ts +81 -0
  65. package/dist/contracts/me.js +104 -0
  66. package/dist/contracts/oauth-resources.d.ts +30 -0
  67. package/dist/contracts/oauth-resources.js +61 -0
  68. package/dist/contracts/operations.d.ts +54 -0
  69. package/dist/contracts/operations.js +14 -0
  70. package/dist/contracts/plan-policy.d.ts +85 -0
  71. package/dist/contracts/plan-policy.js +75 -0
  72. package/dist/contracts/platform.d.ts +359 -0
  73. package/dist/contracts/platform.js +216 -0
  74. package/dist/contracts/push-new.d.ts +156 -0
  75. package/dist/contracts/push-new.js +52 -0
  76. package/dist/contracts/quotas.d.ts +16 -0
  77. package/dist/contracts/quotas.js +36 -0
  78. package/dist/contracts/repository-connections.d.ts +231 -0
  79. package/dist/contracts/repository-connections.js +106 -0
  80. package/dist/contracts/resources.d.ts +529 -0
  81. package/dist/contracts/resources.js +209 -0
  82. package/dist/contracts/routes.d.ts +45 -0
  83. package/dist/contracts/routes.js +31 -0
  84. package/dist/contracts/runtime-api.d.ts +449 -0
  85. package/dist/contracts/runtime-api.js +513 -0
  86. package/dist/contracts/sites.d.ts +393 -0
  87. package/dist/contracts/sites.js +121 -0
  88. package/dist/contracts/slugs.d.ts +31 -0
  89. package/dist/contracts/slugs.js +47 -0
  90. package/dist/contracts/space-config.d.ts +216 -0
  91. package/dist/contracts/space-config.js +237 -0
  92. package/dist/contracts/space-theme.d.ts +25 -0
  93. package/dist/contracts/space-theme.js +49 -0
  94. package/dist/contracts/spaces.d.ts +2760 -0
  95. package/dist/contracts/spaces.js +589 -0
  96. package/dist/contracts/superadmin-activity.d.ts +205 -0
  97. package/dist/contracts/superadmin-activity.js +107 -0
  98. package/dist/contracts/superadmin-emails.d.ts +212 -0
  99. package/dist/contracts/superadmin-emails.js +112 -0
  100. package/dist/contracts/superadmin-queues.d.ts +414 -0
  101. package/dist/contracts/superadmin-queues.js +202 -0
  102. package/dist/contracts/superadmin-runtime.d.ts +27 -0
  103. package/dist/contracts/superadmin-runtime.js +38 -0
  104. package/dist/contracts/superadmin-spaces.d.ts +429 -0
  105. package/dist/contracts/superadmin-spaces.js +82 -0
  106. package/dist/contracts/superadmin-tenants.d.ts +180 -0
  107. package/dist/contracts/superadmin-tenants.js +117 -0
  108. package/dist/contracts/superadmin.d.ts +654 -0
  109. package/dist/contracts/superadmin.js +309 -0
  110. package/dist/contracts/tags.d.ts +1140 -0
  111. package/dist/contracts/tags.js +1050 -0
  112. package/dist/contracts/teams.d.ts +233 -0
  113. package/dist/contracts/teams.js +174 -0
  114. package/dist/contracts/telemetry.d.ts +2 -0
  115. package/dist/contracts/telemetry.js +1 -0
  116. package/dist/contracts/transfers.d.ts +105 -0
  117. package/dist/contracts/transfers.js +48 -0
  118. package/dist/contracts/variables.d.ts +189 -0
  119. package/dist/contracts/variables.js +82 -0
  120. package/dist/contracts/webhooks.d.ts +159 -0
  121. package/dist/contracts/webhooks.js +59 -0
  122. package/dist/contracts/zero.d.ts +1538 -0
  123. package/dist/contracts/zero.js +755 -0
  124. package/dist/docs/agent-prose.d.ts +35 -0
  125. package/dist/docs/agent-prose.js +153 -0
  126. package/dist/docs/agent-setup.d.ts +6 -0
  127. package/dist/docs/agent-setup.js +164 -0
  128. package/dist/docs/agent-solutions.d.ts +110 -0
  129. package/dist/docs/agent-solutions.js +181 -0
  130. package/dist/docs/error-docs.d.ts +12 -0
  131. package/dist/docs/error-docs.js +1601 -0
  132. package/dist/docs/skill-distribution.d.ts +12 -0
  133. package/dist/docs/skill-distribution.js +18 -0
  134. package/dist/domain-exploration.d.ts +108 -0
  135. package/dist/domain-exploration.js +488 -0
  136. package/dist/domain-normalize.d.ts +1 -0
  137. package/dist/domain-normalize.js +14 -0
  138. package/dist/domain-zones.d.ts +1 -0
  139. package/dist/domain-zones.js +5272 -0
  140. package/dist/index.d.ts +1 -0
  141. package/dist/index.js +1 -0
  142. package/dist/utils/access-policy.d.ts +39 -0
  143. package/dist/utils/access-policy.js +232 -0
  144. package/dist/utils/api.d.ts +4 -0
  145. package/dist/utils/api.js +13 -0
  146. package/dist/utils/auth-redirect.d.ts +1 -0
  147. package/dist/utils/auth-redirect.js +48 -0
  148. package/dist/utils/auth.d.ts +5 -0
  149. package/dist/utils/auth.js +13 -0
  150. package/dist/utils/build-settings.d.ts +49 -0
  151. package/dist/utils/build-settings.js +366 -0
  152. package/dist/utils/claim-token.d.ts +1 -0
  153. package/dist/utils/claim-token.js +9 -0
  154. package/dist/utils/collections.d.ts +1 -0
  155. package/dist/utils/collections.js +5 -0
  156. package/dist/utils/concurrency.d.ts +1 -0
  157. package/dist/utils/concurrency.js +18 -0
  158. package/dist/utils/content-type.d.ts +10 -0
  159. package/dist/utils/content-type.js +145 -0
  160. package/dist/utils/error-display.d.ts +7 -0
  161. package/dist/utils/error-display.js +42 -0
  162. package/dist/utils/error.d.ts +1 -0
  163. package/dist/utils/error.js +3 -0
  164. package/dist/utils/generate-space-name.d.ts +14 -0
  165. package/dist/utils/generate-space-name.js +95 -0
  166. package/dist/utils/git-repository.d.ts +5 -0
  167. package/dist/utils/git-repository.js +99 -0
  168. package/dist/utils/guards.d.ts +1 -0
  169. package/dist/utils/guards.js +3 -0
  170. package/dist/utils/publish-detection.d.ts +10 -0
  171. package/dist/utils/publish-detection.js +118 -0
  172. package/dist/utils/publish-policy.d.ts +69 -0
  173. package/dist/utils/publish-policy.js +429 -0
  174. package/dist/utils/query-client.d.ts +7 -0
  175. package/dist/utils/query-client.js +21 -0
  176. package/dist/utils/query-keys.d.ts +75 -0
  177. package/dist/utils/query-keys.js +78 -0
  178. package/dist/utils/runtime-paths.d.ts +7 -0
  179. package/dist/utils/runtime-paths.js +28 -0
  180. package/dist/utils/runtime-upload.d.ts +19 -0
  181. package/dist/utils/runtime-upload.js +27 -0
  182. package/dist/utils/slug.d.ts +5 -0
  183. package/dist/utils/slug.js +13 -0
  184. package/dist/utils/space-config.d.ts +75 -0
  185. package/dist/utils/space-config.js +415 -0
  186. package/dist/utils/space-theme.d.ts +16 -0
  187. package/dist/utils/space-theme.js +89 -0
  188. package/dist/utils/static-runtime-policy.d.ts +17 -0
  189. package/dist/utils/static-runtime-policy.js +103 -0
  190. package/dist/utils/upload-session.d.ts +34 -0
  191. package/dist/utils/upload-session.js +69 -0
  192. package/dist/utils/urls.d.ts +2 -0
  193. package/dist/utils/urls.js +7 -0
  194. package/dist/utils/version-path.d.ts +6 -0
  195. package/dist/utils/version-path.js +51 -0
  196. package/dist/utils/wpcom-auth-redirects.d.ts +14 -0
  197. package/dist/utils/wpcom-auth-redirects.js +49 -0
  198. package/dist/utils/zero-realtime-signature.d.ts +12 -0
  199. package/dist/utils/zero-realtime-signature.js +45 -0
  200. package/dist/vocabulary.d.ts +230 -0
  201. package/dist/vocabulary.js +218 -0
  202. package/package.json +58 -0
@@ -0,0 +1,233 @@
1
+ import { z } from "zod";
2
+ export declare const TEAM_ROLE_VALUES: readonly ["owner", "admin", "member"];
3
+ export declare const PLAN_FEATURE_VALUES: readonly ["version-diagnostics"];
4
+ export declare const teamMemberRole: z.ZodEnum<{
5
+ owner: "owner";
6
+ admin: "admin";
7
+ member: "member";
8
+ }>;
9
+ export declare const teamInvitationCreateSchema: z.ZodObject<{
10
+ email: z.ZodString;
11
+ role: z.ZodDefault<z.ZodEnum<{
12
+ owner: "owner";
13
+ admin: "admin";
14
+ member: "member";
15
+ }>>;
16
+ }, z.core.$strip>;
17
+ export declare const teamMemberListQuerySchema: z.ZodObject<{
18
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
19
+ cursor: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ export declare const teamInvitationListQuerySchema: z.ZodObject<{
22
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
23
+ cursor: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ export declare const teamListQuerySchema: z.ZodObject<{
26
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
27
+ cursor: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ export declare const teamSpaceListQuerySchema: z.ZodObject<{
30
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
31
+ cursor: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>;
33
+ export declare const TeamInvitationSchema: z.ZodObject<{
34
+ id: z.ZodString;
35
+ teamId: z.ZodString;
36
+ email: z.ZodString;
37
+ role: z.ZodEnum<{
38
+ owner: "owner";
39
+ admin: "admin";
40
+ member: "member";
41
+ }>;
42
+ status: z.ZodString;
43
+ expiresAt: z.ZodString;
44
+ createdAt: z.ZodString;
45
+ }, z.core.$strip>;
46
+ export declare const teamPlanCode: z.ZodEnum<{
47
+ personal: "personal";
48
+ work: "work";
49
+ enterprise: "enterprise";
50
+ internal: "internal";
51
+ free: "free";
52
+ }>;
53
+ export declare const TeamSummarySchema: z.ZodObject<{
54
+ id: z.ZodString;
55
+ tenantId: z.ZodString;
56
+ name: z.ZodString;
57
+ slug: z.ZodString;
58
+ role: z.ZodEnum<{
59
+ owner: "owner";
60
+ admin: "admin";
61
+ member: "member";
62
+ }>;
63
+ plan: z.ZodEnum<{
64
+ personal: "personal";
65
+ work: "work";
66
+ enterprise: "enterprise";
67
+ internal: "internal";
68
+ free: "free";
69
+ }>;
70
+ defaultDataLocation: z.ZodString;
71
+ createdAt: z.ZodString;
72
+ updatedAt: z.ZodString;
73
+ }, z.core.$strip>;
74
+ export declare const TeamDetailSchema: z.ZodObject<{
75
+ id: z.ZodString;
76
+ tenantId: z.ZodString;
77
+ name: z.ZodString;
78
+ slug: z.ZodString;
79
+ role: z.ZodEnum<{
80
+ owner: "owner";
81
+ admin: "admin";
82
+ member: "member";
83
+ }>;
84
+ plan: z.ZodEnum<{
85
+ personal: "personal";
86
+ work: "work";
87
+ enterprise: "enterprise";
88
+ internal: "internal";
89
+ free: "free";
90
+ }>;
91
+ defaultDataLocation: z.ZodString;
92
+ createdAt: z.ZodString;
93
+ updatedAt: z.ZodString;
94
+ logo: z.ZodNullable<z.ZodString>;
95
+ metadata: z.ZodNullable<z.ZodString>;
96
+ stripeCustomerId: z.ZodNullable<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ export declare const teamListResponseSchema: z.ZodObject<{
99
+ data: z.ZodArray<z.ZodObject<{
100
+ id: z.ZodString;
101
+ tenantId: z.ZodString;
102
+ name: z.ZodString;
103
+ slug: z.ZodString;
104
+ role: z.ZodEnum<{
105
+ owner: "owner";
106
+ admin: "admin";
107
+ member: "member";
108
+ }>;
109
+ plan: z.ZodEnum<{
110
+ personal: "personal";
111
+ work: "work";
112
+ enterprise: "enterprise";
113
+ internal: "internal";
114
+ free: "free";
115
+ }>;
116
+ defaultDataLocation: z.ZodString;
117
+ createdAt: z.ZodString;
118
+ updatedAt: z.ZodString;
119
+ }, z.core.$strip>>;
120
+ pagination: z.ZodObject<{
121
+ nextCursor: z.ZodNullable<z.ZodString>;
122
+ hasMore: z.ZodBoolean;
123
+ }, z.core.$strip>;
124
+ }, z.core.$strip>;
125
+ export declare const teamMemberListResponseSchema: z.ZodObject<{
126
+ data: z.ZodArray<z.ZodObject<{
127
+ id: z.ZodString;
128
+ teamId: z.ZodString;
129
+ userId: z.ZodString;
130
+ role: z.ZodEnum<{
131
+ owner: "owner";
132
+ admin: "admin";
133
+ member: "member";
134
+ }>;
135
+ createdAt: z.ZodString;
136
+ user: z.ZodNullable<z.ZodObject<{
137
+ id: z.ZodString;
138
+ name: z.ZodString;
139
+ email: z.ZodString;
140
+ image: z.ZodNullable<z.ZodString>;
141
+ }, z.core.$strip>>;
142
+ }, z.core.$strip>>;
143
+ pagination: z.ZodObject<{
144
+ nextCursor: z.ZodNullable<z.ZodString>;
145
+ hasMore: z.ZodBoolean;
146
+ }, z.core.$strip>;
147
+ }, z.core.$strip>;
148
+ export declare const teamJoinResponseSchema: z.ZodObject<{
149
+ data: z.ZodObject<{
150
+ teamId: z.ZodString;
151
+ userId: z.ZodString;
152
+ role: z.ZodLiteral<"member">;
153
+ }, z.core.$strip>;
154
+ }, z.core.$strip>;
155
+ export declare const teamInvitationListResponseSchema: z.ZodObject<{
156
+ data: z.ZodArray<z.ZodObject<{
157
+ id: z.ZodString;
158
+ teamId: z.ZodString;
159
+ email: z.ZodString;
160
+ role: z.ZodEnum<{
161
+ owner: "owner";
162
+ admin: "admin";
163
+ member: "member";
164
+ }>;
165
+ status: z.ZodString;
166
+ expiresAt: z.ZodString;
167
+ createdAt: z.ZodString;
168
+ }, z.core.$strip>>;
169
+ pagination: z.ZodObject<{
170
+ nextCursor: z.ZodNullable<z.ZodString>;
171
+ hasMore: z.ZodBoolean;
172
+ }, z.core.$strip>;
173
+ }, z.core.$strip>;
174
+ export declare const teamDataLocationSchema: z.ZodString;
175
+ export declare const teamSettingsUpdateSchema: z.ZodObject<{
176
+ defaultDataLocation: z.ZodString;
177
+ }, z.core.$strip>;
178
+ export declare const teamSettingsResponseSchema: z.ZodObject<{
179
+ teamId: z.ZodString;
180
+ defaultDataLocation: z.ZodString;
181
+ regionOptions: z.ZodArray<z.ZodObject<{
182
+ id: z.ZodString;
183
+ label: z.ZodString;
184
+ }, z.core.$strip>>;
185
+ wpCloudCapabilities: z.ZodObject<{
186
+ status: z.ZodEnum<{
187
+ failed: "failed";
188
+ running: "running";
189
+ ready: "ready";
190
+ idle: "idle";
191
+ }>;
192
+ degraded: z.ZodBoolean;
193
+ lastSyncedAt: z.ZodNullable<z.ZodString>;
194
+ lastError: z.ZodNullable<z.ZodString>;
195
+ regionCount: z.ZodNumber;
196
+ phpVersionCount: z.ZodNumber;
197
+ }, z.core.$strip>;
198
+ }, z.core.$strip>;
199
+ export declare const teamUsageResponseSchema: z.ZodObject<{
200
+ teamId: z.ZodString;
201
+ usage: z.ZodObject<{
202
+ spaces: z.ZodNumber;
203
+ domains: z.ZodNumber;
204
+ members: z.ZodNumber;
205
+ storageBytes: z.ZodNumber;
206
+ storageQuotaBytes: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
207
+ storageOverageBytes: z.ZodNumber;
208
+ storageCalculatedAt: z.ZodNullable<z.ZodString>;
209
+ storageOverQuotaSince: z.ZodNullable<z.ZodString>;
210
+ storageWarningSentAt: z.ZodNullable<z.ZodString>;
211
+ buildsDeploysThisMonth: z.ZodNumber;
212
+ buildsDeploysMonthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
213
+ meterStartedAt: z.ZodNullable<z.ZodString>;
214
+ }, z.core.$strip>;
215
+ }, z.core.$strip>;
216
+ export declare const teamInvitationPreviewSchema: z.ZodObject<{
217
+ id: z.ZodString;
218
+ teamName: z.ZodString;
219
+ invitedEmail: z.ZodString;
220
+ status: z.ZodEnum<{
221
+ closed: "closed";
222
+ expired: "expired";
223
+ pending: "pending";
224
+ }>;
225
+ expiresAt: z.ZodString;
226
+ }, z.core.$strip>;
227
+ export declare const teamUpdateSchema: z.ZodObject<{
228
+ name: z.ZodOptional<z.ZodString>;
229
+ slug: z.ZodOptional<z.ZodString>;
230
+ logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodString>>;
232
+ defaultDataLocation: z.ZodOptional<z.ZodString>;
233
+ }, z.core.$strip>;
@@ -0,0 +1,174 @@
1
+ import { z } from "zod";
2
+ import { CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
+ import { planCodeSchema, planLimitValueSchema } from "./features.js";
4
+ export const TEAM_ROLE_VALUES = ["owner", "admin", "member"];
5
+ export const PLAN_FEATURE_VALUES = ["version-diagnostics"];
6
+ export const teamMemberRole = z.enum(TEAM_ROLE_VALUES);
7
+ export const teamInvitationCreateSchema = z.object({
8
+ email: z.string().trim().email().toLowerCase(),
9
+ role: teamMemberRole.default("member"),
10
+ });
11
+ export const teamMemberListQuerySchema = cursorListQuerySchema;
12
+ export const teamInvitationListQuerySchema = cursorListQuerySchema;
13
+ export const teamListQuerySchema = cursorListQuerySchema;
14
+ export const teamSpaceListQuerySchema = cursorListQuerySchema;
15
+ const TeamMemberUserSchema = z.object({
16
+ id: z.string(),
17
+ name: z.string(),
18
+ email: z.string().email(),
19
+ image: z.string().nullable(),
20
+ });
21
+ const TeamMemberSchema = z.object({
22
+ id: z.string(),
23
+ teamId: z.string(),
24
+ userId: z.string(),
25
+ role: teamMemberRole,
26
+ createdAt: z.string().datetime(),
27
+ user: TeamMemberUserSchema.nullable(),
28
+ });
29
+ export const TeamInvitationSchema = z.object({
30
+ id: z.string(),
31
+ teamId: z.string(),
32
+ email: z.string().email(),
33
+ role: teamMemberRole,
34
+ status: z.string(),
35
+ expiresAt: z.string().datetime(),
36
+ createdAt: z.string().datetime(),
37
+ });
38
+ // Team (internal-docs/platform.md "Team"): Better Auth team in the main
39
+ // tenant, carrying the resolved plan and default data location.
40
+ export const teamPlanCode = planCodeSchema;
41
+ export const TeamSummarySchema = z.object({
42
+ id: z.string().describe("Team id (the Better Auth team id in the main tenant)."),
43
+ tenantId: z.string().describe("Owning tenant; ten_main for self-serve teams."),
44
+ name: z.string().describe("Display name of the team."),
45
+ slug: z.string().describe("URL-safe team slug, unique per tenant."),
46
+ role: teamMemberRole.describe("Requesting member's role; member for non-session credentials."),
47
+ plan: teamPlanCode.describe("Resolved plan code from the active subscription."),
48
+ defaultDataLocation: z
49
+ .string()
50
+ .describe('Default placement region for new spaces; "auto" lets placement decide.'),
51
+ createdAt: z.string().datetime(),
52
+ updatedAt: z.string().datetime(),
53
+ });
54
+ export const TeamDetailSchema = TeamSummarySchema.extend({
55
+ logo: z.string().nullable().describe("Optional team logo URL."),
56
+ metadata: z.string().nullable().describe("Opaque team metadata stored by the client."),
57
+ stripeCustomerId: z
58
+ .string()
59
+ .nullable()
60
+ .describe("Stripe customer id linked to this team, when billing has been initialized."),
61
+ });
62
+ export const teamListResponseSchema = z.object({
63
+ data: z.array(TeamSummarySchema),
64
+ pagination: CursorPaginationSchema,
65
+ });
66
+ export const teamMemberListResponseSchema = z.object({
67
+ data: z.array(TeamMemberSchema),
68
+ pagination: CursorPaginationSchema,
69
+ });
70
+ export const teamJoinResponseSchema = z.object({
71
+ data: z.object({
72
+ teamId: z.string(),
73
+ userId: z.string(),
74
+ role: z.literal("member"),
75
+ }),
76
+ });
77
+ export const teamInvitationListResponseSchema = z.object({
78
+ data: z.array(TeamInvitationSchema),
79
+ pagination: CursorPaginationSchema,
80
+ });
81
+ // Team activity is served by `GET /v1/teams/{teamId}/activity`, a facade over
82
+ // the one activity store using the ActivityEvent contract (contracts/activity.ts).
83
+ // `defaultDataLocation` is the spec Team field: "auto" lets placement decide,
84
+ // any other value must be an available placement region id.
85
+ export const teamDataLocationSchema = z
86
+ .string()
87
+ .trim()
88
+ .min(1)
89
+ .max(64)
90
+ .describe('Default placement region for new spaces; "auto" lets placement decide.');
91
+ export const teamSettingsUpdateSchema = z.object({
92
+ defaultDataLocation: teamDataLocationSchema,
93
+ });
94
+ // Served by `GET /v1/teams/{teamId}/settings` (and echoed by the PATCH):
95
+ // the default data location plus the placement options it may take.
96
+ export const teamSettingsResponseSchema = z.object({
97
+ teamId: z.string().describe("Team the settings belong to."),
98
+ defaultDataLocation: teamDataLocationSchema,
99
+ regionOptions: z
100
+ .array(z.object({
101
+ id: z.string().describe("Placement region id."),
102
+ label: z.string().describe("Human-readable region label."),
103
+ }))
104
+ .describe("Placement regions currently available for new spaces."),
105
+ wpCloudCapabilities: z
106
+ .object({
107
+ status: z
108
+ .enum(["idle", "running", "ready", "failed"])
109
+ .describe("State of the provider capability sync."),
110
+ degraded: z.boolean().describe("Whether the last sync finished with an error."),
111
+ lastSyncedAt: z.string().nullable().describe("When capabilities last synced."),
112
+ lastError: z.string().nullable().describe("Last sync error, if any."),
113
+ regionCount: z.number().int().describe("Known placement regions."),
114
+ phpVersionCount: z.number().int().describe("Known runtime PHP versions."),
115
+ })
116
+ .describe("Provider capability sync status backing the region options."),
117
+ });
118
+ // Served by `GET /v1/teams/{teamId}/usage`: counts and metered usage against
119
+ // the named plan limits.
120
+ export const teamUsageResponseSchema = z.object({
121
+ teamId: z.string().describe("Team the usage was metered for."),
122
+ usage: z
123
+ .object({
124
+ spaces: z.number().int().describe("Live spaces in the team."),
125
+ domains: z.number().int().describe("External domain groups counted against the plan."),
126
+ members: z.number().int().describe("Team members."),
127
+ storageBytes: z.number().describe("Stored bytes across the team's spaces."),
128
+ storageQuotaBytes: z
129
+ .union([z.number(), z.literal("unlimited")])
130
+ .describe('Plan storage quota; "unlimited" when unbounded.'),
131
+ storageOverageBytes: z.number().describe("Bytes over the plan storage quota."),
132
+ storageCalculatedAt: z.string().nullable().describe("When storage was last accounted."),
133
+ storageOverQuotaSince: z
134
+ .string()
135
+ .nullable()
136
+ .describe("When the team first went over its storage quota."),
137
+ storageWarningSentAt: z.string().nullable().describe("When the over-quota warning went out."),
138
+ buildsDeploysThisMonth: z
139
+ .number()
140
+ .int()
141
+ .describe("Publishes (user pushes and CI builds pooled) this month."),
142
+ buildsDeploysMonthly: planLimitValueSchema.describe("Monthly publish limit for the plan."),
143
+ meterStartedAt: z.string().nullable().describe("Start of the current metering month."),
144
+ })
145
+ .describe("Usage counters against the named plan limits."),
146
+ });
147
+ // Served by `GET /v1/teams/invitations/{invitationId}/preview`: the unauthenticated
148
+ // invite landing view (email is masked, never the full address).
149
+ export const teamInvitationPreviewSchema = z.object({
150
+ id: z.string().describe("Invitation id."),
151
+ teamName: z.string().describe("Inviting team's display name."),
152
+ invitedEmail: z.string().describe("Masked invited email address."),
153
+ status: z.enum(["pending", "expired", "closed"]).describe("Whether the invite can be accepted."),
154
+ expiresAt: z.string().describe("When the invitation expires."),
155
+ });
156
+ export const teamUpdateSchema = z
157
+ .object({
158
+ name: z.string().trim().min(1).max(255).optional(),
159
+ slug: z
160
+ .string()
161
+ .trim()
162
+ .min(1)
163
+ .max(255)
164
+ .regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/, {
165
+ message: "Team slugs must contain lowercase letters, numbers, and hyphens.",
166
+ })
167
+ .optional(),
168
+ logo: z.string().trim().max(2048).nullable().optional(),
169
+ metadata: z.string().nullable().optional(),
170
+ defaultDataLocation: teamDataLocationSchema.optional(),
171
+ })
172
+ .refine((value) => Object.keys(value).length > 0, {
173
+ message: "At least one team field is required.",
174
+ });
@@ -0,0 +1,2 @@
1
+ export { EVENT_BODY_CAP_BYTES as TELEMETRY_BODY_CAP_BYTES, EVENT_MAX_EVENTS_PER_REQUEST as TELEMETRY_MAX_EVENTS_PER_REQUEST, eventAcceptedSchema as telemetryAcceptedSchema, eventIngestSchema as telemetryIngestSchema, eventPayloadSchema as telemetryEventSchema, } from "./events.js";
2
+ export type { EventIngest as TelemetryIngest, EventPayload as TelemetryEvent } from "./events.js";
@@ -0,0 +1 @@
1
+ export { EVENT_BODY_CAP_BYTES as TELEMETRY_BODY_CAP_BYTES, EVENT_MAX_EVENTS_PER_REQUEST as TELEMETRY_MAX_EVENTS_PER_REQUEST, eventAcceptedSchema as telemetryAcceptedSchema, eventIngestSchema as telemetryIngestSchema, eventPayloadSchema as telemetryEventSchema, } from "./events.js";
@@ -0,0 +1,105 @@
1
+ import { z } from "zod";
2
+ export declare const principalIdSchema: z.ZodString;
3
+ export declare const transferPrincipalInputSchema: z.ZodObject<{
4
+ principalType: z.ZodEnum<{
5
+ external: "external";
6
+ team: "team";
7
+ }>;
8
+ principalId: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export declare const transferPrincipalSchema: z.ZodObject<{
11
+ principalType: z.ZodEnum<{
12
+ external: "external";
13
+ team: "team";
14
+ }>;
15
+ principalId: z.ZodString;
16
+ tenantId: z.ZodString;
17
+ }, z.core.$strip>;
18
+ export declare const spaceTransferCreateSchema: z.ZodObject<{
19
+ to: z.ZodObject<{
20
+ principalType: z.ZodEnum<{
21
+ external: "external";
22
+ team: "team";
23
+ }>;
24
+ principalId: z.ZodString;
25
+ }, z.core.$strip>;
26
+ }, z.core.$strip>;
27
+ export declare const spaceTransferSchema: z.ZodObject<{
28
+ id: z.ZodString;
29
+ spaceId: z.ZodString;
30
+ from: z.ZodObject<{
31
+ principalType: z.ZodEnum<{
32
+ external: "external";
33
+ team: "team";
34
+ }>;
35
+ principalId: z.ZodString;
36
+ tenantId: z.ZodString;
37
+ }, z.core.$strip>;
38
+ to: z.ZodObject<{
39
+ principalType: z.ZodEnum<{
40
+ external: "external";
41
+ team: "team";
42
+ }>;
43
+ principalId: z.ZodString;
44
+ tenantId: z.ZodString;
45
+ }, z.core.$strip>;
46
+ status: z.ZodEnum<{
47
+ completed: "completed";
48
+ canceled: "canceled";
49
+ expired: "expired";
50
+ moving: "moving";
51
+ pending_confirmation: "pending_confirmation";
52
+ confirming_domains: "confirming_domains";
53
+ }>;
54
+ requiredActions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
55
+ type: z.ZodLiteral<"dns">;
56
+ instructions: z.ZodArray<z.ZodObject<{
57
+ type: z.ZodEnum<{
58
+ A: "A";
59
+ AAAA: "AAAA";
60
+ CNAME: "CNAME";
61
+ TXT: "TXT";
62
+ ALIAS: "ALIAS";
63
+ }>;
64
+ name: z.ZodString;
65
+ value: z.ZodString;
66
+ ttl: z.ZodOptional<z.ZodNumber>;
67
+ purpose: z.ZodEnum<{
68
+ verification: "verification";
69
+ routing: "routing";
70
+ ssl: "ssl";
71
+ }>;
72
+ }, z.core.$strip>>;
73
+ }, z.core.$strip>, z.ZodObject<{
74
+ type: z.ZodLiteral<"confirm_move">;
75
+ conflictId: z.ZodString;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ type: z.ZodLiteral<"verify_domain">;
78
+ domainId: z.ZodString;
79
+ }, z.core.$strip>, z.ZodObject<{
80
+ type: z.ZodLiteral<"renew">;
81
+ domainId: z.ZodString;
82
+ }, z.core.$strip>], "type">>;
83
+ diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
84
+ code: z.ZodString;
85
+ severity: z.ZodEnum<{
86
+ info: "info";
87
+ warning: "warning";
88
+ error: "error";
89
+ }>;
90
+ message: z.ZodString;
91
+ path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
93
+ wpcloud: "wpcloud";
94
+ dns: "dns";
95
+ registrar: "registrar";
96
+ runtime: "runtime";
97
+ }>>>;
98
+ details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
99
+ fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
+ retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
101
+ }, z.core.$strip>>>;
102
+ expiresAt: z.ZodString;
103
+ createdAt: z.ZodString;
104
+ updatedAt: z.ZodString;
105
+ }, z.core.$strip>;
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ import { baseDiagnosticSchema, requiredActionsSchema } from "./common.js";
3
+ import { spaceTransferStatus } from "./enums.js";
4
+ // Tenant-local external principal id grammar (internal-docs/platform.md
5
+ // "Principal"): 1-256 chars, no whitespace, no `/` or `\`, no
6
+ // control/non-printable characters. Team principal ids are Better Auth team
7
+ // ids and trivially satisfy the same grammar.
8
+ export const principalIdSchema = z
9
+ .string()
10
+ .min(1)
11
+ .max(256)
12
+ .regex(/^[^\s/\\]+$/)
13
+ .refine((value) => [...value].every((char) => {
14
+ const code = char.codePointAt(0) ?? 0;
15
+ return code >= 32 && code !== 127;
16
+ }))
17
+ .describe("Tenant-local principal id: a team id, or the integrator's own external customer id.");
18
+ // Request `to` omits tenantId: transfers are tenant-local and the tenant is
19
+ // inferred from the space (internal-docs/platform.md "Transfer semantics").
20
+ export const transferPrincipalInputSchema = z.object({
21
+ principalType: z
22
+ .enum(["team", "external"])
23
+ .describe("Receiving principal kind: a first-party team or a host-managed external principal."),
24
+ principalId: principalIdSchema,
25
+ });
26
+ // Responses carry the full canonical PrincipalRef shape.
27
+ export const transferPrincipalSchema = transferPrincipalInputSchema.extend({
28
+ tenantId: z.string().min(1).describe("Tenant both transfer parties live in."),
29
+ });
30
+ export const spaceTransferCreateSchema = z.object({
31
+ to: transferPrincipalInputSchema.describe("Receiving principal. Must live in the space's tenant; cross-tenant transfers are unsupported."),
32
+ });
33
+ export const spaceTransferSchema = z.object({
34
+ id: z.string().describe("SpaceTransfer id (`trf_`)."),
35
+ spaceId: z.string().describe("Space being transferred."),
36
+ 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([]),
42
+ expiresAt: z
43
+ .string()
44
+ .datetime()
45
+ .describe("Pending transfers expire after this stamp (default 7 days)."),
46
+ createdAt: z.string().datetime(),
47
+ updatedAt: z.string().datetime(),
48
+ });