CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/schema/compute/get-detailed-state.ts
Views: 688
1
import { z } from "../../framework";
2
3
import { FailedAPIOperationSchema } from "../common";
4
5
import { ProjectIdSchema } from "../projects/common";
6
7
import { ComputeServerIdSchema } from "./common";
8
9
// OpenAPI spec
10
//
11
export const GetDetailedServerStateInputSchema = z
12
.object({
13
id: ComputeServerIdSchema,
14
project_id: ProjectIdSchema,
15
name: z
16
.string()
17
.describe(
18
`Optional JSON path to select a particular property of the compute
19
server's detailed state.`,
20
)
21
.optional(),
22
})
23
.describe(
24
`Returns a map from component name to something like \`{state:'running',time:Date.now()}\`.
25
This is used to provide users with insight into what's currently happening on their
26
compute server. The response may optionally be filtered via a JSON path specified in
27
the \`name\` attribute to obtain a particular (possibly nested) state property.`,
28
);
29
30
export const GetDetailedServerStateOutputSchema = z.union([
31
FailedAPIOperationSchema,
32
z.string().describe(
33
`When the \`name\` field is not specified, the entire server state is returned as a
34
string; otherwise, only the subset of the server state corresponding to the JSON
35
path specified in \`name\` is returned.`,
36
),
37
]);
38
39
export type GetDetailedServerStateInput = z.infer<
40
typeof GetDetailedServerStateInputSchema
41
>;
42
export type GetDetailedServerStateOutput = z.infer<
43
typeof GetDetailedServerStateOutputSchema
44
>;
45
46