@spacefast/common 0.0.26 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/dist/agents/connect-targets.d.ts +6 -146
  2. package/dist/agents/connect-targets.js +63 -295
  3. package/dist/agents/private-key-oauth.d.ts +31 -1
  4. package/dist/agents/private-key-oauth.js +124 -33
  5. package/dist/agents/registry/core.d.ts +292 -0
  6. package/dist/agents/registry/core.js +1388 -0
  7. package/dist/agents/registry/deeplink-probes.d.ts +23 -0
  8. package/dist/agents/registry/deeplink-probes.js +18 -0
  9. package/dist/agents/registry/node.d.ts +56 -0
  10. package/dist/agents/registry/node.js +339 -0
  11. package/dist/brand-assets-build.js +1 -2
  12. package/dist/brand-assets.js +4 -7
  13. package/dist/brand.d.ts +17 -0
  14. package/dist/brand.js +24 -4
  15. package/dist/config/domains.d.ts +55 -28
  16. package/dist/config/domains.js +85 -41
  17. package/dist/config/index.js +1 -2
  18. package/dist/contracts/abuse.js +9 -24
  19. package/dist/contracts/access-profiles.d.ts +86 -0
  20. package/dist/contracts/access-profiles.js +89 -0
  21. package/dist/contracts/access.d.ts +21 -27
  22. package/dist/contracts/access.js +33 -64
  23. package/dist/contracts/activity.d.ts +18 -1
  24. package/dist/contracts/activity.js +70 -26
  25. package/dist/contracts/analytics.js +8 -10
  26. package/dist/contracts/api-keys.d.ts +77 -52
  27. package/dist/contracts/api-keys.js +44 -24
  28. package/dist/contracts/application-journal.d.ts +216 -0
  29. package/dist/contracts/application-journal.js +167 -0
  30. package/dist/contracts/auth.d.ts +90 -17
  31. package/dist/contracts/auth.js +86 -17
  32. package/dist/contracts/beta.d.ts +9 -4
  33. package/dist/contracts/beta.js +20 -16
  34. package/dist/contracts/billing.js +7 -11
  35. package/dist/contracts/bootstrap.d.ts +791 -0
  36. package/dist/contracts/bootstrap.js +51 -0
  37. package/dist/contracts/builds.d.ts +186 -7
  38. package/dist/contracts/builds.js +75 -21
  39. package/dist/contracts/channels.d.ts +43 -0
  40. package/dist/contracts/channels.js +25 -9
  41. package/dist/contracts/cli.d.ts +7 -0
  42. package/dist/contracts/cli.js +6 -0
  43. package/dist/contracts/collab-public.d.ts +1 -1
  44. package/dist/contracts/collab-public.js +5 -8
  45. package/dist/contracts/comments.d.ts +45 -35
  46. package/dist/contracts/comments.js +107 -77
  47. package/dist/contracts/commerce.d.ts +165 -0
  48. package/dist/contracts/commerce.js +146 -0
  49. package/dist/contracts/common.d.ts +3 -3
  50. package/dist/contracts/common.js +18 -29
  51. package/dist/contracts/content-contract-verification.d.ts +521 -0
  52. package/dist/contracts/content-contract-verification.js +320 -0
  53. package/dist/contracts/content-platform-fixture.d.ts +1278 -0
  54. package/dist/contracts/content-platform-fixture.js +44 -0
  55. package/dist/contracts/content-program.d.ts +994 -0
  56. package/dist/contracts/content-program.js +658 -0
  57. package/dist/contracts/content-sync.d.ts +290 -0
  58. package/dist/contracts/content-sync.js +167 -0
  59. package/dist/contracts/content.d.ts +432 -0
  60. package/dist/contracts/content.js +303 -0
  61. package/dist/contracts/continuation.d.ts +17 -1
  62. package/dist/contracts/continuation.js +23 -23
  63. package/dist/contracts/countries.js +3 -4
  64. package/dist/contracts/crons.d.ts +17 -0
  65. package/dist/contracts/crons.js +33 -15
  66. package/dist/contracts/dashboard-prefs.d.ts +56 -0
  67. package/dist/contracts/dashboard-prefs.js +51 -0
  68. package/dist/contracts/device-auth.d.ts +234 -37
  69. package/dist/contracts/device-auth.js +267 -53
  70. package/dist/contracts/docs.d.ts +6 -10
  71. package/dist/contracts/docs.js +5 -13
  72. package/dist/contracts/domains.d.ts +499 -102
  73. package/dist/contracts/domains.js +169 -58
  74. package/dist/contracts/email-preferences.d.ts +3 -3
  75. package/dist/contracts/email-preferences.js +6 -7
  76. package/dist/contracts/enums.d.ts +26 -26
  77. package/dist/contracts/enums.js +61 -54
  78. package/dist/contracts/error-code-meta.d.ts +269 -7
  79. package/dist/contracts/error-code-meta.js +80 -5
  80. package/dist/contracts/error-codes.d.ts +5 -5
  81. package/dist/contracts/error-codes.js +78 -16
  82. package/dist/contracts/events.d.ts +100 -20
  83. package/dist/contracts/events.js +107 -20
  84. package/dist/contracts/execution.d.ts +47 -66
  85. package/dist/contracts/execution.js +51 -64
  86. package/dist/contracts/feature-lifecycle.d.ts +70 -14
  87. package/dist/contracts/feature-lifecycle.js +86 -15
  88. package/dist/contracts/features.d.ts +100 -37
  89. package/dist/contracts/features.js +21 -27
  90. package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
  91. package/dist/contracts/frame-session.d.ts +192 -0
  92. package/dist/contracts/frame-session.js +164 -0
  93. package/dist/contracts/functions.d.ts +218 -211
  94. package/dist/contracts/functions.js +273 -260
  95. package/dist/contracts/grant-copy.d.ts +43 -0
  96. package/dist/contracts/grant-copy.js +44 -0
  97. package/dist/contracts/grants.d.ts +64 -56
  98. package/dist/contracts/grants.js +124 -23
  99. package/dist/contracts/ids.d.ts +4 -1
  100. package/dist/contracts/ids.js +4 -1
  101. package/dist/contracts/internal.d.ts +5 -4
  102. package/dist/contracts/internal.js +12 -3
  103. package/dist/contracts/mcp.d.ts +17 -0
  104. package/dist/contracts/mcp.js +23 -0
  105. package/dist/contracts/me.d.ts +6 -1
  106. package/dist/contracts/me.js +12 -6
  107. package/dist/contracts/notifications.d.ts +27 -29
  108. package/dist/contracts/notifications.js +9 -4
  109. package/dist/contracts/oauth-resources.d.ts +112 -10
  110. package/dist/contracts/oauth-resources.js +116 -11
  111. package/dist/contracts/oauth-scope-actions.d.ts +90 -0
  112. package/dist/contracts/oauth-scope-actions.js +126 -0
  113. package/dist/contracts/operations.d.ts +27 -4
  114. package/dist/contracts/operations.js +11 -5
  115. package/dist/contracts/pages.d.ts +29 -5
  116. package/dist/contracts/pages.js +22 -5
  117. package/dist/contracts/partner-notifications.d.ts +3 -0
  118. package/dist/contracts/partner-notifications.js +65 -0
  119. package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
  120. package/dist/contracts/{platform.js → partner.js} +27 -40
  121. package/dist/contracts/plan-policy.d.ts +1 -1
  122. package/dist/contracts/principal-assertion.d.ts +43 -0
  123. package/dist/contracts/principal-assertion.js +67 -0
  124. package/dist/contracts/principals.d.ts +73 -0
  125. package/dist/contracts/principals.js +59 -0
  126. package/dist/contracts/privacy.d.ts +11 -0
  127. package/dist/contracts/privacy.js +17 -0
  128. package/dist/contracts/problem-document.js +3 -4
  129. package/dist/contracts/publish-archive.d.ts +116 -18
  130. package/dist/contracts/publish-archive.js +6 -3
  131. package/dist/contracts/push-new.d.ts +4 -4
  132. package/dist/contracts/quotas.js +3 -3
  133. package/dist/contracts/realtime.d.ts +52 -0
  134. package/dist/contracts/realtime.js +54 -0
  135. package/dist/contracts/repository-connections.d.ts +1 -1
  136. package/dist/contracts/repository-connections.js +6 -2
  137. package/dist/contracts/resources.d.ts +105 -14
  138. package/dist/contracts/resources.js +145 -21
  139. package/dist/contracts/route-inventory.d.ts +358 -0
  140. package/dist/contracts/route-inventory.js +141 -0
  141. package/dist/contracts/runtime-api.d.ts +112 -35
  142. package/dist/contracts/runtime-api.js +86 -66
  143. package/dist/contracts/runtime-app.d.ts +11 -21
  144. package/dist/contracts/runtime-app.js +39 -24
  145. package/dist/contracts/runtime-components.d.ts +143 -0
  146. package/dist/contracts/runtime-components.js +199 -0
  147. package/dist/contracts/runtime-db.d.ts +45 -19
  148. package/dist/contracts/runtime-db.js +85 -20
  149. package/dist/contracts/runtime-purge.js +3 -5
  150. package/dist/contracts/runtime-services.d.ts +43 -75
  151. package/dist/contracts/runtime-services.js +29 -49
  152. package/dist/contracts/runtime-storage.d.ts +14 -14
  153. package/dist/contracts/runtime-storage.js +28 -13
  154. package/dist/contracts/sf-config-v1.d.ts +14 -18
  155. package/dist/contracts/slugs.js +13 -4
  156. package/dist/contracts/space-config.d.ts +235 -28
  157. package/dist/contracts/space-config.js +246 -91
  158. package/dist/contracts/spaces.d.ts +360 -255
  159. package/dist/contracts/spaces.js +190 -122
  160. package/dist/contracts/superadmin-activity.d.ts +3 -43
  161. package/dist/contracts/superadmin-activity.js +6 -30
  162. package/dist/contracts/superadmin-emails.d.ts +1 -0
  163. package/dist/contracts/superadmin-emails.js +17 -1
  164. package/dist/contracts/superadmin-runtime.d.ts +199 -0
  165. package/dist/contracts/superadmin-runtime.js +141 -0
  166. package/dist/contracts/superadmin-search.d.ts +22 -2
  167. package/dist/contracts/superadmin-search.js +14 -6
  168. package/dist/contracts/superadmin-spaces.d.ts +435 -186
  169. package/dist/contracts/superadmin-spaces.js +131 -25
  170. package/dist/contracts/superadmin-teams.d.ts +3 -0
  171. package/dist/contracts/superadmin-teams.js +1 -2
  172. package/dist/contracts/superadmin-tenants.d.ts +627 -6
  173. package/dist/contracts/superadmin-tenants.js +32 -7
  174. package/dist/contracts/superadmin.d.ts +98 -16
  175. package/dist/contracts/superadmin.js +63 -10
  176. package/dist/contracts/tags.d.ts +85 -58
  177. package/dist/contracts/tags.js +44 -34
  178. package/dist/contracts/teams.d.ts +72 -9
  179. package/dist/contracts/teams.js +84 -25
  180. package/dist/contracts/tenants.d.ts +135 -0
  181. package/dist/contracts/tenants.js +120 -0
  182. package/dist/contracts/test-triggers.d.ts +70 -0
  183. package/dist/contracts/test-triggers.js +116 -0
  184. package/dist/contracts/theme-json.js +3 -8
  185. package/dist/contracts/transfers.d.ts +1 -0
  186. package/dist/contracts/transfers.js +1 -0
  187. package/dist/contracts/usage.d.ts +209 -0
  188. package/dist/contracts/usage.js +124 -12
  189. package/dist/contracts/variables.d.ts +2 -2
  190. package/dist/contracts/variables.js +9 -13
  191. package/dist/contracts/webhooks.d.ts +13 -5
  192. package/dist/contracts/webhooks.js +3 -1
  193. package/dist/contracts/zero.d.ts +57 -64
  194. package/dist/contracts/zero.js +68 -66
  195. package/dist/dashboard-paths/index.d.ts +24 -21
  196. package/dist/dashboard-paths/index.js +35 -47
  197. package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
  198. package/dist/dashboard-paths/route-reservations.generated.js +36 -0
  199. package/dist/docs/agent-arrival.d.ts +92 -0
  200. package/dist/docs/agent-arrival.js +227 -0
  201. package/dist/docs/agent-output-policy.d.ts +6 -0
  202. package/dist/docs/agent-output-policy.js +22 -0
  203. package/dist/docs/agent-prose.d.ts +11 -17
  204. package/dist/docs/agent-prose.js +62 -37
  205. package/dist/docs/agent-setup.d.ts +72 -41
  206. package/dist/docs/agent-setup.js +336 -436
  207. package/dist/docs/catalog.d.ts +147 -89
  208. package/dist/docs/catalog.js +157 -42
  209. package/dist/docs/error-docs.d.ts +2098 -1
  210. package/dist/docs/error-docs.js +281 -16
  211. package/dist/docs/index-build.d.ts +0 -1
  212. package/dist/docs/index-build.js +2 -3
  213. package/dist/docs/page-context-prompt.d.ts +77 -0
  214. package/dist/docs/page-context-prompt.js +131 -0
  215. package/dist/docs/reference-urls.d.ts +46 -0
  216. package/dist/docs/reference-urls.js +79 -0
  217. package/dist/docs/search.d.ts +6 -8
  218. package/dist/docs/search.js +10 -13
  219. package/dist/docs/skill-distribution.d.ts +4 -1
  220. package/dist/docs/skill-distribution.js +10 -5
  221. package/dist/docs/skills.d.ts +117 -117
  222. package/dist/docs/skills.js +120 -72
  223. package/dist/docs/start-prompts.d.ts +45 -0
  224. package/dist/docs/start-prompts.js +62 -0
  225. package/dist/domain-exploration.js +9 -13
  226. package/dist/og-template.d.ts +56 -0
  227. package/dist/og-template.js +56 -0
  228. package/dist/slug-policy/index.js +5 -11
  229. package/dist/utils/browser-credential.d.ts +13 -6
  230. package/dist/utils/browser-credential.js +14 -7
  231. package/dist/utils/build-settings.d.ts +16 -0
  232. package/dist/utils/build-settings.js +63 -17
  233. package/dist/utils/canonical-json.d.ts +3 -5
  234. package/dist/utils/canonical-json.js +3 -5
  235. package/dist/utils/cast-transport.d.ts +5 -17
  236. package/dist/utils/cast-transport.js +6 -19
  237. package/dist/utils/claim-token.js +1 -2
  238. package/dist/utils/comment-avatars.js +4 -6
  239. package/dist/utils/concurrency.js +2 -3
  240. package/dist/utils/content-type.d.ts +7 -6
  241. package/dist/utils/content-type.js +73 -51
  242. package/dist/utils/credential-policy.d.ts +50 -6
  243. package/dist/utils/credential-policy.js +123 -57
  244. package/dist/utils/egress-policy.fixtures.json +1 -1
  245. package/dist/utils/generate-space-name.d.ts +3 -8
  246. package/dist/utils/generate-space-name.js +3 -8
  247. package/dist/utils/grants.d.ts +0 -1
  248. package/dist/utils/grants.js +4 -7
  249. package/dist/utils/gravatar.d.ts +2 -4
  250. package/dist/utils/gravatar.js +6 -12
  251. package/dist/utils/id-hints.js +14 -23
  252. package/dist/utils/idempotency.d.ts +3 -3
  253. package/dist/utils/idempotency.js +6 -7
  254. package/dist/utils/local-space-state.d.ts +15 -15
  255. package/dist/utils/local-space-state.js +34 -23
  256. package/dist/utils/oauth-signed-query.d.ts +3 -5
  257. package/dist/utils/oauth-signed-query.js +6 -9
  258. package/dist/utils/one-shot-replay.d.ts +3 -5
  259. package/dist/utils/one-shot-replay.js +3 -5
  260. package/dist/utils/page-colors.d.ts +4 -10
  261. package/dist/utils/page-colors.js +11 -35
  262. package/dist/utils/page-fonts.js +6 -11
  263. package/dist/utils/page-preview.d.ts +0 -1
  264. package/dist/utils/page-preview.js +0 -1
  265. package/dist/utils/pages.d.ts +22 -11
  266. package/dist/utils/pages.js +70 -30
  267. package/dist/utils/privacy-regions.d.ts +19 -0
  268. package/dist/utils/privacy-regions.js +91 -0
  269. package/dist/utils/publish-form-data.d.ts +4 -5
  270. package/dist/utils/publish-form-data.js +2 -3
  271. package/dist/utils/publish-policy.d.ts +10 -23
  272. package/dist/utils/publish-policy.js +63 -116
  273. package/dist/utils/query-client.d.ts +2 -0
  274. package/dist/utils/query-client.js +10 -1
  275. package/dist/utils/runtime-paths.d.ts +4 -4
  276. package/dist/utils/runtime-paths.js +6 -8
  277. package/dist/utils/runtime-upload.d.ts +4 -0
  278. package/dist/utils/runtime-upload.js +5 -0
  279. package/dist/utils/secure-local-file.d.ts +3 -3
  280. package/dist/utils/secure-local-file.js +18 -24
  281. package/dist/utils/space-config.d.ts +11 -14
  282. package/dist/utils/space-config.js +10 -16
  283. package/dist/utils/static-runtime-policy.d.ts +5 -8
  284. package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
  285. package/dist/utils/static-runtime-policy.generated.js +70 -0
  286. package/dist/utils/static-runtime-policy.js +17 -84
  287. package/dist/utils/storage-policy.js +1 -2
  288. package/dist/utils/upload-session.js +8 -14
  289. package/dist/utils/version-path.js +11 -19
  290. package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
  291. package/dist/utils/wpcom-auth-redirects.js +1 -4
  292. package/dist/vocabulary.d.ts +7 -7
  293. package/dist/vocabulary.js +30 -16
  294. package/package.json +14 -2
  295. package/dist/agents/client-registry.d.ts +0 -22
  296. package/dist/agents/client-registry.js +0 -41
  297. package/dist/docs/agent-handoff-document.d.ts +0 -15
  298. package/dist/docs/agent-handoff-document.js +0 -180
  299. package/dist/docs/agent-solutions.d.ts +0 -110
  300. package/dist/docs/agent-solutions.js +0 -183
  301. package/dist/utils/query-keys.d.ts +0 -84
  302. package/dist/utils/query-keys.js +0 -108
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
+ import { normalizeSlug } from "../utils/slug.js";
2
3
  import { baseDiagnosticSchema, CursorPaginationSchema, cursorListQuerySchema, dataEnvelope, } from "./common.js";
