@mark1russell7/workflow 0.0.0-bootstrap.0 → 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["recordOr","listOr"],"sources":["../src/world.ts","../src/language.ts","../src/check.ts","../src/sample.ts","../src/edit.ts"],"sourcesContent":["import type { Kind, Namespace, PartShape as Shape, WorldPart } from \"@mark1russell7/coeval\";\n\n/** The name of the format of a workflow document. */\nexport const WORKFLOW_FORMAT = \"workflow/1\";\n\nconst text: Shape = { shape: \"text\" };\n/** An expression: a document, or a bare JSON value that is a literal. */\nconst term: Shape = { shape: \"term\", of: \"lit\" };\n/** A document of the workflow: a trigger, a job, a step or a call. */\nconst node: Shape = { shape: \"term\" };\nconst data: Shape = { shape: \"none\" };\nconst terms: Shape = { shape: \"map\", item: term };\n\n/**\n * The kinds of a trigger. A trigger is data, but a filter or a condition in it is a document. An add-on adds a trigger\n * kind to the namespace `trigger`, for example the events of one host.\n */\nconst TRIGGERS: Namespace = {\n kinds: {\n manual: {\n verbs: { eval: \"workflow.trigger\" },\n parts: { shape: \"record\", fields: { summary: text, layers: data }, closed: true },\n summary: \"A person starts the workflow by a click, with the inputs of the workflow.\",\n },\n schedule: {\n verbs: { eval: \"workflow.trigger\" },\n parts: { shape: \"record\", fields: { cron: text, zone: text, layers: data }, required: [\"cron\"], closed: true },\n summary: \"The clock starts the workflow at each time of a cron line, in a time zone.\",\n },\n event: {\n verbs: { eval: \"workflow.trigger\" },\n parts: { shape: \"record\", fields: { event: text, types: { shape: \"list\", item: text }, when: term, layers: data }, required: [\"event\"], closed: true },\n summary: \"An event of the host starts the workflow. The condition when selects the events.\",\n },\n feed: {\n verbs: { eval: \"workflow.trigger\" },\n parts: { shape: \"record\", fields: { from: text, collection: text, when: term, layers: data }, required: [\"from\", \"collection\"], closed: true },\n summary: \"A new or changed record of a collection of a workspace starts the workflow. This is a read of that workspace.\",\n },\n call: {\n verbs: { eval: \"workflow.trigger\" },\n parts: { shape: \"record\", fields: { summary: text, layers: data }, closed: true },\n summary: \"Another workflow calls this workflow as a procedure, with its inputs and its outputs.\",\n },\n },\n};\n\n/**\n * The namespace `procedure`: each document under it is a call of a procedure. The keys after `procedure` are the path of the\n * procedure, for example `[\"procedure\", \"git\", \"clone\"]`. The value is the record of the inputs, and each input is a\n * document. A call is on the run side, and its effect has the kind of its path, thus a grant names procedures.\n */\nconst PROCEDURES: Namespace = {\n kinds: {},\n fallback: {\n verbs: { eval: \"workflow.call\" },\n parts: { shape: \"record\", fields: {}, rest: term },\n side: \"run\",\n effects: \"type\",\n summary: \"A call of a procedure. The path after procedure names the procedure, and the value holds its inputs.\",\n },\n};\n\nconst step: Kind = {\n verbs: { eval: \"workflow.step\" },\n parts: {\n shape: \"record\",\n fields: {\n id: text,\n name: text,\n if: term,\n do: node,\n env: terms,\n retry: data,\n timeout: { shape: \"number\", min: 0 },\n continue: { shape: \"one\", values: [true, false] },\n layers: data,\n },\n required: [\"do\"],\n closed: true,\n },\n summary: \"One step of a job: a call of a procedure, with a condition, a retry rule and a time limit.\",\n};\n\nconst job: Kind = {\n verbs: { eval: \"workflow.job\" },\n parts: {\n shape: \"record\",\n fields: {\n name: text,\n needs: { shape: \"list\", item: text },\n if: term,\n matrix: node,\n env: terms,\n steps: { shape: \"list\", item: node },\n outputs: terms,\n timeout: { shape: \"number\", min: 0 },\n layers: data,\n },\n required: [\"steps\"],\n closed: true,\n },\n summary: \"A job: steps in order. The jobs run at the same time, unless one needs another.\",\n};\n\nconst matrix: Kind = {\n verbs: { eval: \"workflow.matrix\" },\n parts: { shape: \"record\", fields: { axes: terms, include: term, exclude: term, parallel: { shape: \"number\", whole: true, min: 1 } }, closed: true },\n summary: \"A job runs one time for each combination of the values of its axes.\",\n};\n\nconst workflow: Kind = {\n verbs: { eval: \"workflow.workflow\" },\n parts: {\n shape: \"record\",\n fields: {\n name: text,\n summary: text,\n workspace: text,\n triggers: { shape: \"list\", item: node },\n inputs: data,\n secrets: data,\n env: terms,\n jobs: { shape: \"map\", item: node },\n outputs: terms,\n layers: data,\n },\n required: [\"name\", \"workspace\", \"triggers\", \"jobs\"],\n closed: true,\n },\n summary: \"A workflow: its triggers, its inputs, the names of its secrets, and its jobs. It belongs to one workspace.\",\n};\n\n/**\n * The world of the workflow language. The formula kit of the kernel gives the expressions: `lit`, `ref`, `if`,\n * `and`, `or` and the operations. This world adds the structure, the calls, the text templates and the secrets.\n */\nexport const WORKFLOW_WORLD: WorldPart = {\n kinds: {\n workflow,\n job,\n step,\n matrix,\n trigger: TRIGGERS,\n procedure: PROCEDURES,\n template: {\n verbs: { eval: \"workflow.template\" },\n parts: { shape: \"list\", of: \"lit\" },\n pure: true,\n summary: \"A text with documents in it. Each text part stays, and each document gives its value as text.\",\n },\n secret: {\n verbs: { eval: \"workflow.secret\" },\n pure: true,\n summary: \"A reference to a secret by its name. It never holds the value, and only a call can use it.\",\n },\n },\n};\n","import {\n type Evaluator,\n type FormulaProfile,\n type Language,\n type Machine,\n type OpFn,\n type Result,\n type Runner,\n type Signature,\n STD_OPS,\n compose,\n defineLanguage,\n fail,\n formulaMachine,\n isRecord,\n} from \"@mark1russell7/coeval\";\nimport { WORKFLOW_WORLD } from \"./world.ts\";\n\n/** The version of the workflow language. */\nexport const WORKFLOW_VERSION = \"0.1.0\";\n\n/** A reference to a secret. It holds the name of the secret, not its value. */\nexport interface SecretRef {\n readonly secret: string;\n}\n\n/** This function tells if a value is a reference to a secret. */\nexport function isSecretRef(value: unknown): value is SecretRef {\n return isRecord(value) && typeof value[\"secret\"] === \"string\" && Object.keys(value).length === 1 && Object.isFrozen(value);\n}\n\nconst ok = (value: unknown): Result => ({ ok: true, value });\n\nfunction scalarText(value: unknown): string | undefined {\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n if (value === null) return \"\";\n return undefined;\n}\n\nfunction noSecret(op: string, args: readonly unknown[]): void {\n if (args.some(isSecretRef)) throw new TypeError(`The operation ${op} cannot read a secret. Only a call can use a secret.`);\n}\n\n/**\n * The operations of the workflow language, beside the operations of the formula kit. Each one is a general operation on\n * texts and lists. No operation reads a secret.\n */\nconst OPS: Readonly<Record<string, (...args: unknown[]) => unknown>> = {\n contains: (...args) => {\n noSecret(\"contains\", args);\n const [where, what] = args;\n if (Array.isArray(where)) return where.some((item) => item === what);\n const a = scalarText(where);\n const b = scalarText(what);\n if (a === undefined || b === undefined) throw new TypeError(\"contains takes a list or a text, and a value.\");\n return a.toLowerCase().includes(b.toLowerCase());\n },\n startsWith: (...args) => {\n noSecret(\"startsWith\", args);\n const [a, b] = args.map(scalarText);\n if (a === undefined || b === undefined) throw new TypeError(\"startsWith takes two texts.\");\n return a.toLowerCase().startsWith(b.toLowerCase());\n },\n endsWith: (...args) => {\n noSecret(\"endsWith\", args);\n const [a, b] = args.map(scalarText);\n if (a === undefined || b === undefined) throw new TypeError(\"endsWith takes two texts.\");\n return a.toLowerCase().endsWith(b.toLowerCase());\n },\n join: (...args) => {\n noSecret(\"join\", args);\n const [list, separator = \",\"] = args;\n const by = scalarText(separator) ?? \",\";\n if (!Array.isArray(list)) return scalarText(list) ?? \"\";\n return list.map((item) => scalarText(item) ?? \"\").join(by);\n },\n toJSON: (...args) => {\n noSecret(\"toJSON\", args);\n return JSON.stringify(args[0] ?? null, null, 2);\n },\n fromJSON: (...args) => {\n const text = scalarText(args[0]);\n if (text === undefined) throw new TypeError(\"fromJSON takes a text.\");\n return JSON.parse(text) as unknown;\n },\n format: (...args) => {\n noSecret(\"format\", args);\n const [pattern, ...values] = args;\n const text = scalarText(pattern);\n if (text === undefined) throw new TypeError(\"format takes a text first.\");\n return text.replace(/\\{\\{|\\}\\}|\\{(\\d+)\\}/g, (match, index: string | undefined) => {\n if (match === \"{{\") return \"{\";\n if (match === \"}}\") return \"}\";\n const value = values[Number(index)];\n return scalarText(value) ?? JSON.stringify(value);\n });\n },\n};\n\nconst TEXT_2: Signature = { params: [\"unknown\", \"unknown\"], to: \"bool\" };\nconst SIGS: Readonly<Record<string, Signature | readonly Signature[]>> = {\n contains: TEXT_2,\n startsWith: TEXT_2,\n endsWith: TEXT_2,\n join: { params: [\"unknown\", \"unknown\"], to: \"text\" },\n toJSON: { params: [\"unknown\"], to: \"text\" },\n fromJSON: { params: [\"text\"], to: \"unknown\" },\n format: { params: [\"text\", \"unknown\", \"unknown\", \"unknown\", \"unknown\"], to: \"text\" },\n};\n\n/** This function gives the combinations of the axes of a matrix, without the excluded ones, with the included ones. */\nexport function expandMatrix(axes: Readonly<Record<string, unknown>>, include: readonly unknown[] = [], exclude: readonly unknown[] = []): Record<string, unknown>[] {\n const lists = Object.entries(axes);\n let rows: Record<string, unknown>[] = lists.length === 0 ? [] : [{}];\n for (const [key, values] of lists) {\n if (!Array.isArray(values)) throw new TypeError(`The axis ${key} of a matrix must be a list.`);\n rows = rows.flatMap((row) => values.map((value) => ({ ...row, [key]: value })));\n }\n const fits = (entry: unknown, row: Record<string, unknown>, keys: Iterable<string>): boolean =>\n isRecord(entry) && [...keys].every((key) => !(key in entry) || JSON.stringify(entry[key]) === JSON.stringify(row[key]));\n rows = rows.filter((row) => !exclude.some((entry) => isRecord(entry) && fits(entry, row, Object.keys(entry))));\n const axisKeys = lists.map(([key]) => key);\n for (const entry of include) {\n if (!isRecord(entry)) continue;\n const matches = rows.filter((row) => fits(entry, row, axisKeys.filter((key) => key in entry)) && axisKeys.some((key) => key in entry));\n if (matches.length === 0) rows.push({ ...entry });\n else for (const row of matches) Object.assign(row, entry);\n }\n return rows;\n}\n\nconst EVALUATORS: Readonly<Record<string, Evaluator>> = {\n \"workflow.secret\": ({ data }) =>\n typeof data === \"string\" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(data)\n ? ok(Object.freeze({ secret: data }))\n : fail(\"#VALUE!\", \"A secret holds the name of a secret: letters, digits and _, not first a digit.\"),\n \"workflow.template\": ({ parts }) => {\n let out = \"\";\n for (const part of parts) {\n const result = part.evaluate();\n if (!result.ok) return result;\n if (isSecretRef(result.value)) return fail(\"#VALUE!\", \"A secret cannot be part of a text. Give it to a call as an input.\");\n const text = scalarText(result.value);\n out += text ?? JSON.stringify(result.value);\n }\n return ok(out);\n },\n \"workflow.matrix\": ({ parts }) => {\n const axes: Record<string, unknown> = {};\n let include: unknown[] = [];\n let exclude: unknown[] = [];\n for (const part of parts) {\n const result = part.evaluate();\n if (!result.ok) return result;\n const [field, key] = part.path;\n if (field === \"axes\" && typeof key === \"string\") axes[key] = result.value;\n else if (field === \"include\") include = Array.isArray(result.value) ? result.value : [];\n else if (field === \"exclude\") exclude = Array.isArray(result.value) ? result.value : [];\n }\n try {\n return ok(expandMatrix(axes, include, exclude));\n } catch (error) {\n return fail(\"#VALUE!\", error instanceof Error ? error.message : String(error));\n }\n },\n \"workflow.trigger\": ({ kind, data }) => ok({ kind, ...(isRecord(data) ? data : {}) }),\n \"workflow.workflow\": () => fail(\"#CALC!\", \"A workflow runs through a runner, not through an evaluation.\"),\n \"workflow.job\": () => fail(\"#CALC!\", \"A job runs through a runner, not through an evaluation.\"),\n \"workflow.step\": () => fail(\"#CALC!\", \"A step runs through a runner, not through an evaluation.\"),\n \"workflow.call\": () => fail(\"#CALC!\", \"A call runs through a runner, not through an evaluation.\"),\n};\n\n/**\n * The runner of a call. It evaluates each input, in the order of the value, and causes one effect. The kind of the\n * effect is the path of the call, for example `procedure.git.clone`, and its payload is the record of the inputs. A\n * reference to a secret stays a reference: the host of the procedure reads the secret, thus no log holds its value.\n */\nconst RUNNERS: Readonly<Record<string, Runner>> = {\n \"workflow.call\": function* ({ kind, parts, effect }) {\n const inputs: Record<string, unknown> = {};\n for (const part of parts) {\n const result = yield* part.evaluate();\n if (!result.ok) return result;\n inputs[part.key] = result.value;\n }\n return yield* effect(kind, inputs);\n },\n};\n\n/** The workflow language: the kinds of `WORKFLOW_WORLD` and their code, on the formula kit of the kernel. */\nexport const WORKFLOW_LANGUAGE: Language = defineLanguage({\n name: \"workflow\",\n version: WORKFLOW_VERSION,\n world: WORKFLOW_WORLD,\n code: { evaluators: EVALUATORS, runners: RUNNERS },\n});\n\n/** The formula profile of the expressions of a workflow: the operations of the kernel and the text operations. */\nexport const WORKFLOW_OPS: FormulaProfile = { ops: { ...STD_OPS.ops, ...(OPS as Readonly<Record<string, OpFn>>) }, lazy: STD_OPS.lazy, sigs: { ...STD_OPS.sigs, ...SIGS }, pure: [...STD_OPS.pure, ...Object.keys(OPS)] };\n\n/**\n * This function gives the machine of the workflow language: the formula kit with the operations of a workflow, and\n * the kinds of the workflow world. An add-on composes its own language after it.\n *\n * @param more - The languages of add-ons, in order.\n * @returns The machine.\n */\nexport function workflowMachine(...more: readonly Language[]): Machine {\n return workflowMachineWith(WORKFLOW_OPS, ...more);\n}\n\n/**\n * This function gives the machine of the workflow language with another formula profile. An add-on gives the\n * operations of its host here, for example `WORKFLOW_OPS` with more operations.\n *\n * @param profile - The formula profile of the expressions.\n * @param more - The languages of add-ons, in order.\n * @returns The machine.\n */\nexport function workflowMachineWith(profile: FormulaProfile, ...more: readonly Language[]): Machine {\n const { world, ...code } = formulaMachine(profile);\n const kit = defineLanguage({ name: \"formula\", version: \"1.0.0\", world, code });\n return compose(kit, WORKFLOW_LANGUAGE, ...more);\n}\n","import { type Key, type Machine, type NodeGraph, check, cycles, isEnvelope, isRecord, nodeLayers } from \"@mark1russell7/coeval\";\nimport { workflowMachine } from \"./language.ts\";\n\n/** One problem of a workflow, at the JSON path of its value. */\nexport interface WorkflowIssue {\n readonly level: \"error\" | \"warning\";\n /** A stable code, for example `needs-unknown`. A kernel issue keeps its code, for example `#NAME?`. */\n readonly code: string;\n /** The keys from the root JSON value of the document to the value with the problem. */\n readonly at: readonly Key[];\n readonly message: string;\n}\n\n/** The answer of a grant check: `ok`, and the words of the reason. */\nexport interface AccessAnswer {\n readonly ok: boolean;\n readonly why: string;\n}\n\n/**\n * The grant check of the workspaces: can the workspace `from` read or write the workspace `target`? The host binds its\n * model of the workspaces. A workflow runs with the grants of its own workspace only.\n */\nexport type Access = (from: string, access: \"read\" | \"write\", target: string) => AccessAnswer;\n\n/** The facts of one procedure for a check. */\nexport interface ProcedureInfo {\n /** The inputs that name a workspace, by the access of the call to that workspace. */\n readonly workspaces?: { readonly read?: readonly string[]; readonly write?: readonly string[] };\n /** The names of the inputs that the procedure needs. */\n readonly required?: readonly string[];\n}\n\n/** The options of `checkWorkflow`. */\nexport interface WorkflowCheckOptions {\n /** The machine. The default is `workflowMachine()`. An add-on gives the machine with its language. */\n readonly machine?: Machine;\n /** The grant check. Without it, the check finds no grant problem. */\n readonly access?: Access;\n /** The procedures that a step can call, by the path with dots, for example `git.clone`. Without it, each path is known. */\n readonly procedures?: Readonly<Record<string, ProcedureInfo>>;\n /** The names that the host binds, for example the contexts of a host. A reference to such a name is always valid. */\n readonly hostNames?: readonly string[];\n /** The namespaces of calls, besides `procedure`. An input of such a call can hold a secret. */\n readonly callNamespaces?: readonly string[];\n /** With `true`, a secret needs no declaration: the host gives the secrets of the workspace. The default is `false`. */\n readonly openSecrets?: boolean;\n}\n\nconst ID = /^[A-Za-z_][A-Za-z0-9_-]*$/;\nconst CRON_FIELD = /^(\\*|\\d+(-\\d+)?)(\\/\\d+)?(,(\\*|\\d+(-\\d+)?)(\\/\\d+)?)*$|^[A-Za-z]{3}(-[A-Za-z]{3})?$/;\n\ntype Record_ = Readonly<Record<string, unknown>>;\nconst recordOr = (value: unknown): Record_ => (isRecord(value) ? value : {});\nconst listOr = (value: unknown): readonly unknown[] => (Array.isArray(value) ? value : []);\n\n/** The names that an expression at a position can read, besides the root `event` and the names of the host. */\nexport interface WorkflowScope {\n /** The names, for example `inputs` and `steps`. */\n readonly names: ReadonlySet<string>;\n /** The ids of the steps that the position can read: the earlier steps of the job. */\n readonly steps?: ReadonlySet<string>;\n /** The ids of the jobs that the position can read: the needs of the job. */\n readonly needs?: ReadonlySet<string>;\n /** The axes of the matrix of the job. `any` is a computed matrix. */\n readonly matrix?: ReadonlySet<string> | \"any\" | undefined;\n}\ntype Scope = WorkflowScope;\n\n/** This function gives the axes of the matrix of a job: `undefined` with no matrix, `any` for a computed one. */\nfunction matrixAxes(matrix: unknown): ReadonlySet<string> | \"any\" | undefined {\n if (matrix === undefined) return undefined;\n if (!isEnvelope(matrix) || matrix.type !== \"matrix\") return \"any\";\n const m = recordOr(matrix.value);\n const keys = new Set(Object.keys(recordOr(m[\"axes\"])));\n // A row of include can add a key. A computed include can add each key.\n const include = m[\"include\"];\n if (include === undefined) return keys;\n if (Array.isArray(include)) {\n for (const row of include) for (const k of Object.keys(recordOr(row))) keys.add(k);\n return keys;\n }\n if (isEnvelope(include) && include.type === \"list\" && Array.isArray(include.value)) {\n for (const row of include.value) if (isEnvelope(row) && row.type === \"record\") for (const k of Object.keys(recordOr(row.value))) keys.add(k);\n return keys;\n }\n return \"any\";\n}\n\n/** The part of a job that holds an expression. A step part gives the index of the step. */\ntype JobPart = \"if\" | \"env\" | \"matrix\" | \"outputs\" | { readonly step: number };\n\n/** This function gives the scope of an expression in a part of a job. */\nfunction jobScopeOf(job: Readonly<Record<string, unknown>>, part: JobPart): WorkflowScope {\n const needs = new Set(listOr(job[\"needs\"]).filter((need): need is string => typeof need === \"string\"));\n if (part === \"matrix\") return { names: new Set([\"inputs\", \"needs\"]), needs };\n const axes = matrixAxes(job[\"matrix\"]);\n const steps = listOr(job[\"steps\"]);\n const count = part === \"outputs\" ? steps.length : typeof part === \"object\" ? part.step : 0;\n const seen = new Set<string>();\n for (const step of steps.slice(0, count)) {\n const id = isEnvelope(step) ? recordOr(step.value)[\"id\"] : undefined;\n if (typeof id === \"string\") seen.add(id);\n }\n const names = [\"inputs\", \"env\", \"needs\", \"job\", ...(axes === undefined ? [] : [\"matrix\"]), ...(seen.size > 0 ? [\"steps\"] : [])];\n return { names: new Set(names), steps: seen, needs, matrix: axes };\n}\n\n/**\n * This function gives the scope of an expression at a JSON path of a workflow document: the names that it can read.\n * The check uses the same rules. A builder uses it to offer only the values that a position can read.\n *\n * @param doc - The workflow document.\n * @param at - The JSON path of the expression, for example `[\"value\", \"jobs\", \"build\", \"value\", \"steps\", 1, \"value\", \"do\"]`.\n * @returns The scope, or `undefined` when the path is not in a workflow.\n */\nexport function scopeAt(doc: unknown, at: readonly Key[]): WorkflowScope | undefined {\n if (!isEnvelope(doc) || doc.type !== \"workflow\" || !isRecord(doc.value) || at[0] !== \"value\") return undefined;\n const [, field, id, , part, index] = at;\n if (field === \"triggers\") return { names: new Set() };\n if (field === \"env\") return { names: new Set([\"inputs\"]) };\n if (field === \"outputs\") return { names: new Set([\"inputs\", \"jobs\"]) };\n if (field !== \"jobs\" || typeof id !== \"string\") return undefined;\n const job = recordOr(doc.value[\"jobs\"])[id];\n if (!isEnvelope(job)) return undefined;\n const j = recordOr(job.value);\n if (part === \"steps\" && typeof index === \"number\") return jobScopeOf(j, { step: index });\n if (part === \"if\" || part === \"env\" || part === \"matrix\" || part === \"outputs\") return jobScopeOf(j, part);\n return undefined;\n}\n\n/** This function gives the reference paths in a document: each envelope `ref` and its path. */\nfunction refsIn(value: unknown, at: readonly Key[], out: { path: readonly unknown[]; at: readonly Key[] }[] = []): { path: readonly unknown[]; at: readonly Key[] }[] {\n if (Array.isArray(value)) value.forEach((item, index) => refsIn(item, [...at, index], out));\n else if (isRecord(value)) {\n if (value[\"type\"] === \"ref\" && Array.isArray(value[\"value\"])) out.push({ path: value[\"value\"], at });\n for (const [key, item] of Object.entries(value)) refsIn(item, [...at, key], out);\n }\n return out;\n}\n\nconst isEmptyText = (doc: unknown): boolean => doc === \"\" || (isEnvelope(doc) && doc.type === \"lit\" && doc.value === \"\");\nconst isSecretDoc = (doc: unknown): boolean => isRecord(doc) && doc[\"type\"] === \"secret\";\n\n/**\n * This function tells if a document is the test of the presence of a secret: `eq` or `ne` of a secret and the empty\n * text. The test reads one bit, not the value. The host answers it.\n *\n * @param doc - The document.\n * @returns `true` for a presence test.\n */\nexport function isPresenceTest(doc: unknown): boolean {\n if (!isEnvelope(doc) || !Array.isArray(doc.type) || doc.type.length !== 2 || doc.type[0] !== \"ops\") return false;\n if (doc.type[1] !== \"eq\" && doc.type[1] !== \"ne\") return false;\n const args = doc.value;\n if (!Array.isArray(args) || args.length !== 2) return false;\n return (isSecretDoc(args[0]) && isEmptyText(args[1])) || (isSecretDoc(args[1]) && isEmptyText(args[0]));\n}\n\n/**\n * This function gives the secret documents in a value, and tells if each one is in a permitted place. A place is\n * permitted in the value of a call, in a map `env` and in a presence test, through plain records and lists only. Another document around\n * the secret, for example a template or an operation, makes the place not permitted.\n */\nfunction secretsIn(value: unknown, at: readonly Key[], allowed: boolean, calls: ReadonlySet<string>, out: { name: unknown; at: readonly Key[]; inCall: boolean }[] = []): { name: unknown; at: readonly Key[]; inCall: boolean }[] {\n if (Array.isArray(value)) value.forEach((item, index) => secretsIn(item, [...at, index], allowed, calls, out));\n else if (isRecord(value)) {\n if (value[\"type\"] === \"secret\") {\n out.push({ name: value[\"value\"], at, inCall: allowed });\n return out;\n }\n if (isEnvelope(value)) {\n const head = Array.isArray(value.type) ? value.type[0] : value.type;\n // A presence test compares a secret with the empty text. It reads one bit, not the value.\n const call = isPresenceTest(value) || (typeof head === \"string\" && calls.has(head));\n secretsIn(value.value, [...at, \"value\"], call, calls, out);\n return out;\n }\n for (const [key, item] of Object.entries(value)) secretsIn(item, [...at, key], key === \"env\" ? true : allowed, calls, out);\n }\n return out;\n}\n\n/**\n * This function checks a workflow document. It gives each problem with its JSON path, and it does not throw.\n *\n * - The kernel checks the kinds, the shapes and the operations (`check`).\n * - The workflow rules check the ids, the needs of the jobs and their cycles, and each reference of each expression.\n * - They also check the secrets, the cron lines and the grants of the workspace.\n *\n * @param doc - The document `{ type: \"workflow\", value }`.\n * @param options - The machine, the grant check and the procedures.\n * @returns The problems. An empty list means a good workflow.\n */\nexport function checkWorkflow(doc: unknown, options: WorkflowCheckOptions = {}): readonly WorkflowIssue[] {\n const issues: WorkflowIssue[] = [];\n const error = (code: string, at: readonly Key[], message: string): void => void issues.push({ level: \"error\", code, at, message });\n const warn = (code: string, at: readonly Key[], message: string): void => void issues.push({ level: \"warning\", code, at, message });\n if (!isEnvelope(doc) || doc.type !== \"workflow\" || !isRecord(doc.value)) {\n error(\"workflow-form\", [], \"A workflow is the document { type: \\\"workflow\\\", value: { name, workspace, triggers, jobs } }.\");\n return issues;\n }\n const machine = options.machine ?? workflowMachine();\n const names = [\"inputs\", \"env\", \"steps\", \"needs\", \"job\", \"jobs\", \"matrix\", ...(options.hostNames ?? [])];\n for (const issue of check(machine, doc, { names })) {\n // A kernel issue has the JSON path of its value when it has one, else the place through the parts.\n error(issue.code, issue.at ?? issue.place, issue.reason);\n }\n const value = doc.value;\n const root: readonly Key[] = [\"value\"];\n const workspace = typeof value[\"workspace\"] === \"string\" ? value[\"workspace\"] : \"\";\n const inputs = new Set(Object.keys(recordOr(value[\"inputs\"])));\n const secretNames = new Set(Object.keys(recordOr(value[\"secrets\"])));\n const jobs = recordOr(value[\"jobs\"]);\n const jobIds = new Set(Object.keys(jobs));\n const hostNames = options.hostNames ?? [];\n\n const checkRefs = (expr: unknown, at: readonly Key[], scope: Scope): void => {\n for (const ref of refsIn(expr, at)) {\n const [first, name, key] = ref.path;\n if (first === \"event\") continue;\n if (first !== \"names\") {\n error(\"ref-root\", ref.at, `A workflow reads only names and the event. The root ${JSON.stringify(first)} is not one.`);\n continue;\n }\n if (typeof name !== \"string\") continue;\n if (hostNames.includes(name)) continue;\n if (name === \"secrets\") {\n error(\"secret-ref\", ref.at, \"A secret is not a name. Use a document { type: \\\"secret\\\", value: NAME } as an input of a call.\");\n continue;\n }\n if (!scope.names.has(name)) {\n error(\"ref-name\", ref.at, `The name ${name} is not available here. Here a workflow can read: ${[...scope.names].join(\", \") || \"only the event\"}.`);\n continue;\n }\n if (typeof key !== \"string\") continue;\n if (name === \"inputs\" && !inputs.has(key)) error(\"ref-input\", ref.at, `The workflow has no input ${key}.`);\n if (name === \"steps\" && scope.steps !== undefined && !scope.steps.has(key)) error(\"ref-step\", ref.at, `No earlier step of this job has the id ${key}.`);\n if (name === \"needs\" && scope.needs !== undefined && !scope.needs.has(key)) error(\"ref-needs\", ref.at, `The job does not need the job ${key}. Add ${key} to its needs.`);\n if (name === \"jobs\" && !jobIds.has(key)) error(\"ref-job\", ref.at, `The workflow has no job ${key}.`);\n if (name === \"matrix\" && scope.matrix !== undefined && scope.matrix !== \"any\" && !scope.matrix.has(key)) error(\"ref-matrix\", ref.at, `The matrix of the job has no axis ${key}.`);\n }\n };\n\n // The triggers.\n listOr(value[\"triggers\"]).forEach((trigger, index) => {\n const at = [...root, \"triggers\", index];\n if (!isEnvelope(trigger)) return;\n const data = recordOr(trigger.value);\n const kind = Array.isArray(trigger.type) ? trigger.type.join(\".\") : String(trigger.type);\n if (kind === \"trigger.schedule\" && typeof data[\"cron\"] === \"string\") {\n const fields = data[\"cron\"].trim().split(/\\s+/);\n if (fields.length !== 5 || !fields.every((field) => CRON_FIELD.test(field))) {\n error(\"cron\", [...at, \"value\", \"cron\"], `A cron line has five fields: minute, hour, day, month and weekday. ${JSON.stringify(data[\"cron\"])} is not one.`);\n }\n }\n if (kind === \"trigger.feed\" && typeof data[\"from\"] === \"string\" && options.access !== undefined) {\n const answer = options.access(workspace, \"read\", data[\"from\"]);\n if (!answer.ok) error(\"grant\", [...at, \"value\", \"from\"], `The workspace ${workspace} cannot read ${data[\"from\"]}: ${answer.why}`);\n }\n if (data[\"when\"] !== undefined) checkRefs(data[\"when\"], [...at, \"value\", \"when\"], { names: new Set() });\n });\n if (listOr(value[\"triggers\"]).length === 0) warn(\"triggers-none\", [...root, \"triggers\"], \"The workflow has no trigger, thus nothing starts it.\");\n\n const top: Scope = { names: new Set([\"inputs\"]) };\n for (const [key, expr] of Object.entries(recordOr(value[\"env\"]))) checkRefs(expr, [...root, \"env\", key], top);\n for (const [key, expr] of Object.entries(recordOr(value[\"outputs\"]))) checkRefs(expr, [...root, \"outputs\", key], { names: new Set([\"inputs\", \"jobs\"]) });\n\n // The jobs.\n const graph = new Map<string, { edges: { to: string; lazy: boolean }[] }>();\n for (const [id, job] of Object.entries(jobs)) {\n const at = [...root, \"jobs\", id];\n if (!ID.test(id)) error(\"job-id\", at, `A job id has letters, digits, _ and -, and it does not start with a digit or -. ${JSON.stringify(id)} does not.`);\n if (!isEnvelope(job) || job.type !== \"job\") {\n error(\"job-form\", at, \"A job is the document { type: \\\"job\\\", value: { steps } }.\");\n continue;\n }\n const j = recordOr(job.value);\n const needs = listOr(j[\"needs\"]).filter((need): need is string => typeof need === \"string\");\n graph.set(id, { edges: needs.map((to) => ({ to, lazy: false })) });\n needs.forEach((need, index) => {\n if (need === id) error(\"needs-self\", [...at, \"value\", \"needs\", index], `The job ${id} cannot need itself.`);\n else if (!jobIds.has(need)) error(\"needs-unknown\", [...at, \"value\", \"needs\", index], `The workflow has no job ${need}.`);\n });\n if (j[\"matrix\"] !== undefined) checkRefs(j[\"matrix\"], [...at, \"value\", \"matrix\"], jobScopeOf(j, \"matrix\"));\n if (j[\"if\"] !== undefined) checkRefs(j[\"if\"], [...at, \"value\", \"if\"], jobScopeOf(j, \"if\"));\n for (const [key, expr] of Object.entries(recordOr(j[\"env\"]))) checkRefs(expr, [...at, \"value\", \"env\", key], jobScopeOf(j, \"env\"));\n const seen = new Set<string>();\n listOr(j[\"steps\"]).forEach((step, index) => {\n const sat = [...at, \"value\", \"steps\", index];\n if (!isEnvelope(step) || step.type !== \"step\") {\n error(\"step-form\", sat, \"A step is the document { type: \\\"step\\\", value: { do } }.\");\n return;\n }\n const s = recordOr(step.value);\n const scope = jobScopeOf(j, { step: index });\n for (const field of [\"if\", \"do\", \"env\"] as const) if (s[field] !== undefined) checkRefs(s[field], [...sat, \"value\", field], scope);\n const call = s[\"do\"];\n if (isEnvelope(call) && Array.isArray(call.type) && call.type[0] === \"procedure\") checkCall(call.type.slice(1).join(\".\"), recordOr(call.value), [...sat, \"value\", \"do\"]);\n if (typeof s[\"id\"] === \"string\") {\n if (!ID.test(s[\"id\"])) error(\"step-id\", [...sat, \"value\", \"id\"], `A step id has letters, digits, _ and -. ${JSON.stringify(s[\"id\"])} does not.`);\n else if (seen.has(s[\"id\"])) error(\"step-id-twice\", [...sat, \"value\", \"id\"], `Two steps of the job ${id} have the id ${s[\"id\"]}.`);\n seen.add(s[\"id\"]);\n }\n });\n if (listOr(j[\"steps\"]).length === 0) warn(\"steps-none\", [...at, \"value\", \"steps\"], `The job ${id} has no step.`);\n for (const [key, expr] of Object.entries(recordOr(j[\"outputs\"]))) checkRefs(expr, [...at, \"value\", \"outputs\", key], jobScopeOf(j, \"outputs\"));\n }\n\n function checkCall(path: string, inputsOfCall: Record_, at: readonly Key[]): void {\n const info = options.procedures === undefined ? undefined : options.procedures[path];\n if (options.procedures !== undefined && info === undefined) {\n warn(\"procedure-unknown\", at, `No procedure has the path ${path}.`);\n return;\n }\n for (const name of info?.required ?? []) if (!(name in inputsOfCall)) error(\"input-missing\", [...at, \"value\"], `The procedure ${path} needs the input ${name}.`);\n if (options.access === undefined) return;\n for (const access of [\"read\", \"write\"] as const) {\n for (const name of info?.workspaces?.[access] ?? []) {\n const target = inputsOfCall[name];\n if (typeof target !== \"string\") {\n warn(\"grant-at-run\", [...at, \"value\", name], `The input ${name} is computed, thus the runner checks the grant at the run.`);\n continue;\n }\n const answer = options.access(workspace, access, target);\n if (!answer.ok) error(\"grant\", [...at, \"value\", name], `The workspace ${workspace} cannot ${access} ${target}: ${answer.why}`);\n }\n }\n }\n\n // The cycles of the needs.\n for (const cycle of cycles(graph as NodeGraph<string>)) {\n if (cycle.certain) error(\"needs-cycle\", [...root, \"jobs\", cycle.nodes[0] as string, \"value\", \"needs\"], `The jobs ${cycle.nodes.join(\", \")} need each other in a cycle.`);\n }\n\n // The secrets: each one is declared, and only a call reads it.\n const calls = new Set([\"procedure\", ...(options.callNamespaces ?? [])]);\n for (const secret of secretsIn(value, root, false, calls)) {\n if (options.openSecrets !== true && typeof secret.name === \"string\" && !secretNames.has(secret.name)) error(\"secret-unknown\", secret.at, `The workflow declares no secret ${secret.name}.`);\n if (!secret.inCall) error(\"secret-place\", secret.at, \"A secret can only be an input of a call, a value of env or a test of its presence (secret != ''). A text, a condition or an output cannot hold it.\");\n }\n return issues;\n}\n\n/** One node of the graph of a workflow. */\nexport interface WorkflowNode {\n readonly id: string;\n readonly kind: \"trigger\" | \"job\" | \"step\";\n /** The job of a step. */\n readonly job?: string;\n readonly label: string;\n /** The JSON path of the node in the document. */\n readonly at: readonly Key[];\n}\n\n/** One edge of the graph of a workflow. `needs` orders two jobs, `data` carries a value, `start` joins a trigger to a job. */\nexport interface WorkflowEdge {\n readonly from: string;\n readonly to: string;\n readonly kind: \"needs\" | \"data\" | \"start\" | \"next\";\n}\n\n/** The graph of a workflow: its nodes, its edges, and the layers of its jobs in the order of their needs. */\nexport interface WorkflowGraph {\n readonly nodes: readonly WorkflowNode[];\n readonly edges: readonly WorkflowEdge[];\n readonly layers: readonly (readonly string[])[];\n}\n\nfunction labelOf(value: Record_, fallback: string): string {\n return typeof value[\"name\"] === \"string\" && value[\"name\"] !== \"\" ? value[\"name\"] : fallback;\n}\n\n/** This function gives the text of the path of a call, for example `git.clone`, or an empty text. */\nexport function callPath(doc: unknown): string {\n return isEnvelope(doc) && Array.isArray(doc.type) && doc.type[0] === \"procedure\" ? doc.type.slice(1).join(\".\") : \"\";\n}\n\n/**\n * This function gives the graph of a workflow from its document. The data edges come from the references of the\n * expressions. Thus the graph shows each value that moves from a step or a job to another.\n *\n * @param doc - The workflow document.\n * @returns The nodes, the edges, and the layers of the jobs.\n */\nexport function workflowGraph(doc: unknown): WorkflowGraph {\n const nodes: WorkflowNode[] = [];\n const edges: WorkflowEdge[] = [];\n if (!isEnvelope(doc) || !isRecord(doc.value)) return { nodes, edges, layers: [] };\n const value = doc.value;\n const jobs = recordOr(value[\"jobs\"]);\n const jobGraph = new Map<string, { edges: { to: string; lazy: boolean }[] }>();\n listOr(value[\"triggers\"]).forEach((trigger, index) => {\n const kind = isEnvelope(trigger) && Array.isArray(trigger.type) ? String(trigger.type[1]) : \"trigger\";\n const data = isEnvelope(trigger) ? recordOr(trigger.value) : {};\n const detail = typeof data[\"event\"] === \"string\" ? data[\"event\"] : typeof data[\"cron\"] === \"string\" ? data[\"cron\"] : typeof data[\"from\"] === \"string\" ? data[\"from\"] : \"\";\n nodes.push({ id: `trigger:${index}`, kind: \"trigger\", label: detail === \"\" ? kind : `${kind}: ${detail}`, at: [\"value\", \"triggers\", index] });\n });\n for (const [id, job] of Object.entries(jobs)) {\n const j = isEnvelope(job) ? recordOr(job.value) : {};\n const needs = listOr(j[\"needs\"]).filter((need): need is string => typeof need === \"string\" && need in jobs);\n jobGraph.set(id, { edges: needs.map((to) => ({ to, lazy: false })) });\n nodes.push({ id: `job:${id}`, kind: \"job\", label: labelOf(j, id), at: [\"value\", \"jobs\", id] });\n for (const need of needs) edges.push({ from: `job:${need}`, to: `job:${id}`, kind: \"needs\" });\n if (needs.length === 0) listOr(value[\"triggers\"]).forEach((_, index) => edges.push({ from: `trigger:${index}`, to: `job:${id}`, kind: \"start\" }));\n const stepIds = new Map<string, string>();\n let previous: string | undefined;\n listOr(j[\"steps\"]).forEach((step, index) => {\n const s = isEnvelope(step) ? recordOr(step.value) : {};\n const node = `step:${id}:${index}`;\n const path = callPath(s[\"do\"]);\n nodes.push({ id: node, kind: \"step\", job: id, label: labelOf(s, typeof s[\"id\"] === \"string\" ? s[\"id\"] : path || `step ${index + 1}`), at: [\"value\", \"jobs\", id, \"value\", \"steps\", index] });\n edges.push({ from: previous ?? `job:${id}`, to: node, kind: \"next\" });\n previous = node;\n const seen = new Set<string>();\n for (const ref of refsIn(step, [])) {\n const [first, name, key] = ref.path;\n if (first !== \"names\" || typeof key !== \"string\") continue;\n const from = name === \"steps\" ? stepIds.get(key) : name === \"needs\" && key in jobs ? `job:${key}` : undefined;\n if (from !== undefined && !seen.has(from)) {\n seen.add(from);\n edges.push({ from, to: node, kind: \"data\" });\n }\n }\n if (typeof s[\"id\"] === \"string\") stepIds.set(s[\"id\"], node);\n });\n }\n const layers = nodeLayers(jobGraph as NodeGraph<string>);\n return { nodes, edges, layers };\n}\n","/**\n * A sample workflow: a build on two versions of a runtime, then a release with a secret. The tests and the site use it.\n */\nexport const SAMPLE_WORKFLOW = {\n type: \"workflow\",\n value: {\n name: \"Build and release\",\n summary: \"It builds the package on two versions, and it releases it when a person asks.\",\n workspace: \"technical\",\n triggers: [\n { type: [\"trigger\", \"event\"], value: { event: \"push\" } },\n { type: [\"trigger\", \"manual\"], value: { summary: \"Release now\" } },\n ],\n inputs: { channel: { type: \"choice\", options: [\"latest\", \"next\"], default: \"latest\", description: \"The channel of the release.\" } },\n secrets: { REGISTRY_TOKEN: { description: \"The token of the registry.\", required: true } },\n jobs: {\n build: {\n type: \"job\",\n value: {\n name: \"Build\",\n matrix: { type: \"matrix\", value: { axes: { version: { type: \"list\", value: [20, 22] } } } },\n steps: [\n { type: \"step\", value: { id: \"source\", name: \"Get the source\", do: { type: [\"procedure\", \"git\", \"clone\"], value: { branch: \"main\" } } } },\n {\n type: \"step\",\n value: {\n id: \"test\",\n name: \"Test\",\n do: { type: [\"procedure\", \"pnpm\", \"test\"], value: { cwd: { type: \"ref\", value: [\"names\", \"steps\", \"source\", \"folder\"] }, version: { type: \"ref\", value: [\"names\", \"matrix\", \"version\"] } } },\n },\n },\n ],\n outputs: { folder: { type: \"ref\", value: [\"names\", \"steps\", \"source\", \"folder\"] } },\n },\n },\n release: {\n type: \"job\",\n value: {\n name: \"Release\",\n needs: [\"build\"],\n if: { type: [\"ops\", \"eq\"], value: [{ type: \"ref\", value: [\"event\", \"name\"] }, \"manual\"] },\n steps: [\n {\n type: \"step\",\n value: {\n id: \"publish\",\n name: \"Publish\",\n do: {\n type: [\"procedure\", \"npm\", \"publish\"],\n value: {\n cwd: { type: \"ref\", value: [\"names\", \"needs\", \"build\", \"outputs\", \"folder\"] },\n tag: { type: \"ref\", value: [\"names\", \"inputs\", \"channel\"] },\n token: { type: \"secret\", value: \"REGISTRY_TOKEN\" },\n note: { type: \"template\", value: [\"Release on the channel \", { type: \"ref\", value: [\"names\", \"inputs\", \"channel\"] }] },\n },\n },\n },\n },\n ],\n },\n },\n },\n },\n} as const;\n","import { isRecord } from \"@mark1russell7/coeval\";\nimport { scopeAt } from \"./check.ts\";\n\n/**\n * The edits of a workflow document. Each edit gives a new document and keeps the original. A builder uses them on\n * each click, then it checks the new document. The edits name no host: a host gives its own step documents.\n */\n\ntype Key = string | number;\ntype Rec = Record<string, unknown>;\n\n/** The result of an edit that can refuse: the new document, or the reason of the refusal. */\nexport type EditResult = { readonly ok: true; readonly doc: unknown } | { readonly ok: false; readonly why: string };\n\nconst recordOr = (value: unknown): Rec => (isRecord(value) ? (value as Rec) : {});\nconst listOr = (value: unknown): readonly unknown[] => (Array.isArray(value) ? value : []);\n\n/**\n * This function reads the value at a JSON path. The path goes through records and lists, also through the `value` of\n * an envelope, as the paths of the problems of `checkWorkflow` do.\n *\n * @param doc - The document.\n * @param at - The JSON path.\n * @returns The value, or `undefined`.\n */\nexport function getIn(doc: unknown, at: readonly Key[]): unknown {\n let here: unknown = doc;\n for (const key of at) {\n if (Array.isArray(here) && typeof key === \"number\") here = here[key];\n else if (isRecord(here) && typeof key === \"string\") here = (here as Rec)[key];\n else return undefined;\n }\n return here;\n}\n\n/**\n * This function gives a copy of a document with a new value at a JSON path. The value `undefined` removes the key, or\n * the item of a list. A missing record on the path becomes an empty record.\n *\n * @param doc - The document.\n * @param at - The JSON path.\n * @param value - The new value.\n * @returns The new document.\n */\nexport function setIn(doc: unknown, at: readonly Key[], value: unknown): unknown {\n if (at.length === 0) return value;\n const [key, ...rest] = at as [Key, ...Key[]];\n if (Array.isArray(doc) && typeof key === \"number\") {\n const copy = [...doc];\n if (rest.length === 0 && value === undefined) copy.splice(key, 1);\n else copy[key] = setIn(doc[key], rest, value);\n return copy;\n }\n const record = recordOr(doc);\n const copy: Rec = { ...record };\n const next = setIn(record[String(key)], rest, value);\n if (next === undefined) delete copy[String(key)];\n else copy[String(key)] = next;\n return copy;\n}\n\nconst jobsOf = (doc: unknown): Rec => recordOr(getIn(doc, [\"value\", \"jobs\"]));\nconst needsOf = (job: unknown): string[] => listOr(getIn(job, [\"value\", \"needs\"])).filter((need): need is string => typeof need === \"string\");\n\n/** This function gives a new id from a base that no key of a record has: `base`, `base-2`, `base-3` and on. */\nexport function freeId(taken: Iterable<string>, base: string): string {\n const used = new Set(taken);\n if (!used.has(base)) return base;\n for (let n = 2; ; n++) if (!used.has(`${base}-${String(n)}`)) return `${base}-${String(n)}`;\n}\n\n/**\n * This function adds a job with the given steps.\n *\n * @param doc - The workflow document.\n * @param base - The base of the id of the job.\n * @param steps - The step documents of the job.\n * @returns The new document and the id of the job.\n */\nexport function addJob(doc: unknown, base: string, steps: readonly unknown[]): { readonly doc: unknown; readonly id: string } {\n const id = freeId(Object.keys(jobsOf(doc)), base);\n return { doc: setIn(doc, [\"value\", \"jobs\", id], { type: \"job\", value: { steps: [...steps] } }), id };\n}\n\n/** This function changes each reference to a job in a document: `needs.<from>` and `jobs.<from>`. */\nfunction renameRefs(value: unknown, from: string, to: string | undefined): unknown {\n if (Array.isArray(value)) return value.map((item) => renameRefs(item, from, to));\n if (!isRecord(value)) return value;\n const record = value as Rec;\n if (record[\"type\"] === \"ref\" && Array.isArray(record[\"value\"])) {\n const path = record[\"value\"];\n if (path[0] === \"names\" && (path[1] === \"needs\" || path[1] === \"jobs\") && path[2] === from && to !== undefined) return { type: \"ref\", value: [path[0], path[1], to, ...path.slice(3)] };\n return record;\n }\n return Object.fromEntries(Object.entries(record).map(([key, item]) => [key, renameRefs(item, from, to)]));\n}\n\n/**\n * This function removes a job, and removes it from the needs of the other jobs. A reference to its outputs stays, and\n * the check finds it.\n *\n * @param doc - The workflow document.\n * @param id - The id of the job.\n * @returns The new document.\n */\nexport function removeJob(doc: unknown, id: string): unknown {\n let out = setIn(doc, [\"value\", \"jobs\", id], undefined);\n for (const [other, job] of Object.entries(jobsOf(out))) {\n const needs = needsOf(job);\n if (needs.includes(id)) out = setIn(out, [\"value\", \"jobs\", other, \"value\", \"needs\"], needs.length === 1 ? undefined : needs.filter((need) => need !== id));\n }\n return out;\n}\n\n/**\n * This function gives a job a new id. The needs of the other jobs and each reference to the job change with it. The\n * order of the jobs stays.\n *\n * @param doc - The workflow document.\n * @param from - The id of the job.\n * @param to - The new id.\n * @returns The new document, or the reason of a refusal.\n */\nexport function renameJob(doc: unknown, from: string, to: string): EditResult {\n const jobs = jobsOf(doc);\n if (!(from in jobs)) return { ok: false, why: `The workflow has no job ${from}.` };\n if (from === to) return { ok: true, doc };\n if (to in jobs) return { ok: false, why: `The workflow has a job ${to} already.` };\n if (!/^[A-Za-z_][A-Za-z0-9_-]*$/.test(to)) return { ok: false, why: \"A job id has letters, digits, _ and -, and it starts with a letter or _.\" };\n const renamed: Rec = {};\n for (const [id, job] of Object.entries(jobs)) {\n const needs = needsOf(job);\n const next = needs.includes(from) ? setIn(job, [\"value\", \"needs\"], needs.map((need) => (need === from ? to : need))) : job;\n renamed[id === from ? to : id] = next;\n }\n return { ok: true, doc: renameRefs(setIn(doc, [\"value\", \"jobs\"], renamed), from, to) };\n}\n\n/** This function tells if a job reaches another job through the needs. */\nfunction reaches(jobs: Rec, from: string, to: string): boolean {\n const seen = new Set<string>();\n const stack = [from];\n while (stack.length > 0) {\n const id = stack.pop() as string;\n if (id === to) return true;\n if (seen.has(id)) continue;\n seen.add(id);\n stack.push(...needsOf(jobs[id]));\n }\n return false;\n}\n\n/**\n * This function adds a need to a job, or removes it. A need that makes a cycle is refused.\n *\n * @param doc - The workflow document.\n * @param job - The id of the job.\n * @param need - The id of the job that it needs.\n * @param on - `true` to add the need, `false` to remove it.\n * @returns The new document, or the reason of a refusal.\n */\nexport function setNeed(doc: unknown, job: string, need: string, on: boolean): EditResult {\n const jobs = jobsOf(doc);\n if (!(job in jobs) || !(need in jobs)) return { ok: false, why: \"The workflow has no such job.\" };\n const needs = needsOf(jobs[job]);\n if (!on) return { ok: true, doc: setIn(doc, [\"value\", \"jobs\", job, \"value\", \"needs\"], needs.length <= 1 && needs.includes(need) ? undefined : needs.filter((id) => id !== need)) };\n if (needs.includes(need)) return { ok: true, doc };\n if (need === job || reaches(jobs, need, job)) return { ok: false, why: `The job ${need} already runs after ${job}. This need makes a cycle.` };\n return { ok: true, doc: setIn(doc, [\"value\", \"jobs\", job, \"value\", \"needs\"], [...needs, need]) };\n}\n\n/**\n * This function adds a step to a job.\n *\n * @param doc - The workflow document.\n * @param job - The id of the job.\n * @param step - The step document.\n * @param index - The place of the new step. The default is the end.\n * @returns The new document.\n */\nexport function addStep(doc: unknown, job: string, step: unknown, index?: number): unknown {\n const steps = [...listOr(getIn(doc, [\"value\", \"jobs\", job, \"value\", \"steps\"]))];\n steps.splice(index ?? steps.length, 0, step);\n return setIn(doc, [\"value\", \"jobs\", job, \"value\", \"steps\"], steps);\n}\n\n/**\n * This function moves a step of a job to another place in the job.\n *\n * @param doc - The workflow document.\n * @param job - The id of the job.\n * @param from - The place of the step.\n * @param to - The new place.\n * @returns The new document.\n */\nexport function moveStep(doc: unknown, job: string, from: number, to: number): unknown {\n const steps = [...listOr(getIn(doc, [\"value\", \"jobs\", job, \"value\", \"steps\"]))];\n if (from < 0 || from >= steps.length || to < 0 || to >= steps.length) return doc;\n const [step] = steps.splice(from, 1);\n steps.splice(to, 0, step);\n return setIn(doc, [\"value\", \"jobs\", job, \"value\", \"steps\"], steps);\n}\n\n/** A value that an expression can read at a position: the reference document and its text. */\nexport interface RefChoice {\n /** The group of the value, for example `inputs` or `needs`. */\n readonly group: string;\n /** The text of the value, for example `needs.build.outputs.folder`. */\n readonly label: string;\n readonly doc: unknown;\n}\n\nconst nameRef = (...path: string[]): unknown => ({ type: \"ref\", value: [\"names\", ...path] });\nconst choice = (group: string, ...path: string[]): RefChoice => ({ group, label: path.join(\".\"), doc: nameRef(...path) });\n\n/**\n * This function gives the paths into the result of each step that the references of the document read, for example\n * `folder` of `steps.source.folder`. The result of a step has no declared shape, thus the known reads are the offer.\n */\nfunction knownStepReads(doc: unknown, out: Map<string, Set<string>> = new Map()): Map<string, Set<string>> {\n if (Array.isArray(doc)) for (const item of doc) knownStepReads(item, out);\n else if (isRecord(doc)) {\n const record = doc as Rec;\n const path = record[\"value\"];\n if (record[\"type\"] === \"ref\" && Array.isArray(path) && path[1] === \"steps\" && typeof path[2] === \"string\" && path.length > 3 && path.slice(3).every((key) => typeof key === \"string\")) {\n const reads = out.get(path[2]) ?? new Set<string>();\n reads.add(path.slice(3).join(\".\"));\n out.set(path[2], reads);\n } else for (const item of Object.values(record)) knownStepReads(item, out);\n }\n return out;\n}\n\n/**\n * This function gives the values that an expression at a JSON path can read. These are the inputs, the env\n * values, the matrix axes, the outputs of the needed jobs and the known reads of the earlier steps. The list follows\n * the scope of `scopeAt`, thus each choice passes the check.\n *\n * @param doc - The workflow document.\n * @param at - The JSON path of the expression.\n * @param host - More choices of the host, for example its contexts.\n * @returns The choices, in groups.\n */\nexport function refChoices(doc: unknown, at: readonly Key[], host: readonly RefChoice[] = []): RefChoice[] {\n const scope = scopeAt(doc, at);\n if (scope === undefined) return [...host];\n const out: RefChoice[] = [];\n const value = recordOr(getIn(doc, [\"value\"]));\n const jobs = recordOr(value[\"jobs\"]);\n if (scope.names.has(\"inputs\")) for (const name of Object.keys(recordOr(value[\"inputs\"]))) out.push(choice(\"inputs\", \"inputs\", name));\n if (scope.names.has(\"env\")) {\n const job = at[1] === \"jobs\" && typeof at[2] === \"string\" ? jobs[at[2]] : undefined;\n const names = new Set([...Object.keys(recordOr(value[\"env\"])), ...Object.keys(recordOr(getIn(job, [\"value\", \"env\"])))]);\n for (const name of names) out.push(choice(\"env\", \"env\", name));\n }\n if (scope.names.has(\"matrix\") && scope.matrix !== undefined && scope.matrix !== \"any\") for (const axis of scope.matrix) out.push(choice(\"matrix\", \"matrix\", axis));\n if (scope.names.has(\"steps\") && scope.steps !== undefined) {\n const known = knownStepReads(doc);\n for (const id of scope.steps) for (const read of known.get(id) ?? []) out.push(choice(\"steps\", \"steps\", id, ...read.split(\".\")));\n }\n if (scope.names.has(\"needs\") && scope.needs !== undefined) {\n for (const id of scope.needs) for (const name of Object.keys(recordOr(getIn(jobs[id], [\"value\", \"outputs\"])))) out.push(choice(\"needs\", \"needs\", id, \"outputs\", name));\n }\n if (scope.names.has(\"jobs\")) for (const [id, job] of Object.entries(jobs)) for (const name of Object.keys(recordOr(getIn(job, [\"value\", \"outputs\"])))) out.push(choice(\"jobs\", \"jobs\", id, \"outputs\", name));\n return [...out, ...host];\n}\n\n"],"mappings":";;;AAGA,MAAa,kBAAkB;AAE/B,MAAM,OAAc,EAAE,OAAO,OAAO;;AAEpC,MAAM,OAAc;CAAE,OAAO;CAAQ,IAAI;AAAM;;AAE/C,MAAM,OAAc,EAAE,OAAO,OAAO;AACpC,MAAM,OAAc,EAAE,OAAO,OAAO;AACpC,MAAM,QAAe;CAAE,OAAO;CAAO,MAAM;AAAK;;;;;AA8HhD,MAAa,iBAA4B,EACvC,OAAO;CACL;EA3BF,OAAO,EAAE,MAAM,oBAAoB;EACnC,OAAO;GACL,OAAO;GACP,QAAQ;IACN,MAAM;IACN,SAAS;IACT,WAAW;IACX,UAAU;KAAE,OAAO;KAAQ,MAAM;IAAK;IACtC,QAAQ;IACR,SAAS;IACT,KAAK;IACL,MAAM;KAAE,OAAO;KAAO,MAAM;IAAK;IACjC,SAAS;IACT,QAAQ;GACV;GACA,UAAU;IAAC;IAAQ;IAAa;IAAY;GAAM;GAClD,QAAQ;EACV;EACA,SAAS;CASP;CACA;EAvDF,OAAO,EAAE,MAAM,eAAe;EAC9B,OAAO;GACL,OAAO;GACP,QAAQ;IACN,MAAM;IACN,OAAO;KAAE,OAAO;KAAQ,MAAM;IAAK;IACnC,IAAI;IACJ,QAAQ;IACR,KAAK;IACL,OAAO;KAAE,OAAO;KAAQ,MAAM;IAAK;IACnC,SAAS;IACT,SAAS;KAAE,O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,GAAW;EACzD,MAAM,QAAQ,eAAe,GAAG;EAChC,KAAK,MAAM,MAAM,MAAM,OAAO,KAAK,MAAM,QAAQ,MAAM,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,SAAS,SAAS,IAAI,GAAG,KAAK,MAAM,GAAG,CAAC,CAAC;CACjI;CACA,IAAI,MAAM,MAAM,IAAI,OAAO,KAAK,MAAM,UAAU,KAAA,GAC9C,KAAK,MAAM,MAAM,MAAM,OAAO,KAAK,MAAM,QAAQ,OAAO,KAAK,SAAS,MAAM,KAAK,KAAK,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,OAAO,SAAS,SAAS,IAAI,WAAW,IAAI,CAAC;CAEvK,IAAI,MAAM,MAAM,IAAI,MAAM,GAAG,KAAK,MAAM,CAAC,IAAI,QAAQ,OAAO,QAAQ,IAAI,GAAG,KAAK,MAAM,QAAQ,OAAO,KAAK,SAAS,MAAM,KAAK,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,OAAO,QAAQ,QAAQ,IAAI,WAAW,IAAI,CAAC;CAC3M,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI;AACzB"}
package/package.json CHANGED
@@ -1,13 +1,47 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package",
2
3
  "name": "@mark1russell7/workflow",
