@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.
- package/README.md +42 -0
- package/dist/brand.d.ts +15 -0
- package/dist/brand.js +24 -0
- package/dist/config/domains.d.ts +30 -0
- package/dist/config/domains.js +75 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +3 -0
- package/dist/contracts/abuse.d.ts +93 -0
- package/dist/contracts/abuse.js +50 -0
- package/dist/contracts/access.d.ts +409 -0
- package/dist/contracts/access.js +396 -0
- package/dist/contracts/account.d.ts +28 -0
- package/dist/contracts/account.js +54 -0
- package/dist/contracts/activity.d.ts +118 -0
- package/dist/contracts/activity.js +180 -0
- package/dist/contracts/analytics.d.ts +56 -0
- package/dist/contracts/analytics.js +91 -0
- package/dist/contracts/annotations.d.ts +327 -0
- package/dist/contracts/annotations.js +234 -0
- package/dist/contracts/api-keys.d.ts +517 -0
- package/dist/contracts/api-keys.js +235 -0
- package/dist/contracts/archives.d.ts +332 -0
- package/dist/contracts/archives.js +120 -0
- package/dist/contracts/auth.d.ts +86 -0
- package/dist/contracts/auth.js +82 -0
- package/dist/contracts/beta.d.ts +106 -0
- package/dist/contracts/beta.js +104 -0
- package/dist/contracts/billing.d.ts +328 -0
- package/dist/contracts/billing.js +203 -0
- package/dist/contracts/builds.d.ts +504 -0
- package/dist/contracts/builds.js +248 -0
- package/dist/contracts/channels.d.ts +49 -0
- package/dist/contracts/channels.js +51 -0
- package/dist/contracts/common.d.ts +238 -0
- package/dist/contracts/common.js +175 -0
- package/dist/contracts/deployments.d.ts +574 -0
- package/dist/contracts/deployments.js +97 -0
- package/dist/contracts/device-auth.d.ts +194 -0
- package/dist/contracts/device-auth.js +162 -0
- package/dist/contracts/domains.d.ts +6115 -0
- package/dist/contracts/domains.js +1435 -0
- package/dist/contracts/enums.d.ts +196 -0
- package/dist/contracts/enums.js +211 -0
- package/dist/contracts/error-code-meta.d.ts +1560 -0
- package/dist/contracts/error-code-meta.js +400 -0
- package/dist/contracts/error-codes.d.ts +13 -0
- package/dist/contracts/error-codes.js +416 -0
- package/dist/contracts/events.d.ts +398 -0
- package/dist/contracts/events.js +320 -0
- package/dist/contracts/fast-domain-search.d.ts +19 -0
- package/dist/contracts/fast-domain-search.js +22 -0
- package/dist/contracts/features.d.ts +240 -0
- package/dist/contracts/features.js +406 -0
- package/dist/contracts/git.d.ts +288 -0
- package/dist/contracts/git.js +116 -0
- package/dist/contracts/ids.d.ts +35 -0
- package/dist/contracts/ids.js +45 -0
- package/dist/contracts/intercom.d.ts +6 -0
- package/dist/contracts/intercom.js +5 -0
- package/dist/contracts/internal.d.ts +103 -0
- package/dist/contracts/internal.js +92 -0
- package/dist/contracts/mcp.d.ts +788 -0
- package/dist/contracts/mcp.js +161 -0
- package/dist/contracts/me.d.ts +81 -0
- package/dist/contracts/me.js +104 -0
- package/dist/contracts/oauth-resources.d.ts +30 -0
- package/dist/contracts/oauth-resources.js +61 -0
- package/dist/contracts/operations.d.ts +54 -0
- package/dist/contracts/operations.js +14 -0
- package/dist/contracts/plan-policy.d.ts +85 -0
- package/dist/contracts/plan-policy.js +75 -0
- package/dist/contracts/platform.d.ts +359 -0
- package/dist/contracts/platform.js +216 -0
- package/dist/contracts/push-new.d.ts +156 -0
- package/dist/contracts/push-new.js +52 -0
- package/dist/contracts/quotas.d.ts +16 -0
- package/dist/contracts/quotas.js +36 -0
- package/dist/contracts/repository-connections.d.ts +231 -0
- package/dist/contracts/repository-connections.js +106 -0
- package/dist/contracts/resources.d.ts +529 -0
- package/dist/contracts/resources.js +209 -0
- package/dist/contracts/routes.d.ts +45 -0
- package/dist/contracts/routes.js +31 -0
- package/dist/contracts/runtime-api.d.ts +449 -0
- package/dist/contracts/runtime-api.js +513 -0
- package/dist/contracts/sites.d.ts +393 -0
- package/dist/contracts/sites.js +121 -0
- package/dist/contracts/slugs.d.ts +31 -0
- package/dist/contracts/slugs.js +47 -0
- package/dist/contracts/space-config.d.ts +216 -0
- package/dist/contracts/space-config.js +237 -0
- package/dist/contracts/space-theme.d.ts +25 -0
- package/dist/contracts/space-theme.js +49 -0
- package/dist/contracts/spaces.d.ts +2760 -0
- package/dist/contracts/spaces.js +589 -0
- package/dist/contracts/superadmin-activity.d.ts +205 -0
- package/dist/contracts/superadmin-activity.js +107 -0
- package/dist/contracts/superadmin-emails.d.ts +212 -0
- package/dist/contracts/superadmin-emails.js +112 -0
- package/dist/contracts/superadmin-queues.d.ts +414 -0
- package/dist/contracts/superadmin-queues.js +202 -0
- package/dist/contracts/superadmin-runtime.d.ts +27 -0
- package/dist/contracts/superadmin-runtime.js +38 -0
- package/dist/contracts/superadmin-spaces.d.ts +429 -0
- package/dist/contracts/superadmin-spaces.js +82 -0
- package/dist/contracts/superadmin-tenants.d.ts +180 -0
- package/dist/contracts/superadmin-tenants.js +117 -0
- package/dist/contracts/superadmin.d.ts +654 -0
- package/dist/contracts/superadmin.js +309 -0
- package/dist/contracts/tags.d.ts +1140 -0
- package/dist/contracts/tags.js +1050 -0
- package/dist/contracts/teams.d.ts +233 -0
- package/dist/contracts/teams.js +174 -0
- package/dist/contracts/telemetry.d.ts +2 -0
- package/dist/contracts/telemetry.js +1 -0
- package/dist/contracts/transfers.d.ts +105 -0
- package/dist/contracts/transfers.js +48 -0
- package/dist/contracts/variables.d.ts +189 -0
- package/dist/contracts/variables.js +82 -0
- package/dist/contracts/webhooks.d.ts +159 -0
- package/dist/contracts/webhooks.js +59 -0
- package/dist/contracts/zero.d.ts +1538 -0
- package/dist/contracts/zero.js +755 -0
- package/dist/docs/agent-prose.d.ts +35 -0
- package/dist/docs/agent-prose.js +153 -0
- package/dist/docs/agent-setup.d.ts +6 -0
- package/dist/docs/agent-setup.js +164 -0
- package/dist/docs/agent-solutions.d.ts +110 -0
- package/dist/docs/agent-solutions.js +181 -0
- package/dist/docs/error-docs.d.ts +12 -0
- package/dist/docs/error-docs.js +1601 -0
- package/dist/docs/skill-distribution.d.ts +12 -0
- package/dist/docs/skill-distribution.js +18 -0
- package/dist/domain-exploration.d.ts +108 -0
- package/dist/domain-exploration.js +488 -0
- package/dist/domain-normalize.d.ts +1 -0
- package/dist/domain-normalize.js +14 -0
- package/dist/domain-zones.d.ts +1 -0
- package/dist/domain-zones.js +5272 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/access-policy.d.ts +39 -0
- package/dist/utils/access-policy.js +232 -0
- package/dist/utils/api.d.ts +4 -0
- package/dist/utils/api.js +13 -0
- package/dist/utils/auth-redirect.d.ts +1 -0
- package/dist/utils/auth-redirect.js +48 -0
- package/dist/utils/auth.d.ts +5 -0
- package/dist/utils/auth.js +13 -0
- package/dist/utils/build-settings.d.ts +49 -0
- package/dist/utils/build-settings.js +366 -0
- package/dist/utils/claim-token.d.ts +1 -0
- package/dist/utils/claim-token.js +9 -0
- package/dist/utils/collections.d.ts +1 -0
- package/dist/utils/collections.js +5 -0
- package/dist/utils/concurrency.d.ts +1 -0
- package/dist/utils/concurrency.js +18 -0
- package/dist/utils/content-type.d.ts +10 -0
- package/dist/utils/content-type.js +145 -0
- package/dist/utils/error-display.d.ts +7 -0
- package/dist/utils/error-display.js +42 -0
- package/dist/utils/error.d.ts +1 -0
- package/dist/utils/error.js +3 -0
- package/dist/utils/generate-space-name.d.ts +14 -0
- package/dist/utils/generate-space-name.js +95 -0
- package/dist/utils/git-repository.d.ts +5 -0
- package/dist/utils/git-repository.js +99 -0
- package/dist/utils/guards.d.ts +1 -0
- package/dist/utils/guards.js +3 -0
- package/dist/utils/publish-detection.d.ts +10 -0
- package/dist/utils/publish-detection.js +118 -0
- package/dist/utils/publish-policy.d.ts +69 -0
- package/dist/utils/publish-policy.js +429 -0
- package/dist/utils/query-client.d.ts +7 -0
- package/dist/utils/query-client.js +21 -0
- package/dist/utils/query-keys.d.ts +75 -0
- package/dist/utils/query-keys.js +78 -0
- package/dist/utils/runtime-paths.d.ts +7 -0
- package/dist/utils/runtime-paths.js +28 -0
- package/dist/utils/runtime-upload.d.ts +19 -0
- package/dist/utils/runtime-upload.js +27 -0
- package/dist/utils/slug.d.ts +5 -0
- package/dist/utils/slug.js +13 -0
- package/dist/utils/space-config.d.ts +75 -0
- package/dist/utils/space-config.js +415 -0
- package/dist/utils/space-theme.d.ts +16 -0
- package/dist/utils/space-theme.js +89 -0
- package/dist/utils/static-runtime-policy.d.ts +17 -0
- package/dist/utils/static-runtime-policy.js +103 -0
- package/dist/utils/upload-session.d.ts +34 -0
- package/dist/utils/upload-session.js +69 -0
- package/dist/utils/urls.d.ts +2 -0
- package/dist/utils/urls.js +7 -0
- package/dist/utils/version-path.d.ts +6 -0
- package/dist/utils/version-path.js +51 -0
- package/dist/utils/wpcom-auth-redirects.d.ts +14 -0
- package/dist/utils/wpcom-auth-redirects.js +49 -0
- package/dist/utils/zero-realtime-signature.d.ts +12 -0
- package/dist/utils/zero-realtime-signature.js +45 -0
- package/dist/vocabulary.d.ts +230 -0
- package/dist/vocabulary.js +218 -0
- package/package.json +58 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AnyObjectSchema, dataEnvelope } from "./common.js";
|
|
3
|
+
export const hostedMcpSessionStatusSchema = z.enum(["active", "closed", "expired", "interrupted"]);
|
|
4
|
+
export const hostedMcpWorkspaceSummarySchema = z.object({
|
|
5
|
+
files: z.number().int().nonnegative(),
|
|
6
|
+
totalBytes: z.number().int().nonnegative(),
|
|
7
|
+
updatedAt: z.string().datetime().nullable(),
|
|
8
|
+
});
|
|
9
|
+
export const hostedMcpSessionSchema = z.object({
|
|
10
|
+
sessionId: z.string(),
|
|
11
|
+
clientId: z.string().nullable(),
|
|
12
|
+
credentialId: z.string().nullable(),
|
|
13
|
+
credentialKind: z.string().nullable(),
|
|
14
|
+
scopes: z.array(z.string()),
|
|
15
|
+
policy: z.object({
|
|
16
|
+
credential: z.string(),
|
|
17
|
+
approvals: z.string(),
|
|
18
|
+
tools: z.string(),
|
|
19
|
+
}),
|
|
20
|
+
status: hostedMcpSessionStatusSchema,
|
|
21
|
+
metadata: AnyObjectSchema.nullable(),
|
|
22
|
+
workspace: hostedMcpWorkspaceSummarySchema,
|
|
23
|
+
ownerId: z.string().nullable(),
|
|
24
|
+
ownerLeaseExpiresAt: z.string().datetime().nullable(),
|
|
25
|
+
createdAt: z.string().datetime(),
|
|
26
|
+
lastSeenAt: z.string().datetime(),
|
|
27
|
+
closedAt: z.string().datetime().nullable(),
|
|
28
|
+
});
|
|
29
|
+
export const hostedMcpApprovalSchema = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
runtime: z.enum(["hosted", "local"]),
|
|
32
|
+
tool: z.string(),
|
|
33
|
+
args: AnyObjectSchema,
|
|
34
|
+
preview: z.unknown(),
|
|
35
|
+
status: z.enum(["pending", "approved", "denied", "consumed", "expired"]),
|
|
36
|
+
decision: z.enum(["approve", "deny"]).nullable(),
|
|
37
|
+
decisionReason: z.string().nullable(),
|
|
38
|
+
decidedAt: z.string().datetime().nullable(),
|
|
39
|
+
createdAt: z.string().datetime(),
|
|
40
|
+
expiresAt: z.string().datetime(),
|
|
41
|
+
});
|
|
42
|
+
export const hostedMcpSessionEventSchema = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
sessionId: z.string(),
|
|
45
|
+
eventType: z.string(),
|
|
46
|
+
tool: z.string().nullable(),
|
|
47
|
+
resourceUri: z.string().nullable(),
|
|
48
|
+
status: z.string().nullable(),
|
|
49
|
+
requestId: z.string().nullable(),
|
|
50
|
+
durationMs: z.number().int().nonnegative().nullable(),
|
|
51
|
+
data: AnyObjectSchema.nullable(),
|
|
52
|
+
createdAt: z.string().datetime(),
|
|
53
|
+
});
|
|
54
|
+
export const hostedMcpExecutionRunStatusSchema = z.enum([
|
|
55
|
+
"queued",
|
|
56
|
+
"running",
|
|
57
|
+
"approval_required",
|
|
58
|
+
"completed",
|
|
59
|
+
"failed",
|
|
60
|
+
"canceled",
|
|
61
|
+
]);
|
|
62
|
+
export const hostedMcpExecutionStepSchema = z.object({
|
|
63
|
+
id: z.string(),
|
|
64
|
+
runId: z.string(),
|
|
65
|
+
index: z.number().int().nonnegative(),
|
|
66
|
+
tool: z.string().nullable(),
|
|
67
|
+
status: z.string(),
|
|
68
|
+
dryRun: z.boolean().nullable(),
|
|
69
|
+
durationMs: z.number().int().nonnegative().nullable(),
|
|
70
|
+
input: AnyObjectSchema.nullable(),
|
|
71
|
+
output: z.unknown().nullable(),
|
|
72
|
+
createdAt: z.string().datetime(),
|
|
73
|
+
});
|
|
74
|
+
export const hostedMcpExecutionArtifactSchema = z.object({
|
|
75
|
+
id: z.string(),
|
|
76
|
+
runId: z.string(),
|
|
77
|
+
kind: z.enum(["log", "warning", "result", "resource", "file", "summary"]),
|
|
78
|
+
name: z.string(),
|
|
79
|
+
mimeType: z.string().nullable(),
|
|
80
|
+
sizeBytes: z.number().int().nonnegative().nullable(),
|
|
81
|
+
data: z.unknown().nullable(),
|
|
82
|
+
createdAt: z.string().datetime(),
|
|
83
|
+
});
|
|
84
|
+
export const hostedMcpExecutionRunSchema = z.object({
|
|
85
|
+
id: z.string(),
|
|
86
|
+
sessionId: z.string().nullable(),
|
|
87
|
+
credentialId: z.string().nullable(),
|
|
88
|
+
tool: z.string(),
|
|
89
|
+
mode: z.string().nullable(),
|
|
90
|
+
status: hostedMcpExecutionRunStatusSchema,
|
|
91
|
+
approvalId: z.string().nullable(),
|
|
92
|
+
cancellationRequested: z.boolean(),
|
|
93
|
+
summary: z.string().nullable(),
|
|
94
|
+
error: z.string().nullable(),
|
|
95
|
+
startedAt: z.string().datetime(),
|
|
96
|
+
completedAt: z.string().datetime().nullable(),
|
|
97
|
+
updatedAt: z.string().datetime(),
|
|
98
|
+
steps: z.array(hostedMcpExecutionStepSchema).optional(),
|
|
99
|
+
artifacts: z.array(hostedMcpExecutionArtifactSchema).optional(),
|
|
100
|
+
});
|
|
101
|
+
export const hostedMcpToolPolicySchema = z.object({
|
|
102
|
+
tool: z.string(),
|
|
103
|
+
runtime: z.enum(["hosted", "on-device", "both"]),
|
|
104
|
+
category: z.string(),
|
|
105
|
+
defaultMode: z.enum(["allow", "approval", "local-only"]),
|
|
106
|
+
approvalRequired: z.boolean(),
|
|
107
|
+
requiredScopes: z.array(z.string()),
|
|
108
|
+
clientPolicy: z.string(),
|
|
109
|
+
sessionPolicy: z.string(),
|
|
110
|
+
});
|
|
111
|
+
export const hostedMcpPolicyDefaultsSchema = z.object({
|
|
112
|
+
approvalTtlSeconds: z.number().int().positive(),
|
|
113
|
+
hostedTransport: z.string(),
|
|
114
|
+
onDeviceTransport: z.string(),
|
|
115
|
+
hostedBoundary: z.string(),
|
|
116
|
+
onDeviceBoundary: z.string(),
|
|
117
|
+
toolPolicies: z.array(hostedMcpToolPolicySchema),
|
|
118
|
+
});
|
|
119
|
+
export const hostedMcpSummarySchema = z.object({
|
|
120
|
+
rowLimit: z.number().int().positive(),
|
|
121
|
+
sessions: z.object({
|
|
122
|
+
total: z.number().int().nonnegative(),
|
|
123
|
+
active: z.number().int().nonnegative(),
|
|
124
|
+
closed: z.number().int().nonnegative(),
|
|
125
|
+
expired: z.number().int().nonnegative(),
|
|
126
|
+
interrupted: z.number().int().nonnegative(),
|
|
127
|
+
}),
|
|
128
|
+
approvals: z.object({
|
|
129
|
+
pending: z.number().int().nonnegative(),
|
|
130
|
+
}),
|
|
131
|
+
events: z.object({
|
|
132
|
+
recent: z.number().int().nonnegative(),
|
|
133
|
+
}),
|
|
134
|
+
executions: z.object({
|
|
135
|
+
recent: z.number().int().nonnegative(),
|
|
136
|
+
running: z.number().int().nonnegative(),
|
|
137
|
+
}),
|
|
138
|
+
});
|
|
139
|
+
export const hostedMcpDashboardSchema = z.object({
|
|
140
|
+
summary: hostedMcpSummarySchema,
|
|
141
|
+
policyDefaults: hostedMcpPolicyDefaultsSchema,
|
|
142
|
+
sessions: z.array(hostedMcpSessionSchema),
|
|
143
|
+
approvals: z.array(hostedMcpApprovalSchema),
|
|
144
|
+
events: z.array(hostedMcpSessionEventSchema),
|
|
145
|
+
executions: z.array(hostedMcpExecutionRunSchema),
|
|
146
|
+
});
|
|
147
|
+
export const hostedMcpDashboardResponseSchema = dataEnvelope(hostedMcpDashboardSchema);
|
|
148
|
+
export const hostedMcpCloseSessionResponseSchema = dataEnvelope(hostedMcpSessionSchema);
|
|
149
|
+
export const hostedMcpApprovalDecisionRequestSchema = z.object({
|
|
150
|
+
decision: z.enum(["approve", "deny"]),
|
|
151
|
+
reason: z.string().max(1_000).optional(),
|
|
152
|
+
});
|
|
153
|
+
export const hostedMcpApprovalResponseSchema = dataEnvelope(hostedMcpApprovalSchema);
|
|
154
|
+
export const hostedMcpSessionEventsResponseSchema = dataEnvelope(z.object({
|
|
155
|
+
session: hostedMcpSessionSchema,
|
|
156
|
+
events: z.array(hostedMcpSessionEventSchema),
|
|
157
|
+
}));
|
|
158
|
+
export const hostedMcpExecutionRunsResponseSchema = dataEnvelope(z.object({
|
|
159
|
+
runs: z.array(hostedMcpExecutionRunSchema),
|
|
160
|
+
}));
|
|
161
|
+
export const hostedMcpExecutionRunResponseSchema = dataEnvelope(hostedMcpExecutionRunSchema);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const meResponseSchema: z.ZodObject<{
|
|
3
|
+
subject: z.ZodObject<{
|
|
4
|
+
type: z.ZodEnum<{
|
|
5
|
+
external: "external";
|
|
6
|
+
user: "user";
|
|
7
|
+
system: "system";
|
|
8
|
+
team: "team";
|
|
9
|
+
}>;
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
user: z.ZodNullable<z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
email: z.ZodNullable<z.ZodString>;
|
|
15
|
+
name: z.ZodNullable<z.ZodString>;
|
|
16
|
+
isAutomattician: z.ZodBoolean;
|
|
17
|
+
wpcom: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
18
|
+
isSuperadmin: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
tenants: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
kind: z.ZodString;
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
access: z.ZodEnum<{
|
|
25
|
+
full: "full";
|
|
26
|
+
scoped: "scoped";
|
|
27
|
+
}>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
teams: z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
tenantId: z.ZodString;
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
34
|
+
role: z.ZodNullable<z.ZodString>;
|
|
35
|
+
plan: z.ZodEnum<{
|
|
36
|
+
personal: "personal";
|
|
37
|
+
work: "work";
|
|
38
|
+
enterprise: "enterprise";
|
|
39
|
+
internal: "internal";
|
|
40
|
+
free: "free";
|
|
41
|
+
}>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
intercom: z.ZodNullable<z.ZodObject<{
|
|
44
|
+
api_base: z.ZodString;
|
|
45
|
+
app_id: z.ZodString;
|
|
46
|
+
user_id: z.ZodString;
|
|
47
|
+
email: z.ZodOptional<z.ZodString>;
|
|
48
|
+
name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
company: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
company_id: z.ZodString;
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
plan: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
personal: "personal";
|
|
55
|
+
work: "work";
|
|
56
|
+
enterprise: "enterprise";
|
|
57
|
+
internal: "internal";
|
|
58
|
+
free: "free";
|
|
59
|
+
}>>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
intercom_user_jwt: z.ZodString;
|
|
62
|
+
session_duration: z.ZodNumber;
|
|
63
|
+
expiresAt: z.ZodString;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
beta: z.ZodObject<{
|
|
66
|
+
gateEnabled: z.ZodBoolean;
|
|
67
|
+
enrolled: z.ZodBoolean;
|
|
68
|
+
wpcom: z.ZodBoolean;
|
|
69
|
+
eligibleTeams: z.ZodArray<z.ZodObject<{
|
|
70
|
+
teamId: z.ZodString;
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
73
|
+
source: z.ZodEnum<{
|
|
74
|
+
invitation: "invitation";
|
|
75
|
+
auto_enroll_domain: "auto_enroll_domain";
|
|
76
|
+
automattician: "automattician";
|
|
77
|
+
}>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type MeResponse = z.infer<typeof meResponseSchema>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { betaEligibleTeamSourceSchema } from "./beta.js";
|
|
3
|
+
import { planCodeSchema } from "./features.js";
|
|
4
|
+
// `GET /v1/me` (internal-docs/platform.md route catalog): the authenticated
|
|
5
|
+
// subject, its tenant grants, principal/team memberships, and a plan summary.
|
|
6
|
+
// Works for every credential kind — sessions resolve their user and team
|
|
7
|
+
// memberships; machine credentials resolve the teams and tenants their policy
|
|
8
|
+
// grants.
|
|
9
|
+
export const meResponseSchema = z.object({
|
|
10
|
+
subject: z
|
|
11
|
+
.object({
|
|
12
|
+
type: z
|
|
13
|
+
.enum(["user", "team", "external", "system"])
|
|
14
|
+
.describe("Subject kind: the session user, or the machine credential's acting subject."),
|
|
15
|
+
id: z.string().describe("Stable subject id."),
|
|
16
|
+
})
|
|
17
|
+
.describe("The authenticated subject of the calling credential."),
|
|
18
|
+
user: z
|
|
19
|
+
.object({
|
|
20
|
+
id: z.string().describe("User id."),
|
|
21
|
+
email: z.string().nullable().describe("User email."),
|
|
22
|
+
name: z.string().nullable().describe("User display name."),
|
|
23
|
+
isAutomattician: z
|
|
24
|
+
.boolean()
|
|
25
|
+
.describe("Whether the linked WordPress.com account is an Automattician."),
|
|
26
|
+
wpcom: z
|
|
27
|
+
.record(z.string(), z.unknown())
|
|
28
|
+
.nullable()
|
|
29
|
+
.describe("Raw WordPress.com `/me` payload from the user's last WP.com login."),
|
|
30
|
+
isSuperadmin: z.boolean().describe("Whether the user is a platform operator."),
|
|
31
|
+
})
|
|
32
|
+
.nullable()
|
|
33
|
+
.describe("User identity when known: the session user, or the machine credential's creator. Null for automation-created credentials."),
|
|
34
|
+
tenants: z
|
|
35
|
+
.array(z.object({
|
|
36
|
+
id: z.string().describe("Tenant id."),
|
|
37
|
+
kind: z.string().describe("Tenant kind."),
|
|
38
|
+
name: z.string().describe("Tenant display name."),
|
|
39
|
+
access: z
|
|
40
|
+
.enum(["full", "scoped"])
|
|
41
|
+
.describe("Grant level the credential's policy holds in this tenant: `full` covers the whole tenant subtree, `scoped` covers specific principals or resources within it."),
|
|
42
|
+
}))
|
|
43
|
+
.describe("Tenant grants derived from the credential's effective policy. The credential's home tenant is always included."),
|
|
44
|
+
teams: z
|
|
45
|
+
.array(z.object({
|
|
46
|
+
id: z.string().describe("Team id."),
|
|
47
|
+
tenantId: z.string().describe("Owning tenant id."),
|
|
48
|
+
name: z.string().describe("Team display name."),
|
|
49
|
+
slug: z.string().nullable().describe("Team slug."),
|
|
50
|
+
role: z
|
|
51
|
+
.string()
|
|
52
|
+
.nullable()
|
|
53
|
+
.describe("The caller's membership role. Null for policy-granted (non-member) access."),
|
|
54
|
+
plan: planCodeSchema.describe("The team's resolved plan code (plan summary)."),
|
|
55
|
+
}))
|
|
56
|
+
.describe("Teams the credential can act in: session team memberships, or the teams a machine credential's policy grants."),
|
|
57
|
+
intercom: z
|
|
58
|
+
.object({
|
|
59
|
+
api_base: z.string().url().describe("Intercom Messenger API base URL."),
|
|
60
|
+
app_id: z.string().describe("Intercom workspace app id."),
|
|
61
|
+
user_id: z.string().describe("Stable Intercom user id."),
|
|
62
|
+
email: z.string().email().optional().describe("User email when available."),
|
|
63
|
+
name: z.string().optional().describe("User display name when available."),
|
|
64
|
+
created_at: z
|
|
65
|
+
.number()
|
|
66
|
+
.int()
|
|
67
|
+
.positive()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("User creation time in Unix seconds."),
|
|
70
|
+
company: z
|
|
71
|
+
.object({
|
|
72
|
+
company_id: z.string().describe("Stable Intercom company id."),
|
|
73
|
+
name: z.string().describe("Company display name."),
|
|
74
|
+
plan: planCodeSchema.optional().describe("Resolved company plan code."),
|
|
75
|
+
})
|
|
76
|
+
.optional()
|
|
77
|
+
.describe("Current team as an Intercom company."),
|
|
78
|
+
intercom_user_jwt: z.string().min(1).describe("Short-lived server-signed Messenger JWT."),
|
|
79
|
+
session_duration: z.number().int().positive().describe("Messenger session cookie TTL in ms."),
|
|
80
|
+
expiresAt: z.string().datetime().describe("JWT expiry timestamp."),
|
|
81
|
+
})
|
|
82
|
+
.nullable()
|
|
83
|
+
.describe("Intercom Messenger boot payload for authenticated browser sessions."),
|
|
84
|
+
beta: z
|
|
85
|
+
.object({
|
|
86
|
+
gateEnabled: z
|
|
87
|
+
.boolean()
|
|
88
|
+
.describe("Whether the beta.enrollment_gate flag is on for this deployment."),
|
|
89
|
+
enrolled: z
|
|
90
|
+
.boolean()
|
|
91
|
+
.describe("Whether the subject user is enrolled (beta_enrolled_at is set)."),
|
|
92
|
+
wpcom: z.boolean().describe("Whether the user passed the Automattician check at enrollment."),
|
|
93
|
+
eligibleTeams: z
|
|
94
|
+
.array(z.object({
|
|
95
|
+
teamId: z.string().describe("Team id."),
|
|
96
|
+
name: z.string().describe("Team display name."),
|
|
97
|
+
slug: z.string().nullable().describe("Team slug."),
|
|
98
|
+
source: betaEligibleTeamSourceSchema,
|
|
99
|
+
}))
|
|
100
|
+
.describe("Teams the user may join via the picker (pending invitation or auto-enroll match)."),
|
|
101
|
+
})
|
|
102
|
+
.describe("Private-beta state. Dashboards key the blocked screen on gateEnabled && !enrolled, " +
|
|
103
|
+
"never on !enrolled alone — else launch-day flag-off would still block people."),
|
|
104
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const OAUTH_AUTHORIZATION_SERVER_PATH: "/v1/auth";
|
|
2
|
+
export declare const OAUTH_RESOURCE_PATHS: {
|
|
3
|
+
readonly api: "/v1";
|
|
4
|
+
readonly mcp: "/mcp";
|
|
5
|
+
};
|
|
6
|
+
export type OAuthResourceKey = keyof typeof OAUTH_RESOURCE_PATHS;
|
|
7
|
+
export declare const OAUTH_API_RESOURCE_SCOPES: readonly ["teams:read", "spaces:read", "spaces:write", "publish:write", "domains:read", "domains:write"];
|
|
8
|
+
export declare const OAUTH_MCP_TOOL_SCOPE: "mcp:tools";
|
|
9
|
+
export declare const OAUTH_MCP_RESOURCE_SCOPES: readonly ["mcp:tools", "teams:read", "spaces:read", "spaces:write", "publish:write", "domains:read", "domains:write"];
|
|
10
|
+
export declare const OAUTH_PROVIDER_SCOPES: readonly ["openid", "profile", "email", "offline_access", "teams:read", "spaces:read", "spaces:write", "publish:write", "domains:read", "domains:write", "mcp:tools"];
|
|
11
|
+
export declare const OAUTH_RESOURCE_DEFINITIONS: {
|
|
12
|
+
readonly api: {
|
|
13
|
+
readonly key: "api";
|
|
14
|
+
readonly path: "/v1";
|
|
15
|
+
readonly name: "Spacefast API";
|
|
16
|
+
readonly accessTokenTtlSeconds: number;
|
|
17
|
+
readonly allowedScopes: readonly ["teams:read", "spaces:read", "spaces:write", "publish:write", "domains:read", "domains:write"];
|
|
18
|
+
};
|
|
19
|
+
readonly mcp: {
|
|
20
|
+
readonly key: "mcp";
|
|
21
|
+
readonly path: "/mcp";
|
|
22
|
+
readonly name: "Spacefast MCP";
|
|
23
|
+
readonly accessTokenTtlSeconds: number;
|
|
24
|
+
readonly allowedScopes: readonly ["mcp:tools", "teams:read", "spaces:read", "spaces:write", "publish:write", "domains:read", "domains:write"];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare function oauthResourceUrl(origin: string | URL, resource: OAuthResourceKey): string;
|
|
28
|
+
export declare function oauthAuthorizationServerUrl(origin: string | URL): string;
|
|
29
|
+
export declare function oauthTokenEndpointUrl(origin: string | URL): string;
|
|
30
|
+
export declare function oauthResourceKeyForPathname(pathname: string): OAuthResourceKey | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const OAUTH_AUTHORIZATION_SERVER_PATH = "/v1/auth";
|
|
2
|
+
export const OAUTH_RESOURCE_PATHS = {
|
|
3
|
+
api: "/v1",
|
|
4
|
+
mcp: "/mcp",
|
|
5
|
+
};
|
|
6
|
+
export const OAUTH_API_RESOURCE_SCOPES = [
|
|
7
|
+
"teams:read",
|
|
8
|
+
"spaces:read",
|
|
9
|
+
"spaces:write",
|
|
10
|
+
"publish:write",
|
|
11
|
+
"domains:read",
|
|
12
|
+
"domains:write",
|
|
13
|
+
];
|
|
14
|
+
export const OAUTH_MCP_TOOL_SCOPE = "mcp:tools";
|
|
15
|
+
export const OAUTH_MCP_RESOURCE_SCOPES = [
|
|
16
|
+
OAUTH_MCP_TOOL_SCOPE,
|
|
17
|
+
...OAUTH_API_RESOURCE_SCOPES,
|
|
18
|
+
];
|
|
19
|
+
export const OAUTH_PROVIDER_SCOPES = [
|
|
20
|
+
"openid",
|
|
21
|
+
"profile",
|
|
22
|
+
"email",
|
|
23
|
+
"offline_access",
|
|
24
|
+
...OAUTH_API_RESOURCE_SCOPES,
|
|
25
|
+
OAUTH_MCP_TOOL_SCOPE,
|
|
26
|
+
];
|
|
27
|
+
export const OAUTH_RESOURCE_DEFINITIONS = {
|
|
28
|
+
api: {
|
|
29
|
+
key: "api",
|
|
30
|
+
path: OAUTH_RESOURCE_PATHS.api,
|
|
31
|
+
name: "Spacefast API",
|
|
32
|
+
accessTokenTtlSeconds: 15 * 60,
|
|
33
|
+
allowedScopes: OAUTH_API_RESOURCE_SCOPES,
|
|
34
|
+
},
|
|
35
|
+
mcp: {
|
|
36
|
+
key: "mcp",
|
|
37
|
+
path: OAUTH_RESOURCE_PATHS.mcp,
|
|
38
|
+
name: "Spacefast MCP",
|
|
39
|
+
accessTokenTtlSeconds: 15 * 60,
|
|
40
|
+
allowedScopes: OAUTH_MCP_RESOURCE_SCOPES,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export function oauthResourceUrl(origin, resource) {
|
|
44
|
+
return new URL(OAUTH_RESOURCE_PATHS[resource], origin).toString();
|
|
45
|
+
}
|
|
46
|
+
export function oauthAuthorizationServerUrl(origin) {
|
|
47
|
+
return new URL(OAUTH_AUTHORIZATION_SERVER_PATH, origin).toString();
|
|
48
|
+
}
|
|
49
|
+
export function oauthTokenEndpointUrl(origin) {
|
|
50
|
+
return new URL(`${OAUTH_AUTHORIZATION_SERVER_PATH}/oauth2/token`, origin).toString();
|
|
51
|
+
}
|
|
52
|
+
export function oauthResourceKeyForPathname(pathname) {
|
|
53
|
+
if (pathname === OAUTH_RESOURCE_PATHS.mcp) {
|
|
54
|
+
return "mcp";
|
|
55
|
+
}
|
|
56
|
+
if (pathname === OAUTH_RESOURCE_PATHS.api ||
|
|
57
|
+
pathname.startsWith(`${OAUTH_RESOURCE_PATHS.api}/`)) {
|
|
58
|
+
return "api";
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const operationListQuerySchema: z.ZodObject<{
|
|
3
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
4
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
5
|
+
resourceType: z.ZodOptional<z.ZodString>;
|
|
6
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const operationListResponseSchema: z.ZodObject<{
|
|
9
|
+
data: z.ZodArray<z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
kind: z.ZodString;
|
|
12
|
+
status: z.ZodEnum<{
|
|
13
|
+
failed: "failed";
|
|
14
|
+
queued: "queued";
|
|
15
|
+
running: "running";
|
|
16
|
+
succeeded: "succeeded";
|
|
17
|
+
canceled: "canceled";
|
|
18
|
+
}>;
|
|
19
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
20
|
+
type: z.ZodString;
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
total: z.ZodNumber;
|
|
25
|
+
completed: z.ZodNumber;
|
|
26
|
+
failed: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
+
code: z.ZodString;
|
|
30
|
+
severity: z.ZodEnum<{
|
|
31
|
+
info: "info";
|
|
32
|
+
warning: "warning";
|
|
33
|
+
error: "error";
|
|
34
|
+
}>;
|
|
35
|
+
message: z.ZodString;
|
|
36
|
+
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
38
|
+
wpcloud: "wpcloud";
|
|
39
|
+
dns: "dns";
|
|
40
|
+
registrar: "registrar";
|
|
41
|
+
runtime: "runtime";
|
|
42
|
+
}>>>;
|
|
43
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
44
|
+
fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
+
retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
createdAt: z.ZodString;
|
|
48
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
pagination: z.ZodObject<{
|
|
51
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
52
|
+
hasMore: z.ZodBoolean;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AsyncOperationSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
|
|
3
|
+
export const operationListQuerySchema = cursorListQuerySchema.extend({
|
|
4
|
+
resourceType: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("Filter to operations touching one resource type, e.g. `space`."),
|
|
9
|
+
resourceId: z.string().min(1).optional().describe("Filter to operations touching one resource."),
|
|
10
|
+
});
|
|
11
|
+
export const operationListResponseSchema = z.object({
|
|
12
|
+
data: z.array(AsyncOperationSchema),
|
|
13
|
+
pagination: CursorPaginationSchema,
|
|
14
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PLAN_DISABLED_BEHAVIOR_CODES: readonly ["free_external_proxy_disabled", "free_headers_basic_auth_disabled", "routing_rules_over_plan", "immutable_version_requires_login"];
|
|
3
|
+
export declare const planDisabledBehaviorSchema: z.ZodObject<{
|
|
4
|
+
code: z.ZodEnum<{
|
|
5
|
+
free_external_proxy_disabled: "free_external_proxy_disabled";
|
|
6
|
+
free_headers_basic_auth_disabled: "free_headers_basic_auth_disabled";
|
|
7
|
+
immutable_version_requires_login: "immutable_version_requires_login";
|
|
8
|
+
routing_rules_over_plan: "routing_rules_over_plan";
|
|
9
|
+
}>;
|
|
10
|
+
behavior: z.ZodString;
|
|
11
|
+
renderedAs: z.ZodEnum<{
|
|
12
|
+
warning: "warning";
|
|
13
|
+
ignored: "ignored";
|
|
14
|
+
platform_page: "platform_page";
|
|
15
|
+
login_redirect: "login_redirect";
|
|
16
|
+
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type PlanDisabledBehavior = z.infer<typeof planDisabledBehaviorSchema>;
|
|
19
|
+
export declare const PlanPolicyResponseSchema: z.ZodObject<{
|
|
20
|
+
principal: z.ZodObject<{
|
|
21
|
+
type: z.ZodEnum<{
|
|
22
|
+
space: "space";
|
|
23
|
+
site: "site";
|
|
24
|
+
team: "team";
|
|
25
|
+
external_principal: "external_principal";
|
|
26
|
+
}>;
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
siteId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
plan: z.ZodEnum<{
|
|
32
|
+
free: "free";
|
|
33
|
+
personal: "personal";
|
|
34
|
+
work: "work";
|
|
35
|
+
enterprise: "enterprise";
|
|
36
|
+
internal: "internal";
|
|
37
|
+
}>;
|
|
38
|
+
limits: z.ZodObject<{
|
|
39
|
+
storageBytes: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
40
|
+
teamMembers: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
41
|
+
subTeams: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
42
|
+
externalDomainGroups: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
43
|
+
boughtDomains: z.ZodLiteral<"unlimited">;
|
|
44
|
+
publicImmutableVersionWindowDays: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
45
|
+
maxFileBytes: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
46
|
+
maxVersionFiles: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
47
|
+
routingRules: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
48
|
+
auditLogRetentionHours: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
49
|
+
buildAccessLogRetentionHours: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
50
|
+
buildsDeploysMonthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
storageBytes: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
teamMembers: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
subTeams: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
externalDomainGroups: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
routingRules: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
buildsDeploysThisMonth: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
|
+
severity: z.ZodEnum<{
|
|
62
|
+
error: "error";
|
|
63
|
+
info: "info";
|
|
64
|
+
warning: "warning";
|
|
65
|
+
}>;
|
|
66
|
+
code: z.ZodString;
|
|
67
|
+
message: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
69
|
+
disabledBehaviors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
70
|
+
code: z.ZodEnum<{
|
|
71
|
+
free_external_proxy_disabled: "free_external_proxy_disabled";
|
|
72
|
+
free_headers_basic_auth_disabled: "free_headers_basic_auth_disabled";
|
|
73
|
+
immutable_version_requires_login: "immutable_version_requires_login";
|
|
74
|
+
routing_rules_over_plan: "routing_rules_over_plan";
|
|
75
|
+
}>;
|
|
76
|
+
behavior: z.ZodString;
|
|
77
|
+
renderedAs: z.ZodEnum<{
|
|
78
|
+
warning: "warning";
|
|
79
|
+
ignored: "ignored";
|
|
80
|
+
platform_page: "platform_page";
|
|
81
|
+
login_redirect: "login_redirect";
|
|
82
|
+
}>;
|
|
83
|
+
}, z.core.$strip>>>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export type PlanPolicyResponse = z.infer<typeof PlanPolicyResponseSchema>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { diagnosticSeverity } from "./enums.js";
|
|
3
|
+
import { planCodeSchema, planLimitValueSchema } from "./features.js";
|
|
4
|
+
// Behaviors the platform disables (rather than failing publishes) when the
|
|
5
|
+
// plan does not include them (internal-docs/platform.md "Plans And Limits").
|
|
6
|
+
export const PLAN_DISABLED_BEHAVIOR_CODES = [
|
|
7
|
+
"free_external_proxy_disabled",
|
|
8
|
+
"free_headers_basic_auth_disabled",
|
|
9
|
+
"routing_rules_over_plan",
|
|
10
|
+
"immutable_version_requires_login",
|
|
11
|
+
];
|
|
12
|
+
export const planDisabledBehaviorSchema = z.object({
|
|
13
|
+
code: z
|
|
14
|
+
.enum(PLAN_DISABLED_BEHAVIOR_CODES)
|
|
15
|
+
.describe("Stable code identifying the disabled behavior."),
|
|
16
|
+
behavior: z.string().describe("What the platform does instead of honoring the behavior."),
|
|
17
|
+
renderedAs: z
|
|
18
|
+
.enum(["warning", "platform_page", "login_redirect", "ignored"])
|
|
19
|
+
.describe("How the disablement surfaces to users."),
|
|
20
|
+
});
|
|
21
|
+
export const PlanPolicyResponseSchema = z.object({
|
|
22
|
+
principal: z
|
|
23
|
+
.object({
|
|
24
|
+
type: z.enum(["team", "site", "space", "external_principal"]),
|
|
25
|
+
id: z.string(),
|
|
26
|
+
})
|
|
27
|
+
.describe("Principal the policy was resolved for."),
|
|
28
|
+
siteId: z.string().optional().describe("Site the policy was resolved against, when site-scoped."),
|
|
29
|
+
spaceId: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Space the policy was resolved against, when space-scoped."),
|
|
33
|
+
plan: planCodeSchema,
|
|
34
|
+
limits: z
|
|
35
|
+
.object({
|
|
36
|
+
storageBytes: planLimitValueSchema,
|
|
37
|
+
teamMembers: planLimitValueSchema,
|
|
38
|
+
subTeams: planLimitValueSchema,
|
|
39
|
+
externalDomainGroups: planLimitValueSchema,
|
|
40
|
+
boughtDomains: z
|
|
41
|
+
.literal("unlimited")
|
|
42
|
+
.describe("Domains bought through Spacefast never count against external domain limits."),
|
|
43
|
+
publicImmutableVersionWindowDays: planLimitValueSchema,
|
|
44
|
+
maxFileBytes: planLimitValueSchema,
|
|
45
|
+
maxVersionFiles: planLimitValueSchema.describe("Files per version; plan policy may lower the 100,000-file contract ceiling, never raise it."),
|
|
46
|
+
routingRules: planLimitValueSchema,
|
|
47
|
+
auditLogRetentionHours: planLimitValueSchema,
|
|
48
|
+
buildAccessLogRetentionHours: planLimitValueSchema,
|
|
49
|
+
buildsDeploysMonthly: planLimitValueSchema.describe("Pooled monthly limit: pricing never separates user pushes from CI builds."),
|
|
50
|
+
})
|
|
51
|
+
.describe("Named plan limits."),
|
|
52
|
+
usage: z
|
|
53
|
+
.object({
|
|
54
|
+
storageBytes: z.number().int().nonnegative().optional(),
|
|
55
|
+
teamMembers: z.number().int().nonnegative().optional(),
|
|
56
|
+
subTeams: z.number().int().nonnegative().optional(),
|
|
57
|
+
externalDomainGroups: z.number().int().nonnegative().optional(),
|
|
58
|
+
routingRules: z.number().int().nonnegative().optional(),
|
|
59
|
+
buildsDeploysThisMonth: z.number().int().nonnegative().optional(),
|
|
60
|
+
})
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Current usage against the named limits, where the platform meters it."),
|
|
63
|
+
warnings: z
|
|
64
|
+
.array(z.object({
|
|
65
|
+
severity: diagnosticSeverity,
|
|
66
|
+
code: z.string(),
|
|
67
|
+
message: z.string(),
|
|
68
|
+
}))
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Plan-level warnings (for example storage over quota)."),
|
|
71
|
+
disabledBehaviors: z
|
|
72
|
+
.array(planDisabledBehaviorSchema)
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("Behaviors the plan disables instead of failing publishes."),
|
|
75
|
+
});
|