@norskvideo/ctl-product-template-schema 0.1.33 → 0.1.34

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.
Files changed (3) hide show
  1. package/index.d.ts +26 -0
  2. package/index.js +13 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -150,6 +150,16 @@ export declare const ProductTemplateMigrationSchema: z.ZodObject<{
150
150
  }>;
151
151
  }, z.core.$strip>;
152
152
  export type ProductTemplateMigration = z.infer<typeof ProductTemplateMigrationSchema>;
153
+ export declare const PRODUCT_TEMPLATE_WORKLOAD_ROLES: readonly ["viewer", "operator", "builder"];
154
+ export declare const ProductTemplateWorkloadSchema: z.ZodObject<{
155
+ role: z.ZodEnum<{
156
+ viewer: "viewer";
157
+ operator: "operator";
158
+ builder: "builder";
159
+ }>;
160
+ on: z.ZodLiteral<"product">;
161
+ }, z.core.$strip>;
162
+ export type ProductTemplateWorkload = z.infer<typeof ProductTemplateWorkloadSchema>;
153
163
  export declare const ProductTemplateManifestSchema: z.ZodObject<{
154
164
  productTemplateSchemaVersion: z.ZodLiteral<1>;
155
165
  productName: z.ZodString;
@@ -330,6 +340,14 @@ export declare const ProductTemplateManifestSchema: z.ZodObject<{
330
340
  hostTls: z.ZodOptional<z.ZodObject<{
331
341
  services: z.ZodArray<z.ZodString>;
332
342
  }, z.core.$strip>>;
343
+ workload: z.ZodOptional<z.ZodObject<{
344
+ role: z.ZodEnum<{
345
+ viewer: "viewer";
346
+ operator: "operator";
347
+ builder: "builder";
348
+ }>;
349
+ on: z.ZodLiteral<"product">;
350
+ }, z.core.$strip>>;
333
351
  migration: z.ZodOptional<z.ZodObject<{
334
352
  strategy: z.ZodEnum<{
335
353
  overlap: "overlap";
@@ -571,6 +589,14 @@ export declare const ProductTemplateMaterialsSchema: z.ZodObject<{
571
589
  hostTls: z.ZodOptional<z.ZodObject<{
572
590
  services: z.ZodArray<z.ZodString>;
573
591
  }, z.core.$strip>>;
592
+ workload: z.ZodOptional<z.ZodObject<{
593
+ role: z.ZodEnum<{
594
+ viewer: "viewer";
595
+ operator: "operator";
596
+ builder: "builder";
597
+ }>;
598
+ on: z.ZodLiteral<"product">;
599
+ }, z.core.$strip>>;
574
600
  migration: z.ZodOptional<z.ZodObject<{
575
601
  strategy: z.ZodEnum<{
576
602
  overlap: "overlap";
package/index.js CHANGED
@@ -319,6 +319,16 @@ export const ProductTemplateMigrationSchema = z
319
319
  }),
320
320
  })
321
321
  .meta({ id: "ProductTemplateMigration", outputId: "ProductTemplateMigration" });
322
+ // The roles a template may declare for its instances' workload: at most
323
+ // builder, since registering a template takes builder and that registration is
324
+ // the consent. Built-in names only, whose meaning every host agrees on.
325
+ export const PRODUCT_TEMPLATE_WORKLOAD_ROLES = ["viewer", "operator", "builder"];
326
+ export const ProductTemplateWorkloadSchema = z
327
+ .object({
328
+ role: z.enum(PRODUCT_TEMPLATE_WORKLOAD_ROLES),
329
+ on: z.literal("product"),
330
+ })
331
+ .meta({ id: "ProductTemplateWorkload", outputId: "ProductTemplateWorkload" });
322
332
  export const ProductTemplateManifestSchema = z
323
333
  .object({
324
334
  productTemplateSchemaVersion: z.literal(1),
@@ -371,6 +381,9 @@ export const ProductTemplateManifestSchema = z
371
381
  hostTls: ProductTemplateHostTlsSchema.optional().meta({
372
382
  description: "Mount the host's TLS certificate and key, read-only, into the named compose services — for a product that serves TLS itself. Copied per launch, so a rotated certificate is picked up on relaunch. Absent = nothing mounted.",
373
383
  }),
384
+ workload: ProductTemplateWorkloadSchema.optional().meta({
385
+ description: "The role each instance's own workload (`urn:norsk:workload:instance:<id>`) holds on its product (`product/<productName>`), granted when it launches, whoever launches it — for an instance that creates or manages its product's other instances (a capture launching recorders). At most `builder`: registering a template takes builder, and that registration is the consent. Absent = the workload holds nothing it was not passed at launch. An older ctl ignores it, and its instances hold nothing.",
386
+ }),
374
387
  migration: ProductTemplateMigrationSchema.optional().meta({
375
388
  description: "How a running instance may be moved between nodes. `strategy` is the strongest promise the product keeps: `overlap` (target started, then source stopped — both may produce briefly), `stopThenStart` (the default when absent — target prepared but not started, source stopped, target started), or `handover` (the job speaks the worker's migration socket and hands over at an exact position). A migrate request may down-grade to a safer strategy but never up-grade past the declaration. Only the manager reads this; the worker never does.",
376
389
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-product-template-schema",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {