@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,189 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const variableScope: z.ZodEnum<{
|
|
3
|
+
principal: "principal";
|
|
4
|
+
space: "space";
|
|
5
|
+
site: "site";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const variableNameSchema: z.ZodString;
|
|
8
|
+
export declare const VariableSchema: z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
scope: z.ZodEnum<{
|
|
11
|
+
principal: "principal";
|
|
12
|
+
space: "space";
|
|
13
|
+
site: "site";
|
|
14
|
+
}>;
|
|
15
|
+
secret: z.ZodBoolean;
|
|
16
|
+
value: z.ZodOptional<z.ZodString>;
|
|
17
|
+
channelValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18
|
+
createdAt: z.ZodString;
|
|
19
|
+
updatedAt: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type Variable = z.infer<typeof VariableSchema>;
|
|
22
|
+
export declare const variableProvenanceSchema: z.ZodArray<z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
valueHash: z.ZodString;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
export type VariableProvenance = z.infer<typeof variableProvenanceSchema>;
|
|
27
|
+
export declare function variableResourceId(scope: z.infer<typeof variableScope>, name: string): string;
|
|
28
|
+
export declare const SystemVariableSchema: z.ZodObject<{
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
value: z.ZodString;
|
|
31
|
+
scope: z.ZodLiteral<"system">;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const variableUpsertSchema: z.ZodObject<{
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
value: z.ZodString;
|
|
36
|
+
secret: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
channelValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const variableValueUpsertSchema: z.ZodObject<{
|
|
40
|
+
value: z.ZodString;
|
|
41
|
+
secret: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
channelValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export declare const variableListQuerySchema: z.ZodObject<{
|
|
45
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
46
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export declare const variableListResponseSchema: z.ZodObject<{
|
|
49
|
+
data: z.ZodArray<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
scope: z.ZodEnum<{
|
|
52
|
+
principal: "principal";
|
|
53
|
+
space: "space";
|
|
54
|
+
site: "site";
|
|
55
|
+
}>;
|
|
56
|
+
secret: z.ZodBoolean;
|
|
57
|
+
value: z.ZodOptional<z.ZodString>;
|
|
58
|
+
channelValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
+
createdAt: z.ZodString;
|
|
60
|
+
updatedAt: z.ZodString;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
pagination: z.ZodObject<{
|
|
63
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
64
|
+
hasMore: z.ZodBoolean;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export declare const spaceVariableListResponseSchema: z.ZodObject<{
|
|
68
|
+
data: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
scope: z.ZodEnum<{
|
|
71
|
+
principal: "principal";
|
|
72
|
+
space: "space";
|
|
73
|
+
site: "site";
|
|
74
|
+
}>;
|
|
75
|
+
secret: z.ZodBoolean;
|
|
76
|
+
value: z.ZodOptional<z.ZodString>;
|
|
77
|
+
channelValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
78
|
+
createdAt: z.ZodString;
|
|
79
|
+
updatedAt: z.ZodString;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
value: z.ZodString;
|
|
83
|
+
scope: z.ZodLiteral<"system">;
|
|
84
|
+
}, z.core.$strip>]>>;
|
|
85
|
+
pagination: z.ZodObject<{
|
|
86
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
87
|
+
hasMore: z.ZodBoolean;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export declare const variableMutationResponseSchema: z.ZodObject<{
|
|
91
|
+
data: z.ZodObject<{
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
scope: z.ZodEnum<{
|
|
94
|
+
principal: "principal";
|
|
95
|
+
space: "space";
|
|
96
|
+
site: "site";
|
|
97
|
+
}>;
|
|
98
|
+
secret: z.ZodBoolean;
|
|
99
|
+
value: z.ZodOptional<z.ZodString>;
|
|
100
|
+
channelValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
101
|
+
createdAt: z.ZodString;
|
|
102
|
+
updatedAt: z.ZodString;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
operation: z.ZodNullable<z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
kind: z.ZodString;
|
|
107
|
+
status: z.ZodEnum<{
|
|
108
|
+
failed: "failed";
|
|
109
|
+
queued: "queued";
|
|
110
|
+
running: "running";
|
|
111
|
+
succeeded: "succeeded";
|
|
112
|
+
canceled: "canceled";
|
|
113
|
+
}>;
|
|
114
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
115
|
+
type: z.ZodString;
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
total: z.ZodNumber;
|
|
120
|
+
completed: z.ZodNumber;
|
|
121
|
+
failed: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
+
code: z.ZodString;
|
|
125
|
+
severity: z.ZodEnum<{
|
|
126
|
+
info: "info";
|
|
127
|
+
warning: "warning";
|
|
128
|
+
error: "error";
|
|
129
|
+
}>;
|
|
130
|
+
message: z.ZodString;
|
|
131
|
+
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
133
|
+
wpcloud: "wpcloud";
|
|
134
|
+
dns: "dns";
|
|
135
|
+
registrar: "registrar";
|
|
136
|
+
runtime: "runtime";
|
|
137
|
+
}>>>;
|
|
138
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
139
|
+
fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
140
|
+
retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
141
|
+
}, z.core.$strip>>>;
|
|
142
|
+
createdAt: z.ZodString;
|
|
143
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
export declare const variableDeleteResponseSchema: z.ZodObject<{
|
|
147
|
+
data: z.ZodNull;
|
|
148
|
+
operation: z.ZodNullable<z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
kind: z.ZodString;
|
|
151
|
+
status: z.ZodEnum<{
|
|
152
|
+
failed: "failed";
|
|
153
|
+
queued: "queued";
|
|
154
|
+
running: "running";
|
|
155
|
+
succeeded: "succeeded";
|
|
156
|
+
canceled: "canceled";
|
|
157
|
+
}>;
|
|
158
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
159
|
+
type: z.ZodString;
|
|
160
|
+
id: z.ZodString;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
total: z.ZodNumber;
|
|
164
|
+
completed: z.ZodNumber;
|
|
165
|
+
failed: z.ZodNumber;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
168
|
+
code: z.ZodString;
|
|
169
|
+
severity: z.ZodEnum<{
|
|
170
|
+
info: "info";
|
|
171
|
+
warning: "warning";
|
|
172
|
+
error: "error";
|
|
173
|
+
}>;
|
|
174
|
+
message: z.ZodString;
|
|
175
|
+
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
176
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
177
|
+
wpcloud: "wpcloud";
|
|
178
|
+
dns: "dns";
|
|
179
|
+
registrar: "registrar";
|
|
180
|
+
runtime: "runtime";
|
|
181
|
+
}>>>;
|
|
182
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
183
|
+
fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
184
|
+
retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
185
|
+
}, z.core.$strip>>>;
|
|
186
|
+
createdAt: z.ZodString;
|
|
187
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, z.core.$strip>>;
|
|
189
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AsyncOperationSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
|
|
3
|
+
// Variable (internal-docs/platform.md "Product Data Shapes"): one model for
|
|
4
|
+
// every scope. Resolution order at finalize is space -> principal -> site.
|
|
5
|
+
// Secret values are write-only after creation: never returned by API, CLI,
|
|
6
|
+
// UI, diagnostics, logs, or activity.
|
|
7
|
+
export const variableScope = z.enum(["space", "principal", "site"]);
|
|
8
|
+
export const variableNameSchema = z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(128)
|
|
12
|
+
.regex(/^[A-Za-z_][A-Za-z0-9_]*$/, {
|
|
13
|
+
message: "Variable names must start with a letter or underscore and contain only letters, numbers, and underscores.",
|
|
14
|
+
})
|
|
15
|
+
.refine((name) => !name.toUpperCase().startsWith("SPACEFAST_"), {
|
|
16
|
+
message: "Variable names starting with SPACEFAST_ are reserved.",
|
|
17
|
+
});
|
|
18
|
+
export const VariableSchema = z.object({
|
|
19
|
+
name: variableNameSchema.describe("Variable name, referenced as {{ vars.NAME }} in templates."),
|
|
20
|
+
scope: variableScope.describe("Where the variable is defined; space wins over principal/site."),
|
|
21
|
+
secret: z.boolean().describe("Secret values are write-only and never returned after creation."),
|
|
22
|
+
value: z.string().optional().describe("Variable value; omitted when secret=true."),
|
|
23
|
+
channelValues: z
|
|
24
|
+
.record(z.string(), z.string())
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Per-channel overrides compiled into channel template variants; omitted for secrets."),
|
|
27
|
+
createdAt: z.string().datetime().describe("When the variable was created."),
|
|
28
|
+
updatedAt: z.string().datetime().describe("When the value was last written."),
|
|
29
|
+
});
|
|
30
|
+
// Version provenance (internal-docs/platform.md "Variable rules"): versions
|
|
31
|
+
// record which variable names and value hashes they were finalized with —
|
|
32
|
+
// never values. Stored on the version row and echoed on the Version resource;
|
|
33
|
+
// the cascade discovers affected spaces through it.
|
|
34
|
+
export const variableProvenanceSchema = z
|
|
35
|
+
.array(z.object({
|
|
36
|
+
name: z.string().describe("Variable name the version was finalized with."),
|
|
37
|
+
valueHash: z
|
|
38
|
+
.string()
|
|
39
|
+
.describe("sha256 of the resolved value at finalize time. Never the value itself."),
|
|
40
|
+
}))
|
|
41
|
+
.describe("Variable names + value hashes baked into this version at finalize. Never values.");
|
|
42
|
+
// Operation `resources` entry id for a coalesced variable write
|
|
43
|
+
// (internal-docs/platform.md "Debounce contract"): `{scope}/{name}`.
|
|
44
|
+
export function variableResourceId(scope, name) {
|
|
45
|
+
return `${scope}/${name}`;
|
|
46
|
+
}
|
|
47
|
+
// Platform-provided, read-only values (SPACEFAST_*) surfaced alongside stored
|
|
48
|
+
// variables on list reads. Not persistable and not a Variable scope.
|
|
49
|
+
export const SystemVariableSchema = z.object({
|
|
50
|
+
name: z.string(),
|
|
51
|
+
value: z.string(),
|
|
52
|
+
scope: z.literal("system").describe("Platform-provided, read-only variable."),
|
|
53
|
+
});
|
|
54
|
+
export const variableUpsertSchema = z.object({
|
|
55
|
+
name: variableNameSchema,
|
|
56
|
+
value: z.string().min(1),
|
|
57
|
+
secret: z.boolean().optional().describe("Mark the value write-only. Defaults to false."),
|
|
58
|
+
channelValues: z.record(z.string(), z.string()).optional(),
|
|
59
|
+
});
|
|
60
|
+
export const variableValueUpsertSchema = variableUpsertSchema.omit({ name: true });
|
|
61
|
+
export const variableListQuerySchema = cursorListQuerySchema;
|
|
62
|
+
export const variableListResponseSchema = z.object({
|
|
63
|
+
data: z.array(VariableSchema),
|
|
64
|
+
pagination: CursorPaginationSchema,
|
|
65
|
+
});
|
|
66
|
+
// Space variable lists interleave platform-provided SPACEFAST_* values with the
|
|
67
|
+
// stored variables visible to the space (space scope plus principal scope).
|
|
68
|
+
export const spaceVariableListResponseSchema = z.object({
|
|
69
|
+
data: z.array(z.union([VariableSchema, SystemVariableSchema])),
|
|
70
|
+
pagination: CursorPaginationSchema,
|
|
71
|
+
});
|
|
72
|
+
// Variable mutations return the debounced cascade operation
|
|
73
|
+
// (internal-docs/platform.md "Debounce contract"): every coalesced PUT/DELETE
|
|
74
|
+
// returns the same pending `op_` id, so "mutation returns `operation`" holds.
|
|
75
|
+
export const variableMutationResponseSchema = z.object({
|
|
76
|
+
data: VariableSchema,
|
|
77
|
+
operation: AsyncOperationSchema.nullable().describe("The debounced re-finalize cascade this write coalesced into; null when no cascade was required."),
|
|
78
|
+
});
|
|
79
|
+
export const variableDeleteResponseSchema = z.object({
|
|
80
|
+
data: z.null().describe("Variable deletes return no resource body."),
|
|
81
|
+
operation: AsyncOperationSchema.nullable().describe("The debounced re-finalize cascade this delete coalesced into; null when no cascade was required."),
|
|
82
|
+
});
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const webhookCreateSchema: z.ZodObject<{
|
|
3
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
events: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const webhookPatchSchema: z.ZodObject<{
|
|
8
|
+
url: z.ZodOptional<z.ZodString>;
|
|
9
|
+
events: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
active: "active";
|
|
12
|
+
disabled: "disabled";
|
|
13
|
+
}>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const webhookSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
tenantId: z.ZodString;
|
|
18
|
+
principal: z.ZodNullable<z.ZodObject<{
|
|
19
|
+
tenantId: z.ZodString;
|
|
20
|
+
principalType: z.ZodEnum<{
|
|
21
|
+
external: "external";
|
|
22
|
+
team: "team";
|
|
23
|
+
}>;
|
|
24
|
+
principalId: z.ZodString;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
url: z.ZodString;
|
|
27
|
+
events: z.ZodArray<z.ZodString>;
|
|
28
|
+
status: z.ZodEnum<{
|
|
29
|
+
active: "active";
|
|
30
|
+
disabled: "disabled";
|
|
31
|
+
failing: "failing";
|
|
32
|
+
}>;
|
|
33
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
34
|
+
secretPreview: z.ZodString;
|
|
35
|
+
previousSecretExpiresAt: z.ZodNullable<z.ZodString>;
|
|
36
|
+
createdAt: z.ZodString;
|
|
37
|
+
updatedAt: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const webhookListQuerySchema: z.ZodObject<{
|
|
40
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
41
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const webhookListResponseSchema: z.ZodObject<{
|
|
44
|
+
data: z.ZodArray<z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
tenantId: z.ZodString;
|
|
47
|
+
principal: z.ZodNullable<z.ZodObject<{
|
|
48
|
+
tenantId: z.ZodString;
|
|
49
|
+
principalType: z.ZodEnum<{
|
|
50
|
+
external: "external";
|
|
51
|
+
team: "team";
|
|
52
|
+
}>;
|
|
53
|
+
principalId: z.ZodString;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
url: z.ZodString;
|
|
56
|
+
events: z.ZodArray<z.ZodString>;
|
|
57
|
+
status: z.ZodEnum<{
|
|
58
|
+
active: "active";
|
|
59
|
+
disabled: "disabled";
|
|
60
|
+
failing: "failing";
|
|
61
|
+
}>;
|
|
62
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
63
|
+
secretPreview: z.ZodString;
|
|
64
|
+
previousSecretExpiresAt: z.ZodNullable<z.ZodString>;
|
|
65
|
+
createdAt: z.ZodString;
|
|
66
|
+
updatedAt: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
pagination: z.ZodObject<{
|
|
69
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
70
|
+
hasMore: z.ZodBoolean;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export declare const webhookRotateSecretSchema: z.ZodObject<{
|
|
74
|
+
expireNow: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export declare const webhookDeliverySchema: z.ZodObject<{
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
webhookId: z.ZodString;
|
|
79
|
+
eventId: z.ZodString;
|
|
80
|
+
status: z.ZodEnum<{
|
|
81
|
+
failed: "failed";
|
|
82
|
+
succeeded: "succeeded";
|
|
83
|
+
pending: "pending";
|
|
84
|
+
exhausted: "exhausted";
|
|
85
|
+
}>;
|
|
86
|
+
attempts: z.ZodNumber;
|
|
87
|
+
lastAttemptAt: z.ZodNullable<z.ZodString>;
|
|
88
|
+
lastResponseStatus: z.ZodNullable<z.ZodNumber>;
|
|
89
|
+
nextRetryAt: z.ZodNullable<z.ZodString>;
|
|
90
|
+
redeliveredFromId: z.ZodNullable<z.ZodString>;
|
|
91
|
+
diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
92
|
+
code: z.ZodString;
|
|
93
|
+
severity: z.ZodEnum<{
|
|
94
|
+
info: "info";
|
|
95
|
+
warning: "warning";
|
|
96
|
+
error: "error";
|
|
97
|
+
}>;
|
|
98
|
+
message: z.ZodString;
|
|
99
|
+
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
101
|
+
wpcloud: "wpcloud";
|
|
102
|
+
dns: "dns";
|
|
103
|
+
registrar: "registrar";
|
|
104
|
+
runtime: "runtime";
|
|
105
|
+
}>>>;
|
|
106
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
107
|
+
fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
+
retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
109
|
+
}, z.core.$strip>>>;
|
|
110
|
+
createdAt: z.ZodString;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export declare const webhookDeliveryListQuerySchema: z.ZodObject<{
|
|
113
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
114
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export declare const webhookDeliveryListResponseSchema: z.ZodObject<{
|
|
117
|
+
data: z.ZodArray<z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
webhookId: z.ZodString;
|
|
120
|
+
eventId: z.ZodString;
|
|
121
|
+
status: z.ZodEnum<{
|
|
122
|
+
failed: "failed";
|
|
123
|
+
succeeded: "succeeded";
|
|
124
|
+
pending: "pending";
|
|
125
|
+
exhausted: "exhausted";
|
|
126
|
+
}>;
|
|
127
|
+
attempts: z.ZodNumber;
|
|
128
|
+
lastAttemptAt: z.ZodNullable<z.ZodString>;
|
|
129
|
+
lastResponseStatus: z.ZodNullable<z.ZodNumber>;
|
|
130
|
+
nextRetryAt: z.ZodNullable<z.ZodString>;
|
|
131
|
+
redeliveredFromId: z.ZodNullable<z.ZodString>;
|
|
132
|
+
diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
133
|
+
code: z.ZodString;
|
|
134
|
+
severity: z.ZodEnum<{
|
|
135
|
+
info: "info";
|
|
136
|
+
warning: "warning";
|
|
137
|
+
error: "error";
|
|
138
|
+
}>;
|
|
139
|
+
message: z.ZodString;
|
|
140
|
+
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
142
|
+
wpcloud: "wpcloud";
|
|
143
|
+
dns: "dns";
|
|
144
|
+
registrar: "registrar";
|
|
145
|
+
runtime: "runtime";
|
|
146
|
+
}>>>;
|
|
147
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
148
|
+
fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
149
|
+
retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
150
|
+
}, z.core.$strip>>>;
|
|
151
|
+
createdAt: z.ZodString;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
pagination: z.ZodObject<{
|
|
154
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
155
|
+
hasMore: z.ZodBoolean;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
export type Webhook = z.infer<typeof webhookSchema>;
|
|
159
|
+
export type WebhookDelivery = z.infer<typeof webhookDeliverySchema>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { baseDiagnosticSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
|
|
3
|
+
export const webhookCreateSchema = z.object({
|
|
4
|
+
teamId: z.string().min(1).optional(),
|
|
5
|
+
url: z.string().url(),
|
|
6
|
+
events: z.array(z.string().min(1)).min(1).default(["*"]),
|
|
7
|
+
});
|
|
8
|
+
export const webhookPatchSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
url: z.string().url().optional(),
|
|
11
|
+
events: z.array(z.string().min(1)).min(1).optional(),
|
|
12
|
+
status: z.enum(["active", "disabled"]).optional(),
|
|
13
|
+
})
|
|
14
|
+
.refine((value) => Object.keys(value).length > 0, "At least one field is required.");
|
|
15
|
+
export const webhookSchema = z.object({
|
|
16
|
+
id: z.string(),
|
|
17
|
+
tenantId: z.string(),
|
|
18
|
+
principal: z
|
|
19
|
+
.object({
|
|
20
|
+
tenantId: z.string(),
|
|
21
|
+
principalType: z.enum(["team", "external"]),
|
|
22
|
+
principalId: z.string(),
|
|
23
|
+
})
|
|
24
|
+
.nullable(),
|
|
25
|
+
url: z.string().url(),
|
|
26
|
+
events: z.array(z.string()),
|
|
27
|
+
status: z.enum(["active", "disabled", "failing"]),
|
|
28
|
+
secret: z.string().optional(),
|
|
29
|
+
secretPreview: z.string(),
|
|
30
|
+
previousSecretExpiresAt: z.string().datetime().nullable(),
|
|
31
|
+
createdAt: z.string().datetime(),
|
|
32
|
+
updatedAt: z.string().datetime(),
|
|
33
|
+
});
|
|
34
|
+
export const webhookListQuerySchema = cursorListQuerySchema;
|
|
35
|
+
export const webhookListResponseSchema = z.object({
|
|
36
|
+
data: z.array(webhookSchema),
|
|
37
|
+
pagination: CursorPaginationSchema,
|
|
38
|
+
});
|
|
39
|
+
export const webhookRotateSecretSchema = z.object({
|
|
40
|
+
expireNow: z.boolean().default(false),
|
|
41
|
+
});
|
|
42
|
+
export const webhookDeliverySchema = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
webhookId: z.string(),
|
|
45
|
+
eventId: z.string(),
|
|
46
|
+
status: z.enum(["pending", "succeeded", "failed", "exhausted"]),
|
|
47
|
+
attempts: z.number().int().nonnegative(),
|
|
48
|
+
lastAttemptAt: z.string().datetime().nullable(),
|
|
49
|
+
lastResponseStatus: z.number().int().nullable(),
|
|
50
|
+
nextRetryAt: z.string().datetime().nullable(),
|
|
51
|
+
redeliveredFromId: z.string().nullable(),
|
|
52
|
+
diagnostics: z.array(baseDiagnosticSchema).default([]),
|
|
53
|
+
createdAt: z.string().datetime(),
|
|
54
|
+
});
|
|
55
|
+
export const webhookDeliveryListQuerySchema = webhookListQuerySchema;
|
|
56
|
+
export const webhookDeliveryListResponseSchema = z.object({
|
|
57
|
+
data: z.array(webhookDeliverySchema),
|
|
58
|
+
pagination: CursorPaginationSchema,
|
|
59
|
+
});
|