@norskvideo/ctl-product-template-schema 0.1.72 → 0.1.74

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 CHANGED
@@ -103,6 +103,10 @@ export declare const ProductTemplateWorkdirSchema: z.ZodObject<{
103
103
  services: z.ZodArray<z.ZodString>;
104
104
  }, z.core.$strip>;
105
105
  export type ProductTemplateWorkdir = z.infer<typeof ProductTemplateWorkdirSchema>;
106
+ export declare const ProductTemplateRuntimeSecretsSchema: z.ZodObject<{
107
+ services: z.ZodArray<z.ZodString>;
108
+ }, z.core.$strip>;
109
+ export type ProductTemplateRuntimeSecrets = z.infer<typeof ProductTemplateRuntimeSecretsSchema>;
106
110
  export declare const ProductTemplateAcceleratorSchema: z.ZodEnum<{
107
111
  none: "none";
108
112
  nvidia: "nvidia";
@@ -415,6 +419,9 @@ export declare const ProductTemplateManifestSchema: z.ZodObject<{
415
419
  hostTls: z.ZodOptional<z.ZodObject<{
416
420
  services: z.ZodArray<z.ZodString>;
417
421
  }, z.core.$strip>>;
422
+ runtimeSecrets: z.ZodOptional<z.ZodObject<{
423
+ services: z.ZodArray<z.ZodString>;
424
+ }, z.core.$strip>>;
418
425
  workload: z.ZodOptional<z.ZodObject<{
419
426
  role: z.ZodEnum<{
420
427
  viewer: "viewer";
@@ -460,6 +467,10 @@ export declare const ProductTemplateParameterSchema: z.ZodObject<{
460
467
  }>>;
461
468
  default: z.ZodOptional<z.ZodString>;
462
469
  secret: z.ZodOptional<z.ZodBoolean>;
470
+ deliver: z.ZodOptional<z.ZodEnum<{
471
+ value: "value";
472
+ reference: "reference";
473
+ }>>;
463
474
  required: z.ZodOptional<z.ZodBoolean>;
464
475
  min: z.ZodOptional<z.ZodNumber>;
465
476
  max: z.ZodOptional<z.ZodNumber>;
@@ -481,6 +492,10 @@ export declare const ParametersFileSchema: z.ZodObject<{
481
492
  }>>;
482
493
  default: z.ZodOptional<z.ZodString>;
483
494
  secret: z.ZodOptional<z.ZodBoolean>;
495
+ deliver: z.ZodOptional<z.ZodEnum<{
496
+ value: "value";
497
+ reference: "reference";
498
+ }>>;
484
499
  required: z.ZodOptional<z.ZodBoolean>;
485
500
  min: z.ZodOptional<z.ZodNumber>;
486
501
  max: z.ZodOptional<z.ZodNumber>;
@@ -706,6 +721,9 @@ export declare const ProductTemplateMaterialsSchema: z.ZodObject<{
706
721
  hostTls: z.ZodOptional<z.ZodObject<{
707
722
  services: z.ZodArray<z.ZodString>;
708
723
  }, z.core.$strip>>;
724
+ runtimeSecrets: z.ZodOptional<z.ZodObject<{
725
+ services: z.ZodArray<z.ZodString>;
726
+ }, z.core.$strip>>;
709
727
  workload: z.ZodOptional<z.ZodObject<{
710
728
  role: z.ZodEnum<{
711
729
  viewer: "viewer";
@@ -744,6 +762,10 @@ export declare const ProductTemplateMaterialsSchema: z.ZodObject<{
744
762
  }>>;
745
763
  default: z.ZodOptional<z.ZodString>;
746
764
  secret: z.ZodOptional<z.ZodBoolean>;
765
+ deliver: z.ZodOptional<z.ZodEnum<{
766
+ value: "value";
767
+ reference: "reference";
768
+ }>>;
747
769
  required: z.ZodOptional<z.ZodBoolean>;
748
770
  min: z.ZodOptional<z.ZodNumber>;
749
771
  max: z.ZodOptional<z.ZodNumber>;
package/index.js CHANGED
@@ -342,6 +342,19 @@ export const ProductTemplateWorkdirSchema = z
342
342
  }),
343
343
  })
344
344
  .meta({ id: "ProductTemplateWorkdir", outputId: "ProductTemplateWorkdir" });
345
+ // Runtime secret resolution (norsk-ctl RFC 0011 §3.3). WHY THIS EXISTS: a
346
+ // product that learns which secrets it needs only while it runs (a relay given
347
+ // an input's passphrase as a reference) cannot have them resolved into its
348
+ // environment at launch. The named services get NORSK_SECRETS_URL and
349
+ // NORSK_SECRETS_TOKEN, and POST references there. A product relying on it
350
+ // declares the runner capability `secret-references-runtime`.
351
+ export const ProductTemplateRuntimeSecretsSchema = z
352
+ .object({
353
+ services: z.array(z.string().min(1)).min(1).meta({
354
+ description: "Compose services that may resolve secret references at runtime. Each must be a service in the template's own compose.yml. The runner sets NORSK_SECRETS_URL and NORSK_SECRETS_TOKEN in each, for the resolver in `@norskvideo/ctl-product-template-schema/secrets`.",
355
+ }),
356
+ })
357
+ .meta({ id: "ProductTemplateRuntimeSecrets", outputId: "ProductTemplateRuntimeSecrets" });
345
358
  // Placement requirements guidance (requirements-authoring.md). Each dimension
346
359
  // the placer reasons over — capacity (vCPUs), cores, GPU, capabilities, host
347
360
  // ports — is optionally declared with a `mode`:
@@ -525,6 +538,9 @@ export const ProductTemplateManifestSchema = z
525
538
  hostTls: ProductTemplateHostTlsSchema.optional().meta({
526
539
  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.",
527
540
  }),
541
+ runtimeSecrets: ProductTemplateRuntimeSecretsSchema.optional().meta({
542
+ description: "Let the named compose services resolve `secretref:` references at runtime, through the runner, instead of only at launch. Absent = no service can. Declare the runner capability `secret-references-runtime` alongside it.",
543
+ }),
528
544
  workload: ProductTemplateWorkloadSchema.optional().meta({
529
545
  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.",
530
546
  }),
@@ -563,6 +579,9 @@ export const ProductTemplateParameterSchema = z
563
579
  type: z.enum(["string", "int", "number", "boolean", "enum"]).default("string"),
564
580
  default: z.string().optional().meta({ description: "Stringified default (even for numeric/boolean/enum types)" }),
565
581
  secret: z.boolean().optional(),
582
+ deliver: z.enum(["value", "reference"]).optional().meta({
583
+ description: "How a `secretref:` reference in this parameter reaches the container. `value` (the default): the runner resolves it into the environment. `reference`: the runner checks its syntax and passes it through, for the application to resolve at runtime (`runtimeSecrets`). Only for a `secret` parameter; declare the runner capability `secret-references-runtime` alongside it.",
584
+ }),
566
585
  /** Mandatory input. Only bites when there is no `default` to fall back
567
586
  * on — the runner/composer blocks launch on an empty required value. */
568
587
  required: z.boolean().optional(),
@@ -581,6 +600,13 @@ export const ProductTemplateParameterSchema = z
581
600
  }),
582
601
  })
