@norskvideo/ctl-product-template-schema 0.1.18 → 0.1.19
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/index.d.ts +57 -0
- package/index.js +20 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ export declare const ProductTemplateSideloadSchema: z.ZodObject<{
|
|
|
49
49
|
llmVenv: z.ZodOptional<z.ZodBoolean>;
|
|
50
50
|
}, z.core.$strip>;
|
|
51
51
|
export type ProductTemplateSideload = z.infer<typeof ProductTemplateSideloadSchema>;
|
|
52
|
+
export declare const ProductTemplateAcceleratorSchema: z.ZodEnum<{
|
|
53
|
+
none: "none";
|
|
54
|
+
nvidia: "nvidia";
|
|
55
|
+
quadra: "quadra";
|
|
56
|
+
}>;
|
|
57
|
+
export type ProductTemplateAccelerator = z.infer<typeof ProductTemplateAcceleratorSchema>;
|
|
52
58
|
export declare const ProductTemplateRequirementsSchema: z.ZodObject<{
|
|
53
59
|
capacity: z.ZodOptional<z.ZodObject<{
|
|
54
60
|
mode: z.ZodEnum<{
|
|
@@ -77,6 +83,23 @@ export declare const ProductTemplateRequirementsSchema: z.ZodObject<{
|
|
|
77
83
|
model: z.ZodOptional<z.ZodString>;
|
|
78
84
|
}, z.core.$strip>>;
|
|
79
85
|
}, z.core.$strip>>;
|
|
86
|
+
accelerator: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
87
|
+
mode: z.ZodLiteral<"fixed">;
|
|
88
|
+
value: z.ZodEnum<{
|
|
89
|
+
none: "none";
|
|
90
|
+
nvidia: "nvidia";
|
|
91
|
+
quadra: "quadra";
|
|
92
|
+
}>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
mode: z.ZodLiteral<"default">;
|
|
95
|
+
value: z.ZodEnum<{
|
|
96
|
+
none: "none";
|
|
97
|
+
nvidia: "nvidia";
|
|
98
|
+
quadra: "quadra";
|
|
99
|
+
}>;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
mode: z.ZodLiteral<"required">;
|
|
102
|
+
}, z.core.$strip>], "mode">>;
|
|
80
103
|
capabilities: z.ZodOptional<z.ZodObject<{
|
|
81
104
|
mode: z.ZodEnum<{
|
|
82
105
|
default: "default";
|
|
@@ -196,6 +219,23 @@ export declare const ProductTemplateManifestSchema: z.ZodObject<{
|
|
|
196
219
|
model: z.ZodOptional<z.ZodString>;
|
|
197
220
|
}, z.core.$strip>>;
|
|
198
221
|
}, z.core.$strip>>;
|
|
222
|
+
accelerator: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
223
|
+
mode: z.ZodLiteral<"fixed">;
|
|
224
|
+
value: z.ZodEnum<{
|
|
225
|
+
none: "none";
|
|
226
|
+
nvidia: "nvidia";
|
|
227
|
+
quadra: "quadra";
|
|
228
|
+
}>;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
mode: z.ZodLiteral<"default">;
|
|
231
|
+
value: z.ZodEnum<{
|
|
232
|
+
none: "none";
|
|
233
|
+
nvidia: "nvidia";
|
|
234
|
+
quadra: "quadra";
|
|
235
|
+
}>;
|
|
236
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
237
|
+
mode: z.ZodLiteral<"required">;
|
|
238
|
+
}, z.core.$strip>], "mode">>;
|
|
199
239
|
capabilities: z.ZodOptional<z.ZodObject<{
|
|
200
240
|
mode: z.ZodEnum<{
|
|
201
241
|
default: "default";
|
|
@@ -374,6 +414,23 @@ export declare const ProductTemplateMaterialsSchema: z.ZodObject<{
|
|
|
374
414
|
model: z.ZodOptional<z.ZodString>;
|
|
375
415
|
}, z.core.$strip>>;
|
|
376
416
|
}, z.core.$strip>>;
|
|
417
|
+
accelerator: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
418
|
+
mode: z.ZodLiteral<"fixed">;
|
|
419
|
+
value: z.ZodEnum<{
|
|
420
|
+
none: "none";
|
|
421
|
+
nvidia: "nvidia";
|
|
422
|
+
quadra: "quadra";
|
|
423
|
+
}>;
|
|
424
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
425
|
+
mode: z.ZodLiteral<"default">;
|
|
426
|
+
value: z.ZodEnum<{
|
|
427
|
+
none: "none";
|
|
428
|
+
nvidia: "nvidia";
|
|
429
|
+
quadra: "quadra";
|
|
430
|
+
}>;
|
|
431
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
432
|
+
mode: z.ZodLiteral<"required">;
|
|
433
|
+
}, z.core.$strip>], "mode">>;
|
|
377
434
|
capabilities: z.ZodOptional<z.ZodObject<{
|
|
378
435
|
mode: z.ZodEnum<{
|
|
379
436
|
default: "default";
|
package/index.js
CHANGED
|
@@ -223,6 +223,12 @@ const ProductTemplateGpuRequirementSchema = z.object({
|
|
|
223
223
|
capacity: z.number().positive().optional().meta({ description: "Fractional GPU reference units" }),
|
|
224
224
|
model: z.string().optional().meta({ description: "GPU model match, e.g. 'RTX 4090'" }),
|
|
225
225
|
});
|
|
226
|
+
// The accelerator a product needs reserved on media. Deliberately the same
|
|
227
|
+
// three values as the runner's own hardware knob, restated here rather than
|
|
228
|
+
// imported: this package is upstream of ctl's contract, not downstream of it.
|
|
229
|
+
// `none` is a real value, not an absence — it is how a CPU-only product says
|
|
230
|
+
// "reserve nothing" as a mandate the operator cannot override.
|
|
231
|
+
export const ProductTemplateAcceleratorSchema = z.enum(["none", "nvidia", "quadra"]);
|
|
226
232
|
export const ProductTemplateRequirementsSchema = z
|
|
227
233
|
.object({
|
|
228
234
|
capacity: requirementDimension(z.number().positive()).optional().meta({
|
|
@@ -234,6 +240,20 @@ export const ProductTemplateRequirementsSchema = z
|
|
|
234
240
|
gpu: requirementDimension(ProductTemplateGpuRequirementSchema, (v) => v.capacity !== undefined || v.model !== undefined)
|
|
235
241
|
.optional()
|
|
236
242
|
.meta({ description: "Fractional GPU need (capacity and/or model)." }),
|
|
243
|
+
// Not requirementDimension(): a discriminated union states in the type what
|
|
244
|
+
// that helper can only enforce at parse time — fixed/default always carry a
|
|
245
|
+
// value, required never does. Downstream that removes the guard for a state
|
|
246
|
+
// the schema already forbids.
|
|
247
|
+
accelerator: z
|
|
248
|
+
.discriminatedUnion("mode", [
|
|
249
|
+
z.object({ mode: z.literal("fixed"), value: ProductTemplateAcceleratorSchema }),
|
|
250
|
+
z.object({ mode: z.literal("default"), value: ProductTemplateAcceleratorSchema }),
|
|
251
|
+
z.object({ mode: z.literal("required") }),
|
|
252
|
+
])
|
|
253
|
+
.optional()
|
|
254
|
+
.meta({
|
|
255
|
+
description: "Which accelerator media needs reserved. `fixed` mandates it — the operator cannot override, and a host without it is refused rather than launched unreserved (`fixed`/`none` is how a CPU-only product forbids a reservation). `default` merely prefers it: the operator may change it, and a host without it falls back to no reservation. `required` means the product cannot know, so the operator must choose at launch. Absent = the runner reserves nothing unless the operator asks.",
|
|
256
|
+
}),
|
|
237
257
|
capabilities: requirementDimension(z.array(ProductTemplateCapabilityRequirementSchema).min(1))
|
|
238
258
|
.optional()
|
|
239
259
|
.meta({ description: "Counted/exclusive hardware & software capabilities (nvidia-gpu, quadra, decklink, …)." }),
|