@rikalabs/akter-cli 0.0.0-stage → 0.1.0-alpha.4
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/CHANGELOG.md +27 -0
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +16 -2
- package/dist/cloud-api/auth.d.ts +79 -0
- package/dist/cloud-api/billing.d.ts +312 -0
- package/dist/cloud-api/contract.d.ts +1556 -0
- package/dist/cloud-api/deployments.d.ts +161 -0
- package/dist/cloud-api/errors.d.ts +75 -0
- package/dist/cloud-api/groups/account.d.ts +370 -0
- package/dist/cloud-api/groups/billing.d.ts +170 -0
- package/dist/cloud-api/groups/deployments.d.ts +304 -0
- package/dist/cloud-api/groups/projects.d.ts +284 -0
- package/dist/cloud-api/groups/runtime.d.ts +482 -0
- package/dist/cloud-api/identity.d.ts +313 -0
- package/dist/cloud-api/index.d.ts +15 -0
- package/dist/cloud-api/index.js +1637 -0
- package/dist/cloud-api/logs.d.ts +44 -0
- package/dist/cloud-api/primitives.d.ts +82 -0
- package/dist/cloud-api/projects.d.ts +189 -0
- package/dist/cloud-api/runtime.d.ts +595 -0
- package/dist/inspector-client.js +14 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +3280 -0
- package/package.json +1 -6
|
@@ -0,0 +1,1637 @@
|
|
|
1
|
+
// ../../packages/cloud-api/src/errors.ts
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
class Unauthorized extends Schema.TaggedError()("Unauthorized", {
|
|
5
|
+
code: Schema.Literals(["missing_credentials", "invalid_credentials", "expired"]),
|
|
6
|
+
message: Schema.String
|
|
7
|
+
}, { httpApiStatus: 401 }) {
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class Forbidden extends Schema.TaggedError()("Forbidden", { message: Schema.String }, { httpApiStatus: 403 }) {
|
|
11
|
+
}
|
|
12
|
+
var NotFoundResource = Schema.Literals([
|
|
13
|
+
"actor",
|
|
14
|
+
"actor-type",
|
|
15
|
+
"api-key",
|
|
16
|
+
"command",
|
|
17
|
+
"cursor",
|
|
18
|
+
"deployment",
|
|
19
|
+
"domain",
|
|
20
|
+
"environment",
|
|
21
|
+
"invitation",
|
|
22
|
+
"live deployment",
|
|
23
|
+
"member",
|
|
24
|
+
"organization",
|
|
25
|
+
"project",
|
|
26
|
+
"source"
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
class NotFound extends Schema.TaggedError()("NotFound", { resource: NotFoundResource, id: Schema.String }, { httpApiStatus: 404 }) {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class Conflict extends Schema.TaggedError()("Conflict", { message: Schema.String }, { httpApiStatus: 409 }) {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class NotImplemented extends Schema.TaggedError()("NotImplemented", { operation: Schema.String }, { httpApiStatus: 501 }) {
|
|
36
|
+
}
|
|
37
|
+
var UnavailableReason = Schema.Literals(["unknownPlan"]);
|
|
38
|
+
|
|
39
|
+
class Unavailable extends Schema.TaggedError()("Unavailable", {
|
|
40
|
+
message: Schema.String,
|
|
41
|
+
retryAfterSeconds: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
|
|
42
|
+
reason: Schema.optionalKey(UnavailableReason)
|
|
43
|
+
}, { httpApiStatus: 503 }) {
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
class PayloadTooLarge extends Schema.TaggedError()("PayloadTooLarge", { limitBytes: Schema.Int }, { httpApiStatus: 413 }) {
|
|
47
|
+
}
|
|
48
|
+
var ReadErrors = [Forbidden, NotFound, NotImplemented, Unavailable];
|
|
49
|
+
var WriteErrors = [Forbidden, NotFound, Conflict, NotImplemented, Unavailable];
|
|
50
|
+
var SelfErrors = [Forbidden, NotImplemented];
|
|
51
|
+
// ../../packages/cloud-api/src/auth.ts
|
|
52
|
+
import { Context, Schema as Schema3 } from "effect";
|
|
53
|
+
import { HttpApiMiddleware, HttpApiSecurity } from "effect/http-api";
|
|
54
|
+
|
|
55
|
+
// ../../packages/cloud-api/src/primitives.ts
|
|
56
|
+
import { Schema as Schema2 } from "effect";
|
|
57
|
+
var identifier = Schema2.String.pipe(Schema2.check(Schema2.isMinLength(1), Schema2.isMaxLength(128)));
|
|
58
|
+
var UserId = identifier.pipe(Schema2.brand("UserId"));
|
|
59
|
+
var OrganizationId = identifier.pipe(Schema2.brand("OrganizationId"));
|
|
60
|
+
var MemberId = identifier.pipe(Schema2.brand("MemberId"));
|
|
61
|
+
var InvitationId = identifier.pipe(Schema2.brand("InvitationId"));
|
|
62
|
+
var ApiKeyId = identifier.pipe(Schema2.brand("ApiKeyId"));
|
|
63
|
+
var ProjectId = identifier.pipe(Schema2.brand("ProjectId"));
|
|
64
|
+
var DeploymentId = identifier.pipe(Schema2.brand("DeploymentId"));
|
|
65
|
+
var DomainId = identifier.pipe(Schema2.brand("DomainId"));
|
|
66
|
+
var DeadLetterId = identifier.pipe(Schema2.brand("DeadLetterId"));
|
|
67
|
+
var InvoiceId = identifier.pipe(Schema2.brand("InvoiceId"));
|
|
68
|
+
var EnvironmentId = identifier.pipe(Schema2.brand("EnvironmentId"));
|
|
69
|
+
var Slug = Schema2.String.pipe(Schema2.check(Schema2.isPattern(/^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/)), Schema2.brand("Slug"));
|
|
70
|
+
var Name = Schema2.String.pipe(Schema2.check(Schema2.isPattern(/^\S(?:.{0,98}\S)?$/)), Schema2.brand("Name"));
|
|
71
|
+
var Email = Schema2.String.pipe(Schema2.check(Schema2.isPattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/), Schema2.isMaxLength(254)), Schema2.brand("Email"));
|
|
72
|
+
var NonNegativeInt = Schema2.Int.pipe(Schema2.check(Schema2.isGreaterThanOrEqualTo(0)));
|
|
73
|
+
var NonNegative = Schema2.Finite.pipe(Schema2.check(Schema2.isGreaterThanOrEqualTo(0)));
|
|
74
|
+
var Timestamp = Schema2.DateTimeUtc;
|
|
75
|
+
var CalendarDay = Schema2.String.pipe(Schema2.check(Schema2.isPattern(/^\d{4}-\d{2}-\d{2}$/)));
|
|
76
|
+
var BillingPeriod = Schema2.String.pipe(Schema2.check(Schema2.isPattern(/^\d{4}-(?:0[1-9]|1[0-2])$/)));
|
|
77
|
+
var Role = Schema2.Literals(["owner", "admin", "member", "viewer"]);
|
|
78
|
+
var InviteRole = Schema2.Literals(["admin", "member", "viewer"]);
|
|
79
|
+
var EnvironmentName = Schema2.Literals(["production", "staging", "dev"]);
|
|
80
|
+
var RegionId = Schema2.Literals(["us-east-1", "us-west-2"]);
|
|
81
|
+
var CommitSha = Schema2.String.pipe(Schema2.check(Schema2.isPattern(/^[0-9a-f]{7,40}$/)));
|
|
82
|
+
var ActorAddress = Schema2.String.pipe(Schema2.check(Schema2.isMinLength(3), Schema2.isMaxLength(1024), Schema2.isPattern(/^[^/]+\/.+$/)));
|
|
83
|
+
var ActorReference = Schema2.Struct({
|
|
84
|
+
kind: Schema2.Literals(["user", "api-key"]),
|
|
85
|
+
id: Schema2.String,
|
|
86
|
+
name: Schema2.NullOr(Schema2.String)
|
|
87
|
+
});
|
|
88
|
+
var SeriesPoint = Schema2.Struct({ at: Timestamp, value: Schema2.Finite });
|
|
89
|
+
var pageQuery = {
|
|
90
|
+
limit: Schema2.optional(Schema2.Int.pipe(Schema2.check(Schema2.isBetween({ minimum: 1, maximum: 100 })))),
|
|
91
|
+
cursor: Schema2.optional(Schema2.String)
|
|
92
|
+
};
|
|
93
|
+
var Page = (item) => Schema2.Struct({ items: Schema2.Array(item), nextCursor: Schema2.NullOr(Schema2.String) });
|
|
94
|
+
|
|
95
|
+
// ../../packages/cloud-api/src/auth.ts
|
|
96
|
+
var sessionCookieName = "better-auth.session_token";
|
|
97
|
+
var secureSessionCookieName = "__Secure-better-auth.session_token";
|
|
98
|
+
var apiKeyHeaderName = "x-api-key";
|
|
99
|
+
var SessionIdentity = Schema3.TaggedStruct("session", {
|
|
100
|
+
userId: UserId,
|
|
101
|
+
sessionId: Schema3.String,
|
|
102
|
+
activeOrganizationId: Schema3.NullOr(OrganizationId)
|
|
103
|
+
});
|
|
104
|
+
var ApiKeyIdentity = Schema3.TaggedStruct("api-key", {
|
|
105
|
+
keyId: ApiKeyId,
|
|
106
|
+
organizationId: OrganizationId,
|
|
107
|
+
permission: Schema3.Literals(["read", "write", "admin"])
|
|
108
|
+
});
|
|
109
|
+
var Identity = Schema3.Union([SessionIdentity, ApiKeyIdentity]);
|
|
110
|
+
|
|
111
|
+
class CurrentIdentity extends Context.Service()("@akter/cloud-api/auth/CurrentIdentity") {
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
class Authentication extends HttpApiMiddleware.Service()("@akter/cloud-api/Authentication", {
|
|
115
|
+
security: {
|
|
116
|
+
session: HttpApiSecurity.apiKey({ key: sessionCookieName, in: "cookie" }),
|
|
117
|
+
secureSession: HttpApiSecurity.apiKey({ key: secureSessionCookieName, in: "cookie" }),
|
|
118
|
+
apiKey: HttpApiSecurity.apiKey({ key: apiKeyHeaderName, in: "header" }),
|
|
119
|
+
bearer: HttpApiSecurity.bearer
|
|
120
|
+
},
|
|
121
|
+
error: [Unauthorized, Forbidden, Unavailable]
|
|
122
|
+
}) {
|
|
123
|
+
}
|
|
124
|
+
// ../../packages/cloud-api/src/identity.ts
|
|
125
|
+
import { Schema as Schema4 } from "effect";
|
|
126
|
+
var PlanId = Schema4.Literals(["free", "pro", "team", "enterprise"]);
|
|
127
|
+
var UnboundPlan = Schema4.TaggedStruct("unbound", {});
|
|
128
|
+
var KnownPlan = Schema4.TaggedStruct("known", { id: PlanId });
|
|
129
|
+
var UnknownPlan = Schema4.TaggedStruct("unknown", { id: Schema4.String });
|
|
130
|
+
var OrganizationPlan = Schema4.Union([UnboundPlan, KnownPlan, UnknownPlan]);
|
|
131
|
+
var User = Schema4.Struct({
|
|
132
|
+
id: UserId,
|
|
133
|
+
name: Schema4.String,
|
|
134
|
+
email: Email,
|
|
135
|
+
emailVerified: Schema4.Boolean,
|
|
136
|
+
image: Schema4.NullOr(Schema4.String)
|
|
137
|
+
});
|
|
138
|
+
var Organization = Schema4.Struct({
|
|
139
|
+
id: OrganizationId,
|
|
140
|
+
name: Schema4.String,
|
|
141
|
+
slug: Slug,
|
|
142
|
+
plan: OrganizationPlan,
|
|
143
|
+
createdAt: Timestamp
|
|
144
|
+
});
|
|
145
|
+
var OrganizationMembership = Schema4.Struct({
|
|
146
|
+
organization: Organization,
|
|
147
|
+
role: Role
|
|
148
|
+
});
|
|
149
|
+
var Me = Schema4.Struct({
|
|
150
|
+
user: Schema4.NullOr(User),
|
|
151
|
+
identityKind: Schema4.Literals(["session", "api-key"]),
|
|
152
|
+
activeOrganizationId: Schema4.NullOr(OrganizationId),
|
|
153
|
+
organizations: Schema4.Array(OrganizationMembership)
|
|
154
|
+
});
|
|
155
|
+
var UpdateProfile = Schema4.Struct({
|
|
156
|
+
name: Schema4.optional(Name),
|
|
157
|
+
image: Schema4.optional(Schema4.NullOr(Schema4.String))
|
|
158
|
+
});
|
|
159
|
+
var DeleteAccount = Schema4.Struct({ confirmation: Email });
|
|
160
|
+
var PersonalDataExport = Schema4.Struct({
|
|
161
|
+
userId: UserId,
|
|
162
|
+
exportedAt: Timestamp,
|
|
163
|
+
tables: Schema4.Record(Schema4.String, Schema4.Array(Schema4.Json))
|
|
164
|
+
});
|
|
165
|
+
var OrganizationDeletion = Schema4.Struct({
|
|
166
|
+
organizationId: OrganizationId,
|
|
167
|
+
phase: Schema4.Literals(["billing", "runners", "databases", "records", "completed"]),
|
|
168
|
+
blocked: Schema4.Boolean
|
|
169
|
+
});
|
|
170
|
+
var SetActiveOrganization = Schema4.Struct({ organizationId: OrganizationId });
|
|
171
|
+
var CreateOrganization = Schema4.Struct({ name: Name, slug: Slug });
|
|
172
|
+
var UpdateOrganization = Schema4.Struct({
|
|
173
|
+
name: Schema4.optional(Name),
|
|
174
|
+
slug: Schema4.optional(Slug)
|
|
175
|
+
});
|
|
176
|
+
var MemberUser = Schema4.Struct({
|
|
177
|
+
id: UserId,
|
|
178
|
+
name: Schema4.String,
|
|
179
|
+
email: Email,
|
|
180
|
+
image: Schema4.NullOr(Schema4.String)
|
|
181
|
+
});
|
|
182
|
+
var Member = Schema4.Struct({
|
|
183
|
+
id: MemberId,
|
|
184
|
+
user: MemberUser,
|
|
185
|
+
role: Role,
|
|
186
|
+
createdAt: Timestamp,
|
|
187
|
+
lastActiveAt: Schema4.NullOr(Timestamp)
|
|
188
|
+
});
|
|
189
|
+
var UpdateMemberRole = Schema4.Struct({ role: Role });
|
|
190
|
+
var InvitationStatus = Schema4.Literals([
|
|
191
|
+
"pending",
|
|
192
|
+
"accepted",
|
|
193
|
+
"declined",
|
|
194
|
+
"canceled",
|
|
195
|
+
"expired"
|
|
196
|
+
]);
|
|
197
|
+
var Invitation = Schema4.Struct({
|
|
198
|
+
id: InvitationId,
|
|
199
|
+
organizationId: OrganizationId,
|
|
200
|
+
email: Email,
|
|
201
|
+
role: InviteRole,
|
|
202
|
+
status: InvitationStatus,
|
|
203
|
+
invitedBy: Schema4.Struct({ id: UserId, name: Schema4.String }),
|
|
204
|
+
createdAt: Timestamp,
|
|
205
|
+
expiresAt: Timestamp
|
|
206
|
+
});
|
|
207
|
+
var CreateInvitation = Schema4.Struct({ email: Email, role: InviteRole });
|
|
208
|
+
var InvitationPreview = Schema4.Struct({
|
|
209
|
+
id: InvitationId,
|
|
210
|
+
email: Email,
|
|
211
|
+
role: InviteRole,
|
|
212
|
+
status: InvitationStatus,
|
|
213
|
+
expiresAt: Timestamp,
|
|
214
|
+
inviterName: Schema4.String,
|
|
215
|
+
organization: Schema4.Struct({
|
|
216
|
+
id: OrganizationId,
|
|
217
|
+
name: Schema4.String,
|
|
218
|
+
slug: Slug,
|
|
219
|
+
plan: OrganizationPlan,
|
|
220
|
+
memberCount: NonNegativeInt
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
var ApiKeyPermission = Schema4.Literals(["read", "write", "admin"]);
|
|
224
|
+
var ApiKey = Schema4.Struct({
|
|
225
|
+
id: ApiKeyId,
|
|
226
|
+
organizationId: OrganizationId,
|
|
227
|
+
name: Schema4.String,
|
|
228
|
+
prefix: Schema4.String,
|
|
229
|
+
lastFour: Schema4.String,
|
|
230
|
+
permission: ApiKeyPermission,
|
|
231
|
+
projectId: Schema4.NullOr(ProjectId),
|
|
232
|
+
createdAt: Timestamp,
|
|
233
|
+
createdBy: ActorReference,
|
|
234
|
+
lastUsedAt: Schema4.NullOr(Timestamp),
|
|
235
|
+
expiresAt: Schema4.NullOr(Timestamp),
|
|
236
|
+
revokedAt: Schema4.NullOr(Timestamp)
|
|
237
|
+
});
|
|
238
|
+
var CreateApiKey = Schema4.Struct({
|
|
239
|
+
name: Name,
|
|
240
|
+
permission: ApiKeyPermission,
|
|
241
|
+
projectId: Schema4.optional(ProjectId),
|
|
242
|
+
expiresAt: Schema4.optional(Timestamp)
|
|
243
|
+
});
|
|
244
|
+
var CreatedApiKey = Schema4.Struct({
|
|
245
|
+
key: ApiKey,
|
|
246
|
+
secret: Schema4.String
|
|
247
|
+
});
|
|
248
|
+
var Theme = Schema4.Literals(["light", "dark", "system"]);
|
|
249
|
+
var Preferences = Schema4.Struct({
|
|
250
|
+
defaultEnvironment: EnvironmentName,
|
|
251
|
+
openActorLinksInNewTab: Schema4.Boolean,
|
|
252
|
+
timeZone: Schema4.String,
|
|
253
|
+
pauseLiveTailOnScroll: Schema4.Boolean,
|
|
254
|
+
showReplayedCommands: Schema4.Boolean,
|
|
255
|
+
theme: Theme
|
|
256
|
+
});
|
|
257
|
+
var UpdatePreferences = Schema4.Struct({
|
|
258
|
+
defaultEnvironment: Schema4.optional(EnvironmentName),
|
|
259
|
+
openActorLinksInNewTab: Schema4.optional(Schema4.Boolean),
|
|
260
|
+
timeZone: Schema4.optional(Schema4.String),
|
|
261
|
+
pauseLiveTailOnScroll: Schema4.optional(Schema4.Boolean),
|
|
262
|
+
showReplayedCommands: Schema4.optional(Schema4.Boolean),
|
|
263
|
+
theme: Schema4.optional(Theme)
|
|
264
|
+
});
|
|
265
|
+
var NotificationEvent = Schema4.Literals([
|
|
266
|
+
"deploy_failed",
|
|
267
|
+
"dead_letter",
|
|
268
|
+
"spend_threshold"
|
|
269
|
+
]);
|
|
270
|
+
var NotificationPreference = Schema4.Struct({
|
|
271
|
+
event: NotificationEvent,
|
|
272
|
+
email: Schema4.Boolean,
|
|
273
|
+
slack: Schema4.Boolean
|
|
274
|
+
});
|
|
275
|
+
var NotificationSettings = Schema4.Struct({
|
|
276
|
+
preferences: Schema4.Array(NotificationPreference)
|
|
277
|
+
});
|
|
278
|
+
var PinnedActor = Schema4.Struct({
|
|
279
|
+
projectId: ProjectId,
|
|
280
|
+
environment: EnvironmentName,
|
|
281
|
+
address: Schema4.String,
|
|
282
|
+
status: Schema4.Literals(["awake", "idle", "unknown"]),
|
|
283
|
+
lastActivityAt: Schema4.NullOr(Timestamp)
|
|
284
|
+
});
|
|
285
|
+
var PinActor = Schema4.Struct({
|
|
286
|
+
projectId: ProjectId,
|
|
287
|
+
environment: EnvironmentName,
|
|
288
|
+
address: Schema4.String
|
|
289
|
+
});
|
|
290
|
+
// ../../packages/cloud-api/src/projects.ts
|
|
291
|
+
import { Schema as Schema5 } from "effect";
|
|
292
|
+
var ProjectStatus = Schema5.Literals(["empty", "live", "deploying", "failed"]);
|
|
293
|
+
var Region = Schema5.Struct({ id: RegionId, city: Schema5.String });
|
|
294
|
+
var Project = Schema5.Struct({
|
|
295
|
+
id: ProjectId,
|
|
296
|
+
organizationId: OrganizationId,
|
|
297
|
+
name: Schema5.String,
|
|
298
|
+
slug: Slug,
|
|
299
|
+
status: ProjectStatus,
|
|
300
|
+
homeRegion: RegionId,
|
|
301
|
+
createdAt: Timestamp
|
|
302
|
+
});
|
|
303
|
+
var CreateProject = Schema5.Struct({ name: Name, slug: Slug, homeRegion: RegionId });
|
|
304
|
+
var UpdateProject = Schema5.Struct({
|
|
305
|
+
name: Schema5.optional(Name),
|
|
306
|
+
slug: Schema5.optional(Slug)
|
|
307
|
+
});
|
|
308
|
+
var Environment = Schema5.Struct({
|
|
309
|
+
name: EnvironmentName,
|
|
310
|
+
projectId: ProjectId,
|
|
311
|
+
currentDeploymentId: Schema5.NullOr(DeploymentId),
|
|
312
|
+
database: Schema5.optionalKey(Schema5.Struct({
|
|
313
|
+
source: Schema5.Literal("customer"),
|
|
314
|
+
state: Schema5.Literals(["missing", "reachable", "unreachable"]),
|
|
315
|
+
latency: Schema5.NullOr(NonNegative),
|
|
316
|
+
latencyWarning: Schema5.Boolean,
|
|
317
|
+
runnerCap: Schema5.NullOr(Schema5.Int)
|
|
318
|
+
}))
|
|
319
|
+
});
|
|
320
|
+
var CreateEnvironment = Schema5.Struct({ name: EnvironmentName });
|
|
321
|
+
var EnvVariable = Schema5.Struct({
|
|
322
|
+
name: Schema5.String,
|
|
323
|
+
usedBy: Schema5.Array(Schema5.String),
|
|
324
|
+
updatedAt: Timestamp,
|
|
325
|
+
updatedBy: Schema5.NullOr(ActorReference)
|
|
326
|
+
});
|
|
327
|
+
var EnvVariableName = Schema5.String.pipe(Schema5.check(Schema5.isPattern(/^[A-Za-z_][A-Za-z0-9_]{0,255}$/)));
|
|
328
|
+
var SetEnvVariable = Schema5.Struct({
|
|
329
|
+
value: Schema5.String.pipe(Schema5.check(Schema5.isMaxLength(65536)))
|
|
330
|
+
});
|
|
331
|
+
var ImportEnvVariables = Schema5.Struct({
|
|
332
|
+
content: Schema5.String.pipe(Schema5.check(Schema5.isMaxLength(1048576)))
|
|
333
|
+
});
|
|
334
|
+
var ImportEnvVariablesResult = Schema5.Struct({
|
|
335
|
+
created: Schema5.Array(Schema5.String),
|
|
336
|
+
updated: Schema5.Array(Schema5.String)
|
|
337
|
+
});
|
|
338
|
+
var DomainStatus = Schema5.Literals(["pending", "verifying", "active"]);
|
|
339
|
+
var DnsRecord = Schema5.Struct({
|
|
340
|
+
type: Schema5.Literals(["A", "AAAA", "CNAME", "TXT"]),
|
|
341
|
+
name: Schema5.String,
|
|
342
|
+
value: Schema5.String
|
|
343
|
+
});
|
|
344
|
+
var Hostname = Schema5.String.pipe(Schema5.check(Schema5.isMaxLength(253), Schema5.isPattern(/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/)));
|
|
345
|
+
var Domain = Schema5.Struct({
|
|
346
|
+
id: DomainId,
|
|
347
|
+
hostname: Hostname,
|
|
348
|
+
environment: EnvironmentName,
|
|
349
|
+
status: DomainStatus,
|
|
350
|
+
dnsRecords: Schema5.Array(DnsRecord),
|
|
351
|
+
createdAt: Timestamp
|
|
352
|
+
});
|
|
353
|
+
var AddDomain = Schema5.Struct({ hostname: Hostname, environment: EnvironmentName });
|
|
354
|
+
var OwnedTable = Schema5.Struct({
|
|
355
|
+
name: Schema5.String,
|
|
356
|
+
actor: Schema5.String,
|
|
357
|
+
rows: NonNegativeInt,
|
|
358
|
+
sizeBytes: NonNegativeInt,
|
|
359
|
+
region: RegionId
|
|
360
|
+
});
|
|
361
|
+
var ProjectRegion = Schema5.Struct({
|
|
362
|
+
region: Region,
|
|
363
|
+
home: Schema5.Boolean,
|
|
364
|
+
tenantCount: NonNegativeInt,
|
|
365
|
+
database: Schema5.Struct({ version: Schema5.String, sizeBytes: NonNegativeInt }),
|
|
366
|
+
storage: Schema5.Struct({ usedBytes: NonNegativeInt, limitBytes: NonNegativeInt }),
|
|
367
|
+
cpuPercent: NonNegative,
|
|
368
|
+
connections: Schema5.Struct({ used: NonNegativeInt, limit: NonNegativeInt }),
|
|
369
|
+
runners: NonNegativeInt,
|
|
370
|
+
largestTables: Schema5.Array(OwnedTable)
|
|
371
|
+
});
|
|
372
|
+
var AddRegion = Schema5.Struct({ region: RegionId });
|
|
373
|
+
var SetHomeRegion = Schema5.Struct({ region: RegionId });
|
|
374
|
+
var ProjectEndpoints = Schema5.Struct({
|
|
375
|
+
httpBaseUrl: Schema5.String,
|
|
376
|
+
webSocketUrl: Schema5.String,
|
|
377
|
+
openApiPath: Schema5.String,
|
|
378
|
+
mcpPath: Schema5.String
|
|
379
|
+
});
|
|
380
|
+
var IntegrationKind = Schema5.Literals([
|
|
381
|
+
"github",
|
|
382
|
+
"slack",
|
|
383
|
+
"datadog",
|
|
384
|
+
"opentelemetry",
|
|
385
|
+
"pagerduty"
|
|
386
|
+
]);
|
|
387
|
+
var Integration = Schema5.Struct({
|
|
388
|
+
kind: IntegrationKind,
|
|
389
|
+
status: Schema5.Literals(["connected", "disconnected", "error"]),
|
|
390
|
+
label: Schema5.NullOr(Schema5.String),
|
|
391
|
+
connectedAt: Schema5.NullOr(Timestamp)
|
|
392
|
+
});
|
|
393
|
+
var ConnectIntegration = Schema5.Struct({
|
|
394
|
+
settings: Schema5.optional(Schema5.Record(Schema5.String, Schema5.String))
|
|
395
|
+
});
|
|
396
|
+
var IntegrationConnection = Schema5.Struct({
|
|
397
|
+
redirectUrl: Schema5.NullOr(Schema5.String),
|
|
398
|
+
integration: Integration
|
|
399
|
+
});
|
|
400
|
+
// ../../packages/cloud-api/src/deployments.ts
|
|
401
|
+
import { Schema as Schema6 } from "effect";
|
|
402
|
+
var DeploymentStatus = Schema6.Literals([
|
|
403
|
+
"in-progress",
|
|
404
|
+
"live",
|
|
405
|
+
"drained",
|
|
406
|
+
"rolled-back",
|
|
407
|
+
"failed"
|
|
408
|
+
]);
|
|
409
|
+
var RolloutStepName = Schema6.Literals([
|
|
410
|
+
"build",
|
|
411
|
+
"migrate",
|
|
412
|
+
"start-runners",
|
|
413
|
+
"drain-previous"
|
|
414
|
+
]);
|
|
415
|
+
var RolloutStep = Schema6.Struct({
|
|
416
|
+
name: RolloutStepName,
|
|
417
|
+
status: Schema6.Literals(["pending", "running", "succeeded", "failed", "skipped"]),
|
|
418
|
+
durationMs: Schema6.NullOr(NonNegativeInt),
|
|
419
|
+
detail: Schema6.NullOr(Schema6.String)
|
|
420
|
+
});
|
|
421
|
+
var DeploymentRunner = Schema6.Struct({
|
|
422
|
+
id: Schema6.String,
|
|
423
|
+
region: RegionId,
|
|
424
|
+
actorCount: Schema6.NullOr(NonNegativeInt),
|
|
425
|
+
cpuPercent: Schema6.NullOr(NonNegative),
|
|
426
|
+
health: Schema6.Literals(["healthy", "unhealthy", "starting", "draining"])
|
|
427
|
+
});
|
|
428
|
+
var DeploymentAuthor = Schema6.Struct({
|
|
429
|
+
name: Schema6.String,
|
|
430
|
+
image: Schema6.NullOr(Schema6.String)
|
|
431
|
+
});
|
|
432
|
+
var DeploymentSummary = Schema6.Struct({
|
|
433
|
+
id: DeploymentId,
|
|
434
|
+
projectId: ProjectId,
|
|
435
|
+
environment: EnvironmentName,
|
|
436
|
+
environmentHost: Schema6.optional(Schema6.String),
|
|
437
|
+
commitSha: CommitSha,
|
|
438
|
+
message: Schema6.String,
|
|
439
|
+
author: DeploymentAuthor,
|
|
440
|
+
regions: Schema6.Array(RegionId),
|
|
441
|
+
runnerCount: NonNegativeInt,
|
|
442
|
+
durationMs: Schema6.NullOr(NonNegativeInt),
|
|
443
|
+
status: DeploymentStatus,
|
|
444
|
+
rolledBackFrom: Schema6.NullOr(DeploymentId),
|
|
445
|
+
createdAt: Timestamp
|
|
446
|
+
});
|
|
447
|
+
var DeploymentDetail = Schema6.Struct({
|
|
448
|
+
...DeploymentSummary.fields,
|
|
449
|
+
steps: Schema6.Array(RolloutStep),
|
|
450
|
+
runners: Schema6.Array(DeploymentRunner)
|
|
451
|
+
});
|
|
452
|
+
var SourceDigest = Schema6.String.pipe(Schema6.check(Schema6.isPattern(/^sha256:[a-f0-9]{64}$/u)));
|
|
453
|
+
var MAX_SOURCE_BYTES = 64 * 1024 * 1024;
|
|
454
|
+
var SourceArchive = Schema6.Struct({
|
|
455
|
+
digest: SourceDigest,
|
|
456
|
+
sizeBytes: NonNegativeInt
|
|
457
|
+
});
|
|
458
|
+
var SOURCE_ENTRY = "src/app.ts";
|
|
459
|
+
var DeploymentSource = Schema6.Struct({
|
|
460
|
+
digest: SourceDigest,
|
|
461
|
+
dockerfile: Schema6.optionalKey(Schema6.Never.annotate({
|
|
462
|
+
message: `source.dockerfile is not accepted: the platform builds every source from ${SOURCE_ENTRY}`
|
|
463
|
+
}))
|
|
464
|
+
});
|
|
465
|
+
var CreateDeployment = Schema6.Struct({
|
|
466
|
+
environment: EnvironmentName,
|
|
467
|
+
commitSha: CommitSha,
|
|
468
|
+
message: Schema6.optional(Schema6.String),
|
|
469
|
+
regions: Schema6.optional(Schema6.Array(RegionId)),
|
|
470
|
+
source: Schema6.optional(DeploymentSource)
|
|
471
|
+
});
|
|
472
|
+
var ImageDigest = Schema6.String.pipe(Schema6.check(Schema6.isPattern(/^(?:[^\s@]+@)?sha256:[a-f0-9]{64}$/u)));
|
|
473
|
+
var RecordBuild = Schema6.Struct({
|
|
474
|
+
image: ImageDigest,
|
|
475
|
+
commitSha: CommitSha,
|
|
476
|
+
environmentSnapshot: Schema6.Record(Schema6.String, Schema6.String).check(Schema6.makeFilter((snapshot) => Object.keys(snapshot).every((key) => /^[A-Za-z_][A-Za-z0-9_]{0,254}$/u.test(key)) || "Environment variable names must be valid identifiers"))
|
|
477
|
+
});
|
|
478
|
+
var FailBuild = Schema6.Struct({
|
|
479
|
+
reason: Schema6.String.check(Schema6.isMinLength(1), Schema6.isMaxLength(4096))
|
|
480
|
+
});
|
|
481
|
+
var BuildLogLine = Schema6.Struct({
|
|
482
|
+
index: NonNegativeInt,
|
|
483
|
+
at: Timestamp,
|
|
484
|
+
stream: Schema6.Literals(["stdout", "stderr"]),
|
|
485
|
+
text: Schema6.String
|
|
486
|
+
});
|
|
487
|
+
var BuildLog = Schema6.Struct({
|
|
488
|
+
lines: Schema6.Array(BuildLogLine),
|
|
489
|
+
complete: Schema6.Boolean
|
|
490
|
+
});
|
|
491
|
+
// ../../packages/cloud-api/src/runtime.ts
|
|
492
|
+
import * as Framework from "@rikalabs/akter/client";
|
|
493
|
+
import { Schema as Schema7, Struct } from "effect";
|
|
494
|
+
var SidebarCounts = Schema7.Struct({
|
|
495
|
+
actorTypes: NonNegativeInt,
|
|
496
|
+
openDeadLetters: NonNegativeInt
|
|
497
|
+
});
|
|
498
|
+
var Overview = Schema7.Struct({
|
|
499
|
+
commands: Schema7.NullOr(Schema7.Struct({
|
|
500
|
+
perSecond: NonNegative,
|
|
501
|
+
series24h: Schema7.Array(SeriesPoint),
|
|
502
|
+
p50Ms: Schema7.NullOr(NonNegative),
|
|
503
|
+
p99Ms: Schema7.NullOr(NonNegative)
|
|
504
|
+
})),
|
|
505
|
+
actors: Schema7.Struct({ awake: Schema7.NullOr(NonNegativeInt), total: NonNegativeInt }),
|
|
506
|
+
jobs: Schema7.Struct({ inFlight: NonNegativeInt, donePerHour: Schema7.NullOr(NonNegativeInt) }),
|
|
507
|
+
deadLettersByJobType: Schema7.Array(Schema7.Struct({ jobName: Schema7.String, count: NonNegativeInt })),
|
|
508
|
+
throughput: Schema7.NullOr(Schema7.Array(SeriesPoint)),
|
|
509
|
+
p99: Schema7.NullOr(Schema7.Array(SeriesPoint)),
|
|
510
|
+
health: Schema7.Struct({
|
|
511
|
+
runners: Schema7.NullOr(Schema7.Struct({ healthy: NonNegativeInt, total: NonNegativeInt })),
|
|
512
|
+
databaseCpuPercent: Schema7.NullOr(NonNegative),
|
|
513
|
+
maxMailbox: Schema7.NullOr(Schema7.Struct({ depth: NonNegativeInt, actor: Schema7.NullOr(ActorAddress) })),
|
|
514
|
+
parkedSockets: Schema7.NullOr(NonNegativeInt),
|
|
515
|
+
outboxLagP99Ms: Schema7.NullOr(NonNegative),
|
|
516
|
+
lastDeployAt: Schema7.NullOr(Timestamp)
|
|
517
|
+
}),
|
|
518
|
+
recentDeployments: Schema7.NullOr(Schema7.Array(DeploymentSummary))
|
|
519
|
+
});
|
|
520
|
+
var ActorTypeSummary = Schema7.Struct({
|
|
521
|
+
name: Schema7.String,
|
|
522
|
+
commands: Schema7.NullOr(Schema7.Array(Schema7.String)),
|
|
523
|
+
instances: NonNegativeInt,
|
|
524
|
+
awake: Schema7.NullOr(NonNegativeInt),
|
|
525
|
+
commandsPerSecond: Schema7.NullOr(NonNegative),
|
|
526
|
+
p99Ms: Schema7.NullOr(NonNegative),
|
|
527
|
+
maxMailbox: Schema7.NullOr(NonNegativeInt)
|
|
528
|
+
});
|
|
529
|
+
var SeriesWindow = Schema7.Literals(["1h", "24h", "7d"]);
|
|
530
|
+
var CommandVolume = Schema7.Struct({
|
|
531
|
+
command: Schema7.String,
|
|
532
|
+
count: NonNegativeInt,
|
|
533
|
+
perSecond: NonNegative
|
|
534
|
+
});
|
|
535
|
+
var ActorTypeActivity = Schema7.Struct({
|
|
536
|
+
window: SeriesWindow,
|
|
537
|
+
since: Timestamp,
|
|
538
|
+
series: Schema7.Array(SeriesPoint),
|
|
539
|
+
commands: Schema7.Array(CommandVolume)
|
|
540
|
+
});
|
|
541
|
+
var LatencyBucket = Schema7.Struct({
|
|
542
|
+
upToMs: Schema7.NullOr(NonNegative),
|
|
543
|
+
count: NonNegativeInt
|
|
544
|
+
});
|
|
545
|
+
var TurnLatency = Schema7.Struct({
|
|
546
|
+
window: SeriesWindow,
|
|
547
|
+
since: Timestamp,
|
|
548
|
+
buckets: Schema7.Array(LatencyBucket),
|
|
549
|
+
p50Ms: Schema7.NullOr(NonNegative),
|
|
550
|
+
p95Ms: Schema7.NullOr(NonNegative),
|
|
551
|
+
p99Ms: Schema7.NullOr(NonNegative)
|
|
552
|
+
});
|
|
553
|
+
var ActorInstance = Schema7.Struct({
|
|
554
|
+
key: Schema7.String,
|
|
555
|
+
status: Schema7.NullOr(Schema7.Literals(["awake", "idle"])),
|
|
556
|
+
lastCommand: Schema7.NullOr(Schema7.String),
|
|
557
|
+
lastActivityAt: Schema7.NullOr(Timestamp),
|
|
558
|
+
generation: NonNegativeInt
|
|
559
|
+
});
|
|
560
|
+
var OwnedTableRows = Schema7.Struct({
|
|
561
|
+
table: Schema7.String,
|
|
562
|
+
columns: Schema7.Array(Schema7.String),
|
|
563
|
+
rows: Schema7.Array(Schema7.Array(Schema7.Json))
|
|
564
|
+
});
|
|
565
|
+
var CommandCaller = Schema7.Struct({
|
|
566
|
+
kind: Schema7.Literals(["user", "anonymous", "system"]),
|
|
567
|
+
subject: Schema7.NullOr(Schema7.String),
|
|
568
|
+
source: Schema7.NullOr(Schema7.String)
|
|
569
|
+
});
|
|
570
|
+
var Receipt = Schema7.Struct({
|
|
571
|
+
commandId: Schema7.String,
|
|
572
|
+
command: Schema7.String,
|
|
573
|
+
result: Schema7.NullOr(Schema7.String),
|
|
574
|
+
caller: Schema7.NullOr(CommandCaller),
|
|
575
|
+
at: Schema7.NullOr(Timestamp),
|
|
576
|
+
expiresAt: Timestamp,
|
|
577
|
+
replayed: Schema7.Boolean
|
|
578
|
+
});
|
|
579
|
+
var ActorEvent = Schema7.Struct({
|
|
580
|
+
name: Schema7.String,
|
|
581
|
+
cursor: Schema7.String,
|
|
582
|
+
emittedAt: Timestamp,
|
|
583
|
+
subscribers: Schema7.NullOr(NonNegativeInt)
|
|
584
|
+
});
|
|
585
|
+
var JobStatus = Schema7.Literals(["queued", "running", "retrying", "done", "dead"]);
|
|
586
|
+
var ActorJob = Schema7.Struct({
|
|
587
|
+
name: Schema7.String,
|
|
588
|
+
id: Schema7.String,
|
|
589
|
+
attempts: NonNegativeInt,
|
|
590
|
+
status: JobStatus
|
|
591
|
+
});
|
|
592
|
+
var ActorTimelineEntry = Schema7.Struct({
|
|
593
|
+
at: Timestamp,
|
|
594
|
+
kind: Schema7.Literals(["command", "event", "job"]),
|
|
595
|
+
label: Schema7.String,
|
|
596
|
+
detail: Schema7.NullOr(Schema7.String),
|
|
597
|
+
caller: Schema7.NullOr(CommandCaller)
|
|
598
|
+
});
|
|
599
|
+
var ActorInspector = Schema7.Struct({
|
|
600
|
+
address: ActorAddress,
|
|
601
|
+
state: Schema7.Json,
|
|
602
|
+
turn: Schema7.NullOr(NonNegativeInt),
|
|
603
|
+
tables: Schema7.NullOr(Schema7.Array(OwnedTableRows)),
|
|
604
|
+
receipts: Schema7.Array(Receipt),
|
|
605
|
+
events: Schema7.Array(ActorEvent),
|
|
606
|
+
jobs: Schema7.Array(ActorJob),
|
|
607
|
+
connections: Schema7.Struct({
|
|
608
|
+
sockets: Schema7.NullOr(NonNegativeInt),
|
|
609
|
+
feedCursor: Schema7.NullOr(Schema7.String)
|
|
610
|
+
}),
|
|
611
|
+
properties: Schema7.Struct({
|
|
612
|
+
status: Schema7.NullOr(Schema7.Literals(["awake", "idle"])),
|
|
613
|
+
type: Schema7.String,
|
|
614
|
+
generation: NonNegativeInt,
|
|
615
|
+
runner: Schema7.NullOr(Schema7.String),
|
|
616
|
+
region: Schema7.NullOr(Schema7.String),
|
|
617
|
+
tenant: Schema7.String,
|
|
618
|
+
mailboxDepth: Schema7.NullOr(NonNegativeInt)
|
|
619
|
+
}),
|
|
620
|
+
timeline: Schema7.NullOr(Schema7.Array(ActorTimelineEntry))
|
|
621
|
+
});
|
|
622
|
+
var CommandOutcome = Schema7.Literals(["ok", "error", "replayed"]);
|
|
623
|
+
var CommandLogEntry = Schema7.Struct({
|
|
624
|
+
commandId: Schema7.String,
|
|
625
|
+
at: Schema7.NullOr(Timestamp),
|
|
626
|
+
durationMs: Schema7.NullOr(NonNegative),
|
|
627
|
+
address: ActorAddress,
|
|
628
|
+
command: Schema7.String,
|
|
629
|
+
caller: Schema7.NullOr(CommandCaller),
|
|
630
|
+
payloadPreview: Schema7.NullOr(Schema7.String),
|
|
631
|
+
outcome: CommandOutcome,
|
|
632
|
+
errorTag: Schema7.NullOr(Schema7.String)
|
|
633
|
+
});
|
|
634
|
+
var commandName = Schema7.String.pipe(Schema7.check(Schema7.isMinLength(1), Schema7.isMaxLength(128)));
|
|
635
|
+
var SendCommand = Schema7.Struct({
|
|
636
|
+
address: ActorAddress,
|
|
637
|
+
command: commandName,
|
|
638
|
+
payload: Schema7.Json,
|
|
639
|
+
commandId: Schema7.optional(commandName)
|
|
640
|
+
});
|
|
641
|
+
var CommandSent = Schema7.Struct({
|
|
642
|
+
commandId: Schema7.String,
|
|
643
|
+
result: Schema7.Json,
|
|
644
|
+
replayed: Schema7.Boolean
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
class CommandExpired extends Schema7.TaggedError()("CommandExpired", { commandId: Schema7.String }, { httpApiStatus: 410 }) {
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
class CommandStreamGap extends Schema7.TaggedError()("CommandStreamGap", {}) {
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
class RunnerDefect extends Schema7.TaggedError()("RunnerDefect", {}, { httpApiStatus: 502 }) {
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
class CommandRefused extends Schema7.TaggedError()("CommandRefused", {
|
|
657
|
+
commandId: Schema7.String,
|
|
658
|
+
reasonTag: Schema7.String,
|
|
659
|
+
reason: Framework.ActorError.fields.reason
|
|
660
|
+
}, { httpApiStatus: 422 }) {
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
class CommandFailed extends Schema7.TaggedError()("CommandFailed", {
|
|
664
|
+
commandId: Schema7.String,
|
|
665
|
+
errorTag: Schema7.String,
|
|
666
|
+
error: Schema7.Json,
|
|
667
|
+
replayed: Schema7.Boolean
|
|
668
|
+
}, { httpApiStatus: 422 }) {
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
class QuotaExceeded2 extends Schema7.TaggedError()("QuotaExceeded", Struct.omit(Framework.QuotaExceeded.fields, ["_tag"]), { httpApiStatus: 429 }) {
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
class QuotaUnbound extends Schema7.TaggedError()("QuotaUnbound", {
|
|
675
|
+
deployment: Schema7.String,
|
|
676
|
+
tenant: Schema7.String,
|
|
677
|
+
reason: Schema7.Literals(["tenant", "account", "plan"])
|
|
678
|
+
}, { httpApiStatus: 402 }) {
|
|
679
|
+
}
|
|
680
|
+
var QuotaErrors = [QuotaExceeded2, QuotaUnbound];
|
|
681
|
+
var JobTypeStats = Schema7.Struct({
|
|
682
|
+
jobName: Schema7.String,
|
|
683
|
+
done: Schema7.NullOr(NonNegativeInt),
|
|
684
|
+
retried: NonNegativeInt,
|
|
685
|
+
dead: NonNegativeInt,
|
|
686
|
+
p99Ms: Schema7.NullOr(NonNegative)
|
|
687
|
+
});
|
|
688
|
+
var JobsSummary = Schema7.Struct({
|
|
689
|
+
queued: NonNegativeInt,
|
|
690
|
+
running: Schema7.NullOr(NonNegativeInt),
|
|
691
|
+
retrying: NonNegativeInt,
|
|
692
|
+
dead: NonNegativeInt,
|
|
693
|
+
byType: Schema7.Array(JobTypeStats),
|
|
694
|
+
throughput: Schema7.NullOr(Schema7.Array(SeriesPoint))
|
|
695
|
+
});
|
|
696
|
+
var DeadLetter = Schema7.Struct({
|
|
697
|
+
id: DeadLetterId,
|
|
698
|
+
jobName: Schema7.String,
|
|
699
|
+
jobId: Schema7.String,
|
|
700
|
+
actor: ActorAddress,
|
|
701
|
+
attempts: NonNegativeInt,
|
|
702
|
+
lastError: Schema7.String,
|
|
703
|
+
since: Timestamp
|
|
704
|
+
});
|
|
705
|
+
var Workflow = Schema7.Struct({
|
|
706
|
+
id: Schema7.String,
|
|
707
|
+
name: Schema7.String,
|
|
708
|
+
actor: ActorAddress,
|
|
709
|
+
step: Schema7.NullOr(Schema7.Struct({
|
|
710
|
+
index: Schema7.Int.pipe(Schema7.check(Schema7.isGreaterThanOrEqualTo(1))),
|
|
711
|
+
total: Schema7.NullOr(Schema7.Int.pipe(Schema7.check(Schema7.isGreaterThanOrEqualTo(1)))),
|
|
712
|
+
name: Schema7.String
|
|
713
|
+
}).pipe(Schema7.check(Schema7.makeFilter((step) => step.total === null || step.index <= step.total || "step.index must not exceed step.total")))),
|
|
714
|
+
waitingFor: Schema7.NullOr(Schema7.Struct({ kind: Schema7.Literals(["event", "timer"]), name: Schema7.String })),
|
|
715
|
+
startedAt: Timestamp,
|
|
716
|
+
status: Schema7.NullOr(Schema7.Literals(["running", "waiting", "completed", "failed"]))
|
|
717
|
+
});
|
|
718
|
+
var TimersSummary = Schema7.Struct({
|
|
719
|
+
pending: NonNegativeInt,
|
|
720
|
+
nextFireAt: Schema7.NullOr(Timestamp)
|
|
721
|
+
});
|
|
722
|
+
var Schedule = Schema7.Struct({
|
|
723
|
+
name: Schema7.String,
|
|
724
|
+
actorPattern: Schema7.String,
|
|
725
|
+
cron: Schema7.String,
|
|
726
|
+
lastRun: Schema7.NullOr(Schema7.Struct({
|
|
727
|
+
at: Timestamp,
|
|
728
|
+
outcome: Schema7.Literals(["ok", "error"]),
|
|
729
|
+
durationMs: Schema7.NullOr(NonNegative)
|
|
730
|
+
})),
|
|
731
|
+
nextRunAt: Schema7.NullOr(Timestamp)
|
|
732
|
+
});
|
|
733
|
+
var ConnectionsSummary = Schema7.Struct({
|
|
734
|
+
open: NonNegativeInt,
|
|
735
|
+
parked: Schema7.NullOr(NonNegativeInt),
|
|
736
|
+
sseStreams: NonNegativeInt,
|
|
737
|
+
feedSubscribers: NonNegativeInt,
|
|
738
|
+
replayGaps: Schema7.NullOr(NonNegativeInt),
|
|
739
|
+
openVersusParked: Schema7.NullOr(Schema7.Array(Schema7.Struct({ at: Timestamp, open: NonNegativeInt, parked: NonNegativeInt }))),
|
|
740
|
+
byActorType: Schema7.Array(Schema7.Struct({
|
|
741
|
+
actorType: Schema7.String,
|
|
742
|
+
open: NonNegativeInt,
|
|
743
|
+
parked: Schema7.NullOr(NonNegativeInt),
|
|
744
|
+
sse: NonNegativeInt
|
|
745
|
+
}))
|
|
746
|
+
});
|
|
747
|
+
var SearchResult = Schema7.Struct({
|
|
748
|
+
kind: Schema7.Literals(["actor-type", "actor", "deployment"]),
|
|
749
|
+
id: Schema7.String,
|
|
750
|
+
title: Schema7.String,
|
|
751
|
+
subtitle: Schema7.NullOr(Schema7.String)
|
|
752
|
+
});
|
|
753
|
+
// ../../packages/cloud-api/src/billing.ts
|
|
754
|
+
import { Schema as Schema8 } from "effect";
|
|
755
|
+
var Plan = Schema8.TaggedStruct("known", {
|
|
756
|
+
id: PlanId,
|
|
757
|
+
name: Schema8.String,
|
|
758
|
+
basePriceCents: NonNegativeInt,
|
|
759
|
+
currency: Schema8.Literal("usd"),
|
|
760
|
+
renewsAt: Schema8.NullOr(Timestamp),
|
|
761
|
+
monthToDateEstimateCents: NonNegativeInt,
|
|
762
|
+
provisional: Schema8.optionalKey(Schema8.Boolean),
|
|
763
|
+
subscribedId: Schema8.optionalKey(PlanId),
|
|
764
|
+
paymentStatus: Schema8.optionalKey(Schema8.Literals(["free", "active", "past_due", "unpaid", "canceled", "incomplete"]))
|
|
765
|
+
});
|
|
766
|
+
var CardPaymentMethod = Schema8.TaggedStruct("card", {
|
|
767
|
+
brand: Schema8.String,
|
|
768
|
+
lastFour: Schema8.String,
|
|
769
|
+
expiryMonth: Schema8.Int.pipe(Schema8.check(Schema8.isBetween({ minimum: 1, maximum: 12 }))),
|
|
770
|
+
expiryYear: NonNegativeInt
|
|
771
|
+
});
|
|
772
|
+
var LinkPaymentMethod = Schema8.TaggedStruct("link", {
|
|
773
|
+
email: Schema8.NullOr(Schema8.String)
|
|
774
|
+
});
|
|
775
|
+
var PaymentMethod = Schema8.Union([CardPaymentMethod, LinkPaymentMethod]);
|
|
776
|
+
var SpendLimit = Schema8.Struct({
|
|
777
|
+
limitCents: Schema8.NullOr(NonNegativeInt),
|
|
778
|
+
currentSpendCents: NonNegativeInt
|
|
779
|
+
});
|
|
780
|
+
var capFields = {
|
|
781
|
+
limit: Schema8.NullOr(NonNegative),
|
|
782
|
+
used: NonNegative,
|
|
783
|
+
atCap: Schema8.Boolean,
|
|
784
|
+
refusing: Schema8.Boolean,
|
|
785
|
+
reason: Schema8.optionalKey(Schema8.Literal("unbound"))
|
|
786
|
+
};
|
|
787
|
+
var CapState = Schema8.Struct({
|
|
788
|
+
cap: Schema8.Literals(["spend", "connections", "compute"]),
|
|
789
|
+
...capFields
|
|
790
|
+
});
|
|
791
|
+
var BillingSummary = Schema8.Struct({
|
|
792
|
+
plan: Schema8.Union([Plan, UnboundPlan]),
|
|
793
|
+
paymentMethod: Schema8.NullOr(PaymentMethod),
|
|
794
|
+
billingEmail: Schema8.NullOr(Email),
|
|
795
|
+
spendLimit: SpendLimit,
|
|
796
|
+
caps: Schema8.optionalKey(Schema8.Array(CapState))
|
|
797
|
+
});
|
|
798
|
+
var SetSpendLimit = Schema8.Struct({ limitCents: Schema8.NullOr(NonNegativeInt) });
|
|
799
|
+
var Invoice = Schema8.Struct({
|
|
800
|
+
id: InvoiceId,
|
|
801
|
+
number: Schema8.String,
|
|
802
|
+
periodStart: Timestamp,
|
|
803
|
+
periodEnd: Timestamp,
|
|
804
|
+
amountCents: NonNegativeInt,
|
|
805
|
+
currency: Schema8.Literal("usd"),
|
|
806
|
+
status: Schema8.Literals(["draft", "open", "paid", "void", "uncollectible"]),
|
|
807
|
+
pdfUrl: Schema8.NullOr(Schema8.String)
|
|
808
|
+
});
|
|
809
|
+
var StartCheckout = Schema8.Struct({ plan: Schema8.Literals(["pro", "team", "enterprise"]) });
|
|
810
|
+
var PlanChange = Schema8.Struct({
|
|
811
|
+
requestId: Schema8.String,
|
|
812
|
+
status: Schema8.Literals(["pending", "completed", "failed"])
|
|
813
|
+
});
|
|
814
|
+
var HostedSession = Schema8.Struct({ url: Schema8.String });
|
|
815
|
+
var machineSizeFields = {
|
|
816
|
+
cpuKind: Schema8.Literals(["shared", "performance"]),
|
|
817
|
+
cpus: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1)),
|
|
818
|
+
memoryMb: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1))
|
|
819
|
+
};
|
|
820
|
+
var PlanFeature = Schema8.Literals([
|
|
821
|
+
"compute-overage",
|
|
822
|
+
"compute-cap",
|
|
823
|
+
"byo-database",
|
|
824
|
+
"checkout"
|
|
825
|
+
]);
|
|
826
|
+
var CatalogPlan = Schema8.Struct({
|
|
827
|
+
id: PlanId,
|
|
828
|
+
name: Schema8.String,
|
|
829
|
+
basePriceCents: NonNegativeInt,
|
|
830
|
+
currency: Schema8.Literal("usd"),
|
|
831
|
+
allowances: Schema8.Struct({
|
|
832
|
+
computeUnitHours: NonNegative,
|
|
833
|
+
computeUnitHourCap: Schema8.NullOr(NonNegative),
|
|
834
|
+
concurrentConnections: NonNegativeInt
|
|
835
|
+
}),
|
|
836
|
+
overage: Schema8.Struct({
|
|
837
|
+
computeCentsPerUnitHour: NonNegative
|
|
838
|
+
}),
|
|
839
|
+
features: Schema8.Array(PlanFeature),
|
|
840
|
+
provisional: Schema8.Boolean
|
|
841
|
+
});
|
|
842
|
+
var ComputeSize = Schema8.Struct({
|
|
843
|
+
...machineSizeFields,
|
|
844
|
+
unitsPerHour: Schema8.Finite.check(Schema8.isGreaterThan(0))
|
|
845
|
+
});
|
|
846
|
+
var PlanCatalog = Schema8.Struct({
|
|
847
|
+
plans: Schema8.Array(CatalogPlan),
|
|
848
|
+
computeSizes: Schema8.Array(ComputeSize),
|
|
849
|
+
provisional: Schema8.Boolean
|
|
850
|
+
});
|
|
851
|
+
var UsageMeterName = Schema8.Literal("runnerHours");
|
|
852
|
+
var UsageMeter = Schema8.Struct({
|
|
853
|
+
meter: UsageMeterName,
|
|
854
|
+
used: NonNegative,
|
|
855
|
+
included: NonNegative,
|
|
856
|
+
overage: NonNegative,
|
|
857
|
+
overageCostCents: NonNegative
|
|
858
|
+
});
|
|
859
|
+
var UsagePricing = Schema8.Struct({
|
|
860
|
+
computeCentsPerUnitHour: NonNegative,
|
|
861
|
+
provisional: Schema8.optionalKey(Schema8.Boolean)
|
|
862
|
+
});
|
|
863
|
+
var ComputeUsage = Schema8.Struct({
|
|
864
|
+
environmentId: EnvironmentId,
|
|
865
|
+
...machineSizeFields,
|
|
866
|
+
machineHours: NonNegative,
|
|
867
|
+
computeUnitHours: NonNegative
|
|
868
|
+
});
|
|
869
|
+
var Usage = Schema8.Struct({
|
|
870
|
+
period: BillingPeriod,
|
|
871
|
+
meters: Schema8.Array(UsageMeter),
|
|
872
|
+
caps: Schema8.Array(CapState),
|
|
873
|
+
byProject: Schema8.Array(Schema8.Struct({
|
|
874
|
+
projectId: ProjectId,
|
|
875
|
+
name: Schema8.String,
|
|
876
|
+
computeUnitHours: NonNegative,
|
|
877
|
+
compute: Schema8.Array(ComputeUsage),
|
|
878
|
+
estimatedCostCents: NonNegative
|
|
879
|
+
})),
|
|
880
|
+
pricing: UsagePricing
|
|
881
|
+
});
|
|
882
|
+
var AuditEntry = Schema8.Struct({
|
|
883
|
+
id: Schema8.String,
|
|
884
|
+
at: Timestamp,
|
|
885
|
+
actor: ActorReference,
|
|
886
|
+
action: Schema8.String,
|
|
887
|
+
target: Schema8.Struct({
|
|
888
|
+
type: Schema8.String,
|
|
889
|
+
id: Schema8.NullOr(Schema8.String),
|
|
890
|
+
name: Schema8.NullOr(Schema8.String)
|
|
891
|
+
}),
|
|
892
|
+
ipAddress: Schema8.NullOr(Schema8.String)
|
|
893
|
+
});
|
|
894
|
+
// ../../packages/cloud-api/src/contract.ts
|
|
895
|
+
import { HttpApi, OpenApi as OpenApi3 } from "effect/http-api";
|
|
896
|
+
|
|
897
|
+
// ../../packages/cloud-api/src/groups/account.ts
|
|
898
|
+
import { Schema as Schema9 } from "effect";
|
|
899
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
900
|
+
var organizationParams = { organizationId: OrganizationId };
|
|
901
|
+
|
|
902
|
+
class AccountGroup extends HttpApiGroup.make("account").add(HttpApiEndpoint.get("me", "/me", { success: Me, error: SelfErrors }), HttpApiEndpoint.get("exportData", "/me/export", {
|
|
903
|
+
success: PersonalDataExport,
|
|
904
|
+
error: SelfErrors
|
|
905
|
+
}), HttpApiEndpoint.delete("deleteAccount", "/me", {
|
|
906
|
+
payload: DeleteAccount,
|
|
907
|
+
error: WriteErrors
|
|
908
|
+
}), HttpApiEndpoint.patch("updateProfile", "/me", {
|
|
909
|
+
payload: UpdateProfile,
|
|
910
|
+
success: User,
|
|
911
|
+
error: SelfErrors
|
|
912
|
+
}), HttpApiEndpoint.put("setActiveOrganization", "/me/active-organization", {
|
|
913
|
+
payload: SetActiveOrganization,
|
|
914
|
+
success: OrganizationMembership,
|
|
915
|
+
error: WriteErrors
|
|
916
|
+
}), HttpApiEndpoint.get("getPreferences", "/me/preferences", {
|
|
917
|
+
success: Preferences,
|
|
918
|
+
error: SelfErrors
|
|
919
|
+
}), HttpApiEndpoint.patch("updatePreferences", "/me/preferences", {
|
|
920
|
+
payload: UpdatePreferences,
|
|
921
|
+
success: Preferences,
|
|
922
|
+
error: SelfErrors
|
|
923
|
+
}), HttpApiEndpoint.get("getNotifications", "/me/notifications", {
|
|
924
|
+
success: NotificationSettings,
|
|
925
|
+
error: SelfErrors
|
|
926
|
+
}), HttpApiEndpoint.put("setNotifications", "/me/notifications", {
|
|
927
|
+
payload: NotificationSettings,
|
|
928
|
+
success: NotificationSettings,
|
|
929
|
+
error: SelfErrors
|
|
930
|
+
}), HttpApiEndpoint.get("listPinnedActors", "/me/pinned-actors", {
|
|
931
|
+
query: { projectId: ProjectId, environment: EnvironmentName },
|
|
932
|
+
success: Schema9.Array(PinnedActor),
|
|
933
|
+
error: ReadErrors
|
|
934
|
+
}), HttpApiEndpoint.post("pinActor", "/me/pinned-actors", {
|
|
935
|
+
payload: PinActor,
|
|
936
|
+
success: PinnedActor,
|
|
937
|
+
error: WriteErrors
|
|
938
|
+
}), HttpApiEndpoint.delete("unpinActor", "/me/pinned-actors", {
|
|
939
|
+
query: { projectId: ProjectId, environment: EnvironmentName, address: Schema9.String },
|
|
940
|
+
error: WriteErrors
|
|
941
|
+
})) {
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
class OrganizationsGroup extends HttpApiGroup.make("organizations").add(HttpApiEndpoint.get("list", "/organizations", {
|
|
945
|
+
success: Schema9.Array(OrganizationMembership),
|
|
946
|
+
error: SelfErrors
|
|
947
|
+
}), HttpApiEndpoint.post("create", "/organizations", {
|
|
948
|
+
payload: CreateOrganization,
|
|
949
|
+
success: OrganizationMembership,
|
|
950
|
+
error: WriteErrors
|
|
951
|
+
}), HttpApiEndpoint.get("get", "/organizations/:organizationId", {
|
|
952
|
+
params: organizationParams,
|
|
953
|
+
success: OrganizationMembership,
|
|
954
|
+
error: ReadErrors
|
|
955
|
+
}), HttpApiEndpoint.patch("update", "/organizations/:organizationId", {
|
|
956
|
+
params: organizationParams,
|
|
957
|
+
payload: UpdateOrganization,
|
|
958
|
+
success: Organization,
|
|
959
|
+
error: WriteErrors
|
|
960
|
+
}), HttpApiEndpoint.delete("delete", "/organizations/:organizationId", {
|
|
961
|
+
params: organizationParams,
|
|
962
|
+
error: WriteErrors
|
|
963
|
+
}), HttpApiEndpoint.get("getDeletion", "/organizations/:organizationId/deletion", {
|
|
964
|
+
params: organizationParams,
|
|
965
|
+
success: OrganizationDeletion,
|
|
966
|
+
error: ReadErrors
|
|
967
|
+
})) {
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
class MembersGroup extends HttpApiGroup.make("members").add(HttpApiEndpoint.get("list", "/organizations/:organizationId/members", {
|
|
971
|
+
params: organizationParams,
|
|
972
|
+
success: Schema9.Array(Member),
|
|
973
|
+
error: ReadErrors
|
|
974
|
+
}), HttpApiEndpoint.patch("updateRole", "/organizations/:organizationId/members/:memberId", {
|
|
975
|
+
params: { ...organizationParams, memberId: MemberId },
|
|
976
|
+
payload: UpdateMemberRole,
|
|
977
|
+
success: Member,
|
|
978
|
+
error: WriteErrors
|
|
979
|
+
}), HttpApiEndpoint.delete("remove", "/organizations/:organizationId/members/:memberId", {
|
|
980
|
+
params: { ...organizationParams, memberId: MemberId },
|
|
981
|
+
error: WriteErrors
|
|
982
|
+
})) {
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
class InvitationsGroup extends HttpApiGroup.make("invitations").add(HttpApiEndpoint.get("list", "/organizations/:organizationId/invitations", {
|
|
986
|
+
params: organizationParams,
|
|
987
|
+
success: Schema9.Array(Invitation),
|
|
988
|
+
error: ReadErrors
|
|
989
|
+
}), HttpApiEndpoint.post("create", "/organizations/:organizationId/invitations", {
|
|
990
|
+
params: organizationParams,
|
|
991
|
+
payload: CreateInvitation,
|
|
992
|
+
success: Invitation,
|
|
993
|
+
error: WriteErrors
|
|
994
|
+
}), HttpApiEndpoint.post("resend", "/organizations/:organizationId/invitations/:invitationId/resend", {
|
|
995
|
+
params: { ...organizationParams, invitationId: InvitationId },
|
|
996
|
+
success: Invitation,
|
|
997
|
+
error: WriteErrors
|
|
998
|
+
}), HttpApiEndpoint.delete("cancel", "/organizations/:organizationId/invitations/:invitationId", {
|
|
999
|
+
params: { ...organizationParams, invitationId: InvitationId },
|
|
1000
|
+
error: WriteErrors
|
|
1001
|
+
}), HttpApiEndpoint.get("preview", "/invitations/:invitationId", {
|
|
1002
|
+
params: { invitationId: InvitationId },
|
|
1003
|
+
success: InvitationPreview,
|
|
1004
|
+
error: ReadErrors
|
|
1005
|
+
}), HttpApiEndpoint.post("accept", "/invitations/:invitationId/accept", {
|
|
1006
|
+
params: { invitationId: InvitationId },
|
|
1007
|
+
success: OrganizationMembership,
|
|
1008
|
+
error: WriteErrors
|
|
1009
|
+
}), HttpApiEndpoint.post("decline", "/invitations/:invitationId/decline", {
|
|
1010
|
+
params: { invitationId: InvitationId },
|
|
1011
|
+
error: WriteErrors
|
|
1012
|
+
})) {
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
class ApiKeysGroup extends HttpApiGroup.make("apiKeys").add(HttpApiEndpoint.get("list", "/organizations/:organizationId/api-keys", {
|
|
1016
|
+
params: organizationParams,
|
|
1017
|
+
query: { projectId: Schema9.optional(ProjectId) },
|
|
1018
|
+
success: Schema9.Array(ApiKey),
|
|
1019
|
+
error: ReadErrors
|
|
1020
|
+
}), HttpApiEndpoint.post("create", "/organizations/:organizationId/api-keys", {
|
|
1021
|
+
params: organizationParams,
|
|
1022
|
+
payload: CreateApiKey,
|
|
1023
|
+
success: CreatedApiKey,
|
|
1024
|
+
error: WriteErrors
|
|
1025
|
+
}), HttpApiEndpoint.delete("revoke", "/organizations/:organizationId/api-keys/:keyId", {
|
|
1026
|
+
params: { ...organizationParams, keyId: ApiKeyId },
|
|
1027
|
+
error: WriteErrors
|
|
1028
|
+
})) {
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// ../../packages/cloud-api/src/groups/billing.ts
|
|
1032
|
+
import { Schema as Schema10 } from "effect";
|
|
1033
|
+
import { HttpApiEndpoint as HttpApiEndpoint2, HttpApiGroup as HttpApiGroup2 } from "effect/http-api";
|
|
1034
|
+
var organizationParams2 = { organizationId: OrganizationId };
|
|
1035
|
+
|
|
1036
|
+
class BillingGroup extends HttpApiGroup2.make("billing").add(HttpApiEndpoint2.get("listPlans", "/billing/plans", {
|
|
1037
|
+
success: PlanCatalog,
|
|
1038
|
+
error: SelfErrors
|
|
1039
|
+
}), HttpApiEndpoint2.get("get", "/organizations/:organizationId/billing", {
|
|
1040
|
+
params: organizationParams2,
|
|
1041
|
+
success: BillingSummary,
|
|
1042
|
+
error: ReadErrors
|
|
1043
|
+
}), HttpApiEndpoint2.get("listInvoices", "/organizations/:organizationId/billing/invoices", {
|
|
1044
|
+
params: organizationParams2,
|
|
1045
|
+
success: Schema10.Array(Invoice),
|
|
1046
|
+
error: ReadErrors
|
|
1047
|
+
}), HttpApiEndpoint2.put("setSpendLimit", "/organizations/:organizationId/billing/spend-limit", {
|
|
1048
|
+
params: organizationParams2,
|
|
1049
|
+
payload: SetSpendLimit,
|
|
1050
|
+
success: SpendLimit,
|
|
1051
|
+
error: WriteErrors
|
|
1052
|
+
}), HttpApiEndpoint2.post("startCheckout", "/organizations/:organizationId/billing/checkout", {
|
|
1053
|
+
params: organizationParams2,
|
|
1054
|
+
payload: StartCheckout,
|
|
1055
|
+
success: HostedSession,
|
|
1056
|
+
error: WriteErrors
|
|
1057
|
+
}), HttpApiEndpoint2.post("changePlan", "/organizations/:organizationId/billing/plan", {
|
|
1058
|
+
params: organizationParams2,
|
|
1059
|
+
payload: StartCheckout,
|
|
1060
|
+
success: PlanChange,
|
|
1061
|
+
error: WriteErrors
|
|
1062
|
+
}), HttpApiEndpoint2.post("openPortal", "/organizations/:organizationId/billing/portal", {
|
|
1063
|
+
params: organizationParams2,
|
|
1064
|
+
success: HostedSession,
|
|
1065
|
+
error: WriteErrors
|
|
1066
|
+
})) {
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
class UsageGroup extends HttpApiGroup2.make("usage").add(HttpApiEndpoint2.get("get", "/organizations/:organizationId/usage", {
|
|
1070
|
+
params: organizationParams2,
|
|
1071
|
+
query: { period: Schema10.optional(BillingPeriod) },
|
|
1072
|
+
success: Usage,
|
|
1073
|
+
error: ReadErrors
|
|
1074
|
+
})) {
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
class AuditGroup extends HttpApiGroup2.make("audit").add(HttpApiEndpoint2.get("list", "/organizations/:organizationId/audit-log", {
|
|
1078
|
+
params: organizationParams2,
|
|
1079
|
+
query: {
|
|
1080
|
+
...pageQuery,
|
|
1081
|
+
action: Schema10.optional(Schema10.String),
|
|
1082
|
+
actorId: Schema10.optional(Schema10.String)
|
|
1083
|
+
},
|
|
1084
|
+
success: Page(AuditEntry),
|
|
1085
|
+
error: ReadErrors
|
|
1086
|
+
})) {
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// ../../packages/cloud-api/src/groups/deployments.ts
|
|
1090
|
+
import { Schema as Schema12 } from "effect";
|
|
1091
|
+
import { HttpApiEndpoint as HttpApiEndpoint3, HttpApiGroup as HttpApiGroup3, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
1092
|
+
|
|
1093
|
+
// ../../packages/cloud-api/src/logs.ts
|
|
1094
|
+
import { Schema as Schema11 } from "effect";
|
|
1095
|
+
var MAX_LOG_LINES = 200;
|
|
1096
|
+
var MAX_LOG_TEXT_BYTES = 4096;
|
|
1097
|
+
var MAX_LOG_WINDOW_SECONDS = 3600;
|
|
1098
|
+
var MAX_LOG_WAIT_SECONDS = 20;
|
|
1099
|
+
var LogCursor = Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(2048));
|
|
1100
|
+
var LogLimit = Schema11.Int.check(Schema11.isBetween({ minimum: 1, maximum: MAX_LOG_LINES }));
|
|
1101
|
+
var LogWait = Schema11.Int.check(Schema11.isBetween({ minimum: 0, maximum: MAX_LOG_WAIT_SECONDS }));
|
|
1102
|
+
var logQuery = {
|
|
1103
|
+
since: Schema11.optional(Timestamp),
|
|
1104
|
+
limit: Schema11.optional(LogLimit),
|
|
1105
|
+
cursor: Schema11.optional(LogCursor),
|
|
1106
|
+
wait: Schema11.optional(LogWait)
|
|
1107
|
+
};
|
|
1108
|
+
var RunnerLogLine = Schema11.Struct({
|
|
1109
|
+
id: Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(512)),
|
|
1110
|
+
deploymentId: DeploymentId,
|
|
1111
|
+
runnerId: Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(256)),
|
|
1112
|
+
at: Timestamp,
|
|
1113
|
+
stream: Schema11.Literals(["stdout", "stderr", "unknown"]),
|
|
1114
|
+
text: Schema11.String.check(Schema11.makeFilter((text) => new TextEncoder().encode(text).byteLength <= MAX_LOG_TEXT_BYTES || "Log text exceeds the byte limit")),
|
|
1115
|
+
clipped: Schema11.Boolean
|
|
1116
|
+
});
|
|
1117
|
+
var RunnerLogPage = Schema11.Struct({
|
|
1118
|
+
lines: Schema11.Array(RunnerLogLine).check(Schema11.isMaxLength(MAX_LOG_LINES)),
|
|
1119
|
+
cursor: LogCursor,
|
|
1120
|
+
more: Schema11.Boolean
|
|
1121
|
+
});
|
|
1122
|
+
|
|
1123
|
+
// ../../packages/cloud-api/src/groups/deployments.ts
|
|
1124
|
+
var projectParams = { projectId: ProjectId };
|
|
1125
|
+
var deploymentParams = { ...projectParams, deploymentId: DeploymentId };
|
|
1126
|
+
|
|
1127
|
+
class DeploymentsGroup extends HttpApiGroup3.make("deployments").add(HttpApiEndpoint3.get("getEnvironmentLogs", "/projects/:projectId/environments/:environment/logs", {
|
|
1128
|
+
params: { ...projectParams, environment: EnvironmentName },
|
|
1129
|
+
query: logQuery,
|
|
1130
|
+
success: RunnerLogPage,
|
|
1131
|
+
error: ReadErrors
|
|
1132
|
+
}).annotate(OpenApi.Description, "Reads recent stdout/stderr from the environment's current deployment. Authorization is checked on every read, including resumed polls, and suspended organizations remain readable. Defaults: since five minutes ago, limit 100, wait 0. The server clamps since to the past hour through now, so network delay and client clock skew do not reject a window boundary; limit is 1–200 and wait is 0–20 seconds. A cursor, at most 2048 characters, resumes the same authorized resource and takes precedence over since. More means another page is immediately available: continue with the cursor and wait 0 until more is false, then follow with wait 20. A current-deployment change switches environment follow to the new deployment and resets its provider position, retaining the original bounded window. Provider retention is recent and best-effort, not an archive. No current deployment returns an empty page. Text is clipped at 4096 UTF-8 bytes; each line's clipped flag reports that independently of more."), HttpApiEndpoint3.get("getLogs", "/projects/:projectId/deployments/:deploymentId/logs", {
|
|
1133
|
+
params: deploymentParams,
|
|
1134
|
+
query: logQuery,
|
|
1135
|
+
success: RunnerLogPage,
|
|
1136
|
+
error: ReadErrors
|
|
1137
|
+
}).annotate(OpenApi.Description, "Reads only the authorized deployment's customer runner stdout/stderr, with the same bounds and cursor protocol as environment logs. A deployment from another project or organization is not visible. Runner identifiers come only from the deployment's stored runner records, never from the cursor or caller input."), HttpApiEndpoint3.get("list", "/projects/:projectId/deployments", {
|
|
1138
|
+
params: projectParams,
|
|
1139
|
+
query: {
|
|
1140
|
+
...pageQuery,
|
|
1141
|
+
environment: Schema12.optional(EnvironmentName),
|
|
1142
|
+
status: Schema12.optional(DeploymentStatus)
|
|
1143
|
+
},
|
|
1144
|
+
success: Page(DeploymentSummary),
|
|
1145
|
+
error: ReadErrors
|
|
1146
|
+
}), HttpApiEndpoint3.post("create", "/projects/:projectId/deployments", {
|
|
1147
|
+
params: projectParams,
|
|
1148
|
+
payload: CreateDeployment,
|
|
1149
|
+
success: DeploymentDetail,
|
|
1150
|
+
error: WriteErrors
|
|
1151
|
+
}), HttpApiEndpoint3.post("uploadSource", "/projects/:projectId/sources", {
|
|
1152
|
+
params: projectParams,
|
|
1153
|
+
payload: Schema12.Uint8Array.pipe(HttpApiSchema.asUint8Array({ contentType: "application/gzip" })),
|
|
1154
|
+
success: SourceArchive,
|
|
1155
|
+
error: [...WriteErrors, PayloadTooLarge]
|
|
1156
|
+
}).annotate(OpenApi.Description, "Stores a gzip-compressed tar of a build context for the project and answers its digest, the SHA-256 of the bytes sent. Sending the same bytes again answers the same digest. A deployment created with `source` naming that digest is built from it by the control plane's builder. Access and the builder are checked before the body is read: a caller without write access answers 403 and a control plane without a builder 501 `NotImplemented`. A body over 64 MiB answers 413 `PayloadTooLarge`, before any byte is read when its `content-length` says so, and as soon as it passes the limit otherwise."), HttpApiEndpoint3.get("get", "/projects/:projectId/deployments/:deploymentId", {
|
|
1157
|
+
params: deploymentParams,
|
|
1158
|
+
success: DeploymentDetail,
|
|
1159
|
+
error: ReadErrors
|
|
1160
|
+
}), HttpApiEndpoint3.post("recordBuild", "/projects/:projectId/deployments/:deploymentId/build", {
|
|
1161
|
+
params: deploymentParams,
|
|
1162
|
+
payload: RecordBuild,
|
|
1163
|
+
success: DeploymentDetail,
|
|
1164
|
+
error: WriteErrors
|
|
1165
|
+
}), HttpApiEndpoint3.post("failBuild", "/projects/:projectId/deployments/:deploymentId/build-failure", {
|
|
1166
|
+
params: deploymentParams,
|
|
1167
|
+
payload: FailBuild,
|
|
1168
|
+
success: DeploymentDetail,
|
|
1169
|
+
error: WriteErrors
|
|
1170
|
+
}), HttpApiEndpoint3.get("getBuildLog", "/projects/:projectId/deployments/:deploymentId/build-log", {
|
|
1171
|
+
params: deploymentParams,
|
|
1172
|
+
query: { after: Schema12.optional(NonNegativeInt) },
|
|
1173
|
+
success: BuildLog,
|
|
1174
|
+
error: ReadErrors
|
|
1175
|
+
}), HttpApiEndpoint3.post("rollback", "/projects/:projectId/deployments/:deploymentId/rollback", {
|
|
1176
|
+
params: deploymentParams,
|
|
1177
|
+
success: DeploymentDetail,
|
|
1178
|
+
error: WriteErrors
|
|
1179
|
+
}).annotate(OpenApi.Description, "Rolls the environment back to the earlier deployment named by `deploymentId`. That deployment must have reached `live` before (status `live`, `drained` or `rolled-back`) and must not be the one live now; otherwise the answer is 409. The build is not repeated: a new deployment in the same environment redeploys that deployment's image and environment-variable snapshot, its `rolledBackFrom` is `deploymentId`, and its build and migrate steps are `skipped`. The new deployment starts `in-progress` and becomes `live` or `failed`. When it becomes `live`, the deployment that was live ends `rolled-back`; if it fails, that deployment stays `live`. The target keeps its own status. A second rollout in the environment while one is `in-progress` answers 409. The response is the new deployment."), HttpApiEndpoint3.post("redeploy", "/projects/:projectId/deployments/:deploymentId/redeploy", {
|
|
1180
|
+
params: deploymentParams,
|
|
1181
|
+
success: DeploymentDetail,
|
|
1182
|
+
error: WriteErrors
|
|
1183
|
+
})) {
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
// ../../packages/cloud-api/src/groups/projects.ts
|
|
1187
|
+
import { Schema as Schema13 } from "effect";
|
|
1188
|
+
import { HttpApiEndpoint as HttpApiEndpoint4, HttpApiGroup as HttpApiGroup4 } from "effect/http-api";
|
|
1189
|
+
var projectParams2 = { projectId: ProjectId };
|
|
1190
|
+
var environmentParams = { ...projectParams2, environment: EnvironmentName };
|
|
1191
|
+
|
|
1192
|
+
class ProjectsGroup extends HttpApiGroup4.make("projects").add(HttpApiEndpoint4.get("list", "/organizations/:organizationId/projects", {
|
|
1193
|
+
params: { organizationId: OrganizationId },
|
|
1194
|
+
success: Schema13.Array(Project),
|
|
1195
|
+
error: ReadErrors
|
|
1196
|
+
}), HttpApiEndpoint4.post("create", "/organizations/:organizationId/projects", {
|
|
1197
|
+
params: { organizationId: OrganizationId },
|
|
1198
|
+
payload: CreateProject,
|
|
1199
|
+
success: Project,
|
|
1200
|
+
error: WriteErrors
|
|
1201
|
+
}), HttpApiEndpoint4.get("get", "/projects/:projectId", {
|
|
1202
|
+
params: projectParams2,
|
|
1203
|
+
success: Project,
|
|
1204
|
+
error: ReadErrors
|
|
1205
|
+
}), HttpApiEndpoint4.patch("update", "/projects/:projectId", {
|
|
1206
|
+
params: projectParams2,
|
|
1207
|
+
payload: UpdateProject,
|
|
1208
|
+
success: Project,
|
|
1209
|
+
error: WriteErrors
|
|
1210
|
+
}), HttpApiEndpoint4.delete("delete", "/projects/:projectId", {
|
|
1211
|
+
params: projectParams2,
|
|
1212
|
+
error: WriteErrors
|
|
1213
|
+
}), HttpApiEndpoint4.get("listEnvironments", "/projects/:projectId/environments", {
|
|
1214
|
+
params: projectParams2,
|
|
1215
|
+
success: Schema13.Array(Environment),
|
|
1216
|
+
error: ReadErrors
|
|
1217
|
+
}), HttpApiEndpoint4.post("createEnvironment", "/projects/:projectId/environments", {
|
|
1218
|
+
params: projectParams2,
|
|
1219
|
+
payload: CreateEnvironment,
|
|
1220
|
+
success: Environment,
|
|
1221
|
+
error: WriteErrors
|
|
1222
|
+
}), HttpApiEndpoint4.get("getEnvironment", "/projects/:projectId/environments/:environment", {
|
|
1223
|
+
params: environmentParams,
|
|
1224
|
+
success: Environment,
|
|
1225
|
+
error: ReadErrors
|
|
1226
|
+
}), HttpApiEndpoint4.delete("deleteEnvironment", "/projects/:projectId/environments/:environment", {
|
|
1227
|
+
params: environmentParams,
|
|
1228
|
+
error: WriteErrors
|
|
1229
|
+
}), HttpApiEndpoint4.get("getEndpoints", "/projects/:projectId/environments/:environment/endpoints", {
|
|
1230
|
+
params: environmentParams,
|
|
1231
|
+
success: ProjectEndpoints,
|
|
1232
|
+
error: ReadErrors
|
|
1233
|
+
})) {
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
class EnvironmentVariablesGroup extends HttpApiGroup4.make("environmentVariables").add(HttpApiEndpoint4.get("list", "/projects/:projectId/environments/:environment/variables", {
|
|
1237
|
+
params: environmentParams,
|
|
1238
|
+
success: Schema13.Array(EnvVariable),
|
|
1239
|
+
error: ReadErrors
|
|
1240
|
+
}), HttpApiEndpoint4.put("set", "/projects/:projectId/environments/:environment/variables/:name", {
|
|
1241
|
+
params: { ...environmentParams, name: EnvVariableName },
|
|
1242
|
+
payload: SetEnvVariable,
|
|
1243
|
+
success: EnvVariable,
|
|
1244
|
+
error: WriteErrors
|
|
1245
|
+
}), HttpApiEndpoint4.delete("delete", "/projects/:projectId/environments/:environment/variables/:name", {
|
|
1246
|
+
params: { ...environmentParams, name: EnvVariableName },
|
|
1247
|
+
error: WriteErrors
|
|
1248
|
+
}), HttpApiEndpoint4.post("import", "/projects/:projectId/environments/:environment/variables/import", {
|
|
1249
|
+
params: environmentParams,
|
|
1250
|
+
payload: ImportEnvVariables,
|
|
1251
|
+
success: ImportEnvVariablesResult,
|
|
1252
|
+
error: WriteErrors
|
|
1253
|
+
})) {
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
class DomainsGroup extends HttpApiGroup4.make("domains").add(HttpApiEndpoint4.get("list", "/projects/:projectId/domains", {
|
|
1257
|
+
params: projectParams2,
|
|
1258
|
+
success: Schema13.Array(Domain),
|
|
1259
|
+
error: ReadErrors
|
|
1260
|
+
}), HttpApiEndpoint4.post("add", "/projects/:projectId/domains", {
|
|
1261
|
+
params: projectParams2,
|
|
1262
|
+
payload: AddDomain,
|
|
1263
|
+
success: Domain,
|
|
1264
|
+
error: WriteErrors
|
|
1265
|
+
}), HttpApiEndpoint4.post("verify", "/projects/:projectId/domains/:domainId/verify", {
|
|
1266
|
+
params: { ...projectParams2, domainId: DomainId },
|
|
1267
|
+
success: Domain,
|
|
1268
|
+
error: WriteErrors
|
|
1269
|
+
}), HttpApiEndpoint4.delete("remove", "/projects/:projectId/domains/:domainId", {
|
|
1270
|
+
params: { ...projectParams2, domainId: DomainId },
|
|
1271
|
+
error: WriteErrors
|
|
1272
|
+
})) {
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
class RegionsGroup extends HttpApiGroup4.make("regions").add(HttpApiEndpoint4.get("catalog", "/regions", {
|
|
1276
|
+
success: Schema13.Array(Region),
|
|
1277
|
+
error: ReadErrors
|
|
1278
|
+
}), HttpApiEndpoint4.get("list", "/projects/:projectId/environments/:environment/regions", {
|
|
1279
|
+
params: environmentParams,
|
|
1280
|
+
success: Schema13.Array(ProjectRegion),
|
|
1281
|
+
error: ReadErrors
|
|
1282
|
+
}), HttpApiEndpoint4.post("add", "/projects/:projectId/regions", {
|
|
1283
|
+
params: projectParams2,
|
|
1284
|
+
payload: AddRegion,
|
|
1285
|
+
success: Region,
|
|
1286
|
+
error: WriteErrors
|
|
1287
|
+
}), HttpApiEndpoint4.delete("remove", "/projects/:projectId/regions/:region", {
|
|
1288
|
+
params: { ...projectParams2, region: RegionId },
|
|
1289
|
+
error: WriteErrors
|
|
1290
|
+
}), HttpApiEndpoint4.put("setHome", "/projects/:projectId/home-region", {
|
|
1291
|
+
params: projectParams2,
|
|
1292
|
+
payload: SetHomeRegion,
|
|
1293
|
+
success: Project,
|
|
1294
|
+
error: WriteErrors
|
|
1295
|
+
})) {
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
class IntegrationsGroup extends HttpApiGroup4.make("integrations").add(HttpApiEndpoint4.get("list", "/projects/:projectId/integrations", {
|
|
1299
|
+
params: projectParams2,
|
|
1300
|
+
success: Schema13.Array(Integration),
|
|
1301
|
+
error: ReadErrors
|
|
1302
|
+
}), HttpApiEndpoint4.post("connect", "/projects/:projectId/integrations/:kind", {
|
|
1303
|
+
params: { ...projectParams2, kind: IntegrationKind },
|
|
1304
|
+
payload: ConnectIntegration,
|
|
1305
|
+
success: IntegrationConnection,
|
|
1306
|
+
error: WriteErrors
|
|
1307
|
+
}), HttpApiEndpoint4.delete("disconnect", "/projects/:projectId/integrations/:kind", {
|
|
1308
|
+
params: { ...projectParams2, kind: IntegrationKind },
|
|
1309
|
+
error: WriteErrors
|
|
1310
|
+
})) {
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
// ../../packages/cloud-api/src/groups/runtime.ts
|
|
1314
|
+
import { Schema as Schema14 } from "effect";
|
|
1315
|
+
import { HttpApiEndpoint as HttpApiEndpoint5, HttpApiGroup as HttpApiGroup5, HttpApiSchema as HttpApiSchema2, OpenApi as OpenApi2 } from "effect/http-api";
|
|
1316
|
+
var environmentParams2 = { projectId: ProjectId, environment: EnvironmentName };
|
|
1317
|
+
var actorTypeParams = { ...environmentParams2, actorType: Schema14.String };
|
|
1318
|
+
var actorParams = { ...actorTypeParams, key: Schema14.String };
|
|
1319
|
+
var InspectErrors = [...ReadErrors, RunnerDefect];
|
|
1320
|
+
|
|
1321
|
+
class RuntimeGroup extends HttpApiGroup5.make("runtime").add(HttpApiEndpoint5.get("getOverview", "/projects/:projectId/environments/:environment/runtime/overview", {
|
|
1322
|
+
params: environmentParams2,
|
|
1323
|
+
success: Overview,
|
|
1324
|
+
error: InspectErrors
|
|
1325
|
+
}), HttpApiEndpoint5.get("getSidebarCounts", "/projects/:projectId/environments/:environment/runtime/sidebar-counts", { params: environmentParams2, success: SidebarCounts, error: InspectErrors }), HttpApiEndpoint5.get("search", "/projects/:projectId/environments/:environment/runtime/search", {
|
|
1326
|
+
params: environmentParams2,
|
|
1327
|
+
query: { q: Schema14.String.pipe(Schema14.check(Schema14.isMinLength(1), Schema14.isMaxLength(256))) },
|
|
1328
|
+
success: Schema14.Array(SearchResult),
|
|
1329
|
+
error: InspectErrors
|
|
1330
|
+
}), HttpApiEndpoint5.get("listActorTypes", "/projects/:projectId/environments/:environment/runtime/actor-types", {
|
|
1331
|
+
params: environmentParams2,
|
|
1332
|
+
success: Schema14.Array(ActorTypeSummary),
|
|
1333
|
+
error: InspectErrors
|
|
1334
|
+
}), HttpApiEndpoint5.get("getActorType", "/projects/:projectId/environments/:environment/runtime/actor-types/:actorType", { params: actorTypeParams, success: ActorTypeSummary, error: InspectErrors }), HttpApiEndpoint5.get("getActorTypeActivity", "/projects/:projectId/environments/:environment/runtime/actor-types/:actorType/activity", {
|
|
1335
|
+
params: actorTypeParams,
|
|
1336
|
+
query: { window: Schema14.optional(SeriesWindow) },
|
|
1337
|
+
success: ActorTypeActivity,
|
|
1338
|
+
error: InspectErrors
|
|
1339
|
+
}).annotate(OpenApi2.Description, "Commands per second over the window (default 24h) and the volume of each command, for one actor type, as the serving runner counted them since `since`. `NotImplemented` while more than one runner serves the environment."), HttpApiEndpoint5.get("getActorTypeLatency", "/projects/:projectId/environments/:environment/runtime/actor-types/:actorType/latency", {
|
|
1340
|
+
params: actorTypeParams,
|
|
1341
|
+
query: { window: Schema14.optional(SeriesWindow) },
|
|
1342
|
+
success: TurnLatency,
|
|
1343
|
+
error: InspectErrors
|
|
1344
|
+
}).annotate(OpenApi2.Description, "Turn-latency histogram over the window (default 24h) with p50, p95 and p99, for one actor type, as the serving runner measured them since `since`. `NotImplemented` while more than one runner serves the environment."), HttpApiEndpoint5.get("listActorInstances", "/projects/:projectId/environments/:environment/runtime/actor-types/:actorType/instances", {
|
|
1345
|
+
params: actorTypeParams,
|
|
1346
|
+
query: { ...pageQuery, status: Schema14.optional(Schema14.Literals(["awake", "idle"])) },
|
|
1347
|
+
success: Page(ActorInstance),
|
|
1348
|
+
error: InspectErrors
|
|
1349
|
+
}), HttpApiEndpoint5.get("inspectActor", "/projects/:projectId/environments/:environment/runtime/actors/:actorType/:key", { params: actorParams, success: ActorInspector, error: InspectErrors }), HttpApiEndpoint5.get("listActorTables", "/projects/:projectId/environments/:environment/runtime/actors/:actorType/:key/tables", { params: actorParams, success: Schema14.Array(OwnedTableRows), error: ReadErrors }), HttpApiEndpoint5.get("listActorReceipts", "/projects/:projectId/environments/:environment/runtime/actors/:actorType/:key/receipts", { params: actorParams, query: pageQuery, success: Page(Receipt), error: InspectErrors }), HttpApiEndpoint5.get("listActorEvents", "/projects/:projectId/environments/:environment/runtime/actors/:actorType/:key/events", { params: actorParams, success: Schema14.Array(ActorEvent), error: InspectErrors }), HttpApiEndpoint5.get("listActorJobs", "/projects/:projectId/environments/:environment/runtime/actors/:actorType/:key/jobs", { params: actorParams, success: Schema14.Array(ActorJob), error: InspectErrors }), HttpApiEndpoint5.get("listActorTimeline", "/projects/:projectId/environments/:environment/runtime/actors/:actorType/:key/timeline", {
|
|
1350
|
+
params: actorParams,
|
|
1351
|
+
query: pageQuery,
|
|
1352
|
+
success: Page(ActorTimelineEntry),
|
|
1353
|
+
error: InspectErrors
|
|
1354
|
+
}), HttpApiEndpoint5.get("listCommands", "/projects/:projectId/environments/:environment/runtime/commands", {
|
|
1355
|
+
params: environmentParams2,
|
|
1356
|
+
query: {
|
|
1357
|
+
...pageQuery,
|
|
1358
|
+
actorType: Schema14.optional(Schema14.String),
|
|
1359
|
+
outcome: Schema14.optional(CommandOutcome)
|
|
1360
|
+
},
|
|
1361
|
+
success: Page(CommandLogEntry),
|
|
1362
|
+
error: InspectErrors
|
|
1363
|
+
}), HttpApiEndpoint5.post("sendCommand", "/projects/:projectId/environments/:environment/runtime/commands", {
|
|
1364
|
+
params: environmentParams2,
|
|
1365
|
+
payload: SendCommand,
|
|
1366
|
+
success: CommandSent,
|
|
1367
|
+
error: [
|
|
1368
|
+
...WriteErrors,
|
|
1369
|
+
CommandFailed,
|
|
1370
|
+
CommandRefused,
|
|
1371
|
+
CommandExpired,
|
|
1372
|
+
RunnerDefect,
|
|
1373
|
+
...QuotaErrors
|
|
1374
|
+
]
|
|
1375
|
+
}).annotate(OpenApi2.Description, "Sends to an actor address, including one not yet created, without requiring an inspector read. Requires project write permission. `commandId` is an optional client idempotency key, not a runner command id. Its scope is organization/project/environment/actor address/command, independent of deployment. The control plane durably assigns a runner-minted id and stores only a canonical payload hash; the same key and JSON input reuse it and replay the receipt with `replayed: true` within the runner's retry window. Different input returns 409 Conflict. After expiry, the key is retained as a tombstone for 30 days and returns 410 `CommandExpired`; reusing it after that starts a new command. Declared actor errors are 422 CommandFailed; admission refusals are typed 4xx, including 422 CommandRefused. Mailbox backpressure remains 503 Unavailable. Remote defects are opaque, non-retryable 502 RunnerDefect errors. The edge's usage refusals keep the framework's tags and payloads: a full Free command quota is a 429 `QuotaExceeded`, a passed spend limit a 402 `SpendLimitExceeded`, a full connection allowance a 429 `ConnectionLimitExceeded` and a Free tenant at its storage cap a 429 `StorageQuotaExceeded`. A command the edge cannot bill, because the tenant has no organization, the organization no billing account, or its plan is not in the pricing configuration, is a 402 `QuotaUnbound` carrying that reason, never a generic 503."), HttpApiEndpoint5.get("streamCommands", "/projects/:projectId/environments/:environment/runtime/commands/stream", {
|
|
1376
|
+
params: environmentParams2,
|
|
1377
|
+
query: {
|
|
1378
|
+
actorType: Schema14.optional(Schema14.String),
|
|
1379
|
+
outcome: Schema14.optional(CommandOutcome)
|
|
1380
|
+
},
|
|
1381
|
+
success: HttpApiSchema2.StreamSse({
|
|
1382
|
+
data: Schema14.toCodecJson(CommandLogEntry),
|
|
1383
|
+
error: CommandStreamGap
|
|
1384
|
+
}),
|
|
1385
|
+
error: InspectErrors
|
|
1386
|
+
}).annotate(OpenApi2.Description, "Each command the serving runner commits from now on, filtered by actor type and outcome (`replayed` is always empty, since a replay commits no turn), with a payload preview of at most 256 characters that the runner cut and redacted. The control plane resumes across the runner's credential expiry; the stream fails with `CommandStreamGap` when the runner can no longer resume it without missing commands, and ends when the runner goes away; a client reconnects. `NotImplemented` while more than one runner serves the environment."), HttpApiEndpoint5.get("getJobs", "/projects/:projectId/environments/:environment/runtime/jobs", {
|
|
1387
|
+
params: environmentParams2,
|
|
1388
|
+
success: JobsSummary,
|
|
1389
|
+
error: InspectErrors
|
|
1390
|
+
}), HttpApiEndpoint5.get("listDeadLetters", "/projects/:projectId/environments/:environment/runtime/dead-letters", {
|
|
1391
|
+
params: environmentParams2,
|
|
1392
|
+
query: pageQuery,
|
|
1393
|
+
success: Page(DeadLetter),
|
|
1394
|
+
error: InspectErrors
|
|
1395
|
+
}), HttpApiEndpoint5.post("retryDeadLetter", "/projects/:projectId/environments/:environment/runtime/dead-letters/:deadLetterId/retry", {
|
|
1396
|
+
params: { ...environmentParams2, deadLetterId: DeadLetterId },
|
|
1397
|
+
error: WriteErrors
|
|
1398
|
+
}), HttpApiEndpoint5.post("discardDeadLetter", "/projects/:projectId/environments/:environment/runtime/dead-letters/:deadLetterId/discard", {
|
|
1399
|
+
params: { ...environmentParams2, deadLetterId: DeadLetterId },
|
|
1400
|
+
error: WriteErrors
|
|
1401
|
+
}), HttpApiEndpoint5.get("listWorkflows", "/projects/:projectId/environments/:environment/runtime/workflows", {
|
|
1402
|
+
params: environmentParams2,
|
|
1403
|
+
query: {
|
|
1404
|
+
...pageQuery,
|
|
1405
|
+
status: Schema14.optional(Schema14.Literals(["running", "waiting", "completed", "failed"]))
|
|
1406
|
+
},
|
|
1407
|
+
success: Page(Workflow),
|
|
1408
|
+
error: InspectErrors
|
|
1409
|
+
}), HttpApiEndpoint5.get("getTimers", "/projects/:projectId/environments/:environment/runtime/timers", {
|
|
1410
|
+
params: environmentParams2,
|
|
1411
|
+
success: TimersSummary,
|
|
1412
|
+
error: InspectErrors
|
|
1413
|
+
}), HttpApiEndpoint5.get("listSchedules", "/projects/:projectId/environments/:environment/runtime/schedules", {
|
|
1414
|
+
params: environmentParams2,
|
|
1415
|
+
success: Schema14.Array(Schedule),
|
|
1416
|
+
error: InspectErrors
|
|
1417
|
+
}), HttpApiEndpoint5.get("getConnections", "/projects/:projectId/environments/:environment/runtime/connections", { params: environmentParams2, success: ConnectionsSummary, error: InspectErrors })) {
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
// ../../packages/cloud-api/src/contract.ts
|
|
1421
|
+
class CloudApi extends HttpApi.make("akter-cloud").add(AccountGroup, OrganizationsGroup, MembersGroup, InvitationsGroup, ApiKeysGroup, ProjectsGroup, EnvironmentVariablesGroup, DomainsGroup, RegionsGroup, IntegrationsGroup, DeploymentsGroup, RuntimeGroup, BillingGroup, UsageGroup, AuditGroup).middleware(Authentication).prefix("/api").annotateMerge(OpenApi3.annotations({ title: "Akter Cloud API" })) {
|
|
1422
|
+
}
|
|
1423
|
+
export {
|
|
1424
|
+
AccountGroup,
|
|
1425
|
+
ActorAddress,
|
|
1426
|
+
ActorEvent,
|
|
1427
|
+
ActorInspector,
|
|
1428
|
+
ActorInstance,
|
|
1429
|
+
ActorJob,
|
|
1430
|
+
ActorReference,
|
|
1431
|
+
ActorTimelineEntry,
|
|
1432
|
+
ActorTypeActivity,
|
|
1433
|
+
ActorTypeSummary,
|
|
1434
|
+
AddDomain,
|
|
1435
|
+
AddRegion,
|
|
1436
|
+
ApiKey,
|
|
1437
|
+
ApiKeyId,
|
|
1438
|
+
ApiKeyIdentity,
|
|
1439
|
+
ApiKeyPermission,
|
|
1440
|
+
ApiKeysGroup,
|
|
1441
|
+
AuditEntry,
|
|
1442
|
+
AuditGroup,
|
|
1443
|
+
Authentication,
|
|
1444
|
+
BillingGroup,
|
|
1445
|
+
BillingPeriod,
|
|
1446
|
+
BillingSummary,
|
|
1447
|
+
BuildLog,
|
|
1448
|
+
BuildLogLine,
|
|
1449
|
+
CalendarDay,
|
|
1450
|
+
CapState,
|
|
1451
|
+
CardPaymentMethod,
|
|
1452
|
+
CatalogPlan,
|
|
1453
|
+
CloudApi,
|
|
1454
|
+
CommandCaller,
|
|
1455
|
+
CommandExpired,
|
|
1456
|
+
CommandFailed,
|
|
1457
|
+
CommandLogEntry,
|
|
1458
|
+
CommandOutcome,
|
|
1459
|
+
CommandRefused,
|
|
1460
|
+
CommandSent,
|
|
1461
|
+
CommandStreamGap,
|
|
1462
|
+
CommandVolume,
|
|
1463
|
+
CommitSha,
|
|
1464
|
+
ComputeSize,
|
|
1465
|
+
ComputeUsage,
|
|
1466
|
+
Conflict,
|
|
1467
|
+
ConnectIntegration,
|
|
1468
|
+
ConnectionsSummary,
|
|
1469
|
+
CreateApiKey,
|
|
1470
|
+
CreateDeployment,
|
|
1471
|
+
CreateEnvironment,
|
|
1472
|
+
CreateInvitation,
|
|
1473
|
+
CreateOrganization,
|
|
1474
|
+
CreateProject,
|
|
1475
|
+
CreatedApiKey,
|
|
1476
|
+
CurrentIdentity,
|
|
1477
|
+
DeadLetter,
|
|
1478
|
+
DeadLetterId,
|
|
1479
|
+
DeleteAccount,
|
|
1480
|
+
DeploymentAuthor,
|
|
1481
|
+
DeploymentDetail,
|
|
1482
|
+
DeploymentId,
|
|
1483
|
+
DeploymentRunner,
|
|
1484
|
+
DeploymentSource,
|
|
1485
|
+
DeploymentStatus,
|
|
1486
|
+
DeploymentSummary,
|
|
1487
|
+
DeploymentsGroup,
|
|
1488
|
+
DnsRecord,
|
|
1489
|
+
Domain,
|
|
1490
|
+
DomainId,
|
|
1491
|
+
DomainStatus,
|
|
1492
|
+
DomainsGroup,
|
|
1493
|
+
Email,
|
|
1494
|
+
EnvVariable,
|
|
1495
|
+
EnvVariableName,
|
|
1496
|
+
Environment,
|
|
1497
|
+
EnvironmentId,
|
|
1498
|
+
EnvironmentName,
|
|
1499
|
+
EnvironmentVariablesGroup,
|
|
1500
|
+
FailBuild,
|
|
1501
|
+
Forbidden,
|
|
1502
|
+
HostedSession,
|
|
1503
|
+
Hostname,
|
|
1504
|
+
Identity,
|
|
1505
|
+
ImageDigest,
|
|
1506
|
+
ImportEnvVariables,
|
|
1507
|
+
ImportEnvVariablesResult,
|
|
1508
|
+
Integration,
|
|
1509
|
+
IntegrationConnection,
|
|
1510
|
+
IntegrationKind,
|
|
1511
|
+
IntegrationsGroup,
|
|
1512
|
+
Invitation,
|
|
1513
|
+
InvitationId,
|
|
1514
|
+
InvitationPreview,
|
|
1515
|
+
InvitationStatus,
|
|
1516
|
+
InvitationsGroup,
|
|
1517
|
+
InviteRole,
|
|
1518
|
+
Invoice,
|
|
1519
|
+
InvoiceId,
|
|
1520
|
+
JobStatus,
|
|
1521
|
+
JobTypeStats,
|
|
1522
|
+
JobsSummary,
|
|
1523
|
+
KnownPlan,
|
|
1524
|
+
LatencyBucket,
|
|
1525
|
+
LinkPaymentMethod,
|
|
1526
|
+
LogCursor,
|
|
1527
|
+
LogLimit,
|
|
1528
|
+
LogWait,
|
|
1529
|
+
MAX_LOG_LINES,
|
|
1530
|
+
MAX_LOG_TEXT_BYTES,
|
|
1531
|
+
MAX_LOG_WAIT_SECONDS,
|
|
1532
|
+
MAX_LOG_WINDOW_SECONDS,
|
|
1533
|
+
MAX_SOURCE_BYTES,
|
|
1534
|
+
Me,
|
|
1535
|
+
Member,
|
|
1536
|
+
MemberId,
|
|
1537
|
+
MemberUser,
|
|
1538
|
+
MembersGroup,
|
|
1539
|
+
Name,
|
|
1540
|
+
NonNegative,
|
|
1541
|
+
NonNegativeInt,
|
|
1542
|
+
NotFound,
|
|
1543
|
+
NotFoundResource,
|
|
1544
|
+
NotImplemented,
|
|
1545
|
+
NotificationEvent,
|
|
1546
|
+
NotificationPreference,
|
|
1547
|
+
NotificationSettings,
|
|
1548
|
+
Organization,
|
|
1549
|
+
OrganizationDeletion,
|
|
1550
|
+
OrganizationId,
|
|
1551
|
+
OrganizationMembership,
|
|
1552
|
+
OrganizationPlan,
|
|
1553
|
+
OrganizationsGroup,
|
|
1554
|
+
Overview,
|
|
1555
|
+
OwnedTable,
|
|
1556
|
+
OwnedTableRows,
|
|
1557
|
+
Page,
|
|
1558
|
+
PayloadTooLarge,
|
|
1559
|
+
PaymentMethod,
|
|
1560
|
+
PersonalDataExport,
|
|
1561
|
+
PinActor,
|
|
1562
|
+
PinnedActor,
|
|
1563
|
+
Plan,
|
|
1564
|
+
PlanCatalog,
|
|
1565
|
+
PlanChange,
|
|
1566
|
+
PlanFeature,
|
|
1567
|
+
PlanId,
|
|
1568
|
+
Preferences,
|
|
1569
|
+
Project,
|
|
1570
|
+
ProjectEndpoints,
|
|
1571
|
+
ProjectId,
|
|
1572
|
+
ProjectRegion,
|
|
1573
|
+
ProjectStatus,
|
|
1574
|
+
ProjectsGroup,
|
|
1575
|
+
QuotaErrors,
|
|
1576
|
+
QuotaExceeded2 as QuotaExceeded,
|
|
1577
|
+
QuotaUnbound,
|
|
1578
|
+
ReadErrors,
|
|
1579
|
+
Receipt,
|
|
1580
|
+
RecordBuild,
|
|
1581
|
+
Region,
|
|
1582
|
+
RegionId,
|
|
1583
|
+
RegionsGroup,
|
|
1584
|
+
Role,
|
|
1585
|
+
RolloutStep,
|
|
1586
|
+
RolloutStepName,
|
|
1587
|
+
RunnerDefect,
|
|
1588
|
+
RunnerLogLine,
|
|
1589
|
+
RunnerLogPage,
|
|
1590
|
+
RuntimeGroup,
|
|
1591
|
+
SOURCE_ENTRY,
|
|
1592
|
+
Schedule,
|
|
1593
|
+
SearchResult,
|
|
1594
|
+
SelfErrors,
|
|
1595
|
+
SendCommand,
|
|
1596
|
+
SeriesPoint,
|
|
1597
|
+
SeriesWindow,
|
|
1598
|
+
SessionIdentity,
|
|
1599
|
+
SetActiveOrganization,
|
|
1600
|
+
SetEnvVariable,
|
|
1601
|
+
SetHomeRegion,
|
|
1602
|
+
SetSpendLimit,
|
|
1603
|
+
SidebarCounts,
|
|
1604
|
+
Slug,
|
|
1605
|
+
SourceArchive,
|
|
1606
|
+
SourceDigest,
|
|
1607
|
+
SpendLimit,
|
|
1608
|
+
StartCheckout,
|
|
1609
|
+
Theme,
|
|
1610
|
+
TimersSummary,
|
|
1611
|
+
Timestamp,
|
|
1612
|
+
TurnLatency,
|
|
1613
|
+
Unauthorized,
|
|
1614
|
+
Unavailable,
|
|
1615
|
+
UnavailableReason,
|
|
1616
|
+
UnboundPlan,
|
|
1617
|
+
UnknownPlan,
|
|
1618
|
+
UpdateMemberRole,
|
|
1619
|
+
UpdateOrganization,
|
|
1620
|
+
UpdatePreferences,
|
|
1621
|
+
UpdateProfile,
|
|
1622
|
+
UpdateProject,
|
|
1623
|
+
Usage,
|
|
1624
|
+
UsageGroup,
|
|
1625
|
+
UsageMeter,
|
|
1626
|
+
UsageMeterName,
|
|
1627
|
+
UsagePricing,
|
|
1628
|
+
User,
|
|
1629
|
+
UserId,
|
|
1630
|
+
Workflow,
|
|
1631
|
+
WriteErrors,
|
|
1632
|
+
apiKeyHeaderName,
|
|
1633
|
+
logQuery,
|
|
1634
|
+
pageQuery,
|
|
1635
|
+
secureSessionCookieName,
|
|
1636
|
+
sessionCookieName
|
|
1637
|
+
};
|