@synnaxlabs/client 0.52.3 → 0.53.0
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/.turbo/turbo-build.log +5 -5
- package/dist/client.cjs +29 -29
- package/dist/client.js +3543 -3382
- package/dist/src/rack/client.d.ts +1 -1
- package/dist/src/rack/client.d.ts.map +1 -1
- package/dist/src/task/client.d.ts +17 -19
- package/dist/src/task/client.d.ts.map +1 -1
- package/dist/src/task/payload.d.ts +30 -25
- package/dist/src/task/payload.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/rack/client.ts +10 -21
- package/src/task/client.ts +56 -148
- package/src/task/payload.ts +33 -56
package/src/task/payload.ts
CHANGED
|
@@ -21,12 +21,7 @@ export const keyZ = z.union([
|
|
|
21
21
|
export type Key = z.infer<typeof keyZ>;
|
|
22
22
|
|
|
23
23
|
export const statusDetailsZ = <DataSchema extends z.ZodType>(data: DataSchema) =>
|
|
24
|
-
z.object({
|
|
25
|
-
task: keyZ,
|
|
26
|
-
running: z.boolean(),
|
|
27
|
-
data,
|
|
28
|
-
cmd: z.string().optional(),
|
|
29
|
-
});
|
|
24
|
+
z.object({ task: keyZ, running: z.boolean(), data, cmd: z.string().optional() });
|
|
30
25
|
|
|
31
26
|
export type StatusDetails<DataSchema extends z.ZodType> = z.infer<
|
|
32
27
|
ReturnType<typeof statusDetailsZ<DataSchema>>
|
|
@@ -35,9 +30,9 @@ export type StatusDetails<DataSchema extends z.ZodType> = z.infer<
|
|
|
35
30
|
export const statusZ = <DataSchema extends z.ZodType>(data: DataSchema) =>
|
|
36
31
|
status.statusZ(statusDetailsZ(data));
|
|
37
32
|
|
|
38
|
-
export
|
|
33
|
+
export interface Status<StatusData extends z.ZodType = z.ZodUnknown> extends z.infer<
|
|
39
34
|
ReturnType<typeof statusZ<StatusData>>
|
|
40
|
-
|
|
35
|
+
> {}
|
|
41
36
|
|
|
42
37
|
const newStatusDetailsZ = <DataSchema extends z.ZodType>(data: DataSchema) =>
|
|
43
38
|
statusDetailsZ(data).partial({ task: true });
|
|
@@ -45,83 +40,65 @@ const newStatusDetailsZ = <DataSchema extends z.ZodType>(data: DataSchema) =>
|
|
|
45
40
|
export const newStatusZ = <DataSchema extends z.ZodType>(data: DataSchema) =>
|
|
46
41
|
status.statusZ(newStatusDetailsZ(data)).partial({ key: true, name: true });
|
|
47
42
|
|
|
48
|
-
export interface NewStatus<DataSchema extends z.ZodType = z.
|
|
43
|
+
export interface NewStatus<DataSchema extends z.ZodType = z.ZodType> extends z.infer<
|
|
49
44
|
ReturnType<typeof newStatusZ<DataSchema>>
|
|
50
45
|
> {}
|
|
51
46
|
|
|
52
|
-
export
|
|
47
|
+
export interface Schemas<
|
|
53
48
|
Type extends z.ZodLiteral<string> = z.ZodLiteral<string>,
|
|
54
49
|
Config extends z.ZodType = z.ZodType,
|
|
55
|
-
StatusData extends z.ZodType = z.
|
|
56
|
-
>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
StatusData extends z.ZodType = z.ZodType,
|
|
51
|
+
> {
|
|
52
|
+
type: Type;
|
|
53
|
+
config: Config;
|
|
54
|
+
statusData: StatusData;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const taskZ = <S extends Schemas = Schemas>(
|
|
58
|
+
schemas = {
|
|
59
|
+
type: z.string() as unknown as S["type"],
|
|
60
|
+
config: record.nullishToEmpty() as S["config"],
|
|
61
|
+
statusData: z.unknown() as S["statusData"],
|
|
61
62
|
},
|
|
62
63
|
) =>
|
|
63
64
|
z.object({
|
|
64
65
|
key: keyZ,
|
|
65
66
|
name: z.string(),
|
|
66
|
-
type: schemas.
|
|
67
|
+
type: schemas.type,
|
|
67
68
|
internal: z.boolean().optional(),
|
|
68
|
-
config: schemas.
|
|
69
|
-
status: statusZ(schemas.
|
|
69
|
+
config: schemas.config,
|
|
70
|
+
status: statusZ(schemas.statusData).optional().nullable(),
|
|
70
71
|
snapshot: z.boolean().optional(),
|
|
71
72
|
});
|
|
72
73
|
|
|
73
|
-
export interface Schemas
|
|
74
|
-
Type extends z.ZodLiteral<string> = z.ZodLiteral<string>,
|
|
75
|
-
Config extends z.ZodType = z.ZodType,
|
|
76
|
-
StatusData extends z.ZodType = z.ZodType,
|
|
77
|
-
> {
|
|
78
|
-
typeSchema: Type;
|
|
79
|
-
configSchema: Config;
|
|
80
|
-
statusDataSchema: StatusData;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export type Payload<
|
|
84
|
-
Type extends z.ZodLiteral<string> = z.ZodLiteral<string>,
|
|
85
|
-
Config extends z.ZodType = z.ZodType,
|
|
86
|
-
StatusData extends z.ZodType = z.ZodType,
|
|
87
|
-
> = {
|
|
74
|
+
export interface Payload<S extends Schemas = Schemas> {
|
|
88
75
|
key: Key;
|
|
89
76
|
name: string;
|
|
90
|
-
type: z.infer<
|
|
91
|
-
config: z.infer<
|
|
92
|
-
status?: Status<
|
|
77
|
+
type: z.infer<S["type"]>;
|
|
78
|
+
config: z.infer<S["config"]>;
|
|
79
|
+
status?: Status<S["statusData"]>;
|
|
93
80
|
snapshot?: boolean;
|
|
94
81
|
internal?: boolean;
|
|
95
|
-
}
|
|
82
|
+
}
|
|
96
83
|
|
|
97
|
-
export const newZ = <
|
|
98
|
-
Type extends z.ZodLiteral<string> = z.ZodLiteral<string>,
|
|
99
|
-
Config extends z.ZodType = z.ZodType,
|
|
100
|
-
StatusData extends z.ZodType = z.ZodUnknown,
|
|
101
|
-
>(
|
|
102
|
-
schemas?: Schemas<Type, Config, StatusData>,
|
|
103
|
-
) =>
|
|
84
|
+
export const newZ = <S extends Schemas = Schemas>(schemas?: S) =>
|
|
104
85
|
taskZ(schemas)
|
|
105
86
|
.omit({ key: true, status: true })
|
|
106
87
|
.extend({
|
|
107
88
|
key: keyZ.transform((k) => k.toString()).optional(),
|
|
108
|
-
config: schemas?.
|
|
109
|
-
status: newStatusZ(schemas?.
|
|
89
|
+
config: schemas?.config ?? record.nullishToEmpty(),
|
|
90
|
+
status: newStatusZ(schemas?.statusData ?? z.unknown())
|
|
110
91
|
.optional()
|
|
111
92
|
.nullable(),
|
|
112
93
|
});
|
|
113
94
|
|
|
114
|
-
export
|
|
115
|
-
Type extends z.ZodLiteral<string> = z.ZodLiteral<string>,
|
|
116
|
-
Config extends z.ZodType = z.ZodType,
|
|
117
|
-
StatusData extends z.ZodType = z.ZodUnknown,
|
|
118
|
-
> = {
|
|
95
|
+
export interface New<S extends Schemas = Schemas> {
|
|
119
96
|
key?: Key;
|
|
120
97
|
name: string;
|
|
121
|
-
type: z.infer<
|
|
122
|
-
config: z.infer<
|
|
123
|
-
status?: NewStatus<
|
|
124
|
-
}
|
|
98
|
+
type: z.infer<S["type"]>;
|
|
99
|
+
config: z.infer<S["config"]>;
|
|
100
|
+
status?: NewStatus<S["statusData"]>;
|
|
101
|
+
}
|
|
125
102
|
|
|
126
103
|
export const commandZ = z.object({
|
|
127
104
|
task: keyZ,
|