3
- "version": "0.0.0-bootstrap.0",
4
- "description": "A placeholder that lets npm trust the release workflow of mark1russell7/coeval. Use a later version.",
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "main": "./build/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./build/index.d.ts",
10
+ "default": "./build/index.js"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "files": [
15
+ "build",
16
+ "src",
17
+ "!src/**/*.test.ts"
18
+ ],
19
+ "sideEffects": false,
20
+ "devDependencies": {
21
+ "@mark1russell7/cue": "^2.1.1",
22
+ "@types/node": "^26.6.4",
23
+ "@vitest/coverage-v8": "^5.0.3",
24
+ "typescript": "^7.0.2",
25
+ "vitest": "^5.0.3"
26
+ },
27
+ "description": "A workflow as a document of coeval: triggers, jobs, steps that call procedures, the data between them, conditions, matrices and references to secrets.",
28
+ "dependencies": {
29
+ "@mark1russell7/coeval": "0.39.1"
30
+ },
31
+ "license": "MIT",
5
32
  "repository": {
6
33
  "type": "git",
7
- "url": "git+https://github.com/mark1russell7/coeval.git"
34
+ "url": "git+https://github.com/mark1russell7/coeval.git",
35
+ "directory": "packages/workflow"
8
36
  },
9
- "license": "MIT",
10
37
  "publishConfig": {
11
38
  "access": "public"
12
- }
13
- }
39
+ },
40
+ "scripts": {
41
+ "build": "tsdown",
42
+ "test": "vitest run",
43
+ "test:watch": "vitest",
44
+ "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.test.json"
45
+ },
46
+ "types": "./build/index.d.ts"
47
+ }