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/set-detailed-state.ts
Views: 688
1
import { z } from "../../framework";
2
3
import { FailedAPIOperationSchema, OkAPIOperationSchema } from "../common";
4
5
import { ProjectIdSchema } from "../projects/common";
6
7
import { ComputeServerIdSchema } from "./common";
8
9
// OpenAPI spec
10
//
11
export const SetDetailedServerStateInputSchema = 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
state: z
23
.string()
24
.describe(
25
`The value of the state field to be set. If this value is empty, the state variable
26
specified in the \`name\` field is removed.`,
27
)
28
.optional(),
29
extra: z.string().describe("State metadata.").optional(),
30
timeout: z
31
.number()
32
.min(0)
33
.describe("Specifies a duration for which this state variable is valid.")
34
.optional(),
35
progress: z.number().optional(),
36
})
37
.describe(
38
`Set detailed state for a compute server; detailed state maps component name to
39
something like \`{state:'running',time:Date.now()}\` and is used to provide users with
40
insight into what's currently happening on their compute server. The \`name\`
41
must be provided to specify a particular (possibly nested) state property to be set.
42
_This is mainly used from the backend to convey information to user about what is
43
going on in a compute server._`,
44
);
45
46
export const SetDetailedServerStateOutputSchema = z.union([
47
FailedAPIOperationSchema,
48
OkAPIOperationSchema,
49
]);
50
51
export type SetDetailedServerStateInput = z.infer<
52
typeof SetDetailedServerStateInputSchema
53
>;
54
export type SetDetailedServerStateOutput = z.infer<
55
typeof SetDetailedServerStateOutputSchema
56
>;
57
58