583
602
  .superRefine((p, ctx) => {
603
+ if (p.deliver === "reference" && p.secret !== true) {
604
+ ctx.addIssue({
605
+ code: "custom",
606
+ path: ["deliver"],
607
+ message: "`deliver: reference` is only for a `secret` parameter",
608
+ });
609
+ }
584
610
  if (p.type === "enum" && (!p.values || p.values.length === 0)) {
585
611
  ctx.addIssue({ code: "custom", path: ["values"], message: "enum parameters require a non-empty `values` list" });
586
612
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-product-template-schema",
3
- "version": "0.1.72",
3
+ "version": "0.1.74",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,6 +4,10 @@ export declare const SECRET_REFERENCE_PREFIX = "secretref:";
4
4
  * references, so placement can keep a job whose parameters hold one off an
5
5
  * older worker — which would hand the container the reference itself. */
6
6
  export declare const SECRET_REFERENCES_CAPABILITY = "norsk.io/secret-references";
7
+ /** The worker capability for runtime resolution (RFC 0011 §3.3): the worker
8
+ * answers a resolve request from the services a template's `runtimeSecrets`
9
+ * names, and passes `deliver: reference` parameters through unresolved. */
10
+ export declare const SECRET_REFERENCES_RUNTIME_CAPABILITY = "norsk.io/secret-references-runtime";
7
11
  /** What a secret parameter's literal value is shown as wherever ctl prints
8
12
  * launch parameters back. */
9
13
  export declare const SECRET_PLACEHOLDER = "<secret>";
@@ -14,6 +14,10 @@ export const SECRET_REFERENCE_PREFIX = "secretref:";
14
14
  * references, so placement can keep a job whose parameters hold one off an
15
15
  * older worker — which would hand the container the reference itself. */
16
16
  export const SECRET_REFERENCES_CAPABILITY = "norsk.io/secret-references";
17
+ /** The worker capability for runtime resolution (RFC 0011 §3.3): the worker
18
+ * answers a resolve request from the services a template's `runtimeSecrets`
19
+ * names, and passes `deliver: reference` parameters through unresolved. */
20
+ export const SECRET_REFERENCES_RUNTIME_CAPABILITY = "norsk.io/secret-references-runtime";
17
21
  /** What a secret parameter's literal value is shown as wherever ctl prints
18
22
  * launch parameters back. */
19
23
  export const SECRET_PLACEHOLDER = "<secret>";