@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.
- package/dist/agents/connect-targets.d.ts +6 -146
- package/dist/agents/connect-targets.js +63 -295
- package/dist/agents/private-key-oauth.d.ts +31 -1
- package/dist/agents/private-key-oauth.js +124 -33
- package/dist/agents/registry/core.d.ts +292 -0
- package/dist/agents/registry/core.js +1388 -0
- package/dist/agents/registry/deeplink-probes.d.ts +23 -0
- package/dist/agents/registry/deeplink-probes.js +18 -0
- package/dist/agents/registry/node.d.ts +56 -0
- package/dist/agents/registry/node.js +339 -0
- package/dist/brand-assets-build.js +1 -2
- package/dist/brand-assets.js +4 -7
- package/dist/brand.d.ts +17 -0
- package/dist/brand.js +24 -4
- package/dist/config/domains.d.ts +55 -28
- package/dist/config/domains.js +85 -41
- package/dist/config/index.js +1 -2
- package/dist/contracts/abuse.js +9 -24
- package/dist/contracts/access-profiles.d.ts +86 -0
- package/dist/contracts/access-profiles.js +89 -0
- package/dist/contracts/access.d.ts +21 -27
- package/dist/contracts/access.js +33 -64
- package/dist/contracts/activity.d.ts +18 -1
- package/dist/contracts/activity.js +70 -26
- package/dist/contracts/analytics.js +8 -10
- package/dist/contracts/api-keys.d.ts +77 -52
- package/dist/contracts/api-keys.js +44 -24
- package/dist/contracts/application-journal.d.ts +216 -0
- package/dist/contracts/application-journal.js +167 -0
- package/dist/contracts/auth.d.ts +90 -17
- package/dist/contracts/auth.js +86 -17
- package/dist/contracts/beta.d.ts +9 -4
- package/dist/contracts/beta.js +20 -16
- package/dist/contracts/billing.js +7 -11
- package/dist/contracts/bootstrap.d.ts +791 -0
- package/dist/contracts/bootstrap.js +51 -0
- package/dist/contracts/builds.d.ts +186 -7
- package/dist/contracts/builds.js +75 -21
- package/dist/contracts/channels.d.ts +43 -0
- package/dist/contracts/channels.js +25 -9
- package/dist/contracts/cli.d.ts +7 -0
- package/dist/contracts/cli.js +6 -0
- package/dist/contracts/collab-public.d.ts +1 -1
- package/dist/contracts/collab-public.js +5 -8
- package/dist/contracts/comments.d.ts +45 -35
- package/dist/contracts/comments.js +107 -77
- package/dist/contracts/commerce.d.ts +165 -0
- package/dist/contracts/commerce.js +146 -0
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/common.js +18 -29
- package/dist/contracts/content-contract-verification.d.ts +521 -0
- package/dist/contracts/content-contract-verification.js +320 -0
- package/dist/contracts/content-platform-fixture.d.ts +1278 -0
- package/dist/contracts/content-platform-fixture.js +44 -0
- package/dist/contracts/content-program.d.ts +994 -0
- package/dist/contracts/content-program.js +658 -0
- package/dist/contracts/content-sync.d.ts +290 -0
- package/dist/contracts/content-sync.js +167 -0
- package/dist/contracts/content.d.ts +432 -0
- package/dist/contracts/content.js +303 -0
- package/dist/contracts/continuation.d.ts +17 -1
- package/dist/contracts/continuation.js +23 -23
- package/dist/contracts/countries.js +3 -4
- package/dist/contracts/crons.d.ts +17 -0
- package/dist/contracts/crons.js +33 -15
- package/dist/contracts/dashboard-prefs.d.ts +56 -0
- package/dist/contracts/dashboard-prefs.js +51 -0
- package/dist/contracts/device-auth.d.ts +234 -37
- package/dist/contracts/device-auth.js +267 -53
- package/dist/contracts/docs.d.ts +6 -10
- package/dist/contracts/docs.js +5 -13
- package/dist/contracts/domains.d.ts +499 -102
- package/dist/contracts/domains.js +169 -58
- package/dist/contracts/email-preferences.d.ts +3 -3
- package/dist/contracts/email-preferences.js +6 -7
- package/dist/contracts/enums.d.ts +26 -26
- package/dist/contracts/enums.js +61 -54
- package/dist/contracts/error-code-meta.d.ts +269 -7
- package/dist/contracts/error-code-meta.js +80 -5
- package/dist/contracts/error-codes.d.ts +5 -5
- package/dist/contracts/error-codes.js +78 -16
- package/dist/contracts/events.d.ts +100 -20
- package/dist/contracts/events.js +107 -20
- package/dist/contracts/execution.d.ts +47 -66
- package/dist/contracts/execution.js +51 -64
- package/dist/contracts/feature-lifecycle.d.ts +70 -14
- package/dist/contracts/feature-lifecycle.js +86 -15
- package/dist/contracts/features.d.ts +100 -37
- package/dist/contracts/features.js +21 -27
- package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
- package/dist/contracts/frame-session.d.ts +192 -0
- package/dist/contracts/frame-session.js +164 -0
- package/dist/contracts/functions.d.ts +218 -211
- package/dist/contracts/functions.js +273 -260
- package/dist/contracts/grant-copy.d.ts +43 -0
- package/dist/contracts/grant-copy.js +44 -0
- package/dist/contracts/grants.d.ts +64 -56
- package/dist/contracts/grants.js +124 -23
- package/dist/contracts/ids.d.ts +4 -1
- package/dist/contracts/ids.js +4 -1
- package/dist/contracts/internal.d.ts +5 -4
- package/dist/contracts/internal.js +12 -3
- package/dist/contracts/mcp.d.ts +17 -0
- package/dist/contracts/mcp.js +23 -0
- package/dist/contracts/me.d.ts +6 -1
- package/dist/contracts/me.js +12 -6
- package/dist/contracts/notifications.d.ts +27 -29
- package/dist/contracts/notifications.js +9 -4
- package/dist/contracts/oauth-resources.d.ts +112 -10
- package/dist/contracts/oauth-resources.js +116 -11
- package/dist/contracts/oauth-scope-actions.d.ts +90 -0
- package/dist/contracts/oauth-scope-actions.js +126 -0
- package/dist/contracts/operations.d.ts +27 -4
- package/dist/contracts/operations.js +11 -5
- package/dist/contracts/pages.d.ts +29 -5
- package/dist/contracts/pages.js +22 -5
- package/dist/contracts/partner-notifications.d.ts +3 -0
- package/dist/contracts/partner-notifications.js +65 -0
- package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
- package/dist/contracts/{platform.js → partner.js} +27 -40
- package/dist/contracts/plan-policy.d.ts +1 -1
- package/dist/contracts/principal-assertion.d.ts +43 -0
- package/dist/contracts/principal-assertion.js +67 -0
- package/dist/contracts/principals.d.ts +73 -0
- package/dist/contracts/principals.js +59 -0
- package/dist/contracts/privacy.d.ts +11 -0
- package/dist/contracts/privacy.js +17 -0
- package/dist/contracts/problem-document.js +3 -4
- package/dist/contracts/publish-archive.d.ts +116 -18
- package/dist/contracts/publish-archive.js +6 -3
- package/dist/contracts/push-new.d.ts +4 -4
- package/dist/contracts/quotas.js +3 -3
- package/dist/contracts/realtime.d.ts +52 -0
- package/dist/contracts/realtime.js +54 -0
- package/dist/contracts/repository-connections.d.ts +1 -1
- package/dist/contracts/repository-connections.js +6 -2
- package/dist/contracts/resources.d.ts +105 -14
- package/dist/contracts/resources.js +145 -21
- package/dist/contracts/route-inventory.d.ts +358 -0
- package/dist/contracts/route-inventory.js +141 -0
- package/dist/contracts/runtime-api.d.ts +112 -35
- package/dist/contracts/runtime-api.js +86 -66
- package/dist/contracts/runtime-app.d.ts +11 -21
- package/dist/contracts/runtime-app.js +39 -24
- package/dist/contracts/runtime-components.d.ts +143 -0
- package/dist/contracts/runtime-components.js +199 -0
- package/dist/contracts/runtime-db.d.ts +45 -19
- package/dist/contracts/runtime-db.js +85 -20
- package/dist/contracts/runtime-purge.js +3 -5
- package/dist/contracts/runtime-services.d.ts +43 -75
- package/dist/contracts/runtime-services.js +29 -49
- package/dist/contracts/runtime-storage.d.ts +14 -14
- package/dist/contracts/runtime-storage.js +28 -13
- package/dist/contracts/sf-config-v1.d.ts +14 -18
- package/dist/contracts/slugs.js +13 -4
- package/dist/contracts/space-config.d.ts +235 -28
- package/dist/contracts/space-config.js +246 -91
- package/dist/contracts/spaces.d.ts +360 -255
- package/dist/contracts/spaces.js +190 -122
- package/dist/contracts/superadmin-activity.d.ts +3 -43
- package/dist/contracts/superadmin-activity.js +6 -30
- package/dist/contracts/superadmin-emails.d.ts +1 -0
- package/dist/contracts/superadmin-emails.js +17 -1
- package/dist/contracts/superadmin-runtime.d.ts +199 -0
- package/dist/contracts/superadmin-runtime.js +141 -0
- package/dist/contracts/superadmin-search.d.ts +22 -2
- package/dist/contracts/superadmin-search.js +14 -6
- package/dist/contracts/superadmin-spaces.d.ts +435 -186
- package/dist/contracts/superadmin-spaces.js +131 -25
- package/dist/contracts/superadmin-teams.d.ts +3 -0
- package/dist/contracts/superadmin-teams.js +1 -2
- package/dist/contracts/superadmin-tenants.d.ts +627 -6
- package/dist/contracts/superadmin-tenants.js +32 -7
- package/dist/contracts/superadmin.d.ts +98 -16
- package/dist/contracts/superadmin.js +63 -10
- package/dist/contracts/tags.d.ts +85 -58
- package/dist/contracts/tags.js +44 -34
- package/dist/contracts/teams.d.ts +72 -9
- package/dist/contracts/teams.js +84 -25
- package/dist/contracts/tenants.d.ts +135 -0
- package/dist/contracts/tenants.js +120 -0
- package/dist/contracts/test-triggers.d.ts +70 -0
- package/dist/contracts/test-triggers.js +116 -0
- package/dist/contracts/theme-json.js +3 -8
- package/dist/contracts/transfers.d.ts +1 -0
- package/dist/contracts/transfers.js +1 -0
- package/dist/contracts/usage.d.ts +209 -0
- package/dist/contracts/usage.js +124 -12
- package/dist/contracts/variables.d.ts +2 -2
- package/dist/contracts/variables.js +9 -13
- package/dist/contracts/webhooks.d.ts +13 -5
- package/dist/contracts/webhooks.js +3 -1
- package/dist/contracts/zero.d.ts +57 -64
- package/dist/contracts/zero.js +68 -66
- package/dist/dashboard-paths/index.d.ts +24 -21
- package/dist/dashboard-paths/index.js +35 -47
- package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
- package/dist/dashboard-paths/route-reservations.generated.js +36 -0
- package/dist/docs/agent-arrival.d.ts +92 -0
- package/dist/docs/agent-arrival.js +227 -0
- package/dist/docs/agent-output-policy.d.ts +6 -0
- package/dist/docs/agent-output-policy.js +22 -0
- package/dist/docs/agent-prose.d.ts +11 -17
- package/dist/docs/agent-prose.js +62 -37
- package/dist/docs/agent-setup.d.ts +72 -41
- package/dist/docs/agent-setup.js +336 -436
- package/dist/docs/catalog.d.ts +147 -89
- package/dist/docs/catalog.js +157 -42
- package/dist/docs/error-docs.d.ts +2098 -1
- package/dist/docs/error-docs.js +281 -16
- package/dist/docs/index-build.d.ts +0 -1
- package/dist/docs/index-build.js +2 -3
- package/dist/docs/page-context-prompt.d.ts +77 -0
- package/dist/docs/page-context-prompt.js +131 -0
- package/dist/docs/reference-urls.d.ts +46 -0
- package/dist/docs/reference-urls.js +79 -0
- package/dist/docs/search.d.ts +6 -8
- package/dist/docs/search.js +10 -13
- package/dist/docs/skill-distribution.d.ts +4 -1
- package/dist/docs/skill-distribution.js +10 -5
- package/dist/docs/skills.d.ts +117 -117
- package/dist/docs/skills.js +120 -72
- package/dist/docs/start-prompts.d.ts +45 -0
- package/dist/docs/start-prompts.js +62 -0
- package/dist/domain-exploration.js +9 -13
- package/dist/og-template.d.ts +56 -0
- package/dist/og-template.js +56 -0
- package/dist/slug-policy/index.js +5 -11
- package/dist/utils/browser-credential.d.ts +13 -6
- package/dist/utils/browser-credential.js +14 -7
- package/dist/utils/build-settings.d.ts +16 -0
- package/dist/utils/build-settings.js +63 -17
- package/dist/utils/canonical-json.d.ts +3 -5
- package/dist/utils/canonical-json.js +3 -5
- package/dist/utils/cast-transport.d.ts +5 -17
- package/dist/utils/cast-transport.js +6 -19
- package/dist/utils/claim-token.js +1 -2
- package/dist/utils/comment-avatars.js +4 -6
- package/dist/utils/concurrency.js +2 -3
- package/dist/utils/content-type.d.ts +7 -6
- package/dist/utils/content-type.js +73 -51
- package/dist/utils/credential-policy.d.ts +50 -6
- package/dist/utils/credential-policy.js +123 -57
- package/dist/utils/egress-policy.fixtures.json +1 -1
- package/dist/utils/generate-space-name.d.ts +3 -8
- package/dist/utils/generate-space-name.js +3 -8
- package/dist/utils/grants.d.ts +0 -1
- package/dist/utils/grants.js +4 -7
- package/dist/utils/gravatar.d.ts +2 -4
- package/dist/utils/gravatar.js +6 -12
- package/dist/utils/id-hints.js +14 -23
- package/dist/utils/idempotency.d.ts +3 -3
- package/dist/utils/idempotency.js +6 -7
- package/dist/utils/local-space-state.d.ts +15 -15
- package/dist/utils/local-space-state.js +34 -23
- package/dist/utils/oauth-signed-query.d.ts +3 -5
- package/dist/utils/oauth-signed-query.js +6 -9
- package/dist/utils/one-shot-replay.d.ts +3 -5
- package/dist/utils/one-shot-replay.js +3 -5
- package/dist/utils/page-colors.d.ts +4 -10
- package/dist/utils/page-colors.js +11 -35
- package/dist/utils/page-fonts.js +6 -11
- package/dist/utils/page-preview.d.ts +0 -1
- package/dist/utils/page-preview.js +0 -1
- package/dist/utils/pages.d.ts +22 -11
- package/dist/utils/pages.js +70 -30
- package/dist/utils/privacy-regions.d.ts +19 -0
- package/dist/utils/privacy-regions.js +91 -0
- package/dist/utils/publish-form-data.d.ts +4 -5
- package/dist/utils/publish-form-data.js +2 -3
- package/dist/utils/publish-policy.d.ts +10 -23
- package/dist/utils/publish-policy.js +63 -116
- package/dist/utils/query-client.d.ts +2 -0
- package/dist/utils/query-client.js +10 -1
- package/dist/utils/runtime-paths.d.ts +4 -4
- package/dist/utils/runtime-paths.js +6 -8
- package/dist/utils/runtime-upload.d.ts +4 -0
- package/dist/utils/runtime-upload.js +5 -0
- package/dist/utils/secure-local-file.d.ts +3 -3
- package/dist/utils/secure-local-file.js +18 -24
- package/dist/utils/space-config.d.ts +11 -14
- package/dist/utils/space-config.js +10 -16
- package/dist/utils/static-runtime-policy.d.ts +5 -8
- package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
- package/dist/utils/static-runtime-policy.generated.js +70 -0
- package/dist/utils/static-runtime-policy.js +17 -84
- package/dist/utils/storage-policy.js +1 -2
- package/dist/utils/upload-session.js +8 -14
- package/dist/utils/version-path.js +11 -19
- package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
- package/dist/utils/wpcom-auth-redirects.js +1 -4
- package/dist/vocabulary.d.ts +7 -7
- package/dist/vocabulary.js +30 -16
- package/package.json +14 -2
- package/dist/agents/client-registry.d.ts +0 -22
- package/dist/agents/client-registry.js +0 -41
- package/dist/docs/agent-handoff-document.d.ts +0 -15
- package/dist/docs/agent-handoff-document.js +0 -180
- package/dist/docs/agent-solutions.d.ts +0 -110
- package/dist/docs/agent-solutions.js +0 -183
- package/dist/utils/query-keys.d.ts +0 -84
- package/dist/utils/query-keys.js +0 -108
package/dist/contracts/tags.js
CHANGED
|
@@ -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
|
|
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
|
|
386
|
+
export const tagRevisionSchema = z.object({
|
|
375
387
|
id: z.string(),
|
|
376
388
|
tagSetId: z.string(),
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
status:
|
|
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
|
|
395
|
-
status:
|
|
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
|
|
398
|
-
data: z.array(
|
|
411
|
+
export const tagRevisionListResponseSchema = z.object({
|
|
412
|
+
data: z.array(tagRevisionSchema),
|
|
399
413
|
pagination: CursorPaginationSchema,
|
|
400
414
|
});
|
|
401
|
-
export const
|
|
402
|
-
export const
|
|
403
|
-
title: z.string().trim().min(1).max(255).default("Draft tag
|
|
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
|
-
|
|
419
|
+
baseRevisionId: z.string().trim().min(1).nullable().optional(),
|
|
406
420
|
graph: tagGraphWriteSchema.optional(),
|
|
407
421
|
});
|
|
408
|
-
export const
|
|
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
|
-
|
|
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
|
-
|
|
433
|
-
|
|
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
|
-
|
|
445
|
-
|
|
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
|
-
|
|
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
|
-
|
|
500
|
-
|
|
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
|
-
|
|
523
|
+
expectedCurrentRevisionId: z.string().trim().min(1).nullable().optional(),
|
|
510
524
|
});
|
|
511
525
|
export const tagApplyResponseSchema = dataEnvelope(z.object({
|
|
512
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
10
|
-
*
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
325
|
+
export declare const teamInvitationDetailSchema: z.ZodObject<{
|
|
267
326
|
id: z.ZodString;
|
|
268
327
|
teamName: z.ZodString;
|
|
269
|
-
|
|
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>;
|
package/dist/contracts/teams.js
CHANGED
|
@@ -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
|
|
8
|
-
*
|
|
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
|
|
30
|
-
//
|
|
31
|
-
//
|
|
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:
|
|
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
|
-
//
|
|
93
|
-
//
|
|
94
|
-
export const
|
|
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
|
|
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
|
-
//
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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/
|
|
188
|
-
// invite landing view
|
|
189
|
-
|
|
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
|
-
|
|
193
|
-
|
|
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.",
|