3
- export const tagVersionStatusSchema = z.enum([
4
+ export const tagRevisionStatusSchema = z.enum([
4
5
  "draft",
5
6
  "in_review",
6
7
  "approved",
@@ -21,6 +22,10 @@ export const TAG_PRIVACY_SIGNAL_CONSENT_CATEGORIES = [
21
22
  "marketing",
22
23
  "personalization",
23
24
  ];
25
+ // `defaultGranted` is the non-GDPR default. `requiresConsentInGdprCountries`
26
+ // mirrors wpcom's per-tracker flag of the same name: inside the GDPR zone the
27
+ // category is denied until the visitor explicitly grants it, and the zone check
28
+ // fails closed on unknown geo (see `isGdprCountry` in utils/privacy-regions).
24
29
  export const TAG_CONSENT_CATEGORY_DEFINITIONS = [
25
30
  {
26
31
  id: "necessary",
@@ -29,6 +34,7 @@ export const TAG_CONSENT_CATEGORY_DEFINITIONS = [
29
34
  defaultGranted: true,
30
35
  required: true,
31
36
  privacySignalDefaultDenied: false,
37
+ requiresConsentInGdprCountries: false,
32
38
  },
33
39
  {
34
40
  id: "functional",
@@ -37,6 +43,7 @@ export const TAG_CONSENT_CATEGORY_DEFINITIONS = [
37
43
  defaultGranted: true,
38
44
  required: false,
39
45
  privacySignalDefaultDenied: false,
46
+ requiresConsentInGdprCountries: false,
40
47
  },
41
48
  {
42
49
  id: "analytics",
@@ -45,6 +52,7 @@ export const TAG_CONSENT_CATEGORY_DEFINITIONS = [
45
52
  defaultGranted: true,
46
53
  required: false,
47
54
  privacySignalDefaultDenied: true,
55
+ requiresConsentInGdprCountries: true,
48
56
  },
49
57
  {
50
58
  id: "marketing",
@@ -53,6 +61,7 @@ export const TAG_CONSENT_CATEGORY_DEFINITIONS = [
53
61
  defaultGranted: true,
54
62
  required: false,
55
63
  privacySignalDefaultDenied: true,
64
+ requiresConsentInGdprCountries: true,
56
65
  },
57
66
  {
58
67
  id: "personalization",
@@ -61,6 +70,7 @@ export const TAG_CONSENT_CATEGORY_DEFINITIONS = [
61
70
  defaultGranted: true,
62
71
  required: false,
63
72
  privacySignalDefaultDenied: true,
73
+ requiresConsentInGdprCountries: true,
64
74
  },
65
75
  ];
66
76
  export const TAG_CONSENT_CATEGORY_IDS = TAG_CONSENT_CATEGORY_DEFINITIONS.map((category) => category.id);
@@ -75,6 +85,7 @@ export const tagConsentPolicySchema = z.object({
75
85
  defaultGranted: z.boolean(),
76
86
  required: z.boolean().default(false),
77
87
  privacySignalDefaultDenied: z.boolean().default(false),
88
+ requiresConsentInGdprCountries: z.boolean().default(false),
78
89
  }))
79
90
  .default(Object.fromEntries(TAG_CONSENT_CATEGORY_DEFINITIONS.map((category) => [
80
91
  category.id,
@@ -84,6 +95,7 @@ export const tagConsentPolicySchema = z.object({
84
95
  defaultGranted: category.defaultGranted,
85
96
  required: category.required,
86
97
  privacySignalDefaultDenied: category.privacySignalDefaultDenied,
98
+ requiresConsentInGdprCountries: category.requiresConsentInGdprCountries,
87
99
  },
88
100
  ]))),
89
101
  defaultByCategory: z.record(z.string(), z.boolean()).default(DEFAULT_TAG_CONSENT_DEFAULTS),
@@ -371,12 +383,12 @@ export const tagValidationResultSchema = z.object({
371
383
  requiredApprovals: z.array(z.string()),
372
384
  graphRevision: z.number().int().positive(),
373
385
  });
374
- export const tagVersionSchema = z.object({
386
+ export const tagRevisionSchema = z.object({
375
387
  id: z.string(),
376
388
  tagSetId: z.string(),
377
- versionNumber: z.number().int().positive(),
378
- baseVersionId: z.string().nullable(),
379
- status: tagVersionStatusSchema,
389
+ revisionNumber: z.number().int().positive(),
390
+ baseRevisionId: z.string().nullable(),
391
+ status: tagRevisionStatusSchema,
380
392
  title: z.string(),
381
393
  description: z.string().nullable(),
382
394
  graph: tagGraphSchema,
@@ -391,26 +403,28 @@ export const tagVersionSchema = z.object({
391
403
  publishedAt: z.string().nullable(),
392
404
  immutableAt: z.string().nullable(),
393
405
  });
394
- export const tagVersionListQuerySchema = cursorListQuerySchema.extend({
395
- status: tagVersionStatusSchema.optional(),
406
+ export const tagRevisionListQuerySchema = cursorListQuerySchema.extend({
407
+ status: tagRevisionStatusSchema
408
+ .optional()
409
+ .describe("Return only revisions in this review state."),
396
410
  });
397
- export const tagVersionListResponseSchema = z.object({
398
- data: z.array(tagVersionSchema),
411
+ export const tagRevisionListResponseSchema = z.object({
412
+ data: z.array(tagRevisionSchema),
399
413
  pagination: CursorPaginationSchema,
400
414
  });
401
- export const tagVersionResponseSchema = dataEnvelope(tagVersionSchema);
402
- export const tagVersionCreateSchema = z.object({
403
- title: z.string().trim().min(1).max(255).default("Draft tag version"),
415
+ export const tagRevisionResponseSchema = dataEnvelope(tagRevisionSchema);
416
+ export const tagRevisionCreateSchema = z.object({
417
+ title: z.string().trim().min(1).max(255).default("Draft tag revision"),
404
418
  description: z.string().trim().max(4_000).nullable().optional(),
405
- baseVersionId: z.string().trim().min(1).nullable().optional(),
419
+ baseRevisionId: z.string().trim().min(1).nullable().optional(),
406
420
  graph: tagGraphWriteSchema.optional(),
407
421
  });
408
- export const tagVersionPatchSchema = z.object({
422
+ export const tagRevisionPatchSchema = z.object({
409
423
  title: z.string().trim().min(1).max(255).optional(),
410
424
  description: z.string().trim().max(4_000).nullable().optional(),
411
425
  });
412
426
  export const tagGraphResponseSchema = dataEnvelope(z.object({
413
- versionId: z.string(),
427
+ revisionId: z.string(),
414
428
  graph: tagGraphSchema,
415
429
  graphRevision: z.number().int().positive(),
416
430
  }));
@@ -429,8 +443,8 @@ export const tagGraphPatchSchema = z.object({
429
443
  });
430
444
  export const tagValidateResponseSchema = dataEnvelope(tagValidationResultSchema);
431
445
  export const tagDiffSchema = z.object({
432
- baseVersionId: z.string().nullable(),
433
- targetVersionId: z.string(),
446
+ baseRevisionId: z.string().nullable(),
447
+ targetRevisionId: z.string(),
434
448
  addedTagIds: z.array(z.string()),
435
449
  removedTagIds: z.array(z.string()),
436
450
  changedTagIds: z.array(z.string()),
@@ -441,8 +455,8 @@ export const tagReleaseSchema = z.object({
441
455
  id: z.string(),
442
456
  tagSetId: z.string(),
443
457
  environment: tagEnvironmentSchema,
444
- versionId: z.string(),
445
- previousVersionId: z.string().nullable(),
458
+ revisionId: z.string(),
459
+ previousRevisionId: z.string().nullable(),
446
460
  sdkRevision: z.string(),
447
461
  staticDigest: z.string(),
448
462
  releaseNotes: z.string().nullable(),
@@ -483,7 +497,7 @@ export const tagInheritancePatchSchema = z.object({
483
497
  export const tagActivityEventSchema = z.object({
484
498
  id: z.string(),
485
499
  type: z.string(),
486
- versionId: z.string().nullable(),
500
+ revisionId: z.string().nullable(),
487
501
  environment: tagEnvironmentSchema.nullable(),
488
502
  message: z.string(),
489
503
  actor: z.record(z.string(), z.unknown()).nullable(),
@@ -496,8 +510,8 @@ export const tagEffectiveTagResponseSchema = dataEnvelope(z.object({
496
510
  source: z.enum(["system", "team", "space", "unknown"]),
497
511
  }));
498
512
  export const tagReleasePutSchema = z.object({
499
- versionId: z.string().trim().min(1),
500
- expectedCurrentVersionId: z.string().trim().min(1).nullable().optional(),
513
+ revisionId: z.string().trim().min(1),
514
+ expectedCurrentRevisionId: z.string().trim().min(1).nullable().optional(),
501
515
  releaseNotes: z.string().trim().max(4_000).nullable().optional(),
502
516
  });
503
517
  export const tagApplySchema = z.object({
@@ -506,10 +520,10 @@ export const tagApplySchema = z.object({
506
520
  description: z.string().trim().max(4_000).nullable().optional(),
507
521
  submit: z.boolean().default(false),
508
522
  releaseEnvironment: tagEnvironmentSchema.optional(),
509
- expectedCurrentVersionId: z.string().trim().min(1).nullable().optional(),
523
+ expectedCurrentRevisionId: z.string().trim().min(1).nullable().optional(),
510
524
  });
511
525
  export const tagApplyResponseSchema = dataEnvelope(z.object({
512
- version: tagVersionSchema,
526
+ revision: tagRevisionSchema,
513
527
  validation: tagValidationResultSchema,
514
528
  release: tagReleaseSchema
515
529
  .extend({
@@ -525,7 +539,7 @@ export const tagApplyResponseSchema = dataEnvelope(z.object({
525
539
  }));
526
540
  export const tagPreviewSessionSchema = z.object({
527
541
  id: z.string(),
528
- versionId: z.string(),
542
+ revisionId: z.string(),
529
543
  environment: tagEnvironmentSchema,
530
544
  previewUrl: z.string(),
531
545
  sdkRevision: z.string(),
@@ -536,6 +550,7 @@ export const tagPreviewSessionSchema = z.object({
536
550
  revokedAt: z.string().nullable(),
537
551
  });
538
552
  export const tagPreviewSessionResponseSchema = dataEnvelope(tagPreviewSessionSchema);
553
+ export const tagPreviewSessionListResponseSchema = dataEnvelope(z.array(tagPreviewSessionSchema));
539
554
  export const tagPreviewSessionCreateSchema = z.object({
540
555
  url: z.string().url().optional(),
541
556
  ttlSeconds: z.number().int().min(60).max(86_400).default(3_600),
@@ -658,7 +673,7 @@ export const tagTemplateListResponseSchema = dataEnvelope(z.object({
658
673
  }));
659
674
  export const tagConsentPolicyResponseSchema = dataEnvelope(z.object({
660
675
  environment: tagEnvironmentSchema,
661
- versionId: z.string().nullable(),
676
+ revisionId: z.string().nullable(),
662
677
  graphRevision: z.number().int().nonnegative(),
663
678
  policy: tagConsentPolicySchema,
664
679
  }));
@@ -883,12 +898,7 @@ function templateFieldValue(config, key) {
883
898
  return typeof value === "string" ? value.trim() : "";
884
899
  }
885
900
  export function safeTagIdPart(value) {
886
- return value
887
- .trim()
888
- .toLowerCase()
889
- .replace(/[^a-z0-9]+/g, "-")
890
- .replace(/^-+|-+$/g, "")
891
- .slice(0, 64);
901
+ return normalizeSlug(value, { maxLength: 64 });
892
902
  }
893
903
  function htmlScript(code) {
894
904
  return /^\s*<script\b[^>]*>[\s\S]*<\/script>\s*$/i.test(code)
@@ -1224,12 +1234,12 @@ export function tagGraphFromTemplateSelections(selections) {
1224
1234
  export const tagEffectiveResponseSchema = dataEnvelope(z.object({
1225
1235
  tagSetId: z.string().nullable(),
1226
1236
  environment: tagEnvironmentSchema,
1227
- versionId: z.string().nullable(),
1237
+ revisionId: z.string().nullable(),
1228
1238
  graph: tagGraphSchema,
1229
1239
  graphRevision: z.number().int().nonnegative(),
1230
1240
  sdkRevision: z.string().nullable(),
1231
1241
  sources: z.array(z.object({
1232
1242
  type: z.enum(["team", "space", "system"]),
1233
- versionId: z.string().nullable(),
1243
+ revisionId: z.string().nullable(),
1234
1244
  })),
1235
1245
  }));
@@ -6,12 +6,12 @@ export declare const teamMemberRole: z.ZodEnum<{
6
6
  member: "member";
7
7
  }>;
8
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.
9
+ * Better Auth stores the member role as free text. Unknown roles carry no
10
+ * privilege, so they read as `member`.
12
11
  */
13
12
  export declare function normalizeTeamMemberRole(role: string | null | undefined): "admin" | "owner" | "member";
14
13
  export declare const teamInvitationCreateSchema: z.ZodObject<{
14
+ teamId: z.ZodString;
15
15
  email: z.ZodString;
16
16
  role: z.ZodDefault<z.ZodEnum<{
17
17
  admin: "admin";
@@ -26,6 +26,7 @@ export declare const teamMemberListQuerySchema: z.ZodObject<{
26
26
  export declare const teamInvitationListQuerySchema: z.ZodObject<{
27
27
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
28
28
  cursor: z.ZodOptional<z.ZodString>;
29
+ teamId: z.ZodString;
29
30
  }, z.core.$strip>;
30
31
  export declare const teamListQuerySchema: z.ZodObject<{
31
32
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -66,6 +67,28 @@ export declare const teamMemberRoleUpdateSchema: z.ZodObject<{
66
67
  }>;
67
68
  }, z.core.$strip>;
68
69
  export type TeamMember = z.infer<typeof TeamMemberSchema>;
70
+ /**
71
+ * The one invitation status vocabulary, shared by the collection and the by-id
72
+ * read. Better Auth's organization plugin owns the stored column and writes
73
+ * `pending | accepted | rejected | canceled`; `expired` is derived, because a
74
+ * still-pending invitation past `expiresAt` can never be accepted and no writer
75
+ * ever rewrites the row.
76
+ */
77
+ export declare const teamInvitationStatus: z.ZodEnum<{
78
+ canceled: "canceled";
79
+ expired: "expired";
80
+ pending: "pending";
81
+ accepted: "accepted";
82
+ rejected: "rejected";
83
+ }>;
84
+ export type TeamInvitationStatus = z.infer<typeof teamInvitationStatus>;
85
+ /**
86
+ * The stored column is free text over a closed domain. An unrecognized value is
87
+ * not something a recipient may act on, so it fails closed to `canceled` —
88
+ * never `pending` (which would offer a dead link) and never `accepted` (which
89
+ * would claim a membership nobody holds).
90
+ */
91
+ export declare function normalizeTeamInvitationStatus(status: string | null | undefined): "canceled" | "expired" | "pending" | "accepted" | "rejected";
69
92
  export declare const TeamInvitationSchema: z.ZodObject<{
70
93
  id: z.ZodString;
71
94
  teamId: z.ZodString;
@@ -75,7 +98,13 @@ export declare const TeamInvitationSchema: z.ZodObject<{
75
98
  owner: "owner";
76
99
  member: "member";
77
100
  }>;
78
- status: z.ZodString;
101
+ status: z.ZodEnum<{
102
+ canceled: "canceled";
103
+ expired: "expired";
104
+ pending: "pending";
105
+ accepted: "accepted";
106
+ rejected: "rejected";
107
+ }>;
79
108
  expiresAt: z.ZodString;
80
109
  createdAt: z.ZodString;
81
110
  }, z.core.$strip>;
@@ -131,6 +160,30 @@ export declare const TeamDetailSchema: z.ZodObject<{
131
160
  logo: z.ZodNullable<z.ZodString>;
132
161
  metadata: z.ZodNullable<z.ZodString>;
133
162
  stripeCustomerId: z.ZodNullable<z.ZodString>;
163
+ systemSpaceId: z.ZodNullable<z.ZodString>;
164
+ manifestStatus: z.ZodObject<{
165
+ items: z.ZodArray<z.ZodObject<{
166
+ key: z.ZodString;
167
+ state: z.ZodEnum<{
168
+ active: "active";
169
+ failed: "failed";
170
+ pending: "pending";
171
+ }>;
172
+ detail: z.ZodOptional<z.ZodString>;
173
+ since: z.ZodString;
174
+ audience: z.ZodOptional<z.ZodString>;
175
+ }, z.core.$strip>>;
176
+ sourceVersionId: z.ZodNullable<z.ZodString>;
177
+ }, z.core.$strip>;
178
+ presentation: z.ZodNullable<z.ZodObject<{
179
+ name: z.ZodOptional<z.ZodString>;
180
+ logo: z.ZodOptional<z.ZodString>;
181
+ supportUrl: z.ZodOptional<z.ZodString>;
182
+ claimOrigin: z.ZodOptional<z.ZodString>;
183
+ accessHandoffOrigin: z.ZodOptional<z.ZodString>;
184
+ problemDocsBaseUrl: z.ZodOptional<z.ZodString>;
185
+ contacts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
186
+ }, z.core.$strict>>;
134
187
  }, z.core.$strip>;
135
188
  export declare const teamListResponseSchema: z.ZodObject<{
136
189
  data: z.ZodArray<z.ZodObject<{
@@ -189,7 +242,7 @@ export declare const teamJoinResponseSchema: z.ZodObject<{
189
242
  role: z.ZodLiteral<"member">;
190
243
  }, z.core.$strip>;
191
244
  }, z.core.$strip>;
192
- export declare const teamInvitationAcceptSchema: z.ZodObject<{
245
+ export declare const teamInvitationParamsSchema: z.ZodObject<{
193
246
  invitationId: z.ZodString;
194
247
  }, z.core.$strip>;
195
248
  export declare const teamInvitationAcceptResponseSchema: z.ZodObject<{
@@ -214,7 +267,13 @@ export declare const teamInvitationListResponseSchema: z.ZodObject<{
214
267
  owner: "owner";
215
268
  member: "member";
216
269
  }>;
217
- status: z.ZodString;
270
+ status: z.ZodEnum<{
271
+ canceled: "canceled";
272
+ expired: "expired";
273
+ pending: "pending";
274
+ accepted: "accepted";
275
+ rejected: "rejected";
276
+ }>;
218
277
  expiresAt: z.ZodString;
219
278
  createdAt: z.ZodString;
220
279
  }, z.core.$strip>>;
@@ -263,14 +322,16 @@ export declare const teamUsageResponseSchema: z.ZodObject<{
263
322
  storageBytes: z.ZodNumber;
264
323
  }, z.core.$strip>>;
265
324
  }, z.core.$strip>;
266
- export declare const teamInvitationPreviewSchema: z.ZodObject<{
325
+ export declare const teamInvitationDetailSchema: z.ZodObject<{
267
326
  id: z.ZodString;
268
327
  teamName: z.ZodString;
269
- invitedEmail: z.ZodString;
328
+ email: z.ZodString;
270
329
  status: z.ZodEnum<{
330
+ canceled: "canceled";
271
331
  expired: "expired";
272
- closed: "closed";
273
332
  pending: "pending";
333
+ accepted: "accepted";
334
+ rejected: "rejected";
274
335
  }>;
275
336
  expiresAt: z.ZodString;
276
337
  }, z.core.$strip>;
@@ -284,4 +345,6 @@ export declare const teamUpdateSchema: z.ZodObject<{
284
345
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
346
  metadata: z.ZodOptional<z.ZodNullable<z.ZodString>>;
286
347
  defaultDataLocation: z.ZodOptional<z.ZodString>;
348
+ systemSpaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
349
+ baseSystemSpaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
287
350
  }, z.core.$strip>;
@@ -1,23 +1,30 @@
1
1
  import { z } from "zod";
2
2
  import { CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
3
  import { planCodeSchema, planLimitValueSchema } from "./features.js";
4
+ import { systemPresentationSchema } from "./space-config.js";
5
+ import { ManifestStatusSchema } from "./tenants.js";
4
6
  export const TEAM_ROLE_VALUES = ["owner", "admin", "member"];
5
7
  export const teamMemberRole = z.enum(TEAM_ROLE_VALUES);
6
8
  /**
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.
9
+ * Better Auth stores the member role as free text. Unknown roles carry no
10
+ * privilege, so they read as `member`.
10
11
  */
11
12
  export function normalizeTeamMemberRole(role) {
12
13
  const parsed = teamMemberRole.safeParse(role ?? "member");
13
14
  return parsed.success ? parsed.data : "member";
14
15
  }
16
+ // An invitation is its own resource under `/v1/team-invitations`, so the team
17
+ // it belongs to travels in the body (create) or the query (list) instead of a
18
+ // path segment.
15
19
  export const teamInvitationCreateSchema = z.object({
20
+ teamId: z.string().trim().min(1).describe("The team to invite this person to."),
16
21
  email: z.string().trim().email().toLowerCase(),
17
22
  role: teamMemberRole.default("member"),
18
23
  });
19
24
  export const teamMemberListQuerySchema = cursorListQuerySchema;
20
- export const teamInvitationListQuerySchema = cursorListQuerySchema;
25
+ export const teamInvitationListQuerySchema = cursorListQuerySchema.extend({
26
+ teamId: z.string().trim().min(1).describe("The team whose invitations to list."),
27
+ });
21
28
  export const teamListQuerySchema = cursorListQuerySchema;
22
29
  export const teamSpaceListQuerySchema = cursorListQuerySchema;
23
30
  export const TeamMemberUserSchema = z.object({
@@ -26,10 +33,9 @@ export const TeamMemberUserSchema = z.object({
26
33
  email: z.string().email().describe("The member's email address."),
27
34
  image: z.string().nullable().describe("Avatar URL, or null when the user has none."),
28
35
  });
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.
36
+ // The one membership shape every surface types from. Better Auth's organization
37
+ // plugin owns the underlying rows; its inferred types never cross an app
38
+ // boundary.
33
39
  export const TeamMemberSchema = z.object({
34
40
  id: z.string().describe("The membership id, stable for the life of the membership."),
35
41
  teamId: z.string().describe("The team this membership belongs to."),
@@ -41,12 +47,36 @@ export const TeamMemberSchema = z.object({
41
47
  export const teamMemberRoleUpdateSchema = z.object({
42
48
  role: teamMemberRole.describe("The role to grant this member."),
43
49
  });
50
+ /**
51
+ * The one invitation status vocabulary, shared by the collection and the by-id
52
+ * read. Better Auth's organization plugin owns the stored column and writes
53
+ * `pending | accepted | rejected | canceled`; `expired` is derived, because a
54
+ * still-pending invitation past `expiresAt` can never be accepted and no writer
55
+ * ever rewrites the row.
56
+ */
57
+ export const teamInvitationStatus = z.enum([
58
+ "pending",
59
+ "accepted",
60
+ "rejected",
61
+ "canceled",
62
+ "expired",
63
+ ]);
64
+ /**
65
+ * The stored column is free text over a closed domain. An unrecognized value is
66
+ * not something a recipient may act on, so it fails closed to `canceled` —
67
+ * never `pending` (which would offer a dead link) and never `accepted` (which
68
+ * would claim a membership nobody holds).
69
+ */
70
+ export function normalizeTeamInvitationStatus(status) {
71
+ const parsed = teamInvitationStatus.safeParse(status);
72
+ return parsed.success ? parsed.data : "canceled";
73
+ }
44
74
  export const TeamInvitationSchema = z.object({
45
75
  id: z.string(),
46
76
  teamId: z.string(),
47
77
  email: z.string().email(),
48
78
  role: teamMemberRole,
49
- status: z.string(),
79
+ status: teamInvitationStatus,
50
80
  expiresAt: z.string().datetime(),
51
81
  createdAt: z.string().datetime(),
52
82
  });
@@ -73,6 +103,14 @@ export const TeamDetailSchema = TeamSummarySchema.extend({
73
103
  .string()
74
104
  .nullable()
75
105
  .describe("Stripe customer id linked to this team; null until billing is initialized."),
106
+ systemSpaceId: z
107
+ .string()
108
+ .nullable()
109
+ .describe("The space that supplies this team's page, theme, and presentation defaults."),
110
+ manifestStatus: ManifestStatusSchema.describe("The status of the restricted manifest from the team's system space."),
111
+ presentation: systemPresentationSchema
112
+ .nullable()
113
+ .describe("The presentation from the team's system space, or null when no value is active."),
76
114
  });
77
115
  export const teamListResponseSchema = z.object({
78
116
  data: z.array(TeamSummarySchema),
@@ -89,14 +127,14 @@ export const teamJoinResponseSchema = z.object({
89
127
  role: z.literal("member"),
90
128
  }),
91
129
  });
92
- // Accepting an invitation is by its id (the opaque token carried in the accept
93
- // email link and returned by the invitations list/preview endpoints).
94
- export const teamInvitationAcceptSchema = z.object({
130
+ // Every by-id invitation door read, accept, resend, revoke is addressed by
131
+ // the opaque token carried in the invite link.
132
+ export const teamInvitationParamsSchema = z.object({
95
133
  invitationId: z
96
134
  .string()
97
135
  .trim()
98
136
  .min(1)
99
- .describe("The invitation id to accept (the token from the invite link)."),
137
+ .describe("The invitation id (the token from the invite link)."),
100
138
  });
101
139
  export const teamInvitationAcceptResponseSchema = z.object({
102
140
  data: z.object({
@@ -112,8 +150,7 @@ export const teamInvitationListResponseSchema = z.object({
112
150
  });
113
151
  // Team activity is served by `GET /v1/teams/{teamId}/activity`, a facade over
114
152
  // the one activity store using the ActivityEvent contract (contracts/activity.ts).
115
- // `defaultDataLocation` is the spec Team field: "auto" lets placement decide,
116
- // any other value must be an available placement region id.
153
+ // Any value other than "auto" must be an available placement region id.
117
154
  export const teamDataLocationSchema = z
118
155
  .string()
119
156
  .trim()
@@ -127,8 +164,7 @@ const infraCapabilityOptionSchema = z.object({
127
164
  id: z.string(),
128
165
  label: z.string(),
129
166
  });
130
- // Served by `GET /v1/teams/{teamId}/settings` (and echoed by the PATCH):
131
- // the default data location plus the placement options it may take.
167
+ // Served by `GET /v1/teams/{teamId}/settings`, and echoed by the PATCH.
132
168
  export const teamSettingsResponseSchema = z.object({
133
169
  teamId: z.string().describe("The team id the settings belong to."),
134
170
  defaultDataLocation: teamDataLocationSchema,
@@ -153,7 +189,7 @@ export const teamUsageResponseSchema = z.object({
153
189
  members: z.number().int().describe("Team members."),
154
190
  storageBytes: z
155
191
  .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."),
192
+ .describe("Disk 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."),
157
193
  storageQuotaBytes: z
158
194
  .union([z.number(), z.literal("unlimited")])
159
195
  .describe('Plan storage quota; "unlimited" when unbounded.'),
@@ -161,7 +197,7 @@ export const teamUsageResponseSchema = z.object({
161
197
  storageCalculatedAt: z
162
198
  .string()
163
199
  .nullable()
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."),
200
+ .describe("How far back the weakest measurement behind this total reaches. Null when the team's storage has not been measured yet. The meter lags the present by about an hour."),
165
201
  buildsDeploysThisMonth: z
166
202
  .number()
167
203
  .int()
@@ -180,17 +216,21 @@ export const teamUsageResponseSchema = z.object({
180
216
  title: z.string().describe("Space display title."),
181
217
  storageBytes: z
182
218
  .number()
183
- .describe("Disk this space occupies, as measured by the infrastructure serving it. Zero for a space that has not been measured yet."),
219
+ .describe("Disk this space occupies, as measured by the infrastructure serving it. Zero until the space has been measured."),
184
220
  }))
185
221
  .describe("Per-space storage breakdown for spaces the caller can read."),
186
222
  });
187
- // Served by `GET /v1/teams/invitations/{invitationId}/preview`: the unauthenticated
188
- // invite landing view (email is masked, never the full address).
189
- export const teamInvitationPreviewSchema = z.object({
223
+ // Served by `GET /v1/team-invitations/{invitationId}`: the unauthenticated
224
+ // invite landing view. Same field names and same status vocabulary as the
225
+ // collection item; the address is masked and the team name is carried so the
226
+ // page can render before sign-in.
227
+ export const teamInvitationDetailSchema = z.object({
190
228
  id: z.string().describe("Invitation id."),
191
229
  teamName: z.string().describe("Inviting team's display name."),
192
- invitedEmail: z.string().describe("Masked invited email address."),
193
- status: z.enum(["pending", "expired", "closed"]).describe("Whether the invite can be accepted."),
230
+ email: z
231
+ .string()
232
+ .describe("The invited address, masked (`ja****@example.com`); never the full address."),
233
+ status: teamInvitationStatus.describe("Current state of the invitation. Only `pending` can be accepted."),
194
234
  expiresAt: z.string().describe("Instant when the invitation expires."),
195
235
  });
196
236
  export const teamCreateSchema = z.object({
@@ -219,6 +259,25 @@ export const teamUpdateSchema = z
219
259
  logo: z.string().trim().max(2048).nullable().optional(),
220
260
  metadata: z.string().nullable().optional(),
221
261
  defaultDataLocation: teamDataLocationSchema.optional(),
262
+ systemSpaceId: z
263
+ .string()
264
+ .nullable()
265
+ .optional()
266
+ .describe("Set the team's system space. Use null to clear the current system space."),
267
+ baseSystemSpaceId: z
268
+ .string()
269
+ .nullable()
270
+ .optional()
271
+ .describe("The current system-space id that the caller expects. The update fails if this value is stale."),
272
+ })
273
+ .superRefine((value, ctx) => {
274
+ if (value.baseSystemSpaceId !== undefined && value.systemSpaceId === undefined) {
275
+ ctx.addIssue({
276
+ code: "custom",
277
+ message: "baseSystemSpaceId requires systemSpaceId.",
278
+ path: ["baseSystemSpaceId"],
279
+ });
280
+ }
222
281
  })
223
282
  .refine((value) => Object.keys(value).length > 0, {
224
283
  message: "At least one team field is required.",