MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / resolveAndValidateVariables

Function resolveAndValidateVariables

packages/cli/src/commands/cloudrun.ts:802–821  ·  view source on GitHub ↗

* Resolve --variables / --variables-file via the shared CLI parser (the same * one `hyperframes render` and `hyperframes lambda render` use), then validate * against the composition's `data-composition-variables` when an `index.html` * is on disk. `--strict-variables` turns mismatches into a hard

(
  args: Record<string, unknown>,
  projectDir: string,
)

Source from the content-addressed store, hash-verified

800 * is on disk. `--strict-variables` turns mismatches into a hard failure.
801 */
802function resolveAndValidateVariables(
803 args: Record<string, unknown>,
804 projectDir: string,
805): Record<string, unknown> | undefined {
806 const variables = resolveVariablesArg(
807 args.variables as string | undefined,
808 args["variables-file"] as string | undefined,
809 );
810 if (variables && Object.keys(variables).length > 0) {
811 const indexPath = join(projectDir, "index.html");
812 if (existsSync(indexPath)) {
813 const issues = validateVariablesAgainstProject(indexPath, variables);
814 reportVariableIssues(issues, {
815 strict: Boolean(args["strict-variables"]),
816 quiet: Boolean(args.json),
817 });
818 }
819 }
820 return variables;
821}
822
823function parseOutputResolution(raw: unknown): CanvasResolution | undefined {
824 if (raw == null || raw === "") return undefined;

Callers 1

runRenderFunction · 0.85

Calls 3

resolveVariablesArgFunction · 0.85
reportVariableIssuesFunction · 0.85

Tested by

no test coverage detected