@antelopejs/cloud-sdk 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +69 -8
- package/dist/api.js +69 -6
- package/dist/generated/cloud-api.d.ts +402 -6
- package/dist/index.d.ts +1 -0
- package/dist/logs.d.ts +25 -0
- package/dist/logs.js +17 -0
- package/openapi/builds.yaml +54 -0
- package/openapi/cloud.openapi.yaml +8 -14
- package/openapi/services.yaml +215 -0
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ProjectDeploymentsApi } from "./deployments.js";
|
|
2
2
|
import { EnvironmentsApi, ProjectRepositoryApi } from "./environments.js";
|
|
3
3
|
import type { components } from "./generated/cloud-api.js";
|
|
4
|
+
import { type BuildLogRequest, type LogRequest } from "./logs.js";
|
|
4
5
|
import { type SseEvent } from "./sse.js";
|
|
5
6
|
/** What the API answers to an accepted source upload. */
|
|
6
7
|
export interface DeploymentReceipt {
|
|
@@ -13,7 +14,20 @@ export type DeviceToken = components["schemas"]["DeviceToken"];
|
|
|
13
14
|
export type EnvironmentVariable = components["schemas"]["EnvironmentVariable"];
|
|
14
15
|
export type EnvironmentVariableList = components["schemas"]["EnvironmentVariableList"];
|
|
15
16
|
export type NewProject = components["schemas"]["NewProject"];
|
|
16
|
-
|
|
17
|
+
/** A service to create: one each `ajs cloud deploy` uploads, or one built from a repository. */
|
|
18
|
+
export type NewService = components["schemas"]["NewService"];
|
|
19
|
+
/** A service whose deployments each carry their own uploaded source. */
|
|
20
|
+
export type NewUploadService = NewService & {
|
|
21
|
+
source: {
|
|
22
|
+
type: "upload";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/** A service AntelopeJS Cloud builds from a repository at each push. */
|
|
26
|
+
export type NewRepositoryService = NewService & {
|
|
27
|
+
source: {
|
|
28
|
+
type: "repository";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
17
31
|
export type VariableOrigin = components["schemas"]["VariableOrigin"];
|
|
18
32
|
export type VariableWrite = components["schemas"]["VariableWrite"];
|
|
19
33
|
export type WorkspaceProvisioning = components["schemas"]["WorkspaceProvisioning"];
|
|
@@ -39,12 +53,12 @@ export interface CreateProjectOptions {
|
|
|
39
53
|
*/
|
|
40
54
|
idempotencyKey?: string;
|
|
41
55
|
}
|
|
42
|
-
/**
|
|
43
|
-
export interface
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
56
|
+
/** A value a service publishes to the other services of its environment. */
|
|
57
|
+
export interface PublishedValue {
|
|
58
|
+
/** The service that publishes the value. */
|
|
59
|
+
serviceId: string;
|
|
60
|
+
/** The key it publishes the value under. */
|
|
61
|
+
publishedKey: string;
|
|
48
62
|
}
|
|
49
63
|
/** The Cloud API, signed in with one token. Every refusal is a {@link CloudApiError}. */
|
|
50
64
|
export declare class CloudApi {
|
|
@@ -110,7 +124,14 @@ export declare class CloudApi {
|
|
|
110
124
|
environmentId: string;
|
|
111
125
|
serviceId?: string | null;
|
|
112
126
|
}>;
|
|
113
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Creates a service in an environment. With a `repository` source it builds
|
|
129
|
+
* that repository at each push to the environment's branch, with the
|
|
130
|
+
* Dockerfile its `dockerfilePath` names when it has one: that is how a
|
|
131
|
+
* second service, such as a dashboard built by `frontend.Dockerfile`, is
|
|
132
|
+
* built from the repository of the first.
|
|
133
|
+
*/
|
|
134
|
+
createService(projectId: string, environmentId: string, body: NewService): Promise<{
|
|
114
135
|
serviceId: string;
|
|
115
136
|
name: string;
|
|
116
137
|
appName: string;
|
|
@@ -161,6 +182,7 @@ export declare class CloudApi {
|
|
|
161
182
|
}>;
|
|
162
183
|
serviceSettings(serviceId: string): Promise<{
|
|
163
184
|
serviceId: string;
|
|
185
|
+
source?: components["schemas"]["ServiceSettingsSource"];
|
|
164
186
|
scaling: {
|
|
165
187
|
bounds: components["schemas"]["ServiceBounds"];
|
|
166
188
|
replicaLimit: number;
|
|
@@ -172,6 +194,38 @@ export declare class CloudApi {
|
|
|
172
194
|
removedRetentionDays: number;
|
|
173
195
|
};
|
|
174
196
|
}>;
|
|
197
|
+
/**
|
|
198
|
+
* Sets the port the service's container listens on, from 1024 to 65535, or
|
|
199
|
+
* clears it with null. A service created from a repository has none, and is
|
|
200
|
+
* refused its deployments until it has one. The running revision keeps its
|
|
201
|
+
* port; the next deployment takes the new one.
|
|
202
|
+
*/
|
|
203
|
+
setServicePort(serviceId: string, port: number | null): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Opens the service to the internet on its own address, or closes it. A
|
|
206
|
+
* service without a port is refused with
|
|
207
|
+
* `cloud.errors.settings.public_needs_port`.
|
|
208
|
+
*/
|
|
209
|
+
setServiceExposure(serviceId: string, isPublic: boolean): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Names the Dockerfile, inside its repository, that builds the service, or
|
|
212
|
+
* goes back to the root `Dockerfile` or a recipe with `null`. The next
|
|
213
|
+
* build reads it. A path that is not a plain relative path is refused with
|
|
214
|
+
* `cloud.errors.settings.invalid_dockerfile_path`, a service that builds no
|
|
215
|
+
* repository with `cloud.errors.settings.not_a_repository_source`.
|
|
216
|
+
*/
|
|
217
|
+
setServiceDockerfile(serviceId: string, path: string | null): Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Adds a variable to the service that follows a value another service of
|
|
220
|
+
* its environment publishes, such as the `MONGO_URL` of a MongoDB resource.
|
|
221
|
+
* The value never reaches the client; the variable is then listed with a
|
|
222
|
+
* `resource` origin.
|
|
223
|
+
*
|
|
224
|
+
* @param serviceId The service that gets the variable
|
|
225
|
+
* @param key The variable's name on that service
|
|
226
|
+
* @param published The publishing service and the key it publishes
|
|
227
|
+
*/
|
|
228
|
+
followPublishedValue(serviceId: string, key: string, published: PublishedValue): Promise<void>;
|
|
175
229
|
deploymentHistory(serviceId: string): Promise<{
|
|
176
230
|
activeBuilds?: components["schemas"]["ActiveBuild"][];
|
|
177
231
|
desiredRevisionId: string | null;
|
|
@@ -188,6 +242,13 @@ export declare class CloudApi {
|
|
|
188
242
|
deploy(serviceId: string, archive: Uint8Array): Promise<DeploymentReceipt>;
|
|
189
243
|
progress(deploymentId: string, signal?: AbortSignal): AsyncGenerator<SseEvent>;
|
|
190
244
|
logs(serviceId: string, request: LogRequest): AsyncGenerator<SseEvent>;
|
|
245
|
+
/**
|
|
246
|
+
* The output of one build, as the `log` events of its stream, then `end`.
|
|
247
|
+
* Without `follow` it is the newest lines, oldest first. A build that is
|
|
248
|
+
* unknown, of another workspace, or whose service was removed answers 404
|
|
249
|
+
* `cloud.errors.builds.not_found`.
|
|
250
|
+
*/
|
|
251
|
+
buildLogs(buildId: string, request: BuildLogRequest): AsyncGenerator<SseEvent>;
|
|
191
252
|
private raw;
|
|
192
253
|
private stream;
|
|
193
254
|
}
|
package/dist/api.js
CHANGED
|
@@ -3,6 +3,7 @@ import { InvalidApiResponseError } from "./api-error.js";
|
|
|
3
3
|
import { ProjectDeploymentsApi } from "./deployments.js";
|
|
4
4
|
import { EnvironmentsApi, ProjectRepositoryApi } from "./environments.js";
|
|
5
5
|
import { isRecord, isString } from "./guards.js";
|
|
6
|
+
import { logReadOf } from "./logs.js";
|
|
6
7
|
import { acceptedOf, dataOf, isApiErrorBody, refusal } from "./result.js";
|
|
7
8
|
import { parseSse } from "./sse.js";
|
|
8
9
|
/** The production Cloud API, used when no `baseUrl` is given. */
|
|
@@ -83,6 +84,13 @@ export class CloudApi {
|
|
|
83
84
|
});
|
|
84
85
|
return dataOf(result);
|
|
85
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Creates a service in an environment. With a `repository` source it builds
|
|
89
|
+
* that repository at each push to the environment's branch, with the
|
|
90
|
+
* Dockerfile its `dockerfilePath` names when it has one: that is how a
|
|
91
|
+
* second service, such as a dashboard built by `frontend.Dockerfile`, is
|
|
92
|
+
* built from the repository of the first.
|
|
93
|
+
*/
|
|
86
94
|
async createService(projectId, environmentId, body) {
|
|
87
95
|
const result = await this.client.POST("/api/cloud/projects/{projectId}/environments/{environmentId}/services", { params: { path: { projectId, environmentId } }, body });
|
|
88
96
|
return dataOf(result);
|
|
@@ -143,6 +151,54 @@ export class CloudApi {
|
|
|
143
151
|
const result = await this.client.GET("/api/cloud/services/{serviceId}/settings", { params: { path: { serviceId } } });
|
|
144
152
|
return dataOf(result);
|
|
145
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Sets the port the service's container listens on, from 1024 to 65535, or
|
|
156
|
+
* clears it with null. A service created from a repository has none, and is
|
|
157
|
+
* refused its deployments until it has one. The running revision keeps its
|
|
158
|
+
* port; the next deployment takes the new one.
|
|
159
|
+
*/
|
|
160
|
+
async setServicePort(serviceId, port) {
|
|
161
|
+
const result = await this.client.PUT("/api/cloud/services/{serviceId}/port", { params: { path: { serviceId } }, body: { port }, parseAs: "text" });
|
|
162
|
+
acceptedOf(result);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Opens the service to the internet on its own address, or closes it. A
|
|
166
|
+
* service without a port is refused with
|
|
167
|
+
* `cloud.errors.settings.public_needs_port`.
|
|
168
|
+
*/
|
|
169
|
+
async setServiceExposure(serviceId, isPublic) {
|
|
170
|
+
const result = await this.client.PUT("/api/cloud/services/{serviceId}/network", { params: { path: { serviceId } }, body: { isPublic }, parseAs: "text" });
|
|
171
|
+
acceptedOf(result);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Names the Dockerfile, inside its repository, that builds the service, or
|
|
175
|
+
* goes back to the root `Dockerfile` or a recipe with `null`. The next
|
|
176
|
+
* build reads it. A path that is not a plain relative path is refused with
|
|
177
|
+
* `cloud.errors.settings.invalid_dockerfile_path`, a service that builds no
|
|
178
|
+
* repository with `cloud.errors.settings.not_a_repository_source`.
|
|
179
|
+
*/
|
|
180
|
+
async setServiceDockerfile(serviceId, path) {
|
|
181
|
+
const result = await this.client.PUT("/api/cloud/services/{serviceId}/source-dockerfile", { params: { path: { serviceId } }, body: { path }, parseAs: "text" });
|
|
182
|
+
acceptedOf(result);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Adds a variable to the service that follows a value another service of
|
|
186
|
+
* its environment publishes, such as the `MONGO_URL` of a MongoDB resource.
|
|
187
|
+
* The value never reaches the client; the variable is then listed with a
|
|
188
|
+
* `resource` origin.
|
|
189
|
+
*
|
|
190
|
+
* @param serviceId The service that gets the variable
|
|
191
|
+
* @param key The variable's name on that service
|
|
192
|
+
* @param published The publishing service and the key it publishes
|
|
193
|
+
*/
|
|
194
|
+
async followPublishedValue(serviceId, key, published) {
|
|
195
|
+
const result = await this.client.POST("/api/cloud/services/{serviceId}/variables/references", {
|
|
196
|
+
params: { path: { serviceId } },
|
|
197
|
+
body: { key, ...published },
|
|
198
|
+
parseAs: "text",
|
|
199
|
+
});
|
|
200
|
+
acceptedOf(result);
|
|
201
|
+
}
|
|
146
202
|
async deploymentHistory(serviceId) {
|
|
147
203
|
const result = await this.client.GET("/api/cloud/services/{serviceId}/deployments", {
|
|
148
204
|
params: { path: { serviceId } },
|
|
@@ -171,12 +227,19 @@ export class CloudApi {
|
|
|
171
227
|
return this.stream(`/api/cloud/deployments/${encodeURIComponent(deploymentId)}/progress`, { Accept: "text/event-stream" }, signal);
|
|
172
228
|
}
|
|
173
229
|
logs(serviceId, request) {
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
230
|
+
const { follow, lastEventId } = request;
|
|
231
|
+
const read = logReadOf({ follow, lastEventId });
|
|
232
|
+
return this.stream(`/api/cloud/services/${encodeURIComponent(serviceId)}/logs${read.query}`, read.headers, undefined, request.onOpen);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The output of one build, as the `log` events of its stream, then `end`.
|
|
236
|
+
* Without `follow` it is the newest lines, oldest first. A build that is
|
|
237
|
+
* unknown, of another workspace, or whose service was removed answers 404
|
|
238
|
+
* `cloud.errors.builds.not_found`.
|
|
239
|
+
*/
|
|
240
|
+
buildLogs(buildId, request) {
|
|
241
|
+
const read = logReadOf(request);
|
|
242
|
+
return this.stream(`/api/cloud/builds/${encodeURIComponent(buildId)}/logs${read.query}`, read.headers, undefined, request.onOpen);
|
|
180
243
|
}
|
|
181
244
|
async raw(path, init) {
|
|
182
245
|
const headers = new Headers(init?.headers);
|
|
@@ -355,6 +355,94 @@ export interface paths {
|
|
|
355
355
|
patch?: never;
|
|
356
356
|
trace?: never;
|
|
357
357
|
};
|
|
358
|
+
"/api/cloud/services/{serviceId}/port": {
|
|
359
|
+
parameters: {
|
|
360
|
+
query?: never;
|
|
361
|
+
header?: never;
|
|
362
|
+
path?: never;
|
|
363
|
+
cookie?: never;
|
|
364
|
+
};
|
|
365
|
+
get?: never;
|
|
366
|
+
/**
|
|
367
|
+
* @description Sets the port the service's container listens on, or clears it with null. A service a
|
|
368
|
+
* project creation builds from a repository starts without one, and cannot be deployed
|
|
369
|
+
* until it has one: a deployment asked before fails with `cloud.errors.builds.missing_port`.
|
|
370
|
+
*
|
|
371
|
+
* The running revision keeps the port it was deployed with; the next deployment takes the
|
|
372
|
+
* new one.
|
|
373
|
+
*/
|
|
374
|
+
put: operations["setServicePort"];
|
|
375
|
+
post?: never;
|
|
376
|
+
delete?: never;
|
|
377
|
+
options?: never;
|
|
378
|
+
head?: never;
|
|
379
|
+
patch?: never;
|
|
380
|
+
trace?: never;
|
|
381
|
+
};
|
|
382
|
+
"/api/cloud/services/{serviceId}/network": {
|
|
383
|
+
parameters: {
|
|
384
|
+
query?: never;
|
|
385
|
+
header?: never;
|
|
386
|
+
path?: never;
|
|
387
|
+
cookie?: never;
|
|
388
|
+
};
|
|
389
|
+
get?: never;
|
|
390
|
+
/**
|
|
391
|
+
* @description Opens the service to the internet on its own address, or closes it. A service is created
|
|
392
|
+
* closed. Sending the exposure it already has changes nothing.
|
|
393
|
+
*/
|
|
394
|
+
put: operations["setServiceExposure"];
|
|
395
|
+
post?: never;
|
|
396
|
+
delete?: never;
|
|
397
|
+
options?: never;
|
|
398
|
+
head?: never;
|
|
399
|
+
patch?: never;
|
|
400
|
+
trace?: never;
|
|
401
|
+
};
|
|
402
|
+
"/api/cloud/services/{serviceId}/source-dockerfile": {
|
|
403
|
+
parameters: {
|
|
404
|
+
query?: never;
|
|
405
|
+
header?: never;
|
|
406
|
+
path?: never;
|
|
407
|
+
cookie?: never;
|
|
408
|
+
};
|
|
409
|
+
get?: never;
|
|
410
|
+
/**
|
|
411
|
+
* @description Names the Dockerfile, inside its repository, that builds the service, or goes back
|
|
412
|
+
* to the root `Dockerfile` or a recipe with null. The next build reads it; the
|
|
413
|
+
* revisions already built keep their image. A build of a commit that holds no file at
|
|
414
|
+
* that path fails with `cloud.errors.builds.dockerfile_not_found`.
|
|
415
|
+
*/
|
|
416
|
+
put: operations["setServiceDockerfile"];
|
|
417
|
+
post?: never;
|
|
418
|
+
delete?: never;
|
|
419
|
+
options?: never;
|
|
420
|
+
head?: never;
|
|
421
|
+
patch?: never;
|
|
422
|
+
trace?: never;
|
|
423
|
+
};
|
|
424
|
+
"/api/cloud/services/{serviceId}/variables/references": {
|
|
425
|
+
parameters: {
|
|
426
|
+
query?: never;
|
|
427
|
+
header?: never;
|
|
428
|
+
path?: never;
|
|
429
|
+
cookie?: never;
|
|
430
|
+
};
|
|
431
|
+
get?: never;
|
|
432
|
+
put?: never;
|
|
433
|
+
/**
|
|
434
|
+
* @description Adds a variable to the service that follows a value another service of the same
|
|
435
|
+
* environment publishes, such as the `MONGO_URL` of a MongoDB resource: the variable takes
|
|
436
|
+
* the published value, and takes the new one when it changes. Listed afterwards with a
|
|
437
|
+
* `resource` origin. The value itself is never sent to the client.
|
|
438
|
+
*/
|
|
439
|
+
post: operations["followPublishedValue"];
|
|
440
|
+
delete?: never;
|
|
441
|
+
options?: never;
|
|
442
|
+
head?: never;
|
|
443
|
+
patch?: never;
|
|
444
|
+
trace?: never;
|
|
445
|
+
};
|
|
358
446
|
"/api/cloud/services/{serviceId}/source-deployments": {
|
|
359
447
|
parameters: {
|
|
360
448
|
query?: never;
|
|
@@ -419,6 +507,33 @@ export interface paths {
|
|
|
419
507
|
patch?: never;
|
|
420
508
|
trace?: never;
|
|
421
509
|
};
|
|
510
|
+
"/api/cloud/builds/{buildId}/logs": {
|
|
511
|
+
parameters: {
|
|
512
|
+
query?: never;
|
|
513
|
+
header?: never;
|
|
514
|
+
path?: never;
|
|
515
|
+
cookie?: never;
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* @description The output of one build as server-sent events, for a member who may observe the
|
|
519
|
+
* build's project. Same contract as a service's logs.
|
|
520
|
+
*
|
|
521
|
+
* Each line is a `log` event: its data is `{ at, level, message, instance }` and its id
|
|
522
|
+
* is the cursor to resume from. Without `follow` the read is a tail: the newest lines,
|
|
523
|
+
* oldest first, then an `end` event. A read from the start opens with one line naming
|
|
524
|
+
* how the build runs (`Build recipe: ...`), which has no cursor and does not count
|
|
525
|
+
* towards `limit`. An `error` event carrying a `code` ends a stream the platform could
|
|
526
|
+
* not serve.
|
|
527
|
+
*/
|
|
528
|
+
get: operations["streamBuildLogs"];
|
|
529
|
+
put?: never;
|
|
530
|
+
post?: never;
|
|
531
|
+
delete?: never;
|
|
532
|
+
options?: never;
|
|
533
|
+
head?: never;
|
|
534
|
+
patch?: never;
|
|
535
|
+
trace?: never;
|
|
536
|
+
};
|
|
422
537
|
"/api/cloud/deployments/{deploymentId}": {
|
|
423
538
|
parameters: {
|
|
424
539
|
query?: never;
|
|
@@ -621,13 +736,15 @@ export interface components {
|
|
|
621
736
|
environmentId: string;
|
|
622
737
|
serviceId?: string | null;
|
|
623
738
|
};
|
|
624
|
-
|
|
739
|
+
/**
|
|
740
|
+
* @description A service to create in an environment. Its source says where its deployments come
|
|
741
|
+
* from: an upload each `ajs cloud deploy` carries, or a repository AntelopeJS Cloud
|
|
742
|
+
* builds at each push.
|
|
743
|
+
*/
|
|
744
|
+
NewService: {
|
|
625
745
|
name: string;
|
|
626
746
|
appName: string;
|
|
627
|
-
source:
|
|
628
|
-
/** @constant */
|
|
629
|
-
type: "upload";
|
|
630
|
-
};
|
|
747
|
+
source: components["schemas"]["UploadSource"] | components["schemas"]["RepositorySource"];
|
|
631
748
|
port?: number | null;
|
|
632
749
|
isPublic?: boolean;
|
|
633
750
|
};
|
|
@@ -652,6 +769,7 @@ export interface components {
|
|
|
652
769
|
};
|
|
653
770
|
ServiceSettings: {
|
|
654
771
|
serviceId: string;
|
|
772
|
+
source?: components["schemas"]["ServiceSettingsSource"];
|
|
655
773
|
scaling: {
|
|
656
774
|
bounds: components["schemas"]["ServiceBounds"];
|
|
657
775
|
replicaLimit: number;
|
|
@@ -827,6 +945,31 @@ export interface components {
|
|
|
827
945
|
environmentId: string;
|
|
828
946
|
services: components["schemas"]["ServiceHealth"][];
|
|
829
947
|
};
|
|
948
|
+
UploadSource: {
|
|
949
|
+
/** @constant */
|
|
950
|
+
type: "upload";
|
|
951
|
+
};
|
|
952
|
+
/**
|
|
953
|
+
* @description Path, inside the repository, of the Dockerfile that builds the service, such as
|
|
954
|
+
* `frontend.Dockerfile` or `apps/web/Dockerfile`: plain segments of letters, digits,
|
|
955
|
+
* `.`, `_` and `-`, separated by `/`. Null or absent: the root `Dockerfile` when the
|
|
956
|
+
* repository has one, else a recipe.
|
|
957
|
+
*/
|
|
958
|
+
DockerfilePath: string | null;
|
|
959
|
+
/**
|
|
960
|
+
* @description A GitHub repository the workspace's GitHub installation grants. Two services of one
|
|
961
|
+
* repository differ by their Dockerfile: an API built by the AntelopeJS recipe next to
|
|
962
|
+
* a dashboard built by `frontend.Dockerfile`.
|
|
963
|
+
*/
|
|
964
|
+
RepositorySource: {
|
|
965
|
+
/** @constant */
|
|
966
|
+
type: "repository";
|
|
967
|
+
/** @description The repository, as `owner/name`. */
|
|
968
|
+
repository: string;
|
|
969
|
+
/** @description The branch this service builds; null or absent follows its environment's branch. */
|
|
970
|
+
branch?: string | null;
|
|
971
|
+
dockerfilePath?: components["schemas"]["DockerfilePath"];
|
|
972
|
+
};
|
|
830
973
|
/** @description A monthly amount in the plan's currency. A plan that rates nothing a database holds includes it, with no amount to show. */
|
|
831
974
|
MonthlyCost: {
|
|
832
975
|
/** @constant */
|
|
@@ -956,6 +1099,14 @@ export interface components {
|
|
|
956
1099
|
/** @description The plan that remains once the databases are created. */
|
|
957
1100
|
plan: components["schemas"]["ResourcePlan"];
|
|
958
1101
|
};
|
|
1102
|
+
/** @description Where the service's deployments come from. */
|
|
1103
|
+
ServiceSettingsSource: {
|
|
1104
|
+
/** @enum {string} */
|
|
1105
|
+
type: "repository" | "image" | "upload" | "database";
|
|
1106
|
+
/** @description `owner/name`, for a repository source. */
|
|
1107
|
+
repository?: string | null;
|
|
1108
|
+
dockerfilePath?: components["schemas"]["DockerfilePath"];
|
|
1109
|
+
};
|
|
959
1110
|
/** @description What a built revision was built from. */
|
|
960
1111
|
RevisionBuild: {
|
|
961
1112
|
/** @description The branch built; null for a source the CLI uploaded. */
|
|
@@ -1429,7 +1580,7 @@ export interface operations {
|
|
|
1429
1580
|
};
|
|
1430
1581
|
requestBody: {
|
|
1431
1582
|
content: {
|
|
1432
|
-
"application/json": components["schemas"]["
|
|
1583
|
+
"application/json": components["schemas"]["NewService"];
|
|
1433
1584
|
};
|
|
1434
1585
|
};
|
|
1435
1586
|
responses: {
|
|
@@ -1619,6 +1770,193 @@ export interface operations {
|
|
|
1619
1770
|
default: components["responses"]["Error"];
|
|
1620
1771
|
};
|
|
1621
1772
|
};
|
|
1773
|
+
setServicePort: {
|
|
1774
|
+
parameters: {
|
|
1775
|
+
query?: never;
|
|
1776
|
+
header?: never;
|
|
1777
|
+
path: {
|
|
1778
|
+
serviceId: string;
|
|
1779
|
+
};
|
|
1780
|
+
cookie?: never;
|
|
1781
|
+
};
|
|
1782
|
+
requestBody: {
|
|
1783
|
+
content: {
|
|
1784
|
+
"application/json": {
|
|
1785
|
+
/** @description The port the container listens on; null for a service that listens on none. */
|
|
1786
|
+
port: number | null;
|
|
1787
|
+
};
|
|
1788
|
+
};
|
|
1789
|
+
};
|
|
1790
|
+
responses: {
|
|
1791
|
+
/** @description Done */
|
|
1792
|
+
200: {
|
|
1793
|
+
headers: {
|
|
1794
|
+
[name: string]: unknown;
|
|
1795
|
+
};
|
|
1796
|
+
content?: never;
|
|
1797
|
+
};
|
|
1798
|
+
/** @description `cloud.errors.settings.invalid_port`: the port is not an integer from 1024 to 65535. */
|
|
1799
|
+
400: {
|
|
1800
|
+
headers: {
|
|
1801
|
+
[name: string]: unknown;
|
|
1802
|
+
};
|
|
1803
|
+
content: {
|
|
1804
|
+
"application/json": components["schemas"]["Error"];
|
|
1805
|
+
};
|
|
1806
|
+
};
|
|
1807
|
+
/** @description `cloud.errors.settings.public_needs_port`: a public service cannot lose its port. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited. */
|
|
1808
|
+
409: {
|
|
1809
|
+
headers: {
|
|
1810
|
+
[name: string]: unknown;
|
|
1811
|
+
};
|
|
1812
|
+
content: {
|
|
1813
|
+
"application/json": components["schemas"]["Error"];
|
|
1814
|
+
};
|
|
1815
|
+
};
|
|
1816
|
+
default: components["responses"]["Error"];
|
|
1817
|
+
};
|
|
1818
|
+
};
|
|
1819
|
+
setServiceExposure: {
|
|
1820
|
+
parameters: {
|
|
1821
|
+
query?: never;
|
|
1822
|
+
header?: never;
|
|
1823
|
+
path: {
|
|
1824
|
+
serviceId: string;
|
|
1825
|
+
};
|
|
1826
|
+
cookie?: never;
|
|
1827
|
+
};
|
|
1828
|
+
requestBody: {
|
|
1829
|
+
content: {
|
|
1830
|
+
"application/json": {
|
|
1831
|
+
/** @description Whether the internet reaches the service on its own address. */
|
|
1832
|
+
isPublic: boolean;
|
|
1833
|
+
};
|
|
1834
|
+
};
|
|
1835
|
+
};
|
|
1836
|
+
responses: {
|
|
1837
|
+
/** @description Done */
|
|
1838
|
+
200: {
|
|
1839
|
+
headers: {
|
|
1840
|
+
[name: string]: unknown;
|
|
1841
|
+
};
|
|
1842
|
+
content?: never;
|
|
1843
|
+
};
|
|
1844
|
+
/** @description `cloud.errors.settings.public_needs_port`: a service without a port cannot be opened. `cloud.errors.settings.subdomain_taken`: another service holds its address. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited. */
|
|
1845
|
+
409: {
|
|
1846
|
+
headers: {
|
|
1847
|
+
[name: string]: unknown;
|
|
1848
|
+
};
|
|
1849
|
+
content: {
|
|
1850
|
+
"application/json": components["schemas"]["Error"];
|
|
1851
|
+
};
|
|
1852
|
+
};
|
|
1853
|
+
default: components["responses"]["Error"];
|
|
1854
|
+
};
|
|
1855
|
+
};
|
|
1856
|
+
setServiceDockerfile: {
|
|
1857
|
+
parameters: {
|
|
1858
|
+
query?: never;
|
|
1859
|
+
header?: never;
|
|
1860
|
+
path: {
|
|
1861
|
+
serviceId: string;
|
|
1862
|
+
};
|
|
1863
|
+
cookie?: never;
|
|
1864
|
+
};
|
|
1865
|
+
requestBody: {
|
|
1866
|
+
content: {
|
|
1867
|
+
"application/json": {
|
|
1868
|
+
path: components["schemas"]["DockerfilePath"];
|
|
1869
|
+
};
|
|
1870
|
+
};
|
|
1871
|
+
};
|
|
1872
|
+
responses: {
|
|
1873
|
+
/** @description Done */
|
|
1874
|
+
200: {
|
|
1875
|
+
headers: {
|
|
1876
|
+
[name: string]: unknown;
|
|
1877
|
+
};
|
|
1878
|
+
content?: never;
|
|
1879
|
+
};
|
|
1880
|
+
/** @description `cloud.errors.settings.invalid_dockerfile_path`: not a plain relative path inside the repository. */
|
|
1881
|
+
400: {
|
|
1882
|
+
headers: {
|
|
1883
|
+
[name: string]: unknown;
|
|
1884
|
+
};
|
|
1885
|
+
content: {
|
|
1886
|
+
"application/json": components["schemas"]["Error"];
|
|
1887
|
+
};
|
|
1888
|
+
};
|
|
1889
|
+
/** @description `cloud.errors.settings.not_a_repository_source`: the service does not build a repository. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited. */
|
|
1890
|
+
409: {
|
|
1891
|
+
headers: {
|
|
1892
|
+
[name: string]: unknown;
|
|
1893
|
+
};
|
|
1894
|
+
content: {
|
|
1895
|
+
"application/json": components["schemas"]["Error"];
|
|
1896
|
+
};
|
|
1897
|
+
};
|
|
1898
|
+
default: components["responses"]["Error"];
|
|
1899
|
+
};
|
|
1900
|
+
};
|
|
1901
|
+
followPublishedValue: {
|
|
1902
|
+
parameters: {
|
|
1903
|
+
query?: never;
|
|
1904
|
+
header?: never;
|
|
1905
|
+
path: {
|
|
1906
|
+
serviceId: string;
|
|
1907
|
+
};
|
|
1908
|
+
cookie?: never;
|
|
1909
|
+
};
|
|
1910
|
+
requestBody: {
|
|
1911
|
+
content: {
|
|
1912
|
+
"application/json": {
|
|
1913
|
+
/** @description The name of the variable on the service. */
|
|
1914
|
+
key: string;
|
|
1915
|
+
/** @description The service that publishes the value. */
|
|
1916
|
+
serviceId: string;
|
|
1917
|
+
/** @description The key the publisher publishes the value under. */
|
|
1918
|
+
publishedKey: string;
|
|
1919
|
+
};
|
|
1920
|
+
};
|
|
1921
|
+
};
|
|
1922
|
+
responses: {
|
|
1923
|
+
/** @description Done */
|
|
1924
|
+
200: {
|
|
1925
|
+
headers: {
|
|
1926
|
+
[name: string]: unknown;
|
|
1927
|
+
};
|
|
1928
|
+
content?: never;
|
|
1929
|
+
};
|
|
1930
|
+
/** @description `cloud.errors.settings.invalid_key`: the name is not a valid variable name. `cloud.errors.settings.self_reference`: a service cannot follow its own value. */
|
|
1931
|
+
400: {
|
|
1932
|
+
headers: {
|
|
1933
|
+
[name: string]: unknown;
|
|
1934
|
+
};
|
|
1935
|
+
content: {
|
|
1936
|
+
"application/json": components["schemas"]["Error"];
|
|
1937
|
+
};
|
|
1938
|
+
};
|
|
1939
|
+
/** @description `cloud.errors.settings.unknown_publisher`: the environment has no such service. `cloud.errors.settings.key_not_published`: the publisher publishes no such key. */
|
|
1940
|
+
404: {
|
|
1941
|
+
headers: {
|
|
1942
|
+
[name: string]: unknown;
|
|
1943
|
+
};
|
|
1944
|
+
content: {
|
|
1945
|
+
"application/json": components["schemas"]["Error"];
|
|
1946
|
+
};
|
|
1947
|
+
};
|
|
1948
|
+
/** @description `cloud.errors.settings.duplicate_key`: the service already holds a variable of that name. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited. */
|
|
1949
|
+
409: {
|
|
1950
|
+
headers: {
|
|
1951
|
+
[name: string]: unknown;
|
|
1952
|
+
};
|
|
1953
|
+
content: {
|
|
1954
|
+
"application/json": components["schemas"]["Error"];
|
|
1955
|
+
};
|
|
1956
|
+
};
|
|
1957
|
+
default: components["responses"]["Error"];
|
|
1958
|
+
};
|
|
1959
|
+
};
|
|
1622
1960
|
deploySource: {
|
|
1623
1961
|
parameters: {
|
|
1624
1962
|
query?: never;
|
|
@@ -1723,6 +2061,64 @@ export interface operations {
|
|
|
1723
2061
|
default: components["responses"]["Error"];
|
|
1724
2062
|
};
|
|
1725
2063
|
};
|
|
2064
|
+
streamBuildLogs: {
|
|
2065
|
+
parameters: {
|
|
2066
|
+
query?: {
|
|
2067
|
+
/** @description Keeps the stream open and delivers the lines the build writes next. */
|
|
2068
|
+
follow?: boolean;
|
|
2069
|
+
/** @description The most lines the read returns before it ends. A tail holds 500 at most. */
|
|
2070
|
+
limit?: number;
|
|
2071
|
+
};
|
|
2072
|
+
header?: {
|
|
2073
|
+
/** @description The id of the last event received. The read resumes after it, oldest first. */
|
|
2074
|
+
"Last-Event-ID"?: string;
|
|
2075
|
+
};
|
|
2076
|
+
path: {
|
|
2077
|
+
buildId: string;
|
|
2078
|
+
};
|
|
2079
|
+
cookie?: never;
|
|
2080
|
+
};
|
|
2081
|
+
requestBody?: never;
|
|
2082
|
+
responses: {
|
|
2083
|
+
/** @description Server-sent log events */
|
|
2084
|
+
200: {
|
|
2085
|
+
headers: {
|
|
2086
|
+
[name: string]: unknown;
|
|
2087
|
+
};
|
|
2088
|
+
content: {
|
|
2089
|
+
"text/event-stream": string;
|
|
2090
|
+
};
|
|
2091
|
+
};
|
|
2092
|
+
/** @description A parameter the API cannot read, such as a `limit` that is not a positive integer. */
|
|
2093
|
+
400: {
|
|
2094
|
+
headers: {
|
|
2095
|
+
[name: string]: unknown;
|
|
2096
|
+
};
|
|
2097
|
+
content: {
|
|
2098
|
+
"application/json": components["schemas"]["Error"];
|
|
2099
|
+
};
|
|
2100
|
+
};
|
|
2101
|
+
/** @description `cloud.errors.builds.not_found`: no such build, a build of another workspace or of a project the member may not observe, or one whose service was removed. */
|
|
2102
|
+
404: {
|
|
2103
|
+
headers: {
|
|
2104
|
+
[name: string]: unknown;
|
|
2105
|
+
};
|
|
2106
|
+
content: {
|
|
2107
|
+
"application/json": components["schemas"]["Error"];
|
|
2108
|
+
};
|
|
2109
|
+
};
|
|
2110
|
+
/** @description The member or the workspace already holds every live follow it may open. `Retry-After` says how long to wait. A read without `follow` is never refused this way. */
|
|
2111
|
+
429: {
|
|
2112
|
+
headers: {
|
|
2113
|
+
[name: string]: unknown;
|
|
2114
|
+
};
|
|
2115
|
+
content: {
|
|
2116
|
+
"application/json": components["schemas"]["Error"];
|
|
2117
|
+
};
|
|
2118
|
+
};
|
|
2119
|
+
default: components["responses"]["Error"];
|
|
2120
|
+
};
|
|
2121
|
+
};
|
|
1726
2122
|
readDeployment: {
|
|
1727
2123
|
parameters: {
|
|
1728
2124
|
query?: never;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export * from "./api.js";
|
|
|
3
3
|
export * from "./deployments.js";
|
|
4
4
|
export * from "./environments.js";
|
|
5
5
|
export type { components, operations, paths } from "./generated/cloud-api.js";
|
|
6
|
+
export type { BuildLogRequest, LogRequest } from "./logs.js";
|
|
6
7
|
export type * from "./resources.js";
|
|
7
8
|
export * from "./sse.js";
|
package/dist/logs.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** How a log read is shaped: one bounded page, or a tail from a cursor. */
|
|
2
|
+
export interface LogRequest {
|
|
3
|
+
follow: boolean;
|
|
4
|
+
lastEventId?: string;
|
|
5
|
+
/** Called once the API accepted the read, before its first frame. */
|
|
6
|
+
onOpen?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/** How one build's log is read. */
|
|
9
|
+
export interface BuildLogRequest extends LogRequest {
|
|
10
|
+
/**
|
|
11
|
+
* The most lines the read returns before it ends. Without `follow` and
|
|
12
|
+
* without `lastEventId` the read is a tail, the newest lines oldest first,
|
|
13
|
+
* and the API returns 500 at most.
|
|
14
|
+
*/
|
|
15
|
+
limit?: number;
|
|
16
|
+
}
|
|
17
|
+
/** A log read as it goes on the wire. */
|
|
18
|
+
interface LogRead {
|
|
19
|
+
/** The query string, with its leading `?`, or empty. */
|
|
20
|
+
query: string;
|
|
21
|
+
headers: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
/** The query string and headers a log read is sent with. */
|
|
24
|
+
export declare function logReadOf(request: BuildLogRequest): LogRead;
|
|
25
|
+
export {};
|
package/dist/logs.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The query string and headers a log read is sent with. */
|
|
2
|
+
export function logReadOf(request) {
|
|
3
|
+
const query = new URLSearchParams();
|
|
4
|
+
if (request.follow)
|
|
5
|
+
query.set("follow", "true");
|
|
6
|
+
if (request.limit !== undefined)
|
|
7
|
+
query.set("limit", String(request.limit));
|
|
8
|
+
const text = query.toString();
|
|
9
|
+
const accept = { Accept: "text/event-stream" };
|
|
10
|
+
return {
|
|
11
|
+
query: text === "" ? "" : `?${text}`,
|
|
12
|
+
headers: request.lastEventId
|
|
13
|
+
? { ...accept, "Last-Event-ID": request.lastEventId }
|
|
14
|
+
: accept,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
paths:
|
|
2
|
+
logs:
|
|
3
|
+
get:
|
|
4
|
+
operationId: streamBuildLogs
|
|
5
|
+
description: |
|
|
6
|
+
The output of one build as server-sent events, for a member who may observe the
|
|
7
|
+
build's project. Same contract as a service's logs.
|
|
8
|
+
|
|
9
|
+
Each line is a `log` event: its data is `{ at, level, message, instance }` and its id
|
|
10
|
+
is the cursor to resume from. Without `follow` the read is a tail: the newest lines,
|
|
11
|
+
oldest first, then an `end` event. A read from the start opens with one line naming
|
|
12
|
+
how the build runs (`Build recipe: ...`), which has no cursor and does not count
|
|
13
|
+
towards `limit`. An `error` event carrying a `code` ends a stream the platform could
|
|
14
|
+
not serve.
|
|
15
|
+
security: [{ bearerAuth: [] }]
|
|
16
|
+
parameters:
|
|
17
|
+
- in: path
|
|
18
|
+
name: buildId
|
|
19
|
+
required: true
|
|
20
|
+
schema: { type: string }
|
|
21
|
+
- in: query
|
|
22
|
+
name: follow
|
|
23
|
+
description: Keeps the stream open and delivers the lines the build writes next.
|
|
24
|
+
schema: { type: boolean }
|
|
25
|
+
- in: query
|
|
26
|
+
name: limit
|
|
27
|
+
description: The most lines the read returns before it ends. A tail holds 500 at most.
|
|
28
|
+
schema: { type: integer, minimum: 1 }
|
|
29
|
+
- in: header
|
|
30
|
+
name: Last-Event-ID
|
|
31
|
+
description: The id of the last event received. The read resumes after it, oldest first.
|
|
32
|
+
schema: { type: string }
|
|
33
|
+
responses:
|
|
34
|
+
'200':
|
|
35
|
+
description: Server-sent log events
|
|
36
|
+
content:
|
|
37
|
+
text/event-stream:
|
|
38
|
+
schema: { type: string }
|
|
39
|
+
'400':
|
|
40
|
+
description: A parameter the API cannot read, such as a `limit` that is not a positive integer.
|
|
41
|
+
content:
|
|
42
|
+
application/json:
|
|
43
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
44
|
+
'404':
|
|
45
|
+
description: '`cloud.errors.builds.not_found`: no such build, a build of another workspace or of a project the member may not observe, or one whose service was removed.'
|
|
46
|
+
content:
|
|
47
|
+
application/json:
|
|
48
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
49
|
+
'429':
|
|
50
|
+
description: The member or the workspace already holds every live follow it may open. `Retry-After` says how long to wait. A read without `follow` is never refused this way.
|
|
51
|
+
content:
|
|
52
|
+
application/json:
|
|
53
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
54
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
@@ -194,19 +194,7 @@ components:
|
|
|
194
194
|
region: { type: string }
|
|
195
195
|
environmentId: { type: string }
|
|
196
196
|
serviceId: { type: [string, "null"] }
|
|
197
|
-
|
|
198
|
-
type: object
|
|
199
|
-
required: [name, appName, source]
|
|
200
|
-
properties:
|
|
201
|
-
name: { type: string }
|
|
202
|
-
appName: { type: string }
|
|
203
|
-
source:
|
|
204
|
-
type: object
|
|
205
|
-
required: [type]
|
|
206
|
-
properties:
|
|
207
|
-
type: { type: string, const: upload }
|
|
208
|
-
port: { type: [integer, "null"] }
|
|
209
|
-
isPublic: { type: boolean }
|
|
197
|
+
NewService: { $ref: 'services.yaml#/schemas/NewService' }
|
|
210
198
|
CreatedService:
|
|
211
199
|
type: object
|
|
212
200
|
required: [serviceId, name, appName]
|
|
@@ -239,6 +227,7 @@ components:
|
|
|
239
227
|
required: [serviceId, scaling, volumeLimits]
|
|
240
228
|
properties:
|
|
241
229
|
serviceId: { type: string }
|
|
230
|
+
source: { $ref: 'services.yaml#/schemas/ServiceSettingsSource' }
|
|
242
231
|
scaling:
|
|
243
232
|
type: object
|
|
244
233
|
required: [bounds, replicaLimit, pricing]
|
|
@@ -353,7 +342,7 @@ paths:
|
|
|
353
342
|
required: true
|
|
354
343
|
content:
|
|
355
344
|
application/json:
|
|
356
|
-
schema: { $ref: '#/components/schemas/
|
|
345
|
+
schema: { $ref: '#/components/schemas/NewService' }
|
|
357
346
|
responses:
|
|
358
347
|
'200':
|
|
359
348
|
content:
|
|
@@ -385,6 +374,10 @@ paths:
|
|
|
385
374
|
application/json:
|
|
386
375
|
schema: { $ref: '#/components/schemas/ServiceSettings' }
|
|
387
376
|
default: { $ref: '#/components/responses/Error' }
|
|
377
|
+
/api/cloud/services/{serviceId}/port: { $ref: 'services.yaml#/paths/port' }
|
|
378
|
+
/api/cloud/services/{serviceId}/network: { $ref: 'services.yaml#/paths/network' }
|
|
379
|
+
/api/cloud/services/{serviceId}/source-dockerfile: { $ref: 'services.yaml#/paths/sourceDockerfile' }
|
|
380
|
+
/api/cloud/services/{serviceId}/variables/references: { $ref: 'services.yaml#/paths/variableReferences' }
|
|
388
381
|
/api/cloud/services/{serviceId}/source-deployments:
|
|
389
382
|
post:
|
|
390
383
|
operationId: deploySource
|
|
@@ -471,6 +464,7 @@ paths:
|
|
|
471
464
|
text/event-stream:
|
|
472
465
|
schema: { type: string }
|
|
473
466
|
default: { $ref: '#/components/responses/Error' }
|
|
467
|
+
/api/cloud/builds/{buildId}/logs: { $ref: 'builds.yaml#/paths/logs' }
|
|
474
468
|
/api/cloud/deployments/{deploymentId}:
|
|
475
469
|
get:
|
|
476
470
|
operationId: readDeployment
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
schemas:
|
|
2
|
+
NewService:
|
|
3
|
+
description: |
|
|
4
|
+
A service to create in an environment. Its source says where its deployments come
|
|
5
|
+
from: an upload each `ajs cloud deploy` carries, or a repository AntelopeJS Cloud
|
|
6
|
+
builds at each push.
|
|
7
|
+
type: object
|
|
8
|
+
required: [name, appName, source]
|
|
9
|
+
properties:
|
|
10
|
+
name: { type: string }
|
|
11
|
+
appName: { type: string }
|
|
12
|
+
source:
|
|
13
|
+
oneOf:
|
|
14
|
+
- $ref: '#/schemas/UploadSource'
|
|
15
|
+
- $ref: '#/schemas/RepositorySource'
|
|
16
|
+
port: { type: [integer, "null"] }
|
|
17
|
+
isPublic: { type: boolean }
|
|
18
|
+
UploadSource:
|
|
19
|
+
type: object
|
|
20
|
+
required: [type]
|
|
21
|
+
properties:
|
|
22
|
+
type: { type: string, const: upload }
|
|
23
|
+
RepositorySource:
|
|
24
|
+
description: |
|
|
25
|
+
A GitHub repository the workspace's GitHub installation grants. Two services of one
|
|
26
|
+
repository differ by their Dockerfile: an API built by the AntelopeJS recipe next to
|
|
27
|
+
a dashboard built by `frontend.Dockerfile`.
|
|
28
|
+
type: object
|
|
29
|
+
required: [type, repository]
|
|
30
|
+
properties:
|
|
31
|
+
type: { type: string, const: repository }
|
|
32
|
+
repository: { type: string, description: "The repository, as `owner/name`." }
|
|
33
|
+
branch:
|
|
34
|
+
description: The branch this service builds; null or absent follows its environment's branch.
|
|
35
|
+
type: [string, "null"]
|
|
36
|
+
dockerfilePath: { $ref: '#/schemas/DockerfilePath' }
|
|
37
|
+
DockerfilePath:
|
|
38
|
+
description: |
|
|
39
|
+
Path, inside the repository, of the Dockerfile that builds the service, such as
|
|
40
|
+
`frontend.Dockerfile` or `apps/web/Dockerfile`: plain segments of letters, digits,
|
|
41
|
+
`.`, `_` and `-`, separated by `/`. Null or absent: the root `Dockerfile` when the
|
|
42
|
+
repository has one, else a recipe.
|
|
43
|
+
type: [string, "null"]
|
|
44
|
+
maxLength: 255
|
|
45
|
+
ServiceSettingsSource:
|
|
46
|
+
description: Where the service's deployments come from.
|
|
47
|
+
type: object
|
|
48
|
+
required: [type]
|
|
49
|
+
properties:
|
|
50
|
+
type: { type: string, enum: [repository, image, upload, database] }
|
|
51
|
+
repository: { type: [string, "null"], description: "`owner/name`, for a repository source." }
|
|
52
|
+
dockerfilePath: { $ref: '#/schemas/DockerfilePath' }
|
|
53
|
+
paths:
|
|
54
|
+
port:
|
|
55
|
+
put:
|
|
56
|
+
operationId: setServicePort
|
|
57
|
+
description: |
|
|
58
|
+
Sets the port the service's container listens on, or clears it with null. A service a
|
|
59
|
+
project creation builds from a repository starts without one, and cannot be deployed
|
|
60
|
+
until it has one: a deployment asked before fails with `cloud.errors.builds.missing_port`.
|
|
61
|
+
|
|
62
|
+
The running revision keeps the port it was deployed with; the next deployment takes the
|
|
63
|
+
new one.
|
|
64
|
+
security: [{ bearerAuth: [] }]
|
|
65
|
+
parameters:
|
|
66
|
+
- in: path
|
|
67
|
+
name: serviceId
|
|
68
|
+
required: true
|
|
69
|
+
schema: { type: string }
|
|
70
|
+
requestBody:
|
|
71
|
+
required: true
|
|
72
|
+
content:
|
|
73
|
+
application/json:
|
|
74
|
+
schema:
|
|
75
|
+
type: object
|
|
76
|
+
required: [port]
|
|
77
|
+
properties:
|
|
78
|
+
port:
|
|
79
|
+
description: The port the container listens on; null for a service that listens on none.
|
|
80
|
+
type: [integer, "null"]
|
|
81
|
+
minimum: 1024
|
|
82
|
+
maximum: 65535
|
|
83
|
+
responses:
|
|
84
|
+
'200':
|
|
85
|
+
description: Done
|
|
86
|
+
'400':
|
|
87
|
+
description: '`cloud.errors.settings.invalid_port`: the port is not an integer from 1024 to 65535.'
|
|
88
|
+
content:
|
|
89
|
+
application/json:
|
|
90
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
91
|
+
'409':
|
|
92
|
+
description: '`cloud.errors.settings.public_needs_port`: a public service cannot lose its port. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited.'
|
|
93
|
+
content:
|
|
94
|
+
application/json:
|
|
95
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
96
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
97
|
+
variableReferences:
|
|
98
|
+
post:
|
|
99
|
+
operationId: followPublishedValue
|
|
100
|
+
description: |
|
|
101
|
+
Adds a variable to the service that follows a value another service of the same
|
|
102
|
+
environment publishes, such as the `MONGO_URL` of a MongoDB resource: the variable takes
|
|
103
|
+
the published value, and takes the new one when it changes. Listed afterwards with a
|
|
104
|
+
`resource` origin. The value itself is never sent to the client.
|
|
105
|
+
security: [{ bearerAuth: [] }]
|
|
106
|
+
parameters:
|
|
107
|
+
- in: path
|
|
108
|
+
name: serviceId
|
|
109
|
+
required: true
|
|
110
|
+
schema: { type: string }
|
|
111
|
+
requestBody:
|
|
112
|
+
required: true
|
|
113
|
+
content:
|
|
114
|
+
application/json:
|
|
115
|
+
schema:
|
|
116
|
+
type: object
|
|
117
|
+
required: [key, serviceId, publishedKey]
|
|
118
|
+
properties:
|
|
119
|
+
key:
|
|
120
|
+
description: The name of the variable on the service.
|
|
121
|
+
type: string
|
|
122
|
+
serviceId:
|
|
123
|
+
description: The service that publishes the value.
|
|
124
|
+
type: string
|
|
125
|
+
publishedKey:
|
|
126
|
+
description: The key the publisher publishes the value under.
|
|
127
|
+
type: string
|
|
128
|
+
responses:
|
|
129
|
+
'200':
|
|
130
|
+
description: Done
|
|
131
|
+
'400':
|
|
132
|
+
description: '`cloud.errors.settings.invalid_key`: the name is not a valid variable name. `cloud.errors.settings.self_reference`: a service cannot follow its own value.'
|
|
133
|
+
content:
|
|
134
|
+
application/json:
|
|
135
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
136
|
+
'404':
|
|
137
|
+
description: '`cloud.errors.settings.unknown_publisher`: the environment has no such service. `cloud.errors.settings.key_not_published`: the publisher publishes no such key.'
|
|
138
|
+
content:
|
|
139
|
+
application/json:
|
|
140
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
141
|
+
'409':
|
|
142
|
+
description: '`cloud.errors.settings.duplicate_key`: the service already holds a variable of that name. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited.'
|
|
143
|
+
content:
|
|
144
|
+
application/json:
|
|
145
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
146
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
147
|
+
network:
|
|
148
|
+
put:
|
|
149
|
+
operationId: setServiceExposure
|
|
150
|
+
description: |
|
|
151
|
+
Opens the service to the internet on its own address, or closes it. A service is created
|
|
152
|
+
closed. Sending the exposure it already has changes nothing.
|
|
153
|
+
security: [{ bearerAuth: [] }]
|
|
154
|
+
parameters:
|
|
155
|
+
- in: path
|
|
156
|
+
name: serviceId
|
|
157
|
+
required: true
|
|
158
|
+
schema: { type: string }
|
|
159
|
+
requestBody:
|
|
160
|
+
required: true
|
|
161
|
+
content:
|
|
162
|
+
application/json:
|
|
163
|
+
schema:
|
|
164
|
+
type: object
|
|
165
|
+
required: [isPublic]
|
|
166
|
+
properties:
|
|
167
|
+
isPublic:
|
|
168
|
+
description: Whether the internet reaches the service on its own address.
|
|
169
|
+
type: boolean
|
|
170
|
+
responses:
|
|
171
|
+
'200':
|
|
172
|
+
description: Done
|
|
173
|
+
'409':
|
|
174
|
+
description: '`cloud.errors.settings.public_needs_port`: a service without a port cannot be opened. `cloud.errors.settings.subdomain_taken`: another service holds its address. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited.'
|
|
175
|
+
content:
|
|
176
|
+
application/json:
|
|
177
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
178
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
179
|
+
sourceDockerfile:
|
|
180
|
+
put:
|
|
181
|
+
operationId: setServiceDockerfile
|
|
182
|
+
description: |
|
|
183
|
+
Names the Dockerfile, inside its repository, that builds the service, or goes back
|
|
184
|
+
to the root `Dockerfile` or a recipe with null. The next build reads it; the
|
|
185
|
+
revisions already built keep their image. A build of a commit that holds no file at
|
|
186
|
+
that path fails with `cloud.errors.builds.dockerfile_not_found`.
|
|
187
|
+
security: [{ bearerAuth: [] }]
|
|
188
|
+
parameters:
|
|
189
|
+
- in: path
|
|
190
|
+
name: serviceId
|
|
191
|
+
required: true
|
|
192
|
+
schema: { type: string }
|
|
193
|
+
requestBody:
|
|
194
|
+
required: true
|
|
195
|
+
content:
|
|
196
|
+
application/json:
|
|
197
|
+
schema:
|
|
198
|
+
type: object
|
|
199
|
+
required: [path]
|
|
200
|
+
properties:
|
|
201
|
+
path: { $ref: '#/schemas/DockerfilePath' }
|
|
202
|
+
responses:
|
|
203
|
+
'200':
|
|
204
|
+
description: Done
|
|
205
|
+
'400':
|
|
206
|
+
description: '`cloud.errors.settings.invalid_dockerfile_path`: not a plain relative path inside the repository.'
|
|
207
|
+
content:
|
|
208
|
+
application/json:
|
|
209
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
210
|
+
'409':
|
|
211
|
+
description: '`cloud.errors.settings.not_a_repository_source`: the service does not build a repository. `cloud.errors.settings.preview_read_only`: a preview mirrors its environment and is not edited.'
|
|
212
|
+
content:
|
|
213
|
+
application/json:
|
|
214
|
+
schema: { $ref: './cloud.openapi.yaml#/components/schemas/Error' }
|
|
215
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/cloud-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Typed client for the AntelopeJS Cloud API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"openapi-fetch": "^0.14.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@antelopejs/tooling-configs": "^0.5.
|
|
56
|
+
"@antelopejs/tooling-configs": "^0.5.5",
|
|
57
57
|
"@types/node": "^22.19.15",
|
|
58
58
|
"openapi-typescript": "^7.9.1",
|
|
59
59
|
"oxfmt": "^0.77.0",
|