@tsplc/config 0.5.0 → 0.5.2
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/dist/build.js +1 -1
- package/dist/build.js.map +4 -4
- package/dist/index.js +7 -1
- package/dist/index.js.map +4 -4
- package/dist/schema.js +7 -1
- package/dist/schema.js.map +4 -4
- package/package.json +1 -1
- package/src/build-schema.ts +5 -0
- package/src/index.ts +1 -0
- package/src/schema.ts +10 -0
package/dist/build.js
CHANGED
package/dist/build.js.map
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"sources": ["../src/compiler.ts", "../src/build-schema.ts", "../src/project-files.ts", "../src/schema.ts", "../src/build.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import { z } from \"zod\";\n\ninterface Diagnostic {\n\torigin: \"config\";\n\tcode: string;\n\tseverity: \"error\";\n\tmessage: string;\n}\n\nexport const nanosecondsPattern = /^[1-9][0-9]*$/;\nexport const durationSchema = z\n\t.object({\n\t\tkind: z.literal(\"duration\"),\n\t\tnanoseconds: z.string().regex(nanosecondsPattern),\n\t})\n\t.strict();\n\nexport type Duration = z.infer<typeof durationSchema>;\n\nfunction duration(value: number, scale: number): Duration {\n\tif (!Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(\"Task duration must be finite and positive.\");\n\t}\n\t// Keep task periods exact before serializing them for the compiler/backend.\n\tconst nanoseconds = value * scale;\n\tif (!Number.isSafeInteger(nanoseconds)) {\n\t\tthrow new Error(\n\t\t\t\"Task duration must be an exact, safe number of nanoseconds.\",\n\t\t);\n\t}\n\treturn { kind: \"duration\", nanoseconds: String(nanoseconds) };\n}\n\nexport const ns = (value: number): Duration => duration(value, 1);\nexport const ms = (value: number): Duration => duration(value, 1_000_000);\nexport const seconds = (value: number): Duration =>\n\tduration(value, 1_000_000_000);\n\n/** The helpers a config calls to write a duration, by the name it calls them. */\nexport const durationHelpers = { ns, ms, seconds };\n\nconst sourceExportSchema = z\n\t.object({ module: z.string().min(1), export: z.string().min(1) })\n\t.strict();\n// Names and priorities are only bounded here; a backend narrows them to what its scheduler accepts.\nexport const taskSchema = z.strictObject({\n\tname: z.string().nonempty(),\n\tschedule: z.strictObject({\n\t\tkind: z.literal(\"cyclic\"),\n\t\tinterval: durationSchema,\n\t}),\n\tpriority: z.number().int().nonnegative(),\n\tprograms: z.array(z.string().nonempty()).nonempty(),\n});\n\n// Shared configuration validates the target envelope. Each backend owns its\n// options schema and hardware-specific scheduling/addressing constraints.\nconst targetSchema = z\n\t.object({\n\t\tkind: z.string().min(1),\n\t\toptions: z.unknown().refine((value) => value !== undefined, {\n\t\t\tmessage: \"Target options are required.\",\n\t\t}),\n\t})\n\t.strict();\nconst common = {\n\tname: z.string().min(1),\n\ttsconfig: z.string().min(1),\n\ttasks: z.array(taskSchema).min(1),\n\ttarget: targetSchema,\n};\nconst entryConfigSchema = z\n\t.object({ ...common, entry: sourceExportSchema })\n\t.strict();\nconst programsConfigSchema = z\n\t.object({\n\t\t...common,\n\t\tprograms: z.record(z.string().min(1), sourceExportSchema),\n\t})\n\t.strict();\n\nexport interface TargetDescriptor<Options = unknown> {\n\tkind: string;\n\toptions: Options;\n}\nexport type SourceExport = z.infer<typeof sourceExportSchema>;\nexport type TaskConfig = Omit<z.infer<typeof taskSchema>, \"programs\"> & {\n\tprograms: readonly string[];\n};\n\nexport type PlcConfig<Target extends TargetDescriptor = TargetDescriptor> = {\n\tname: string;\n\ttsconfig: string;\n\ttasks: readonly TaskConfig[];\n\ttarget: Target;\n} & (\n\t| { entry: SourceExport; programs?: never }\n\t| { programs: Readonly<Record<string, SourceExport>>; entry?: never }\n);\n\nexport interface NormalizedConfig {\n\tname: string;\n\ttsconfig: string;\n\tprograms: Readonly<Record<string, SourceExport>>;\n\ttasks: readonly TaskConfig[];\n\ttarget: TargetDescriptor;\n}\n\nexport function definePlcConfig<const C extends PlcConfig>(config: C): C {\n\treturn config;\n}\n\nexport function validateConfig(value: unknown): {\n\tconfig?: NormalizedConfig;\n\tdiagnostics: readonly Diagnostic[];\n} {\n\tconst multiplePrograms =\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\tObject.hasOwn(value, \"programs\") &&\n\t\t!Object.hasOwn(value, \"entry\");\n\tconst parsed = (\n\t\tmultiplePrograms ? programsConfigSchema : entryConfigSchema\n\t).safeParse(value);\n\tif (!parsed.success) {\n\t\treturn {\n\t\t\tdiagnostics: parsed.error.issues.map((issue) => ({\n\t\t\t\torigin: \"config\",\n\t\t\t\tcode: \"PLC5001\",\n\t\t\t\tseverity: \"error\",\n\t\t\t\tmessage: `${issue.path.join(\".\") || \"config\"}: ${issue.message}`,\n\t\t\t})),\n\t\t};\n\t}\n\n\tconst { data } = parsed;\n\tconst programs = \"entry\" in data ? { main: data.entry } : data.programs;\n\tconst diagnostics: Diagnostic[] = [];\n\tconst report = (message: string): void => {\n\t\tdiagnostics.push({\n\t\t\torigin: \"config\",\n\t\t\tcode: \"PLC5002\",\n\t\t\tseverity: \"error\",\n\t\t\tmessage,\n\t\t});\n\t};\n\tif (Object.keys(programs).length === 0) {\n\t\treport(\"At least one program is required.\");\n\t}\n\n\t// A program has one scan owner. Preserve task call order while rejecting\n\t// unknown, duplicated, or unassigned program keys.\n\tconst taskNames = new Set<string>();\n\tconst assigned = new Set<string>();\n\tfor (const task of data.tasks) {\n\t\tif (taskNames.has(task.name)) {\n\t\t\treport(`Duplicate task name: ${task.name}.`);\n\t\t}\n\t\ttaskNames.add(task.name);\n\t\tfor (const program of task.programs) {\n\t\t\tif (!Object.hasOwn(programs, program)) {\n\t\t\t\treport(`Task ${task.name} references unknown program ${program}.`);\n\t\t\t}\n\t\t\tif (assigned.has(program)) {\n\t\t\t\treport(`Program ${program} must belong to exactly one task.`);\n\t\t\t}\n\t\t\tassigned.add(program);\n\t\t}\n\t}\n\tfor (const program of Object.keys(programs)) {\n\t\tif (!assigned.has(program)) {\n\t\t\treport(`Program ${program} is not assigned to a task.`);\n\t\t}\n\t}\n\n\tif (diagnostics.length) {\n\t\treturn { diagnostics };\n\t}\n\treturn {\n\t\tconfig: {\n\t\t\tname: data.name,\n\t\t\ttsconfig: data.tsconfig,\n\t\t\tprograms,\n\t\t\ttasks: data.tasks,\n\t\t\ttarget: data.target,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n",
|
|
6
|
-
"import { z } from \"zod\";\nimport { nanosecondsPattern } from \"./compiler.ts\";\n\nexport const commandArgumentSchema = z\n\t.string()\n\t.refine(\n\t\t(value) => value.trim().length > 0,\n\t\t\"Command arguments must not be empty\",\n\t)\n\t.refine(\n\t\t(value) => !/[\"\\r\\n\\0]/.test(value),\n\t\t\"Command arguments must not contain quotes, line breaks, or null bytes\",\n\t);\n// CODESYS startup and project loading can each take several minutes.\nexport const codesysTimeouts = {\n\tbuild: 20 * 60 * 1000,\n\thostCommand: 15_000,\n\truntime: 60_000,\n\tstartup: 20 * 60 * 1000,\n\tstop: 10_000,\n\tterminate: 5000,\n\t// A transfer past this is reported, never interrupted.\n\ttransfer: 30 * 60 * 1000,\n};\n\nconst positiveMilliseconds = z.number().int().positive();\nconst pathSchema = z.string().trim().nonempty();\nexport const tcpPort = z.number().int().min(1).max(65535);\n/** A SHA-256 digest as lowercase hex, the form `node:crypto` writes. */\nexport const sha256Digest = z.string().regex(/^[a-f0-9]{64}$/);\n/** The name of an environment variable a credential is read from, so the config never holds it. */\nexport const envName = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst wineSchema = z.strictObject({\n\tprefix: pathSchema,\n\tbinary: pathSchema.default(\"wine\"),\n\tpathBinary: pathSchema.default(\"winepath\"),\n\tdebug: z.string().default(\"-all\"),\n\tnativeExit: z.boolean().default(false),\n});\nexport const localCodesysSchema = z.strictObject({\n\texecutable: commandArgumentSchema,\n\tprofile: commandArgumentSchema,\n\twine: wineSchema.optional(),\n\tcommandProcessor: pathSchema.default(\"cmd.exe\"),\n});\n\n// `tsplc configure` builds this tag; every project compiles with it.\nexport const dockerImage = \"tsplc-build:latest\";\nexport const containerCodesys = {\n\texecutable:\n\t\t\"/tmp/codesys-wine/drive_c/CODESYS-3.5.22.30/CODESYS/Common/CODESYS.exe\",\n\tprofile: \"CODESYS V3.5 SP22 Patch 3\",\n\twine: { prefix: \"/tmp/codesys-wine\", nativeExit: true },\n};\nexport const iecName = z.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/);\nexport const taskPriority = z.number().int().min(0).max(31);\nexport const cyclicTasksSchema = z\n\t.array(\n\t\tz.strictObject({\n\t\t\tname: iecName,\n\t\t\tintervalNanoseconds: z\n\t\t\t\t.string()\n\t\t\t\t.regex(nanosecondsPattern)\n\t\t\t\t.refine((value) => {\n\t\t\t\t\t// zod runs this refinement even when the pattern fails, and BigInt throws on a non-integer.\n\t\t\t\t\tif (!nanosecondsPattern.test(value)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tconst ns = BigInt(value);\n\t\t\t\t\treturn ns % 1_000_000n === 0n && ns <= 4_294_967_295_000_000n;\n\t\t\t\t}, \"Cyclic tasks require an exact positive TIME interval in milliseconds\"),\n\t\t\tpriority: taskPriority,\n\t\t\tprograms: z.array(iecName).nonempty(),\n\t\t}),\n\t)\n\t.nonempty()\n\t.superRefine((tasks, context) => {\n\t\tconst names = new Set<string>();\n\t\tconst programs = new Set<string>();\n\t\ttasks.forEach((task, index) => {\n\t\t\tif (names.has(task.name.toLowerCase())) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index, \"name\"],\n\t\t\t\t\tmessage: \"Task names must be unique\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tnames.add(task.name.toLowerCase());\n\t\t\ttask.programs.forEach((program, position) => {\n\t\t\t\tif (programs.has(program.toLowerCase())) {\n\t\t\t\t\tcontext.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [index, \"programs\", position],\n\t\t\t\t\t\tmessage: \"A program can be scheduled only once\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tprograms.add(program.toLowerCase());\n\t\t\t});\n\t\t});\n\t});\nexport type CyclicTask = z.infer<typeof cyclicTasksSchema>[number];\n/** `inverted` reads a BOOL input as its opposite; `shared` lets several bindings read one input. */\nexport const ioBindingOptions = {\n\tinverted: z.boolean().optional(),\n\tshared: z.boolean().optional(),\n};\n/** A process-image address in CODESYS byte addressing, with an optional IEC type. */\nexport const directIoBindingSchema = z.strictObject({\n\taddress: z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|[BWD]\\d+)$/),\n\ttype: z.string().optional(),\n\t...ioBindingOptions,\n});\n/** The controller's Ethernet interface; omitted settings keep the CODESYS defaults. */\nexport const ethernetSchema = z.strictObject({\n\tinterface: z.string().nonempty().optional(),\n\taddress: z.ipv4().optional(),\n\tsubnet: z.ipv4().optional(),\n\tgateway: z.ipv4().optional(),\n});\n/** The byte where a device's input or output assembly starts in the process image. */\nexport const assemblyAddress = z.string().regex(/^%[IQ]B\\d+$/);\nconst processImageSchema = z.strictObject({\n\taddress: assemblyAddress,\n\tsize: z.number().int().positive(),\n});\n/** A bit or byte channel of a generated device tree. */\nconst channelAddress = z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|B\\d+)$/);\n/**\n * An EtherNet/IP scanner tree generated from EDS files. Each adapter's EDS is\n * already reduced to its selected connection and raw byte assemblies, so every\n * payload byte becomes one channel pinned at its region's address plus offset.\n */\nexport const deviceTreeSchema = z.strictObject({\n\tethernet: ethernetSchema.default({}),\n\tdevices: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tname: iecName,\n\t\t\t\teds: z.string().nonempty(),\n\t\t\t\taddress: z.ipv4().optional(),\n\t\t\t\trpiMicroseconds: z.number().int().positive().optional(),\n\t\t\t\tinputs: processImageSchema.optional(),\n\t\t\t\toutputs: processImageSchema.optional(),\n\t\t\t\t// Registers written over Modbus TCP at the adapter's address, with their pinned channels.\n\t\t\t\tmodbus: z\n\t\t\t\t\t.strictObject({\n\t\t\t\t\t\tport: tcpPort,\n\t\t\t\t\t\tregisters: z.array(\n\t\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\t\tname: iecName,\n\t\t\t\t\t\t\t\toffset: z.number().int().nonnegative(),\n\t\t\t\t\t\t\t\tvalue: z.string().regex(/^%QW\\d+$/),\n\t\t\t\t\t\t\t\twrite: z.string().regex(/^%QX\\d+\\.[0-7]$/),\n\t\t\t\t\t\t\t\tstatus: z.string().regex(/^%IB\\d+$/),\n\t\t\t\t\t\t\t\trequests: z.string().regex(/^%ID\\d+$/),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\t// Channel comments name the logical IO bound at a pinned byte or bit.\n\t\t\t\tcomments: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\taddress: channelAddress,\n\t\t\t\t\t\t\ttext: z.string().nonempty(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\t.default([]),\n\t\t\t}),\n\t\t)\n\t\t.nonempty(),\n\t// Variables mapped to pinned bit or byte channels, relative to the application.\n\tmappings: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\taddress: channelAddress,\n\t\t\t\tvariable: z.string().nonempty(),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type DeviceTree = z.input<typeof deviceTreeSchema>;\n/** A device or library version as CODESYS repositories spell it: four numbers. */\nexport const fourPartVersion = z.string().regex(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/);\n/** A controller's device repository identity, as CODESYS shows it under Device > Information. */\nexport const controllerSchema = z.strictObject({\n\ttype: z.number().int().positive(),\n\tid: z.string().regex(/^[0-9A-F]{4} [0-9A-F]{4}$/),\n\tversion: fourPartVersion,\n});\nexport type Controller = z.infer<typeof controllerSchema>;\n/** A controller the build image carries, named instead of spelled as its repository identity. */\nexport const controllerTargetSchema = controllerSchema\n\t.pick({ version: true })\n\t.extend({\n\t\ttarget: z.enum([\"linux-sl\", \"virtual-linux-arm64-sl\"]),\n\t});\nexport const controllerDevices = {\n\t\"linux-sl\": { type: 4102, id: \"0000 0005\" },\n\t\"virtual-linux-arm64-sl\": { type: 4096, id: \"0000 1008\" },\n} satisfies Record<\n\tz.infer<typeof controllerTargetSchema>[\"target\"],\n\tOmit<Controller, \"version\">\n>;\nexport const configSchema = z.strictObject({\n\tio: z.record(z.string(), directIoBindingSchema).optional(),\n\tdeviceTree: deviceTreeSchema.optional(),\n\t// Replaces the template's controller; the build image must carry its description.\n\tcontroller: controllerSchema.optional(),\n\tlibraryReferences: z.array(z.string().nonempty()).default([]),\n\tlibraries: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\ttitle: z.string(),\n\t\t\t\tcompany: z.string().optional(),\n\t\t\t\tversion: z.string().optional(),\n\t\t\t\tnamespace: z.string().optional(),\n\t\t\t\tpath: pathSchema,\n\t\t\t\tsha256: sha256Digest,\n\t\t\t\turl: z.string().optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n\tdocker: z\n\t\t.strictObject({\n\t\t\tcpuSet: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+(?:-\\d+)?(?:,\\d+(?:-\\d+)?)*$/)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttemplate: pathSchema.optional(),\n\tsourceDir: pathSchema.default(\"src\"),\n\tentry: pathSchema.default(\"src/Main.st\"),\n\toutDir: pathSchema.default(\"build\"),\n\ttask: z.string().nonempty().default(\"MainTask\"),\n\ttasks: cyclicTasksSchema.optional(),\n\tremoveObjects: z.array(z.string().nonempty()).default([]),\n\tsymbols: z.boolean().default(false),\n\t/**\n\t * Experimental: a project imported into the template, as a build without a cached project or a\n\t * download without a baseline does, brings its POUs in one PLCopenXML import instead of one\n\t * call each, and falls back to one at a time on any error. A host setting, like `docker`.\n\t */\n\tbulkImport: z.boolean().optional(),\n\tonline: z\n\t\t.strictObject({\n\t\t\tnetwork: pathSchema.default(\"bridge\"),\n\t\t\tgateway: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(1217),\n\t\t\t}),\n\t\t\tdevice: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(11740),\n\t\t\t}),\n\t\t\tcredentials: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tusernameEnv: envName,\n\t\t\t\t\tpasswordEnv: envName,\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttimeouts: z\n\t\t.strictObject({\n\t\t\tstartup: positiveMilliseconds.default(codesysTimeouts.startup),\n\t\t\tbuild: positiveMilliseconds.default(codesysTimeouts.build),\n\t\t\tstop: positiveMilliseconds.default(codesysTimeouts.stop),\n\t\t\tterminate: positiveMilliseconds.default(codesysTimeouts.terminate),\n\t\t\thostCommand: positiveMilliseconds.default(codesysTimeouts.hostCommand),\n\t\t\truntime: positiveMilliseconds.default(codesysTimeouts.runtime),\n\t\t\t// Unset rather than defaulted, so a release's config still loads on agents that predate them.\n\t\t\t/** A controller operation's work before it touches the controller; `build` when unset. */\n\t\t\tprepare: positiveMilliseconds.optional(),\n\t\t\t/** How long a controller transfer runs before it is reported overdue; it is never interrupted. */\n\t\t\ttransfer: positiveMilliseconds.optional(),\n\t\t})\n\t\t.prefault({}),\n});\nexport type CodesysBuildConfig = z.input<typeof configSchema>;\n\n/**\n * A controller operation's budgets: `prepare` for opening, importing and compiling, after which the\n * worker may be stopped because the controller is untouched; `transfer` for the transfer and what\n * confirms it, after which the operation is only reported overdue, since stopping CODESYS then could\n * leave the controller without an application.\n */\nexport const controllerBudgets = (\n\ttimeouts: z.output<typeof configSchema>[\"timeouts\"],\n) => ({\n\tprepare: timeouts.prepare ?? timeouts.build,\n\ttransfer: timeouts.transfer ?? codesysTimeouts.transfer,\n});\n\n/**\n * The build config a release carries to the plant agent. The agent supplies the output\n * directory and the controller connection; Docker settings belong to the host that built it.\n */\nexport const releaseConfigSchema = configSchema.omit({\n\tdocker: true,\n\toutDir: true,\n\tonline: true,\n\tbulkImport: true,\n});\nexport type ReleaseConfig = z.input<typeof releaseConfigSchema>;\n\n/** The build settings a TypeScript project passes its compiler; the compiler decides the rest. */\nexport const engineeringBuildSchema = configSchema.omit({\n\tsourceDir: true,\n\tentry: true,\n\toutDir: true,\n\ttask: true,\n\ttasks: true,\n});\n\nexport function engineeringBuildOptions(\n\tbuild: CodesysBuildConfig,\n): z.input<typeof engineeringBuildSchema> {\n\tconst {\n\t\tsourceDir: _source,\n\t\tentry: _entry,\n\t\toutDir: _out,\n\t\ttask: _task,\n\t\ttasks: _tasks,\n\t\t...settings\n\t} = build;\n\treturn settings;\n}\n",
|
|
6
|
+
"import { z } from \"zod\";\nimport { nanosecondsPattern } from \"./compiler.ts\";\n\nexport const commandArgumentSchema = z\n\t.string()\n\t.refine(\n\t\t(value) => value.trim().length > 0,\n\t\t\"Command arguments must not be empty\",\n\t)\n\t.refine(\n\t\t(value) => !/[\"\\r\\n\\0]/.test(value),\n\t\t\"Command arguments must not contain quotes, line breaks, or null bytes\",\n\t);\n// CODESYS startup and project loading can each take several minutes.\nexport const codesysTimeouts = {\n\tbuild: 20 * 60 * 1000,\n\thostCommand: 15_000,\n\truntime: 60_000,\n\tstartup: 20 * 60 * 1000,\n\tstop: 10_000,\n\tterminate: 5000,\n\t// A transfer past this is reported, never interrupted.\n\ttransfer: 30 * 60 * 1000,\n};\n\nconst positiveMilliseconds = z.number().int().positive();\nconst pathSchema = z.string().trim().nonempty();\nexport const tcpPort = z.number().int().min(1).max(65535);\n/** A SHA-256 digest as lowercase hex, the form `node:crypto` writes. */\nexport const sha256Digest = z.string().regex(/^[a-f0-9]{64}$/);\n/** The name of an environment variable a credential is read from, so the config never holds it. */\nexport const envName = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst wineSchema = z.strictObject({\n\tprefix: pathSchema,\n\tbinary: pathSchema.default(\"wine\"),\n\tpathBinary: pathSchema.default(\"winepath\"),\n\tdebug: z.string().default(\"-all\"),\n\tnativeExit: z.boolean().default(false),\n});\nexport const localCodesysSchema = z.strictObject({\n\texecutable: commandArgumentSchema,\n\tprofile: commandArgumentSchema,\n\twine: wineSchema.optional(),\n\tcommandProcessor: pathSchema.default(\"cmd.exe\"),\n});\n\n// `tsplc configure` builds this tag; every project compiles with it.\nexport const dockerImage = \"tsplc-build:latest\";\nexport const containerCodesys = {\n\texecutable:\n\t\t\"/tmp/codesys-wine/drive_c/CODESYS-3.5.22.30/CODESYS/Common/CODESYS.exe\",\n\tprofile: \"CODESYS V3.5 SP22 Patch 3\",\n\twine: { prefix: \"/tmp/codesys-wine\", nativeExit: true },\n};\nexport const iecName = z.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/);\nexport const taskPriority = z.number().int().min(0).max(31);\nexport const cyclicTasksSchema = z\n\t.array(\n\t\tz.strictObject({\n\t\t\tname: iecName,\n\t\t\tintervalNanoseconds: z\n\t\t\t\t.string()\n\t\t\t\t.regex(nanosecondsPattern)\n\t\t\t\t.refine((value) => {\n\t\t\t\t\t// zod runs this refinement even when the pattern fails, and BigInt throws on a non-integer.\n\t\t\t\t\tif (!nanosecondsPattern.test(value)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tconst ns = BigInt(value);\n\t\t\t\t\treturn ns % 1_000_000n === 0n && ns <= 4_294_967_295_000_000n;\n\t\t\t\t}, \"Cyclic tasks require an exact positive TIME interval in milliseconds\"),\n\t\t\tpriority: taskPriority,\n\t\t\tprograms: z.array(iecName).nonempty(),\n\t\t}),\n\t)\n\t.nonempty()\n\t.superRefine((tasks, context) => {\n\t\tconst names = new Set<string>();\n\t\tconst programs = new Set<string>();\n\t\ttasks.forEach((task, index) => {\n\t\t\tif (names.has(task.name.toLowerCase())) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index, \"name\"],\n\t\t\t\t\tmessage: \"Task names must be unique\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tnames.add(task.name.toLowerCase());\n\t\t\ttask.programs.forEach((program, position) => {\n\t\t\t\tif (programs.has(program.toLowerCase())) {\n\t\t\t\t\tcontext.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [index, \"programs\", position],\n\t\t\t\t\t\tmessage: \"A program can be scheduled only once\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tprograms.add(program.toLowerCase());\n\t\t\t});\n\t\t});\n\t});\nexport type CyclicTask = z.infer<typeof cyclicTasksSchema>[number];\n/** `inverted` reads a BOOL input as its opposite; `shared` lets several bindings read one input. */\nexport const ioBindingOptions = {\n\tinverted: z.boolean().optional(),\n\tshared: z.boolean().optional(),\n};\n/** A process-image address in CODESYS byte addressing, with an optional IEC type. */\nexport const directIoBindingSchema = z.strictObject({\n\taddress: z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|[BWD]\\d+)$/),\n\ttype: z.string().optional(),\n\t...ioBindingOptions,\n});\n/** The controller's Ethernet interface; omitted settings keep the CODESYS defaults. */\nexport const ethernetSchema = z.strictObject({\n\tinterface: z.string().nonempty().optional(),\n\taddress: z.ipv4().optional(),\n\tsubnet: z.ipv4().optional(),\n\tgateway: z.ipv4().optional(),\n});\n/** The byte where a device's input or output assembly starts in the process image. */\nexport const assemblyAddress = z.string().regex(/^%[IQ]B\\d+$/);\nconst processImageSchema = z.strictObject({\n\taddress: assemblyAddress,\n\tsize: z.number().int().positive(),\n});\n/** A bit or byte channel of a generated device tree. */\nconst channelAddress = z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|B\\d+)$/);\n/**\n * An EtherNet/IP scanner tree generated from EDS files. Each adapter's EDS is\n * already reduced to its selected connection and raw byte assemblies, so every\n * payload byte becomes one channel pinned at its region's address plus offset.\n */\nexport const deviceTreeSchema = z.strictObject({\n\tethernet: ethernetSchema.default({}),\n\tdevices: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tname: iecName,\n\t\t\t\teds: z.string().nonempty(),\n\t\t\t\taddress: z.ipv4().optional(),\n\t\t\t\trpiMicroseconds: z.number().int().positive().optional(),\n\t\t\t\tinputs: processImageSchema.optional(),\n\t\t\t\toutputs: processImageSchema.optional(),\n\t\t\t\t// Registers written over Modbus TCP at the adapter's address, with their pinned channels.\n\t\t\t\tmodbus: z\n\t\t\t\t\t.strictObject({\n\t\t\t\t\t\tport: tcpPort,\n\t\t\t\t\t\tregisters: z.array(\n\t\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\t\tname: iecName,\n\t\t\t\t\t\t\t\toffset: z.number().int().nonnegative(),\n\t\t\t\t\t\t\t\tvalue: z.string().regex(/^%QW\\d+$/),\n\t\t\t\t\t\t\t\twrite: z.string().regex(/^%QX\\d+\\.[0-7]$/),\n\t\t\t\t\t\t\t\tstatus: z.string().regex(/^%IB\\d+$/),\n\t\t\t\t\t\t\t\trequests: z.string().regex(/^%ID\\d+$/),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\t// Channel comments name the logical IO bound at a pinned byte or bit.\n\t\t\t\tcomments: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\taddress: channelAddress,\n\t\t\t\t\t\t\ttext: z.string().nonempty(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\t.default([]),\n\t\t\t}),\n\t\t)\n\t\t.nonempty(),\n\t// Variables mapped to pinned bit or byte channels, relative to the application.\n\tmappings: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\taddress: channelAddress,\n\t\t\t\tvariable: z.string().nonempty(),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type DeviceTree = z.input<typeof deviceTreeSchema>;\n/** A device or library version as CODESYS repositories spell it: four numbers. */\nexport const fourPartVersion = z.string().regex(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/);\n/** A controller's device repository identity, as CODESYS shows it under Device > Information. */\nexport const controllerSchema = z.strictObject({\n\ttype: z.number().int().positive(),\n\tid: z.string().regex(/^[0-9A-F]{4} [0-9A-F]{4}$/),\n\tversion: fourPartVersion,\n});\nexport type Controller = z.infer<typeof controllerSchema>;\n/** A controller the build image carries, named instead of spelled as its repository identity. */\nexport const controllerTargetSchema = controllerSchema\n\t.pick({ version: true })\n\t.extend({\n\t\ttarget: z.enum([\"linux-sl\", \"virtual-linux-arm64-sl\"]),\n\t});\nexport const controllerDevices = {\n\t\"linux-sl\": { type: 4102, id: \"0000 0005\" },\n\t\"virtual-linux-arm64-sl\": { type: 4096, id: \"0000 1008\" },\n} satisfies Record<\n\tz.infer<typeof controllerTargetSchema>[\"target\"],\n\tOmit<Controller, \"version\">\n>;\n/** The device name each controller target's runtime reports, as its OPC UA node ids spell it. */\nexport const controllerDeviceNames = {\n\t\"linux-sl\": \"CODESYS Control for Linux SL\",\n\t\"virtual-linux-arm64-sl\": \"CODESYS Virtual Control for Linux ARM64 SL\",\n} satisfies Record<z.infer<typeof controllerTargetSchema>[\"target\"], string>;\nexport const configSchema = z.strictObject({\n\tio: z.record(z.string(), directIoBindingSchema).optional(),\n\tdeviceTree: deviceTreeSchema.optional(),\n\t// Replaces the template's controller; the build image must carry its description.\n\tcontroller: controllerSchema.optional(),\n\tlibraryReferences: z.array(z.string().nonempty()).default([]),\n\tlibraries: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\ttitle: z.string(),\n\t\t\t\tcompany: z.string().optional(),\n\t\t\t\tversion: z.string().optional(),\n\t\t\t\tnamespace: z.string().optional(),\n\t\t\t\tpath: pathSchema,\n\t\t\t\tsha256: sha256Digest,\n\t\t\t\turl: z.string().optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n\tdocker: z\n\t\t.strictObject({\n\t\t\tcpuSet: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+(?:-\\d+)?(?:,\\d+(?:-\\d+)?)*$/)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttemplate: pathSchema.optional(),\n\tsourceDir: pathSchema.default(\"src\"),\n\tentry: pathSchema.default(\"src/Main.st\"),\n\toutDir: pathSchema.default(\"build\"),\n\ttask: z.string().nonempty().default(\"MainTask\"),\n\ttasks: cyclicTasksSchema.optional(),\n\tremoveObjects: z.array(z.string().nonempty()).default([]),\n\tsymbols: z.boolean().default(false),\n\t/**\n\t * Experimental: a project imported into the template, as a build without a cached project or a\n\t * download without a baseline does, brings its POUs in one PLCopenXML import instead of one\n\t * call each, and falls back to one at a time on any error. A host setting, like `docker`.\n\t */\n\tbulkImport: z.boolean().optional(),\n\tonline: z\n\t\t.strictObject({\n\t\t\tnetwork: pathSchema.default(\"bridge\"),\n\t\t\tgateway: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(1217),\n\t\t\t}),\n\t\t\tdevice: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(11740),\n\t\t\t}),\n\t\t\tcredentials: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tusernameEnv: envName,\n\t\t\t\t\tpasswordEnv: envName,\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttimeouts: z\n\t\t.strictObject({\n\t\t\tstartup: positiveMilliseconds.default(codesysTimeouts.startup),\n\t\t\tbuild: positiveMilliseconds.default(codesysTimeouts.build),\n\t\t\tstop: positiveMilliseconds.default(codesysTimeouts.stop),\n\t\t\tterminate: positiveMilliseconds.default(codesysTimeouts.terminate),\n\t\t\thostCommand: positiveMilliseconds.default(codesysTimeouts.hostCommand),\n\t\t\truntime: positiveMilliseconds.default(codesysTimeouts.runtime),\n\t\t\t// Unset rather than defaulted, so a release's config still loads on agents that predate them.\n\t\t\t/** A controller operation's work before it touches the controller; `build` when unset. */\n\t\t\tprepare: positiveMilliseconds.optional(),\n\t\t\t/** How long a controller transfer runs before it is reported overdue; it is never interrupted. */\n\t\t\ttransfer: positiveMilliseconds.optional(),\n\t\t})\n\t\t.prefault({}),\n});\nexport type CodesysBuildConfig = z.input<typeof configSchema>;\n\n/**\n * A controller operation's budgets: `prepare` for opening, importing and compiling, after which the\n * worker may be stopped because the controller is untouched; `transfer` for the transfer and what\n * confirms it, after which the operation is only reported overdue, since stopping CODESYS then could\n * leave the controller without an application.\n */\nexport const controllerBudgets = (\n\ttimeouts: z.output<typeof configSchema>[\"timeouts\"],\n) => ({\n\tprepare: timeouts.prepare ?? timeouts.build,\n\ttransfer: timeouts.transfer ?? codesysTimeouts.transfer,\n});\n\n/**\n * The build config a release carries to the plant agent. The agent supplies the output\n * directory and the controller connection; Docker settings belong to the host that built it.\n */\nexport const releaseConfigSchema = configSchema.omit({\n\tdocker: true,\n\toutDir: true,\n\tonline: true,\n\tbulkImport: true,\n});\nexport type ReleaseConfig = z.input<typeof releaseConfigSchema>;\n\n/** The build settings a TypeScript project passes its compiler; the compiler decides the rest. */\nexport const engineeringBuildSchema = configSchema.omit({\n\tsourceDir: true,\n\tentry: true,\n\toutDir: true,\n\ttask: true,\n\ttasks: true,\n});\n\nexport function engineeringBuildOptions(\n\tbuild: CodesysBuildConfig,\n): z.input<typeof engineeringBuildSchema> {\n\tconst {\n\t\tsourceDir: _source,\n\t\tentry: _entry,\n\t\toutDir: _out,\n\t\ttask: _task,\n\t\ttasks: _tasks,\n\t\t...settings\n\t} = build;\n\treturn settings;\n}\n",
|
|
7
7
|
"/** Generated project state, relative to the directory that holds a project's config. */\nexport const generatedDirectory = \".tsplc\";\n\n/** The ST the compiler emits, with the files it publishes beside it for typegen and the debugger. */\nexport const emittedStDirectory = `${generatedDirectory}/artifacts/st`;\n\n/** The files the compiler writes into `emittedStDirectory` for other tools to read. */\nexport const emittedFiles = {\n\tioSymbols: \"io-symbols.json\",\n\tpublication: \"publication.json\",\n\tmachines: \"machines.ts\",\n} as const;\n\n/** Typegen's materialized config and symbols, which the editor reads instead of executing the config. */\nexport const projectSnapshotFile = `${generatedDirectory}/project.json`;\n",
|
|
8
|
-
"import { z } from \"zod\";\nimport {\n\tassemblyAddress,\n\ttype CodesysBuildConfig,\n\tconfigSchema,\n\tcontrollerDevices,\n\tcontrollerTargetSchema,\n\tcyclicTasksSchema,\n\tdirectIoBindingSchema,\n\tengineeringBuildOptions,\n\tenvName,\n\tethernetSchema,\n\tfourPartVersion,\n\tiecName,\n\tioBindingOptions,\n\ttaskPriority,\n\ttcpPort,\n} from \"./build-schema.ts\";\nimport {\n\tdurationSchema,\n\ttype PlcConfig,\n\ttaskSchema,\n\tvalidateConfig as validateCompilerConfig,\n} from \"./compiler.ts\";\nimport { generatedDirectory } from \"./project-files.ts\";\n\nexport type {\n\tCodesysBuildConfig,\n\tController,\n\tDeviceTree,\n} from \"./build-schema.ts\";\nexport {\n\ttype Duration,\n\tdefinePlcConfig,\n\tdurationHelpers,\n\tms,\n\ttype NormalizedConfig,\n\tns,\n\ttype PlcConfig,\n\ttype SourceExport,\n\tseconds,\n\ttype TargetDescriptor,\n\ttype TaskConfig,\n\tvalidateConfig,\n} from \"./compiler.ts\";\n\nexport const httpOptionsSchema = z\n\t.strictObject({\n\t\ttimeoutMs: z.number().int().positive().max(60000).default(2000),\n\t\tcredentials: z\n\t\t\t.array(\n\t\t\t\tz.strictObject({\n\t\t\t\t\toriginEnv: envName,\n\t\t\t\t\tbearerTokenEnv: envName,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.default([]),\n\t})\n\t.prefault({});\nexport type HttpOptions = z.infer<typeof httpOptionsSchema>;\n\nconst ioBindingSchema = z.union([\n\tdirectIoBindingSchema,\n\tz.strictObject({\n\t\tdevice: z.string().min(1),\n\t\tchannel: z.string().min(1),\n\t\t...ioBindingOptions,\n\t}),\n]);\n// Each field defaults: the assembly from the connection, the size from the EDS and,\n// with a generated device tree, the address from tsPLC's process-image layout.\nconst assemblySchema = z.strictObject({\n\tassembly: z.number().int().nonnegative().optional(),\n\tsize: z.number().int().positive().optional(),\n\taddress: assemblyAddress.optional(),\n});\nconst hardwareDeviceSchema = z.strictObject({\n\tfile: z.string().min(1),\n\tconnection: z.string().min(1).optional(),\n\tinputs: assemblySchema.optional(),\n\toutputs: assemblySchema.optional(),\n\t// Registers the generated device tree writes over Modbus TCP, at network.address.\n\t// Each maps a name to its wire offset, and is written with FC06 when its write channel rises.\n\tmodbus: z\n\t\t.strictObject({\n\t\t\tport: tcpPort.default(502),\n\t\t\tregisters: z.record(iecName, z.number().int().min(0).max(65535)),\n\t\t})\n\t\t.optional(),\n\tstatusSymbols: z.record(z.string(), z.string()).optional(),\n\t// The adapter's network identity in a generated device tree.\n\tnetwork: z\n\t\t.strictObject({\n\t\t\taddress: z.ipv4().optional(),\n\t\t\trpi: durationSchema\n\t\t\t\t.refine(\n\t\t\t\t\t(rpi) => BigInt(rpi.nanoseconds) % 1000n === 0n,\n\t\t\t\t\t\"An RPI must be a whole number of microseconds.\",\n\t\t\t\t)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n});\nconst dependencySchema = z.union([\n\tfourPartVersion,\n\tz.strictObject({\n\t\tversion: fourPartVersion,\n\t\tcompany: z.string().optional(),\n\t\tnamespace: z.string().optional(),\n\t}),\n\tz.strictObject({ path: z.string().min(1), namespace: z.string().optional() }),\n]);\n// `backend` is always CODESYS, so tasks get its name and priority rules here, as raw ST schedules do in cyclicTasksSchema.\nconst codesysTaskSchema = taskSchema.extend({\n\tname: iecName,\n\tpriority: taskPriority,\n});\nconst monitorSchema = z\n\t.strictObject({\n\t\tendpoint: z.string().url(),\n\t\tnamespaceUri: z.string().optional(),\n\t\tsymbols: z.array(z.string().min(1)).optional(),\n\t\tsecurityMode: z\n\t\t\t.enum([\"None\", \"Sign\", \"SignAndEncrypt\"])\n\t\t\t.default(\"SignAndEncrypt\"),\n\t\tsecurityPolicy: z.enum([\"None\", \"Basic256Sha256\"]).optional(),\n\t\tcertificateDirectory: z\n\t\t\t.string()\n\t\t\t.min(1)\n\t\t\t.default(`${generatedDirectory}/opcua-pki`),\n\t\tusername: z.string().min(1).optional(),\n\t\tpasswordEnv: envName.optional(),\n\t})\n\t.superRefine((monitor, context) => {\n\t\tif (\n\t\t\tmonitor.securityPolicy &&\n\t\t\t(monitor.securityMode === \"None\") !== (monitor.securityPolicy === \"None\")\n\t\t) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityPolicy\"],\n\t\t\t\tmessage:\n\t\t\t\t\t\"None mode requires None policy; secure modes require Basic256Sha256.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.passwordEnv && !monitor.username) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"username\"],\n\t\t\t\tmessage: \"Configure username when passwordEnv is used.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.username && monitor.securityMode === \"None\") {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityMode\"],\n\t\t\t\tmessage: \"Username authentication requires a secure OPC-UA connection.\",\n\t\t\t});\n\t\t}\n\t})\n\t.transform((monitor) => ({\n\t\t...monitor,\n\t\tsecurityPolicy:\n\t\t\tmonitor.securityPolicy ??\n\t\t\t(monitor.securityMode === \"None\"\n\t\t\t\t? (\"None\" as const)\n\t\t\t\t: (\"Basic256Sha256\" as const)),\n\t}));\n/**\n * The records each PLC task keeps for its sender (docs/language/telemetry.md): used whenever the\n * program calls `@tsplc/compiler/telemetry`, records unhandled job failures or traces for the debugger.\n */\nexport const telemetrySchema = z.strictObject({\n\t/** Records in each task's ring; older unsent records are overwritten and counted as dropped. */\n\tcapacity: z.number().int().min(4).max(4096).default(64),\n\t/**\n\t * The largest encoded JSON of one record, checked for every call when the program compiles.\n\t * It is fixed rather than fitted to the program, so that a ring keeps its layout from one build\n\t * to the next: CODESYS cannot apply an online change that moves a ring.\n\t */\n\trecordBytes: z.number().int().min(128).max(1024).default(512),\n});\n/**\n * The debugger's fixed-size instrumentation (docs/design/debugging.md). It reads state through\n * the engineering login, so it publishes nothing. Without it a build only carries its build id.\n */\nconst debugSchema = z.strictObject({\n\t/** Records enum state changes, decisions and job starts and ends; for local debugging sessions. */\n\ttrace: z\n\t\t.union([\n\t\t\tz.literal(false),\n\t\t\tz.strictObject({\n\t\t\t\tcapacity: z.number().int().min(16).max(4096).default(256),\n\t\t\t\toperands: z.number().int().min(0).max(8).default(4),\n\t\t\t}),\n\t\t])\n\t\t.default(false),\n\twriters: z.boolean().default(true),\n\tjobs: z.boolean().default(true),\n\t/** Watch groups the debugger opens with: TypeScript paths, `*` matching one path segment. */\n\twatch: z.record(z.string(), z.array(z.string().min(1))).default({}),\n\trequests: z\n\t\t.strictObject({\n\t\t\tcapacity: z.number().int().min(1).max(100_000).default(1000),\n\t\t\t/** Keep service call inputs and outputs; off by default because they may carry data that isn't the debugger's to show. */\n\t\t\tbodies: z.boolean().default(false),\n\t\t})\n\t\t.prefault({}),\n});\nexport const typegenSchema = z.strictObject({\n\ttypes: z.union([z.string(), z.array(z.string())]).optional(),\n\tglobals: z.union([z.string(), z.array(z.string())]).optional(),\n\t/** Directory for the generated `plc.ts`, `hardware.ts` and `machines.ts`. */\n\tdir: z.string().default(\"generated\"),\n\t/** Emit TypeScript declarations in `plc.ts`, not just the runtime field and symbol tables. */\n\tdeclarations: z.boolean().default(true),\n\t/** Emit the I/O binding types and device catalog in `hardware.ts`, not just the publication selectors. */\n\tioTypes: z.boolean().default(true),\n});\nexport const buildTargetSchema = z.enum([\"production\", \"development\"]);\nexport type BuildTarget = z.infer<typeof buildTargetSchema>;\nexport const publicationSchema = z.strictObject({\n\tproduction: z.array(z.string().nonempty()),\n\tdevelopment: z.array(z.string().nonempty()),\n});\nexport type Publication = Readonly<Record<BuildTarget, readonly string[]>>;\n/** Each IO binding's name with the published symbol path the compiler gave it. */\nexport const ioSymbolsSchema = z.record(z.string(), z.string());\n/** A published PLC variable, as `Global.Field`. */\nconst hmiTarget = z.string().regex(/^\\w+(\\.\\w+|\\[\\d+\\])+$/);\nconst hmiControlSchema = z.discriminatedUnion(\"kind\", [\n\t/** Pulses a BOOL on for 200 ms, like a pushbutton. */\n\tz.strictObject({\n\t\tkind: z.literal(\"button\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\ttone: z.enum([\"start\", \"stop\"]).optional(),\n\t\t/** Ask before pressing, for controls that start motion. */\n\t\tconfirm: z.boolean().optional(),\n\t}),\n\t/** Switches a BOOL on or off, and shows its current state. */\n\tz.strictObject({\n\t\tkind: z.literal(\"toggle\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t}),\n\t/** Writes an integer when released, and shows its current value. */\n\tz.strictObject({\n\t\tkind: z.literal(\"slider\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\tmin: z.number().int(),\n\t\tmax: z.number().int(),\n\t}),\n]);\nexport const hmiSchema = z.strictObject({\n\ttitle: z.string().nonempty(),\n\tcontrols: z.array(hmiControlSchema).default([]),\n\t/** The PLC reports whether each position of these conveyors is occupied, in this order. */\n\tconveyors: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tlabel: z.string().nonempty(),\n\t\t\t\tpositions: z.number().int().positive(),\n\t\t\t\t/** Positions that are diverters, drawn differently. */\n\t\t\t\tdiverters: z.array(z.number().int().nonnegative()).default([]),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type HmiConfig = z.input<typeof hmiSchema>;\nexport type ResolvedHmiConfig = z.output<typeof hmiSchema>;\n\nexport const tsplcConfigSchema = z.strictObject({\n\tname: z.string().default(\"Application\"),\n\tbackend: z.literal(\"codesys\"),\n\tpublish: publicationSchema.optional(),\n\tserver: z\n\t\t.strictObject({\n\t\t\tbaseUrlEnv: z.string().optional(),\n\t\t\ttransport: z.enum([\"http\", \"opcua\"]).default(\"http\"),\n\t\t\truntime: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tentry: z.string(),\n\t\t\t\t\ttarget: z\n\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\"bun-linux-x64\",\n\t\t\t\t\t\t\t\"bun-linux-arm64\",\n\t\t\t\t\t\t\t\"bun-darwin-x64\",\n\t\t\t\t\t\t\t\"bun-darwin-arm64\",\n\t\t\t\t\t\t\t\"bun-windows-x64\",\n\t\t\t\t\t\t])\n\t\t\t\t\t\t.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\tcompiler: z\n\t\t.strictObject({\n\t\t\ttsconfig: z.string().default(\"tsconfig.json\"),\n\t\t\tprograms: z.record(\n\t\t\t\tz.string(),\n\t\t\t\tz.strictObject({ module: z.string(), export: z.string() }),\n\t\t\t),\n\t\t})\n\t\t.optional(),\n\ttasks: z.array(codesysTaskSchema).nonempty().optional(),\n\t// Keep an authored legacy task distinguishable from resolveConfig's default.\n\t// An explicit shared schedule must have a single owner.\n\tbuild: configSchema\n\t\t.extend({ task: configSchema.shape.task.unwrap().optional() })\n\t\t.optional(),\n\tcodesys: z\n\t\t.strictObject({\n\t\t\thttp: httpOptionsSchema.optional(),\n\t\t\tprogramNames: z.record(z.string(), z.string()).optional(),\n\t\t\t// Generate an EtherNet/IP scanner with one adapter per entry in devices.\n\t\t\tdeviceTree: z\n\t\t\t\t.strictObject({ ethernet: ethernetSchema.optional() })\n\t\t\t\t.optional(),\n\t\t\t// Each omitted controller keeps the template's device. See controllerFor.\n\t\t\tcontrollers: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tproduction: controllerTargetSchema.optional(),\n\t\t\t\t\tdevelopment: controllerTargetSchema.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\teds: z.union([z.string(), z.array(z.string())]).default(\"eds\"),\n\tdevices: z.record(z.string(), hardwareDeviceSchema).default({}),\n\tio: z.record(z.string(), ioBindingSchema).default({}),\n\tdependencies: z.record(z.string(), dependencySchema).default({}),\n\t// Raw ST builds opt into PLC contract generation by configuring this section.\n\ttypegen: typegenSchema.optional(),\n\tmonitor: monitorSchema.optional(),\n\thmi: hmiSchema.optional(),\n\ttelemetry: telemetrySchema.optional(),\n\tdebug: debugSchema.optional(),\n\t/**\n\t * Where the program runs, each with literal values for environment variables, which win over the\n\t * environment, and the plant agent that deploys to it.\n\t */\n\ttargets: z\n\t\t.record(\n\t\t\tz.string().nonempty(),\n\t\t\tz.strictObject({\n\t\t\t\tvalues: z.record(envName, z.string()).default({}),\n\t\t\t\tagent: z.strictObject({ url: z.url() }).optional(),\n\t\t\t}),\n\t\t)\n\t\t.default({}),\n\t/** Variables a release for the plant agent leaves to it, which reads them from Bun.secrets on its own PC. */\n\tsecrets: z\n\t\t.strictObject({\n\t\t\tservice: z.string().nonempty(),\n\t\t\tnames: z.array(envName).nonempty(),\n\t\t})\n\t\t.optional(),\n});\nexport type TsplcConfig = z.input<typeof tsplcConfigSchema>;\nexport type ResolvedTsplcConfig = z.output<typeof tsplcConfigSchema>;\nexport type HardwareDevice = z.infer<typeof hardwareDeviceSchema>;\nexport type ResolvedTelemetryConfig = z.output<typeof telemetrySchema>;\nexport type ResolvedDebugConfig = z.output<typeof debugSchema>;\nexport type LibraryDependency = z.infer<typeof dependencySchema>;\n/** A binding resolved to its process-image address, as `compilerConfig` receives it. */\ntype DirectIoBinding = z.infer<typeof directIoBindingSchema>;\n\n/**\n * `build` compiles for the production controller. `run` and controller\n * operations target the local runtime, so they compile for the development one.\n */\nexport const buildTargetFor = (command: string): BuildTarget =>\n\t[\"run\", \"download\", \"online-change\", \"inspect\"].includes(command)\n\t\t? \"development\"\n\t\t: \"production\";\nexport const controllerFor = (config: ResolvedTsplcConfig, command: string) => {\n\tconst controller = config.codesys?.controllers?.[buildTargetFor(command)];\n\treturn (\n\t\tcontroller && {\n\t\t\t...controllerDevices[controller.target],\n\t\t\tversion: controller.version,\n\t\t}\n\t);\n};\n\n/**\n * The variable holding the bearer token the PLC sends the project's own server: the HTTP\n * credential for the server's base URL.\n */\nexport const serverTokenEnv = (config: ResolvedTsplcConfig) =>\n\tconfig.codesys?.http?.credentials.find(\n\t\t({ originEnv }) => originEnv === config.server?.baseUrlEnv,\n\t)?.bearerTokenEnv;\n\n/**\n * The project without fieldbus I/O, for a plant simulator that writes inputs over\n * OPC UA: fieldbus input copies would overwrite those writes every scan.\n */\nexport const simulationConfig = (\n\tconfig: ResolvedTsplcConfig,\n): ResolvedTsplcConfig => ({\n\t...config,\n\teds: [],\n\tdevices: {},\n\tio: {},\n\t...(config.codesys && {\n\t\tcodesys: {\n\t\t\t...config.codesys,\n\t\t\tdeviceTree: undefined,\n\t\t},\n\t}),\n});\n\n/** All paths are relative to this file; no package has a second project config. */\nexport function defineConfig<const C extends TsplcConfig>(config: C): C {\n\treturn config;\n}\n\n/** Raw ST program names already are IEC names; use the shared schedule directly. */\nexport function rawBuildConfig(\n\tconfig: ResolvedTsplcConfig,\n): CodesysBuildConfig {\n\tif (config.compiler) {\n\t\tthrow new Error(\"Use the compiler build plan for TypeScript projects.\");\n\t}\n\tif (!config.build) {\n\t\tthrow new Error(\"Configure build settings.\");\n\t}\n\tif (!config.tasks) {\n\t\treturn config.build;\n\t}\n\tif (config.build.tasks || config.build.task !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"Configure the raw ST schedule in tasks or build.tasks/build.task, not both.\",\n\t\t);\n\t}\n\treturn {\n\t\t...config.build,\n\t\ttasks: cyclicTasksSchema.parse(\n\t\t\tconfig.tasks.map((task) => ({\n\t\t\t\tname: task.name,\n\t\t\t\tintervalNanoseconds: task.schedule.interval.nanoseconds,\n\t\t\t\tpriority: task.priority,\n\t\t\t\tprograms: task.programs,\n\t\t\t})),\n\t\t),\n\t};\n}\n\n/** Adapt the shared project to the compiler's backend-independent scan model. */\nexport function compilerConfig(\n\tconfig: ResolvedTsplcConfig,\n\tio: Record<string, DirectIoBinding>,\n\tbuildTarget: BuildTarget = \"production\",\n) {\n\tif (!config.compiler || !config.tasks) {\n\t\tthrow new Error(\n\t\t\t\"This project uses raw Structured Text; no TypeScript compiler is configured.\",\n\t\t);\n\t}\n\t// The device tree and controllers are build-time engineering; the compiler only sees addresses.\n\tconst {\n\t\tdeviceTree: _deviceTree,\n\t\tcontrollers: _controllers,\n\t\t...codesys\n\t} = config.codesys ?? {};\n\tconst value: PlcConfig = {\n\t\tname: config.name,\n\t\ttsconfig: config.compiler.tsconfig,\n\t\tprograms: config.compiler.programs,\n\t\ttasks: config.tasks,\n\t\ttarget: {\n\t\t\tkind: config.backend,\n\t\t\toptions: {\n\t\t\t\t...codesys,\n\t\t\t\tpublish: config.publish,\n\t\t\t\tbuildTarget,\n\t\t\t\tio: Object.fromEntries(\n\t\t\t\t\tObject.entries(io).map(([name, binding]) => [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"direct\",\n\t\t\t\t\t\t\t...binding,\n\t\t\t\t\t\t\t...(mappedChannel(config, name, binding) && { mapped: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tengineering: {\n\t\t\t\t\tkind: \"v3.5\",\n\t\t\t\t\t...(config.build\n\t\t\t\t\t\t? { build: engineeringBuildOptions(config.build) }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n\tconst validated = validateCompilerConfig(value);\n\tif (!validated.config) {\n\t\tthrow new Error(\n\t\t\tvalidated.diagnostics.map((item) => item.message).join(\"\\n\"),\n\t\t);\n\t}\n\treturn validated.config;\n}\n\n/**\n * A generated device tree maps a device's bit or byte scalar to its variable in the\n * I/O mapping. Wider values span several byte channels and keep an AT declaration.\n */\nfunction mappedChannel(\n\tconfig: ResolvedTsplcConfig,\n\tname: string,\n\tbinding: DirectIoBinding,\n) {\n\tconst source = config.io[name];\n\treturn (\n\t\tconfig.codesys?.deviceTree !== undefined &&\n\t\tsource !== undefined &&\n\t\t\"device\" in source &&\n\t\t// A channel maps to one variable as it stands, so these need an AT wire and a copy.\n\t\t!binding.inverted &&\n\t\t!binding.shared &&\n\t\t/^%[IQ][XB]/.test(binding.address) &&\n\t\t!/^ARRAY/i.test(binding.type ?? \"\")\n\t);\n}\n",
|
|
8
|
+
"import { z } from \"zod\";\nimport {\n\tassemblyAddress,\n\ttype CodesysBuildConfig,\n\tconfigSchema,\n\tcontrollerDeviceNames,\n\tcontrollerDevices,\n\tcontrollerTargetSchema,\n\tcyclicTasksSchema,\n\tdirectIoBindingSchema,\n\tengineeringBuildOptions,\n\tenvName,\n\tethernetSchema,\n\tfourPartVersion,\n\tiecName,\n\tioBindingOptions,\n\ttaskPriority,\n\ttcpPort,\n} from \"./build-schema.ts\";\nimport {\n\tdurationSchema,\n\ttype PlcConfig,\n\ttaskSchema,\n\tvalidateConfig as validateCompilerConfig,\n} from \"./compiler.ts\";\nimport { generatedDirectory } from \"./project-files.ts\";\n\nexport type {\n\tCodesysBuildConfig,\n\tController,\n\tDeviceTree,\n} from \"./build-schema.ts\";\nexport {\n\ttype Duration,\n\tdefinePlcConfig,\n\tdurationHelpers,\n\tms,\n\ttype NormalizedConfig,\n\tns,\n\ttype PlcConfig,\n\ttype SourceExport,\n\tseconds,\n\ttype TargetDescriptor,\n\ttype TaskConfig,\n\tvalidateConfig,\n} from \"./compiler.ts\";\n\nexport const httpOptionsSchema = z\n\t.strictObject({\n\t\ttimeoutMs: z.number().int().positive().max(60000).default(2000),\n\t\tcredentials: z\n\t\t\t.array(\n\t\t\t\tz.strictObject({\n\t\t\t\t\toriginEnv: envName,\n\t\t\t\t\tbearerTokenEnv: envName,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.default([]),\n\t})\n\t.prefault({});\nexport type HttpOptions = z.infer<typeof httpOptionsSchema>;\n\nconst ioBindingSchema = z.union([\n\tdirectIoBindingSchema,\n\tz.strictObject({\n\t\tdevice: z.string().min(1),\n\t\tchannel: z.string().min(1),\n\t\t...ioBindingOptions,\n\t}),\n]);\n// Each field defaults: the assembly from the connection, the size from the EDS and,\n// with a generated device tree, the address from tsPLC's process-image layout.\nconst assemblySchema = z.strictObject({\n\tassembly: z.number().int().nonnegative().optional(),\n\tsize: z.number().int().positive().optional(),\n\taddress: assemblyAddress.optional(),\n});\nconst hardwareDeviceSchema = z.strictObject({\n\tfile: z.string().min(1),\n\tconnection: z.string().min(1).optional(),\n\tinputs: assemblySchema.optional(),\n\toutputs: assemblySchema.optional(),\n\t// Registers the generated device tree writes over Modbus TCP, at network.address.\n\t// Each maps a name to its wire offset, and is written with FC06 when its write channel rises.\n\tmodbus: z\n\t\t.strictObject({\n\t\t\tport: tcpPort.default(502),\n\t\t\tregisters: z.record(iecName, z.number().int().min(0).max(65535)),\n\t\t})\n\t\t.optional(),\n\tstatusSymbols: z.record(z.string(), z.string()).optional(),\n\t// The adapter's network identity in a generated device tree.\n\tnetwork: z\n\t\t.strictObject({\n\t\t\taddress: z.ipv4().optional(),\n\t\t\trpi: durationSchema\n\t\t\t\t.refine(\n\t\t\t\t\t(rpi) => BigInt(rpi.nanoseconds) % 1000n === 0n,\n\t\t\t\t\t\"An RPI must be a whole number of microseconds.\",\n\t\t\t\t)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n});\nconst dependencySchema = z.union([\n\tfourPartVersion,\n\tz.strictObject({\n\t\tversion: fourPartVersion,\n\t\tcompany: z.string().optional(),\n\t\tnamespace: z.string().optional(),\n\t}),\n\tz.strictObject({ path: z.string().min(1), namespace: z.string().optional() }),\n]);\n// `backend` is always CODESYS, so tasks get its name and priority rules here, as raw ST schedules do in cyclicTasksSchema.\nconst codesysTaskSchema = taskSchema.extend({\n\tname: iecName,\n\tpriority: taskPriority,\n});\nconst monitorSchema = z\n\t.strictObject({\n\t\tendpoint: z.string().url(),\n\t\tnamespaceUri: z.string().optional(),\n\t\tsymbols: z.array(z.string().min(1)).optional(),\n\t\tsecurityMode: z\n\t\t\t.enum([\"None\", \"Sign\", \"SignAndEncrypt\"])\n\t\t\t.default(\"SignAndEncrypt\"),\n\t\tsecurityPolicy: z.enum([\"None\", \"Basic256Sha256\"]).optional(),\n\t\tcertificateDirectory: z\n\t\t\t.string()\n\t\t\t.min(1)\n\t\t\t.default(`${generatedDirectory}/opcua-pki`),\n\t\tusername: z.string().min(1).optional(),\n\t\tpasswordEnv: envName.optional(),\n\t})\n\t.superRefine((monitor, context) => {\n\t\tif (\n\t\t\tmonitor.securityPolicy &&\n\t\t\t(monitor.securityMode === \"None\") !== (monitor.securityPolicy === \"None\")\n\t\t) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityPolicy\"],\n\t\t\t\tmessage:\n\t\t\t\t\t\"None mode requires None policy; secure modes require Basic256Sha256.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.passwordEnv && !monitor.username) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"username\"],\n\t\t\t\tmessage: \"Configure username when passwordEnv is used.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.username && monitor.securityMode === \"None\") {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityMode\"],\n\t\t\t\tmessage: \"Username authentication requires a secure OPC-UA connection.\",\n\t\t\t});\n\t\t}\n\t})\n\t.transform((monitor) => ({\n\t\t...monitor,\n\t\tsecurityPolicy:\n\t\t\tmonitor.securityPolicy ??\n\t\t\t(monitor.securityMode === \"None\"\n\t\t\t\t? (\"None\" as const)\n\t\t\t\t: (\"Basic256Sha256\" as const)),\n\t}));\n/**\n * The records each PLC task keeps for its sender (docs/language/telemetry.md): used whenever the\n * program calls `@tsplc/compiler/telemetry`, records unhandled job failures or traces for the debugger.\n */\nexport const telemetrySchema = z.strictObject({\n\t/** Records in each task's ring; older unsent records are overwritten and counted as dropped. */\n\tcapacity: z.number().int().min(4).max(4096).default(64),\n\t/**\n\t * The largest encoded JSON of one record, checked for every call when the program compiles.\n\t * It is fixed rather than fitted to the program, so that a ring keeps its layout from one build\n\t * to the next: CODESYS cannot apply an online change that moves a ring.\n\t */\n\trecordBytes: z.number().int().min(128).max(1024).default(512),\n});\n/**\n * The debugger's fixed-size instrumentation (docs/design/debugging.md). It reads state through\n * the engineering login, so it publishes nothing. Without it a build only carries its build id.\n */\nconst debugSchema = z.strictObject({\n\t/** Records enum state changes, decisions and job starts and ends; for local debugging sessions. */\n\ttrace: z\n\t\t.union([\n\t\t\tz.literal(false),\n\t\t\tz.strictObject({\n\t\t\t\tcapacity: z.number().int().min(16).max(4096).default(256),\n\t\t\t\toperands: z.number().int().min(0).max(8).default(4),\n\t\t\t}),\n\t\t])\n\t\t.default(false),\n\twriters: z.boolean().default(true),\n\tjobs: z.boolean().default(true),\n\t/** Watch groups the debugger opens with: TypeScript paths, `*` matching one path segment. */\n\twatch: z.record(z.string(), z.array(z.string().min(1))).default({}),\n\trequests: z\n\t\t.strictObject({\n\t\t\tcapacity: z.number().int().min(1).max(100_000).default(1000),\n\t\t\t/** Keep service call inputs and outputs; off by default because they may carry data that isn't the debugger's to show. */\n\t\t\tbodies: z.boolean().default(false),\n\t\t})\n\t\t.prefault({}),\n});\nexport const typegenSchema = z.strictObject({\n\ttypes: z.union([z.string(), z.array(z.string())]).optional(),\n\tglobals: z.union([z.string(), z.array(z.string())]).optional(),\n\t/** Directory for the generated `plc.ts`, `hardware.ts` and `machines.ts`. */\n\tdir: z.string().default(\"generated\"),\n\t/** Emit TypeScript declarations in `plc.ts`, not just the runtime field and symbol tables. */\n\tdeclarations: z.boolean().default(true),\n\t/** Emit the I/O binding types and device catalog in `hardware.ts`, not just the publication selectors. */\n\tioTypes: z.boolean().default(true),\n});\nexport const buildTargetSchema = z.enum([\"production\", \"development\"]);\nexport type BuildTarget = z.infer<typeof buildTargetSchema>;\nexport const publicationSchema = z.strictObject({\n\tproduction: z.array(z.string().nonempty()),\n\tdevelopment: z.array(z.string().nonempty()),\n});\nexport type Publication = Readonly<Record<BuildTarget, readonly string[]>>;\n/** Each IO binding's name with the published symbol path the compiler gave it. */\nexport const ioSymbolsSchema = z.record(z.string(), z.string());\n/** A published PLC variable, as `Global.Field`. */\nconst hmiTarget = z.string().regex(/^\\w+(\\.\\w+|\\[\\d+\\])+$/);\nconst hmiControlSchema = z.discriminatedUnion(\"kind\", [\n\t/** Pulses a BOOL on for 200 ms, like a pushbutton. */\n\tz.strictObject({\n\t\tkind: z.literal(\"button\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\ttone: z.enum([\"start\", \"stop\"]).optional(),\n\t\t/** Ask before pressing, for controls that start motion. */\n\t\tconfirm: z.boolean().optional(),\n\t}),\n\t/** Switches a BOOL on or off, and shows its current state. */\n\tz.strictObject({\n\t\tkind: z.literal(\"toggle\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t}),\n\t/** Writes an integer when released, and shows its current value. */\n\tz.strictObject({\n\t\tkind: z.literal(\"slider\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\tmin: z.number().int(),\n\t\tmax: z.number().int(),\n\t}),\n]);\nexport const hmiSchema = z.strictObject({\n\ttitle: z.string().nonempty(),\n\tcontrols: z.array(hmiControlSchema).default([]),\n\t/** The PLC reports whether each position of these conveyors is occupied, in this order. */\n\tconveyors: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tlabel: z.string().nonempty(),\n\t\t\t\tpositions: z.number().int().positive(),\n\t\t\t\t/** Positions that are diverters, drawn differently. */\n\t\t\t\tdiverters: z.array(z.number().int().nonnegative()).default([]),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type HmiConfig = z.input<typeof hmiSchema>;\nexport type ResolvedHmiConfig = z.output<typeof hmiSchema>;\n\nexport const tsplcConfigSchema = z.strictObject({\n\tname: z.string().default(\"Application\"),\n\tbackend: z.literal(\"codesys\"),\n\tpublish: publicationSchema.optional(),\n\tserver: z\n\t\t.strictObject({\n\t\t\tbaseUrlEnv: z.string().optional(),\n\t\t\ttransport: z.enum([\"http\", \"opcua\"]).default(\"http\"),\n\t\t\truntime: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tentry: z.string(),\n\t\t\t\t\ttarget: z\n\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\"bun-linux-x64\",\n\t\t\t\t\t\t\t\"bun-linux-arm64\",\n\t\t\t\t\t\t\t\"bun-darwin-x64\",\n\t\t\t\t\t\t\t\"bun-darwin-arm64\",\n\t\t\t\t\t\t\t\"bun-windows-x64\",\n\t\t\t\t\t\t])\n\t\t\t\t\t\t.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\tcompiler: z\n\t\t.strictObject({\n\t\t\ttsconfig: z.string().default(\"tsconfig.json\"),\n\t\t\tprograms: z.record(\n\t\t\t\tz.string(),\n\t\t\t\tz.strictObject({ module: z.string(), export: z.string() }),\n\t\t\t),\n\t\t})\n\t\t.optional(),\n\ttasks: z.array(codesysTaskSchema).nonempty().optional(),\n\t// Keep an authored legacy task distinguishable from resolveConfig's default.\n\t// An explicit shared schedule must have a single owner.\n\tbuild: configSchema\n\t\t.extend({ task: configSchema.shape.task.unwrap().optional() })\n\t\t.optional(),\n\tcodesys: z\n\t\t.strictObject({\n\t\t\thttp: httpOptionsSchema.optional(),\n\t\t\tprogramNames: z.record(z.string(), z.string()).optional(),\n\t\t\t// Generate an EtherNet/IP scanner with one adapter per entry in devices.\n\t\t\tdeviceTree: z\n\t\t\t\t.strictObject({ ethernet: ethernetSchema.optional() })\n\t\t\t\t.optional(),\n\t\t\t// Each omitted controller keeps the template's device. See controllerFor.\n\t\t\tcontrollers: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tproduction: controllerTargetSchema.optional(),\n\t\t\t\t\tdevelopment: controllerTargetSchema.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\teds: z.union([z.string(), z.array(z.string())]).default(\"eds\"),\n\tdevices: z.record(z.string(), hardwareDeviceSchema).default({}),\n\tio: z.record(z.string(), ioBindingSchema).default({}),\n\tdependencies: z.record(z.string(), dependencySchema).default({}),\n\t// Raw ST builds opt into PLC contract generation by configuring this section.\n\ttypegen: typegenSchema.optional(),\n\tmonitor: monitorSchema.optional(),\n\thmi: hmiSchema.optional(),\n\ttelemetry: telemetrySchema.optional(),\n\tdebug: debugSchema.optional(),\n\t/**\n\t * Where the program runs, each with literal values for environment variables, which win over the\n\t * environment, and the plant agent that deploys to it.\n\t */\n\ttargets: z\n\t\t.record(\n\t\t\tz.string().nonempty(),\n\t\t\tz.strictObject({\n\t\t\t\tvalues: z.record(envName, z.string()).default({}),\n\t\t\t\tagent: z.strictObject({ url: z.url() }).optional(),\n\t\t\t}),\n\t\t)\n\t\t.default({}),\n\t/** Variables a release for the plant agent leaves to it, which reads them from Bun.secrets on its own PC. */\n\tsecrets: z\n\t\t.strictObject({\n\t\t\tservice: z.string().nonempty(),\n\t\t\tnames: z.array(envName).nonempty(),\n\t\t})\n\t\t.optional(),\n});\nexport type TsplcConfig = z.input<typeof tsplcConfigSchema>;\nexport type ResolvedTsplcConfig = z.output<typeof tsplcConfigSchema>;\nexport type HardwareDevice = z.infer<typeof hardwareDeviceSchema>;\nexport type ResolvedTelemetryConfig = z.output<typeof telemetrySchema>;\nexport type ResolvedDebugConfig = z.output<typeof debugSchema>;\nexport type LibraryDependency = z.infer<typeof dependencySchema>;\n/** A binding resolved to its process-image address, as `compilerConfig` receives it. */\ntype DirectIoBinding = z.infer<typeof directIoBindingSchema>;\n\n/**\n * `build` compiles for the production controller. `run` and controller\n * operations target the local runtime, so they compile for the development one.\n */\nexport const buildTargetFor = (command: string): BuildTarget =>\n\t[\"run\", \"download\", \"online-change\", \"inspect\"].includes(command)\n\t\t? \"development\"\n\t\t: \"production\";\nexport const controllerFor = (config: ResolvedTsplcConfig, command: string) => {\n\tconst controller = config.codesys?.controllers?.[buildTargetFor(command)];\n\treturn (\n\t\tcontroller && {\n\t\t\t...controllerDevices[controller.target],\n\t\t\tversion: controller.version,\n\t\t}\n\t);\n};\n\n/** The name of the device `command` runs on: the configured controller, else Linux SL, the local runtime `run` deploys to. */\nexport const controllerDeviceName = (\n\tconfig: ResolvedTsplcConfig,\n\tcommand: string,\n) =>\n\tcontrollerDeviceNames[\n\t\tconfig.codesys?.controllers?.[buildTargetFor(command)]?.target ?? \"linux-sl\"\n\t];\n\n/**\n * The variable holding the bearer token the PLC sends the project's own server: the HTTP\n * credential for the server's base URL.\n */\nexport const serverTokenEnv = (config: ResolvedTsplcConfig) =>\n\tconfig.codesys?.http?.credentials.find(\n\t\t({ originEnv }) => originEnv === config.server?.baseUrlEnv,\n\t)?.bearerTokenEnv;\n\n/**\n * The project without fieldbus I/O, for a plant simulator that writes inputs over\n * OPC UA: fieldbus input copies would overwrite those writes every scan.\n */\nexport const simulationConfig = (\n\tconfig: ResolvedTsplcConfig,\n): ResolvedTsplcConfig => ({\n\t...config,\n\teds: [],\n\tdevices: {},\n\tio: {},\n\t...(config.codesys && {\n\t\tcodesys: {\n\t\t\t...config.codesys,\n\t\t\tdeviceTree: undefined,\n\t\t},\n\t}),\n});\n\n/** All paths are relative to this file; no package has a second project config. */\nexport function defineConfig<const C extends TsplcConfig>(config: C): C {\n\treturn config;\n}\n\n/** Raw ST program names already are IEC names; use the shared schedule directly. */\nexport function rawBuildConfig(\n\tconfig: ResolvedTsplcConfig,\n): CodesysBuildConfig {\n\tif (config.compiler) {\n\t\tthrow new Error(\"Use the compiler build plan for TypeScript projects.\");\n\t}\n\tif (!config.build) {\n\t\tthrow new Error(\"Configure build settings.\");\n\t}\n\tif (!config.tasks) {\n\t\treturn config.build;\n\t}\n\tif (config.build.tasks || config.build.task !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"Configure the raw ST schedule in tasks or build.tasks/build.task, not both.\",\n\t\t);\n\t}\n\treturn {\n\t\t...config.build,\n\t\ttasks: cyclicTasksSchema.parse(\n\t\t\tconfig.tasks.map((task) => ({\n\t\t\t\tname: task.name,\n\t\t\t\tintervalNanoseconds: task.schedule.interval.nanoseconds,\n\t\t\t\tpriority: task.priority,\n\t\t\t\tprograms: task.programs,\n\t\t\t})),\n\t\t),\n\t};\n}\n\n/** Adapt the shared project to the compiler's backend-independent scan model. */\nexport function compilerConfig(\n\tconfig: ResolvedTsplcConfig,\n\tio: Record<string, DirectIoBinding>,\n\tbuildTarget: BuildTarget = \"production\",\n) {\n\tif (!config.compiler || !config.tasks) {\n\t\tthrow new Error(\n\t\t\t\"This project uses raw Structured Text; no TypeScript compiler is configured.\",\n\t\t);\n\t}\n\t// The device tree and controllers are build-time engineering; the compiler only sees addresses.\n\tconst {\n\t\tdeviceTree: _deviceTree,\n\t\tcontrollers: _controllers,\n\t\t...codesys\n\t} = config.codesys ?? {};\n\tconst value: PlcConfig = {\n\t\tname: config.name,\n\t\ttsconfig: config.compiler.tsconfig,\n\t\tprograms: config.compiler.programs,\n\t\ttasks: config.tasks,\n\t\ttarget: {\n\t\t\tkind: config.backend,\n\t\t\toptions: {\n\t\t\t\t...codesys,\n\t\t\t\tpublish: config.publish,\n\t\t\t\tbuildTarget,\n\t\t\t\tio: Object.fromEntries(\n\t\t\t\t\tObject.entries(io).map(([name, binding]) => [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"direct\",\n\t\t\t\t\t\t\t...binding,\n\t\t\t\t\t\t\t...(mappedChannel(config, name, binding) && { mapped: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tengineering: {\n\t\t\t\t\tkind: \"v3.5\",\n\t\t\t\t\t...(config.build\n\t\t\t\t\t\t? { build: engineeringBuildOptions(config.build) }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n\tconst validated = validateCompilerConfig(value);\n\tif (!validated.config) {\n\t\tthrow new Error(\n\t\t\tvalidated.diagnostics.map((item) => item.message).join(\"\\n\"),\n\t\t);\n\t}\n\treturn validated.config;\n}\n\n/**\n * A generated device tree maps a device's bit or byte scalar to its variable in the\n * I/O mapping. Wider values span several byte channels and keep an AT declaration.\n */\nfunction mappedChannel(\n\tconfig: ResolvedTsplcConfig,\n\tname: string,\n\tbinding: DirectIoBinding,\n) {\n\tconst source = config.io[name];\n\treturn (\n\t\tconfig.codesys?.deviceTree !== undefined &&\n\t\tsource !== undefined &&\n\t\t\"device\" in source &&\n\t\t// A channel maps to one variable as it stands, so these need an AT wire and a copy.\n\t\t!binding.inverted &&\n\t\t!binding.shared &&\n\t\t/^%[IQ][XB]/.test(binding.address) &&\n\t\t!/^ARRAY/i.test(binding.type ?? \"\")\n\t);\n}\n",
|
|
9
9
|
"import { dirname, resolve } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport type { z } from \"zod\";\nimport {\n\ttype CodesysBuildConfig,\n\tconfigSchema,\n\tcontainerCodesys,\n\tlocalCodesysSchema,\n} from \"./build-schema.ts\";\n\nexport {\n\ttype CodesysBuildConfig,\n\ttype Controller,\n\ttype CyclicTask,\n\tcodesysTimeouts,\n\tcommandArgumentSchema,\n\tconfigSchema,\n\tcontainerCodesys,\n\tcontrollerBudgets,\n\tcontrollerSchema,\n\tcyclicTasksSchema,\n\ttype DeviceTree,\n\tdeviceTreeSchema,\n\tdirectIoBindingSchema,\n\tdockerImage,\n\tengineeringBuildSchema,\n\tethernetSchema,\n\tiecName,\n\ttype ReleaseConfig,\n\treleaseConfigSchema,\n\tsha256Digest,\n\ttcpPort,\n} from \"./build-schema.ts\";\n\nexport type ResolvedConfig = z.output<typeof configSchema> & {\n\ttemplate: string;\n\tconfigFile: string;\n\tcodesys: z.output<typeof localCodesysSchema>;\n};\n\n/** Keep config authoring typed; validation and relative path resolution happen at load. */\nexport const defineBuildConfig = (\n\tconfig: CodesysBuildConfig,\n): CodesysBuildConfig => config;\n\nexport const resolveConfig = (\n\tinput: unknown,\n\tconfigFile: string,\n): ResolvedConfig => {\n\tconst parsed = configSchema.parse(input);\n\tconst root = dirname(resolve(configFile));\n\tconst codesys = localCodesysSchema.parse(containerCodesys);\n\treturn {\n\t\t...parsed,\n\t\tdocker: parsed.docker ?? {},\n\t\tconfigFile: resolve(configFile),\n\t\ttemplate: parsed.template\n\t\t\t? resolve(root, parsed.template)\n\t\t\t: fileURLToPath(new URL(\"../templates/default.project\", import.meta.url)),\n\t\tremoveObjects: parsed.template\n\t\t\t? parsed.removeObjects\n\t\t\t: [\"PLC_PRG\", ...parsed.removeObjects],\n\t\tlibraries: parsed.libraries?.map((library) => ({\n\t\t\t...library,\n\t\t\tpath: resolve(root, library.path),\n\t\t})),\n\t\tsourceDir: resolve(root, parsed.sourceDir),\n\t\tentry: resolve(root, parsed.entry),\n\t\toutDir: resolve(root, parsed.outDir),\n\t\tcodesys: {\n\t\t\t...codesys,\n\t\t\texecutable: resolve(root, codesys.executable),\n\t\t\twine: codesys.wine\n\t\t\t\t? { ...codesys.wine, prefix: resolve(root, codesys.wine.prefix) }\n\t\t\t\t: undefined,\n\t\t},\n\t};\n};\n\nexport const loadConfig = async (file = \"tsplc.config.ts\") => {\n\tconst path = resolve(file);\n\tconst module = (await import(pathToFileURL(path).href)) as {\n\t\tconfig?: unknown;\n\t\tdefault?: unknown;\n\t};\n\tif (module.default === undefined && module.config === undefined) {\n\t\tthrow new Error(`${path} must export a default config`);\n\t}\n\tconst input = module.default ?? module.config;\n\tif (input && typeof input === \"object\" && \"build\" in input) {\n\t\tconst { rawBuildConfig, tsplcConfigSchema } = await import(\"./schema.ts\");\n\t\treturn resolveConfig(rawBuildConfig(tsplcConfigSchema.parse(input)), path);\n\t}\n\treturn resolveConfig(input, path);\n};\n"
|
|
10
10
|
],
|
|
11
|
-
"mappings": ";;;;;;;;;;;;;AAAA;AAAA,IASa,oBACA,gBA+BP,oBAIO,YAYP,cAQA,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
|
"names": []
|
|
14
14
|
}
|
package/dist/index.js
CHANGED
|
@@ -289,6 +289,10 @@ var controllerDevices = {
|
|
|
289
289
|
"linux-sl": { type: 4102, id: "0000 0005" },
|
|
290
290
|
"virtual-linux-arm64-sl": { type: 4096, id: "0000 1008" }
|
|
291
291
|
};
|
|
292
|
+
var controllerDeviceNames = {
|
|
293
|
+
"linux-sl": "CODESYS Control for Linux SL",
|
|
294
|
+
"virtual-linux-arm64-sl": "CODESYS Virtual Control for Linux ARM64 SL"
|
|
295
|
+
};
|
|
292
296
|
var configSchema = z3.strictObject({
|
|
293
297
|
io: z3.record(z3.string(), directIoBindingSchema).optional(),
|
|
294
298
|
deviceTree: deviceTreeSchema.optional(),
|
|
@@ -578,6 +582,7 @@ var controllerFor = (config, command) => {
|
|
|
578
582
|
version: controller.version
|
|
579
583
|
};
|
|
580
584
|
};
|
|
585
|
+
var controllerDeviceName = (config, command) => controllerDeviceNames[config.codesys?.controllers?.[buildTargetFor(command)]?.target ?? "linux-sl"];
|
|
581
586
|
var serverTokenEnv = (config) => config.codesys?.http?.credentials.find(({ originEnv }) => originEnv === config.server?.baseUrlEnv)?.bearerTokenEnv;
|
|
582
587
|
var simulationConfig = (config) => ({
|
|
583
588
|
...config,
|
|
@@ -694,6 +699,7 @@ export {
|
|
|
694
699
|
buildTargetFor,
|
|
695
700
|
buildTargetSchema,
|
|
696
701
|
compilerConfig,
|
|
702
|
+
controllerDeviceName,
|
|
697
703
|
controllerFor,
|
|
698
704
|
defineConfig,
|
|
699
705
|
definePlcConfig,
|
|
@@ -717,5 +723,5 @@ export {
|
|
|
717
723
|
validateConfig
|
|
718
724
|
};
|
|
719
725
|
|
|
720
|
-
//# debugId=
|
|
726
|
+
//# debugId=8E026EB8E700759F64756E2164756E21
|
|
721
727
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"import { z } from \"zod\";\n\ninterface Diagnostic {\n\torigin: \"config\";\n\tcode: string;\n\tseverity: \"error\";\n\tmessage: string;\n}\n\nexport const nanosecondsPattern = /^[1-9][0-9]*$/;\nexport const durationSchema = z\n\t.object({\n\t\tkind: z.literal(\"duration\"),\n\t\tnanoseconds: z.string().regex(nanosecondsPattern),\n\t})\n\t.strict();\n\nexport type Duration = z.infer<typeof durationSchema>;\n\nfunction duration(value: number, scale: number): Duration {\n\tif (!Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(\"Task duration must be finite and positive.\");\n\t}\n\t// Keep task periods exact before serializing them for the compiler/backend.\n\tconst nanoseconds = value * scale;\n\tif (!Number.isSafeInteger(nanoseconds)) {\n\t\tthrow new Error(\n\t\t\t\"Task duration must be an exact, safe number of nanoseconds.\",\n\t\t);\n\t}\n\treturn { kind: \"duration\", nanoseconds: String(nanoseconds) };\n}\n\nexport const ns = (value: number): Duration => duration(value, 1);\nexport const ms = (value: number): Duration => duration(value, 1_000_000);\nexport const seconds = (value: number): Duration =>\n\tduration(value, 1_000_000_000);\n\n/** The helpers a config calls to write a duration, by the name it calls them. */\nexport const durationHelpers = { ns, ms, seconds };\n\nconst sourceExportSchema = z\n\t.object({ module: z.string().min(1), export: z.string().min(1) })\n\t.strict();\n// Names and priorities are only bounded here; a backend narrows them to what its scheduler accepts.\nexport const taskSchema = z.strictObject({\n\tname: z.string().nonempty(),\n\tschedule: z.strictObject({\n\t\tkind: z.literal(\"cyclic\"),\n\t\tinterval: durationSchema,\n\t}),\n\tpriority: z.number().int().nonnegative(),\n\tprograms: z.array(z.string().nonempty()).nonempty(),\n});\n\n// Shared configuration validates the target envelope. Each backend owns its\n// options schema and hardware-specific scheduling/addressing constraints.\nconst targetSchema = z\n\t.object({\n\t\tkind: z.string().min(1),\n\t\toptions: z.unknown().refine((value) => value !== undefined, {\n\t\t\tmessage: \"Target options are required.\",\n\t\t}),\n\t})\n\t.strict();\nconst common = {\n\tname: z.string().min(1),\n\ttsconfig: z.string().min(1),\n\ttasks: z.array(taskSchema).min(1),\n\ttarget: targetSchema,\n};\nconst entryConfigSchema = z\n\t.object({ ...common, entry: sourceExportSchema })\n\t.strict();\nconst programsConfigSchema = z\n\t.object({\n\t\t...common,\n\t\tprograms: z.record(z.string().min(1), sourceExportSchema),\n\t})\n\t.strict();\n\nexport interface TargetDescriptor<Options = unknown> {\n\tkind: string;\n\toptions: Options;\n}\nexport type SourceExport = z.infer<typeof sourceExportSchema>;\nexport type TaskConfig = Omit<z.infer<typeof taskSchema>, \"programs\"> & {\n\tprograms: readonly string[];\n};\n\nexport type PlcConfig<Target extends TargetDescriptor = TargetDescriptor> = {\n\tname: string;\n\ttsconfig: string;\n\ttasks: readonly TaskConfig[];\n\ttarget: Target;\n} & (\n\t| { entry: SourceExport; programs?: never }\n\t| { programs: Readonly<Record<string, SourceExport>>; entry?: never }\n);\n\nexport interface NormalizedConfig {\n\tname: string;\n\ttsconfig: string;\n\tprograms: Readonly<Record<string, SourceExport>>;\n\ttasks: readonly TaskConfig[];\n\ttarget: TargetDescriptor;\n}\n\nexport function definePlcConfig<const C extends PlcConfig>(config: C): C {\n\treturn config;\n}\n\nexport function validateConfig(value: unknown): {\n\tconfig?: NormalizedConfig;\n\tdiagnostics: readonly Diagnostic[];\n} {\n\tconst multiplePrograms =\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\tObject.hasOwn(value, \"programs\") &&\n\t\t!Object.hasOwn(value, \"entry\");\n\tconst parsed = (\n\t\tmultiplePrograms ? programsConfigSchema : entryConfigSchema\n\t).safeParse(value);\n\tif (!parsed.success) {\n\t\treturn {\n\t\t\tdiagnostics: parsed.error.issues.map((issue) => ({\n\t\t\t\torigin: \"config\",\n\t\t\t\tcode: \"PLC5001\",\n\t\t\t\tseverity: \"error\",\n\t\t\t\tmessage: `${issue.path.join(\".\") || \"config\"}: ${issue.message}`,\n\t\t\t})),\n\t\t};\n\t}\n\n\tconst { data } = parsed;\n\tconst programs = \"entry\" in data ? { main: data.entry } : data.programs;\n\tconst diagnostics: Diagnostic[] = [];\n\tconst report = (message: string): void => {\n\t\tdiagnostics.push({\n\t\t\torigin: \"config\",\n\t\t\tcode: \"PLC5002\",\n\t\t\tseverity: \"error\",\n\t\t\tmessage,\n\t\t});\n\t};\n\tif (Object.keys(programs).length === 0) {\n\t\treport(\"At least one program is required.\");\n\t}\n\n\t// A program has one scan owner. Preserve task call order while rejecting\n\t// unknown, duplicated, or unassigned program keys.\n\tconst taskNames = new Set<string>();\n\tconst assigned = new Set<string>();\n\tfor (const task of data.tasks) {\n\t\tif (taskNames.has(task.name)) {\n\t\t\treport(`Duplicate task name: ${task.name}.`);\n\t\t}\n\t\ttaskNames.add(task.name);\n\t\tfor (const program of task.programs) {\n\t\t\tif (!Object.hasOwn(programs, program)) {\n\t\t\t\treport(`Task ${task.name} references unknown program ${program}.`);\n\t\t\t}\n\t\t\tif (assigned.has(program)) {\n\t\t\t\treport(`Program ${program} must belong to exactly one task.`);\n\t\t\t}\n\t\t\tassigned.add(program);\n\t\t}\n\t}\n\tfor (const program of Object.keys(programs)) {\n\t\tif (!assigned.has(program)) {\n\t\t\treport(`Program ${program} is not assigned to a task.`);\n\t\t}\n\t}\n\n\tif (diagnostics.length) {\n\t\treturn { diagnostics };\n\t}\n\treturn {\n\t\tconfig: {\n\t\t\tname: data.name,\n\t\t\ttsconfig: data.tsconfig,\n\t\t\tprograms,\n\t\t\ttasks: data.tasks,\n\t\t\ttarget: data.target,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n",
|
|
6
6
|
"import { z } from \"zod\";\nimport type { ResolvedTsplcConfig } from \"./schema.ts\";\n\n/** Environment variables by name, as `process.env` holds them. */\nexport type Environment = Readonly<Record<string, string | undefined>>;\n\n/** The longest secret value the PLC holds. */\nconst secretLength = 512;\n\n/** A secret's value, which the PLC sends as a bearer token: no line break or NUL. */\nexport const secretValue = z\n\t.string()\n\t.nonempty(\"is empty\")\n\t.max(secretLength, `is longer than ${secretLength} characters`)\n\t.regex(/^[^\\r\\n\\0]*$/, \"holds a line break or NUL\");\n\n/**\n * What a release for the plant agent carries in its ST instead of secret `name`; the agent puts\n * the value in its place. It is as long as the longest value, so whatever holds it fits the value.\n */\nexport const secretPlaceholder = (name: string) =>\n\t`${`{{tsplc-secret:${name}:`.padEnd(secretLength - 2, \"-\")}}}`;\n\nexport interface EnvironmentOptions {\n\tenv: Environment;\n\t/** The config's target to take values from; with one target configured, that one. */\n\ttarget: string | undefined;\n\t/** A release for the plant agent: it gets placeholders for the secrets, and several targets need a choice. */\n\tforAgent: boolean;\n}\n\nconst selectedTarget = (\n\tconfig: ResolvedTsplcConfig,\n\t{ target, forAgent }: EnvironmentOptions,\n) => {\n\tconst names = Object.keys(config.targets);\n\tif (target !== undefined) {\n\t\tconst selected = config.targets[target];\n\t\tif (!selected) {\n\t\t\tthrow new Error(\n\t\t\t\t`The config has no target ${target}; its targets are: ${names.join(\", \") || \"none\"}.`,\n\t\t\t);\n\t\t}\n\t\treturn selected;\n\t}\n\tconst targets = Object.values(config.targets);\n\tif (targets.length <= 1) {\n\t\treturn targets[0];\n\t}\n\tif (!forAgent) {\n\t\treturn undefined;\n\t}\n\t// Of several, the plant agent's commands reach the one that names an agent.\n\tconst withAgent = targets.filter(({ agent }) => agent);\n\tif (withAgent.length === 1) {\n\t\treturn withAgent[0];\n\t}\n\tthrow new Error(\n\t\t`Choose the target to deploy to with --target: ${names.join(\", \")}.`,\n\t);\n};\n\n/**\n * The environment the build reads the config's variables from, such as `server.baseUrlEnv`, the\n * HTTP credentials and the program's `env()` calls, and the plant commands their agent from:\n * `env`, with the target's agent as TSPLC_AGENT_URL and its values over it.\n */\nexport const projectEnvironment = (\n\tconfig: ResolvedTsplcConfig,\n\toptions: EnvironmentOptions,\n): Environment => {\n\tconst target = selectedTarget(config, options);\n\treturn {\n\t\t...options.env,\n\t\t...(target?.agent && { TSPLC_AGENT_URL: target.agent.url }),\n\t\t...target?.values,\n\t\t...(options.forAgent &&\n\t\t\tObject.fromEntries(\n\t\t\t\t(config.secrets?.names ?? []).map((name) => [\n\t\t\t\t\tname,\n\t\t\t\t\tsecretPlaceholder(name),\n\t\t\t\t]),\n\t\t\t)),\n\t};\n};\n",
|
|
7
7
|
"import { readFile } from \"node:fs/promises\";\nimport { dirname, resolve } from \"node:path\";\nimport { createJiti } from \"jiti\";\nimport { type EnvironmentOptions, projectEnvironment } from \"./environment.ts\";\nimport { tsplcConfigSchema } from \"./schema.ts\";\n\n/** The config, and the environment its variables resolve in: `process.env` and the only target, unless `environment` says otherwise. */\nexport async function loadTsplcConfig(\n\tfile = \"tsplc.config.ts\",\n\tenvironment: EnvironmentOptions = {\n\t\tenv: process.env,\n\t\ttarget: undefined,\n\t\tforAgent: false,\n\t},\n) {\n\tconst configFile = resolve(file);\n\tawait readFile(configFile);\n\tconst jiti = createJiti(import.meta.url, {\n\t\tmoduleCache: false,\n\t\tfsCache: false,\n\t\tinteropDefault: false,\n\t\t// Bun can import TS natively, but its module cache would hide config edits.\n\t\ttryNative: false,\n\t});\n\tconst module = await jiti.import<{ default?: unknown; config?: unknown }>(\n\t\tconfigFile,\n\t);\n\tconst config = tsplcConfigSchema.parse(module.default ?? module.config);\n\tif (config.compiler && !config.tasks) {\n\t\tthrow new Error(\"TypeScript programs require a tasks configuration.\");\n\t}\n\treturn {\n\t\tconfigFile,\n\t\troot: dirname(configFile),\n\t\tconfig,\n\t\tenv: projectEnvironment(config, environment),\n\t};\n}\n\n/** A loaded project config: its file, the directory relative paths resolve from, and the validated config. */\nexport type LoadedConfig = Awaited<ReturnType<typeof loadTsplcConfig>>;\n",
|
|
8
|
-
"import { z } from \"zod\";\nimport {\n\tassemblyAddress,\n\ttype CodesysBuildConfig,\n\tconfigSchema,\n\tcontrollerDevices,\n\tcontrollerTargetSchema,\n\tcyclicTasksSchema,\n\tdirectIoBindingSchema,\n\tengineeringBuildOptions,\n\tenvName,\n\tethernetSchema,\n\tfourPartVersion,\n\tiecName,\n\tioBindingOptions,\n\ttaskPriority,\n\ttcpPort,\n} from \"./build-schema.ts\";\nimport {\n\tdurationSchema,\n\ttype PlcConfig,\n\ttaskSchema,\n\tvalidateConfig as validateCompilerConfig,\n} from \"./compiler.ts\";\nimport { generatedDirectory } from \"./project-files.ts\";\n\nexport type {\n\tCodesysBuildConfig,\n\tController,\n\tDeviceTree,\n} from \"./build-schema.ts\";\nexport {\n\ttype Duration,\n\tdefinePlcConfig,\n\tdurationHelpers,\n\tms,\n\ttype NormalizedConfig,\n\tns,\n\ttype PlcConfig,\n\ttype SourceExport,\n\tseconds,\n\ttype TargetDescriptor,\n\ttype TaskConfig,\n\tvalidateConfig,\n} from \"./compiler.ts\";\n\nexport const httpOptionsSchema = z\n\t.strictObject({\n\t\ttimeoutMs: z.number().int().positive().max(60000).default(2000),\n\t\tcredentials: z\n\t\t\t.array(\n\t\t\t\tz.strictObject({\n\t\t\t\t\toriginEnv: envName,\n\t\t\t\t\tbearerTokenEnv: envName,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.default([]),\n\t})\n\t.prefault({});\nexport type HttpOptions = z.infer<typeof httpOptionsSchema>;\n\nconst ioBindingSchema = z.union([\n\tdirectIoBindingSchema,\n\tz.strictObject({\n\t\tdevice: z.string().min(1),\n\t\tchannel: z.string().min(1),\n\t\t...ioBindingOptions,\n\t}),\n]);\n// Each field defaults: the assembly from the connection, the size from the EDS and,\n// with a generated device tree, the address from tsPLC's process-image layout.\nconst assemblySchema = z.strictObject({\n\tassembly: z.number().int().nonnegative().optional(),\n\tsize: z.number().int().positive().optional(),\n\taddress: assemblyAddress.optional(),\n});\nconst hardwareDeviceSchema = z.strictObject({\n\tfile: z.string().min(1),\n\tconnection: z.string().min(1).optional(),\n\tinputs: assemblySchema.optional(),\n\toutputs: assemblySchema.optional(),\n\t// Registers the generated device tree writes over Modbus TCP, at network.address.\n\t// Each maps a name to its wire offset, and is written with FC06 when its write channel rises.\n\tmodbus: z\n\t\t.strictObject({\n\t\t\tport: tcpPort.default(502),\n\t\t\tregisters: z.record(iecName, z.number().int().min(0).max(65535)),\n\t\t})\n\t\t.optional(),\n\tstatusSymbols: z.record(z.string(), z.string()).optional(),\n\t// The adapter's network identity in a generated device tree.\n\tnetwork: z\n\t\t.strictObject({\n\t\t\taddress: z.ipv4().optional(),\n\t\t\trpi: durationSchema\n\t\t\t\t.refine(\n\t\t\t\t\t(rpi) => BigInt(rpi.nanoseconds) % 1000n === 0n,\n\t\t\t\t\t\"An RPI must be a whole number of microseconds.\",\n\t\t\t\t)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n});\nconst dependencySchema = z.union([\n\tfourPartVersion,\n\tz.strictObject({\n\t\tversion: fourPartVersion,\n\t\tcompany: z.string().optional(),\n\t\tnamespace: z.string().optional(),\n\t}),\n\tz.strictObject({ path: z.string().min(1), namespace: z.string().optional() }),\n]);\n// `backend` is always CODESYS, so tasks get its name and priority rules here, as raw ST schedules do in cyclicTasksSchema.\nconst codesysTaskSchema = taskSchema.extend({\n\tname: iecName,\n\tpriority: taskPriority,\n});\nconst monitorSchema = z\n\t.strictObject({\n\t\tendpoint: z.string().url(),\n\t\tnamespaceUri: z.string().optional(),\n\t\tsymbols: z.array(z.string().min(1)).optional(),\n\t\tsecurityMode: z\n\t\t\t.enum([\"None\", \"Sign\", \"SignAndEncrypt\"])\n\t\t\t.default(\"SignAndEncrypt\"),\n\t\tsecurityPolicy: z.enum([\"None\", \"Basic256Sha256\"]).optional(),\n\t\tcertificateDirectory: z\n\t\t\t.string()\n\t\t\t.min(1)\n\t\t\t.default(`${generatedDirectory}/opcua-pki`),\n\t\tusername: z.string().min(1).optional(),\n\t\tpasswordEnv: envName.optional(),\n\t})\n\t.superRefine((monitor, context) => {\n\t\tif (\n\t\t\tmonitor.securityPolicy &&\n\t\t\t(monitor.securityMode === \"None\") !== (monitor.securityPolicy === \"None\")\n\t\t) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityPolicy\"],\n\t\t\t\tmessage:\n\t\t\t\t\t\"None mode requires None policy; secure modes require Basic256Sha256.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.passwordEnv && !monitor.username) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"username\"],\n\t\t\t\tmessage: \"Configure username when passwordEnv is used.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.username && monitor.securityMode === \"None\") {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityMode\"],\n\t\t\t\tmessage: \"Username authentication requires a secure OPC-UA connection.\",\n\t\t\t});\n\t\t}\n\t})\n\t.transform((monitor) => ({\n\t\t...monitor,\n\t\tsecurityPolicy:\n\t\t\tmonitor.securityPolicy ??\n\t\t\t(monitor.securityMode === \"None\"\n\t\t\t\t? (\"None\" as const)\n\t\t\t\t: (\"Basic256Sha256\" as const)),\n\t}));\n/**\n * The records each PLC task keeps for its sender (docs/language/telemetry.md): used whenever the\n * program calls `@tsplc/compiler/telemetry`, records unhandled job failures or traces for the debugger.\n */\nexport const telemetrySchema = z.strictObject({\n\t/** Records in each task's ring; older unsent records are overwritten and counted as dropped. */\n\tcapacity: z.number().int().min(4).max(4096).default(64),\n\t/**\n\t * The largest encoded JSON of one record, checked for every call when the program compiles.\n\t * It is fixed rather than fitted to the program, so that a ring keeps its layout from one build\n\t * to the next: CODESYS cannot apply an online change that moves a ring.\n\t */\n\trecordBytes: z.number().int().min(128).max(1024).default(512),\n});\n/**\n * The debugger's fixed-size instrumentation (docs/design/debugging.md). It reads state through\n * the engineering login, so it publishes nothing. Without it a build only carries its build id.\n */\nconst debugSchema = z.strictObject({\n\t/** Records enum state changes, decisions and job starts and ends; for local debugging sessions. */\n\ttrace: z\n\t\t.union([\n\t\t\tz.literal(false),\n\t\t\tz.strictObject({\n\t\t\t\tcapacity: z.number().int().min(16).max(4096).default(256),\n\t\t\t\toperands: z.number().int().min(0).max(8).default(4),\n\t\t\t}),\n\t\t])\n\t\t.default(false),\n\twriters: z.boolean().default(true),\n\tjobs: z.boolean().default(true),\n\t/** Watch groups the debugger opens with: TypeScript paths, `*` matching one path segment. */\n\twatch: z.record(z.string(), z.array(z.string().min(1))).default({}),\n\trequests: z\n\t\t.strictObject({\n\t\t\tcapacity: z.number().int().min(1).max(100_000).default(1000),\n\t\t\t/** Keep service call inputs and outputs; off by default because they may carry data that isn't the debugger's to show. */\n\t\t\tbodies: z.boolean().default(false),\n\t\t})\n\t\t.prefault({}),\n});\nexport const typegenSchema = z.strictObject({\n\ttypes: z.union([z.string(), z.array(z.string())]).optional(),\n\tglobals: z.union([z.string(), z.array(z.string())]).optional(),\n\t/** Directory for the generated `plc.ts`, `hardware.ts` and `machines.ts`. */\n\tdir: z.string().default(\"generated\"),\n\t/** Emit TypeScript declarations in `plc.ts`, not just the runtime field and symbol tables. */\n\tdeclarations: z.boolean().default(true),\n\t/** Emit the I/O binding types and device catalog in `hardware.ts`, not just the publication selectors. */\n\tioTypes: z.boolean().default(true),\n});\nexport const buildTargetSchema = z.enum([\"production\", \"development\"]);\nexport type BuildTarget = z.infer<typeof buildTargetSchema>;\nexport const publicationSchema = z.strictObject({\n\tproduction: z.array(z.string().nonempty()),\n\tdevelopment: z.array(z.string().nonempty()),\n});\nexport type Publication = Readonly<Record<BuildTarget, readonly string[]>>;\n/** Each IO binding's name with the published symbol path the compiler gave it. */\nexport const ioSymbolsSchema = z.record(z.string(), z.string());\n/** A published PLC variable, as `Global.Field`. */\nconst hmiTarget = z.string().regex(/^\\w+(\\.\\w+|\\[\\d+\\])+$/);\nconst hmiControlSchema = z.discriminatedUnion(\"kind\", [\n\t/** Pulses a BOOL on for 200 ms, like a pushbutton. */\n\tz.strictObject({\n\t\tkind: z.literal(\"button\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\ttone: z.enum([\"start\", \"stop\"]).optional(),\n\t\t/** Ask before pressing, for controls that start motion. */\n\t\tconfirm: z.boolean().optional(),\n\t}),\n\t/** Switches a BOOL on or off, and shows its current state. */\n\tz.strictObject({\n\t\tkind: z.literal(\"toggle\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t}),\n\t/** Writes an integer when released, and shows its current value. */\n\tz.strictObject({\n\t\tkind: z.literal(\"slider\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\tmin: z.number().int(),\n\t\tmax: z.number().int(),\n\t}),\n]);\nexport const hmiSchema = z.strictObject({\n\ttitle: z.string().nonempty(),\n\tcontrols: z.array(hmiControlSchema).default([]),\n\t/** The PLC reports whether each position of these conveyors is occupied, in this order. */\n\tconveyors: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tlabel: z.string().nonempty(),\n\t\t\t\tpositions: z.number().int().positive(),\n\t\t\t\t/** Positions that are diverters, drawn differently. */\n\t\t\t\tdiverters: z.array(z.number().int().nonnegative()).default([]),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type HmiConfig = z.input<typeof hmiSchema>;\nexport type ResolvedHmiConfig = z.output<typeof hmiSchema>;\n\nexport const tsplcConfigSchema = z.strictObject({\n\tname: z.string().default(\"Application\"),\n\tbackend: z.literal(\"codesys\"),\n\tpublish: publicationSchema.optional(),\n\tserver: z\n\t\t.strictObject({\n\t\t\tbaseUrlEnv: z.string().optional(),\n\t\t\ttransport: z.enum([\"http\", \"opcua\"]).default(\"http\"),\n\t\t\truntime: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tentry: z.string(),\n\t\t\t\t\ttarget: z\n\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\"bun-linux-x64\",\n\t\t\t\t\t\t\t\"bun-linux-arm64\",\n\t\t\t\t\t\t\t\"bun-darwin-x64\",\n\t\t\t\t\t\t\t\"bun-darwin-arm64\",\n\t\t\t\t\t\t\t\"bun-windows-x64\",\n\t\t\t\t\t\t])\n\t\t\t\t\t\t.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\tcompiler: z\n\t\t.strictObject({\n\t\t\ttsconfig: z.string().default(\"tsconfig.json\"),\n\t\t\tprograms: z.record(\n\t\t\t\tz.string(),\n\t\t\t\tz.strictObject({ module: z.string(), export: z.string() }),\n\t\t\t),\n\t\t})\n\t\t.optional(),\n\ttasks: z.array(codesysTaskSchema).nonempty().optional(),\n\t// Keep an authored legacy task distinguishable from resolveConfig's default.\n\t// An explicit shared schedule must have a single owner.\n\tbuild: configSchema\n\t\t.extend({ task: configSchema.shape.task.unwrap().optional() })\n\t\t.optional(),\n\tcodesys: z\n\t\t.strictObject({\n\t\t\thttp: httpOptionsSchema.optional(),\n\t\t\tprogramNames: z.record(z.string(), z.string()).optional(),\n\t\t\t// Generate an EtherNet/IP scanner with one adapter per entry in devices.\n\t\t\tdeviceTree: z\n\t\t\t\t.strictObject({ ethernet: ethernetSchema.optional() })\n\t\t\t\t.optional(),\n\t\t\t// Each omitted controller keeps the template's device. See controllerFor.\n\t\t\tcontrollers: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tproduction: controllerTargetSchema.optional(),\n\t\t\t\t\tdevelopment: controllerTargetSchema.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\teds: z.union([z.string(), z.array(z.string())]).default(\"eds\"),\n\tdevices: z.record(z.string(), hardwareDeviceSchema).default({}),\n\tio: z.record(z.string(), ioBindingSchema).default({}),\n\tdependencies: z.record(z.string(), dependencySchema).default({}),\n\t// Raw ST builds opt into PLC contract generation by configuring this section.\n\ttypegen: typegenSchema.optional(),\n\tmonitor: monitorSchema.optional(),\n\thmi: hmiSchema.optional(),\n\ttelemetry: telemetrySchema.optional(),\n\tdebug: debugSchema.optional(),\n\t/**\n\t * Where the program runs, each with literal values for environment variables, which win over the\n\t * environment, and the plant agent that deploys to it.\n\t */\n\ttargets: z\n\t\t.record(\n\t\t\tz.string().nonempty(),\n\t\t\tz.strictObject({\n\t\t\t\tvalues: z.record(envName, z.string()).default({}),\n\t\t\t\tagent: z.strictObject({ url: z.url() }).optional(),\n\t\t\t}),\n\t\t)\n\t\t.default({}),\n\t/** Variables a release for the plant agent leaves to it, which reads them from Bun.secrets on its own PC. */\n\tsecrets: z\n\t\t.strictObject({\n\t\t\tservice: z.string().nonempty(),\n\t\t\tnames: z.array(envName).nonempty(),\n\t\t})\n\t\t.optional(),\n});\nexport type TsplcConfig = z.input<typeof tsplcConfigSchema>;\nexport type ResolvedTsplcConfig = z.output<typeof tsplcConfigSchema>;\nexport type HardwareDevice = z.infer<typeof hardwareDeviceSchema>;\nexport type ResolvedTelemetryConfig = z.output<typeof telemetrySchema>;\nexport type ResolvedDebugConfig = z.output<typeof debugSchema>;\nexport type LibraryDependency = z.infer<typeof dependencySchema>;\n/** A binding resolved to its process-image address, as `compilerConfig` receives it. */\ntype DirectIoBinding = z.infer<typeof directIoBindingSchema>;\n\n/**\n * `build` compiles for the production controller. `run` and controller\n * operations target the local runtime, so they compile for the development one.\n */\nexport const buildTargetFor = (command: string): BuildTarget =>\n\t[\"run\", \"download\", \"online-change\", \"inspect\"].includes(command)\n\t\t? \"development\"\n\t\t: \"production\";\nexport const controllerFor = (config: ResolvedTsplcConfig, command: string) => {\n\tconst controller = config.codesys?.controllers?.[buildTargetFor(command)];\n\treturn (\n\t\tcontroller && {\n\t\t\t...controllerDevices[controller.target],\n\t\t\tversion: controller.version,\n\t\t}\n\t);\n};\n\n/**\n * The variable holding the bearer token the PLC sends the project's own server: the HTTP\n * credential for the server's base URL.\n */\nexport const serverTokenEnv = (config: ResolvedTsplcConfig) =>\n\tconfig.codesys?.http?.credentials.find(\n\t\t({ originEnv }) => originEnv === config.server?.baseUrlEnv,\n\t)?.bearerTokenEnv;\n\n/**\n * The project without fieldbus I/O, for a plant simulator that writes inputs over\n * OPC UA: fieldbus input copies would overwrite those writes every scan.\n */\nexport const simulationConfig = (\n\tconfig: ResolvedTsplcConfig,\n): ResolvedTsplcConfig => ({\n\t...config,\n\teds: [],\n\tdevices: {},\n\tio: {},\n\t...(config.codesys && {\n\t\tcodesys: {\n\t\t\t...config.codesys,\n\t\t\tdeviceTree: undefined,\n\t\t},\n\t}),\n});\n\n/** All paths are relative to this file; no package has a second project config. */\nexport function defineConfig<const C extends TsplcConfig>(config: C): C {\n\treturn config;\n}\n\n/** Raw ST program names already are IEC names; use the shared schedule directly. */\nexport function rawBuildConfig(\n\tconfig: ResolvedTsplcConfig,\n): CodesysBuildConfig {\n\tif (config.compiler) {\n\t\tthrow new Error(\"Use the compiler build plan for TypeScript projects.\");\n\t}\n\tif (!config.build) {\n\t\tthrow new Error(\"Configure build settings.\");\n\t}\n\tif (!config.tasks) {\n\t\treturn config.build;\n\t}\n\tif (config.build.tasks || config.build.task !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"Configure the raw ST schedule in tasks or build.tasks/build.task, not both.\",\n\t\t);\n\t}\n\treturn {\n\t\t...config.build,\n\t\ttasks: cyclicTasksSchema.parse(\n\t\t\tconfig.tasks.map((task) => ({\n\t\t\t\tname: task.name,\n\t\t\t\tintervalNanoseconds: task.schedule.interval.nanoseconds,\n\t\t\t\tpriority: task.priority,\n\t\t\t\tprograms: task.programs,\n\t\t\t})),\n\t\t),\n\t};\n}\n\n/** Adapt the shared project to the compiler's backend-independent scan model. */\nexport function compilerConfig(\n\tconfig: ResolvedTsplcConfig,\n\tio: Record<string, DirectIoBinding>,\n\tbuildTarget: BuildTarget = \"production\",\n) {\n\tif (!config.compiler || !config.tasks) {\n\t\tthrow new Error(\n\t\t\t\"This project uses raw Structured Text; no TypeScript compiler is configured.\",\n\t\t);\n\t}\n\t// The device tree and controllers are build-time engineering; the compiler only sees addresses.\n\tconst {\n\t\tdeviceTree: _deviceTree,\n\t\tcontrollers: _controllers,\n\t\t...codesys\n\t} = config.codesys ?? {};\n\tconst value: PlcConfig = {\n\t\tname: config.name,\n\t\ttsconfig: config.compiler.tsconfig,\n\t\tprograms: config.compiler.programs,\n\t\ttasks: config.tasks,\n\t\ttarget: {\n\t\t\tkind: config.backend,\n\t\t\toptions: {\n\t\t\t\t...codesys,\n\t\t\t\tpublish: config.publish,\n\t\t\t\tbuildTarget,\n\t\t\t\tio: Object.fromEntries(\n\t\t\t\t\tObject.entries(io).map(([name, binding]) => [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"direct\",\n\t\t\t\t\t\t\t...binding,\n\t\t\t\t\t\t\t...(mappedChannel(config, name, binding) && { mapped: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tengineering: {\n\t\t\t\t\tkind: \"v3.5\",\n\t\t\t\t\t...(config.build\n\t\t\t\t\t\t? { build: engineeringBuildOptions(config.build) }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n\tconst validated = validateCompilerConfig(value);\n\tif (!validated.config) {\n\t\tthrow new Error(\n\t\t\tvalidated.diagnostics.map((item) => item.message).join(\"\\n\"),\n\t\t);\n\t}\n\treturn validated.config;\n}\n\n/**\n * A generated device tree maps a device's bit or byte scalar to its variable in the\n * I/O mapping. Wider values span several byte channels and keep an AT declaration.\n */\nfunction mappedChannel(\n\tconfig: ResolvedTsplcConfig,\n\tname: string,\n\tbinding: DirectIoBinding,\n) {\n\tconst source = config.io[name];\n\treturn (\n\t\tconfig.codesys?.deviceTree !== undefined &&\n\t\tsource !== undefined &&\n\t\t\"device\" in source &&\n\t\t// A channel maps to one variable as it stands, so these need an AT wire and a copy.\n\t\t!binding.inverted &&\n\t\t!binding.shared &&\n\t\t/^%[IQ][XB]/.test(binding.address) &&\n\t\t!/^ARRAY/i.test(binding.type ?? \"\")\n\t);\n}\n",
|
|
9
|
-
"import { z } from \"zod\";\nimport { nanosecondsPattern } from \"./compiler.ts\";\n\nexport const commandArgumentSchema = z\n\t.string()\n\t.refine(\n\t\t(value) => value.trim().length > 0,\n\t\t\"Command arguments must not be empty\",\n\t)\n\t.refine(\n\t\t(value) => !/[\"\\r\\n\\0]/.test(value),\n\t\t\"Command arguments must not contain quotes, line breaks, or null bytes\",\n\t);\n// CODESYS startup and project loading can each take several minutes.\nexport const codesysTimeouts = {\n\tbuild: 20 * 60 * 1000,\n\thostCommand: 15_000,\n\truntime: 60_000,\n\tstartup: 20 * 60 * 1000,\n\tstop: 10_000,\n\tterminate: 5000,\n\t// A transfer past this is reported, never interrupted.\n\ttransfer: 30 * 60 * 1000,\n};\n\nconst positiveMilliseconds = z.number().int().positive();\nconst pathSchema = z.string().trim().nonempty();\nexport const tcpPort = z.number().int().min(1).max(65535);\n/** A SHA-256 digest as lowercase hex, the form `node:crypto` writes. */\nexport const sha256Digest = z.string().regex(/^[a-f0-9]{64}$/);\n/** The name of an environment variable a credential is read from, so the config never holds it. */\nexport const envName = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst wineSchema = z.strictObject({\n\tprefix: pathSchema,\n\tbinary: pathSchema.default(\"wine\"),\n\tpathBinary: pathSchema.default(\"winepath\"),\n\tdebug: z.string().default(\"-all\"),\n\tnativeExit: z.boolean().default(false),\n});\nexport const localCodesysSchema = z.strictObject({\n\texecutable: commandArgumentSchema,\n\tprofile: commandArgumentSchema,\n\twine: wineSchema.optional(),\n\tcommandProcessor: pathSchema.default(\"cmd.exe\"),\n});\n\n// `tsplc configure` builds this tag; every project compiles with it.\nexport const dockerImage = \"tsplc-build:latest\";\nexport const containerCodesys = {\n\texecutable:\n\t\t\"/tmp/codesys-wine/drive_c/CODESYS-3.5.22.30/CODESYS/Common/CODESYS.exe\",\n\tprofile: \"CODESYS V3.5 SP22 Patch 3\",\n\twine: { prefix: \"/tmp/codesys-wine\", nativeExit: true },\n};\nexport const iecName = z.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/);\nexport const taskPriority = z.number().int().min(0).max(31);\nexport const cyclicTasksSchema = z\n\t.array(\n\t\tz.strictObject({\n\t\t\tname: iecName,\n\t\t\tintervalNanoseconds: z\n\t\t\t\t.string()\n\t\t\t\t.regex(nanosecondsPattern)\n\t\t\t\t.refine((value) => {\n\t\t\t\t\t// zod runs this refinement even when the pattern fails, and BigInt throws on a non-integer.\n\t\t\t\t\tif (!nanosecondsPattern.test(value)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tconst ns = BigInt(value);\n\t\t\t\t\treturn ns % 1_000_000n === 0n && ns <= 4_294_967_295_000_000n;\n\t\t\t\t}, \"Cyclic tasks require an exact positive TIME interval in milliseconds\"),\n\t\t\tpriority: taskPriority,\n\t\t\tprograms: z.array(iecName).nonempty(),\n\t\t}),\n\t)\n\t.nonempty()\n\t.superRefine((tasks, context) => {\n\t\tconst names = new Set<string>();\n\t\tconst programs = new Set<string>();\n\t\ttasks.forEach((task, index) => {\n\t\t\tif (names.has(task.name.toLowerCase())) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index, \"name\"],\n\t\t\t\t\tmessage: \"Task names must be unique\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tnames.add(task.name.toLowerCase());\n\t\t\ttask.programs.forEach((program, position) => {\n\t\t\t\tif (programs.has(program.toLowerCase())) {\n\t\t\t\t\tcontext.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [index, \"programs\", position],\n\t\t\t\t\t\tmessage: \"A program can be scheduled only once\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tprograms.add(program.toLowerCase());\n\t\t\t});\n\t\t});\n\t});\nexport type CyclicTask = z.infer<typeof cyclicTasksSchema>[number];\n/** `inverted` reads a BOOL input as its opposite; `shared` lets several bindings read one input. */\nexport const ioBindingOptions = {\n\tinverted: z.boolean().optional(),\n\tshared: z.boolean().optional(),\n};\n/** A process-image address in CODESYS byte addressing, with an optional IEC type. */\nexport const directIoBindingSchema = z.strictObject({\n\taddress: z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|[BWD]\\d+)$/),\n\ttype: z.string().optional(),\n\t...ioBindingOptions,\n});\n/** The controller's Ethernet interface; omitted settings keep the CODESYS defaults. */\nexport const ethernetSchema = z.strictObject({\n\tinterface: z.string().nonempty().optional(),\n\taddress: z.ipv4().optional(),\n\tsubnet: z.ipv4().optional(),\n\tgateway: z.ipv4().optional(),\n});\n/** The byte where a device's input or output assembly starts in the process image. */\nexport const assemblyAddress = z.string().regex(/^%[IQ]B\\d+$/);\nconst processImageSchema = z.strictObject({\n\taddress: assemblyAddress,\n\tsize: z.number().int().positive(),\n});\n/** A bit or byte channel of a generated device tree. */\nconst channelAddress = z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|B\\d+)$/);\n/**\n * An EtherNet/IP scanner tree generated from EDS files. Each adapter's EDS is\n * already reduced to its selected connection and raw byte assemblies, so every\n * payload byte becomes one channel pinned at its region's address plus offset.\n */\nexport const deviceTreeSchema = z.strictObject({\n\tethernet: ethernetSchema.default({}),\n\tdevices: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tname: iecName,\n\t\t\t\teds: z.string().nonempty(),\n\t\t\t\taddress: z.ipv4().optional(),\n\t\t\t\trpiMicroseconds: z.number().int().positive().optional(),\n\t\t\t\tinputs: processImageSchema.optional(),\n\t\t\t\toutputs: processImageSchema.optional(),\n\t\t\t\t// Registers written over Modbus TCP at the adapter's address, with their pinned channels.\n\t\t\t\tmodbus: z\n\t\t\t\t\t.strictObject({\n\t\t\t\t\t\tport: tcpPort,\n\t\t\t\t\t\tregisters: z.array(\n\t\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\t\tname: iecName,\n\t\t\t\t\t\t\t\toffset: z.number().int().nonnegative(),\n\t\t\t\t\t\t\t\tvalue: z.string().regex(/^%QW\\d+$/),\n\t\t\t\t\t\t\t\twrite: z.string().regex(/^%QX\\d+\\.[0-7]$/),\n\t\t\t\t\t\t\t\tstatus: z.string().regex(/^%IB\\d+$/),\n\t\t\t\t\t\t\t\trequests: z.string().regex(/^%ID\\d+$/),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\t// Channel comments name the logical IO bound at a pinned byte or bit.\n\t\t\t\tcomments: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\taddress: channelAddress,\n\t\t\t\t\t\t\ttext: z.string().nonempty(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\t.default([]),\n\t\t\t}),\n\t\t)\n\t\t.nonempty(),\n\t// Variables mapped to pinned bit or byte channels, relative to the application.\n\tmappings: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\taddress: channelAddress,\n\t\t\t\tvariable: z.string().nonempty(),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type DeviceTree = z.input<typeof deviceTreeSchema>;\n/** A device or library version as CODESYS repositories spell it: four numbers. */\nexport const fourPartVersion = z.string().regex(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/);\n/** A controller's device repository identity, as CODESYS shows it under Device > Information. */\nexport const controllerSchema = z.strictObject({\n\ttype: z.number().int().positive(),\n\tid: z.string().regex(/^[0-9A-F]{4} [0-9A-F]{4}$/),\n\tversion: fourPartVersion,\n});\nexport type Controller = z.infer<typeof controllerSchema>;\n/** A controller the build image carries, named instead of spelled as its repository identity. */\nexport const controllerTargetSchema = controllerSchema\n\t.pick({ version: true })\n\t.extend({\n\t\ttarget: z.enum([\"linux-sl\", \"virtual-linux-arm64-sl\"]),\n\t});\nexport const controllerDevices = {\n\t\"linux-sl\": { type: 4102, id: \"0000 0005\" },\n\t\"virtual-linux-arm64-sl\": { type: 4096, id: \"0000 1008\" },\n} satisfies Record<\n\tz.infer<typeof controllerTargetSchema>[\"target\"],\n\tOmit<Controller, \"version\">\n>;\nexport const configSchema = z.strictObject({\n\tio: z.record(z.string(), directIoBindingSchema).optional(),\n\tdeviceTree: deviceTreeSchema.optional(),\n\t// Replaces the template's controller; the build image must carry its description.\n\tcontroller: controllerSchema.optional(),\n\tlibraryReferences: z.array(z.string().nonempty()).default([]),\n\tlibraries: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\ttitle: z.string(),\n\t\t\t\tcompany: z.string().optional(),\n\t\t\t\tversion: z.string().optional(),\n\t\t\t\tnamespace: z.string().optional(),\n\t\t\t\tpath: pathSchema,\n\t\t\t\tsha256: sha256Digest,\n\t\t\t\turl: z.string().optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n\tdocker: z\n\t\t.strictObject({\n\t\t\tcpuSet: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+(?:-\\d+)?(?:,\\d+(?:-\\d+)?)*$/)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttemplate: pathSchema.optional(),\n\tsourceDir: pathSchema.default(\"src\"),\n\tentry: pathSchema.default(\"src/Main.st\"),\n\toutDir: pathSchema.default(\"build\"),\n\ttask: z.string().nonempty().default(\"MainTask\"),\n\ttasks: cyclicTasksSchema.optional(),\n\tremoveObjects: z.array(z.string().nonempty()).default([]),\n\tsymbols: z.boolean().default(false),\n\t/**\n\t * Experimental: a project imported into the template, as a build without a cached project or a\n\t * download without a baseline does, brings its POUs in one PLCopenXML import instead of one\n\t * call each, and falls back to one at a time on any error. A host setting, like `docker`.\n\t */\n\tbulkImport: z.boolean().optional(),\n\tonline: z\n\t\t.strictObject({\n\t\t\tnetwork: pathSchema.default(\"bridge\"),\n\t\t\tgateway: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(1217),\n\t\t\t}),\n\t\t\tdevice: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(11740),\n\t\t\t}),\n\t\t\tcredentials: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tusernameEnv: envName,\n\t\t\t\t\tpasswordEnv: envName,\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttimeouts: z\n\t\t.strictObject({\n\t\t\tstartup: positiveMilliseconds.default(codesysTimeouts.startup),\n\t\t\tbuild: positiveMilliseconds.default(codesysTimeouts.build),\n\t\t\tstop: positiveMilliseconds.default(codesysTimeouts.stop),\n\t\t\tterminate: positiveMilliseconds.default(codesysTimeouts.terminate),\n\t\t\thostCommand: positiveMilliseconds.default(codesysTimeouts.hostCommand),\n\t\t\truntime: positiveMilliseconds.default(codesysTimeouts.runtime),\n\t\t\t// Unset rather than defaulted, so a release's config still loads on agents that predate them.\n\t\t\t/** A controller operation's work before it touches the controller; `build` when unset. */\n\t\t\tprepare: positiveMilliseconds.optional(),\n\t\t\t/** How long a controller transfer runs before it is reported overdue; it is never interrupted. */\n\t\t\ttransfer: positiveMilliseconds.optional(),\n\t\t})\n\t\t.prefault({}),\n});\nexport type CodesysBuildConfig = z.input<typeof configSchema>;\n\n/**\n * A controller operation's budgets: `prepare` for opening, importing and compiling, after which the\n * worker may be stopped because the controller is untouched; `transfer` for the transfer and what\n * confirms it, after which the operation is only reported overdue, since stopping CODESYS then could\n * leave the controller without an application.\n */\nexport const controllerBudgets = (\n\ttimeouts: z.output<typeof configSchema>[\"timeouts\"],\n) => ({\n\tprepare: timeouts.prepare ?? timeouts.build,\n\ttransfer: timeouts.transfer ?? codesysTimeouts.transfer,\n});\n\n/**\n * The build config a release carries to the plant agent. The agent supplies the output\n * directory and the controller connection; Docker settings belong to the host that built it.\n */\nexport const releaseConfigSchema = configSchema.omit({\n\tdocker: true,\n\toutDir: true,\n\tonline: true,\n\tbulkImport: true,\n});\nexport type ReleaseConfig = z.input<typeof releaseConfigSchema>;\n\n/** The build settings a TypeScript project passes its compiler; the compiler decides the rest. */\nexport const engineeringBuildSchema = configSchema.omit({\n\tsourceDir: true,\n\tentry: true,\n\toutDir: true,\n\ttask: true,\n\ttasks: true,\n});\n\nexport function engineeringBuildOptions(\n\tbuild: CodesysBuildConfig,\n): z.input<typeof engineeringBuildSchema> {\n\tconst {\n\t\tsourceDir: _source,\n\t\tentry: _entry,\n\t\toutDir: _out,\n\t\ttask: _task,\n\t\ttasks: _tasks,\n\t\t...settings\n\t} = build;\n\treturn settings;\n}\n",
|
|
8
|
+
"import { z } from \"zod\";\nimport {\n\tassemblyAddress,\n\ttype CodesysBuildConfig,\n\tconfigSchema,\n\tcontrollerDeviceNames,\n\tcontrollerDevices,\n\tcontrollerTargetSchema,\n\tcyclicTasksSchema,\n\tdirectIoBindingSchema,\n\tengineeringBuildOptions,\n\tenvName,\n\tethernetSchema,\n\tfourPartVersion,\n\tiecName,\n\tioBindingOptions,\n\ttaskPriority,\n\ttcpPort,\n} from \"./build-schema.ts\";\nimport {\n\tdurationSchema,\n\ttype PlcConfig,\n\ttaskSchema,\n\tvalidateConfig as validateCompilerConfig,\n} from \"./compiler.ts\";\nimport { generatedDirectory } from \"./project-files.ts\";\n\nexport type {\n\tCodesysBuildConfig,\n\tController,\n\tDeviceTree,\n} from \"./build-schema.ts\";\nexport {\n\ttype Duration,\n\tdefinePlcConfig,\n\tdurationHelpers,\n\tms,\n\ttype NormalizedConfig,\n\tns,\n\ttype PlcConfig,\n\ttype SourceExport,\n\tseconds,\n\ttype TargetDescriptor,\n\ttype TaskConfig,\n\tvalidateConfig,\n} from \"./compiler.ts\";\n\nexport const httpOptionsSchema = z\n\t.strictObject({\n\t\ttimeoutMs: z.number().int().positive().max(60000).default(2000),\n\t\tcredentials: z\n\t\t\t.array(\n\t\t\t\tz.strictObject({\n\t\t\t\t\toriginEnv: envName,\n\t\t\t\t\tbearerTokenEnv: envName,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.default([]),\n\t})\n\t.prefault({});\nexport type HttpOptions = z.infer<typeof httpOptionsSchema>;\n\nconst ioBindingSchema = z.union([\n\tdirectIoBindingSchema,\n\tz.strictObject({\n\t\tdevice: z.string().min(1),\n\t\tchannel: z.string().min(1),\n\t\t...ioBindingOptions,\n\t}),\n]);\n// Each field defaults: the assembly from the connection, the size from the EDS and,\n// with a generated device tree, the address from tsPLC's process-image layout.\nconst assemblySchema = z.strictObject({\n\tassembly: z.number().int().nonnegative().optional(),\n\tsize: z.number().int().positive().optional(),\n\taddress: assemblyAddress.optional(),\n});\nconst hardwareDeviceSchema = z.strictObject({\n\tfile: z.string().min(1),\n\tconnection: z.string().min(1).optional(),\n\tinputs: assemblySchema.optional(),\n\toutputs: assemblySchema.optional(),\n\t// Registers the generated device tree writes over Modbus TCP, at network.address.\n\t// Each maps a name to its wire offset, and is written with FC06 when its write channel rises.\n\tmodbus: z\n\t\t.strictObject({\n\t\t\tport: tcpPort.default(502),\n\t\t\tregisters: z.record(iecName, z.number().int().min(0).max(65535)),\n\t\t})\n\t\t.optional(),\n\tstatusSymbols: z.record(z.string(), z.string()).optional(),\n\t// The adapter's network identity in a generated device tree.\n\tnetwork: z\n\t\t.strictObject({\n\t\t\taddress: z.ipv4().optional(),\n\t\t\trpi: durationSchema\n\t\t\t\t.refine(\n\t\t\t\t\t(rpi) => BigInt(rpi.nanoseconds) % 1000n === 0n,\n\t\t\t\t\t\"An RPI must be a whole number of microseconds.\",\n\t\t\t\t)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n});\nconst dependencySchema = z.union([\n\tfourPartVersion,\n\tz.strictObject({\n\t\tversion: fourPartVersion,\n\t\tcompany: z.string().optional(),\n\t\tnamespace: z.string().optional(),\n\t}),\n\tz.strictObject({ path: z.string().min(1), namespace: z.string().optional() }),\n]);\n// `backend` is always CODESYS, so tasks get its name and priority rules here, as raw ST schedules do in cyclicTasksSchema.\nconst codesysTaskSchema = taskSchema.extend({\n\tname: iecName,\n\tpriority: taskPriority,\n});\nconst monitorSchema = z\n\t.strictObject({\n\t\tendpoint: z.string().url(),\n\t\tnamespaceUri: z.string().optional(),\n\t\tsymbols: z.array(z.string().min(1)).optional(),\n\t\tsecurityMode: z\n\t\t\t.enum([\"None\", \"Sign\", \"SignAndEncrypt\"])\n\t\t\t.default(\"SignAndEncrypt\"),\n\t\tsecurityPolicy: z.enum([\"None\", \"Basic256Sha256\"]).optional(),\n\t\tcertificateDirectory: z\n\t\t\t.string()\n\t\t\t.min(1)\n\t\t\t.default(`${generatedDirectory}/opcua-pki`),\n\t\tusername: z.string().min(1).optional(),\n\t\tpasswordEnv: envName.optional(),\n\t})\n\t.superRefine((monitor, context) => {\n\t\tif (\n\t\t\tmonitor.securityPolicy &&\n\t\t\t(monitor.securityMode === \"None\") !== (monitor.securityPolicy === \"None\")\n\t\t) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityPolicy\"],\n\t\t\t\tmessage:\n\t\t\t\t\t\"None mode requires None policy; secure modes require Basic256Sha256.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.passwordEnv && !monitor.username) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"username\"],\n\t\t\t\tmessage: \"Configure username when passwordEnv is used.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.username && monitor.securityMode === \"None\") {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityMode\"],\n\t\t\t\tmessage: \"Username authentication requires a secure OPC-UA connection.\",\n\t\t\t});\n\t\t}\n\t})\n\t.transform((monitor) => ({\n\t\t...monitor,\n\t\tsecurityPolicy:\n\t\t\tmonitor.securityPolicy ??\n\t\t\t(monitor.securityMode === \"None\"\n\t\t\t\t? (\"None\" as const)\n\t\t\t\t: (\"Basic256Sha256\" as const)),\n\t}));\n/**\n * The records each PLC task keeps for its sender (docs/language/telemetry.md): used whenever the\n * program calls `@tsplc/compiler/telemetry`, records unhandled job failures or traces for the debugger.\n */\nexport const telemetrySchema = z.strictObject({\n\t/** Records in each task's ring; older unsent records are overwritten and counted as dropped. */\n\tcapacity: z.number().int().min(4).max(4096).default(64),\n\t/**\n\t * The largest encoded JSON of one record, checked for every call when the program compiles.\n\t * It is fixed rather than fitted to the program, so that a ring keeps its layout from one build\n\t * to the next: CODESYS cannot apply an online change that moves a ring.\n\t */\n\trecordBytes: z.number().int().min(128).max(1024).default(512),\n});\n/**\n * The debugger's fixed-size instrumentation (docs/design/debugging.md). It reads state through\n * the engineering login, so it publishes nothing. Without it a build only carries its build id.\n */\nconst debugSchema = z.strictObject({\n\t/** Records enum state changes, decisions and job starts and ends; for local debugging sessions. */\n\ttrace: z\n\t\t.union([\n\t\t\tz.literal(false),\n\t\t\tz.strictObject({\n\t\t\t\tcapacity: z.number().int().min(16).max(4096).default(256),\n\t\t\t\toperands: z.number().int().min(0).max(8).default(4),\n\t\t\t}),\n\t\t])\n\t\t.default(false),\n\twriters: z.boolean().default(true),\n\tjobs: z.boolean().default(true),\n\t/** Watch groups the debugger opens with: TypeScript paths, `*` matching one path segment. */\n\twatch: z.record(z.string(), z.array(z.string().min(1))).default({}),\n\trequests: z\n\t\t.strictObject({\n\t\t\tcapacity: z.number().int().min(1).max(100_000).default(1000),\n\t\t\t/** Keep service call inputs and outputs; off by default because they may carry data that isn't the debugger's to show. */\n\t\t\tbodies: z.boolean().default(false),\n\t\t})\n\t\t.prefault({}),\n});\nexport const typegenSchema = z.strictObject({\n\ttypes: z.union([z.string(), z.array(z.string())]).optional(),\n\tglobals: z.union([z.string(), z.array(z.string())]).optional(),\n\t/** Directory for the generated `plc.ts`, `hardware.ts` and `machines.ts`. */\n\tdir: z.string().default(\"generated\"),\n\t/** Emit TypeScript declarations in `plc.ts`, not just the runtime field and symbol tables. */\n\tdeclarations: z.boolean().default(true),\n\t/** Emit the I/O binding types and device catalog in `hardware.ts`, not just the publication selectors. */\n\tioTypes: z.boolean().default(true),\n});\nexport const buildTargetSchema = z.enum([\"production\", \"development\"]);\nexport type BuildTarget = z.infer<typeof buildTargetSchema>;\nexport const publicationSchema = z.strictObject({\n\tproduction: z.array(z.string().nonempty()),\n\tdevelopment: z.array(z.string().nonempty()),\n});\nexport type Publication = Readonly<Record<BuildTarget, readonly string[]>>;\n/** Each IO binding's name with the published symbol path the compiler gave it. */\nexport const ioSymbolsSchema = z.record(z.string(), z.string());\n/** A published PLC variable, as `Global.Field`. */\nconst hmiTarget = z.string().regex(/^\\w+(\\.\\w+|\\[\\d+\\])+$/);\nconst hmiControlSchema = z.discriminatedUnion(\"kind\", [\n\t/** Pulses a BOOL on for 200 ms, like a pushbutton. */\n\tz.strictObject({\n\t\tkind: z.literal(\"button\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\ttone: z.enum([\"start\", \"stop\"]).optional(),\n\t\t/** Ask before pressing, for controls that start motion. */\n\t\tconfirm: z.boolean().optional(),\n\t}),\n\t/** Switches a BOOL on or off, and shows its current state. */\n\tz.strictObject({\n\t\tkind: z.literal(\"toggle\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t}),\n\t/** Writes an integer when released, and shows its current value. */\n\tz.strictObject({\n\t\tkind: z.literal(\"slider\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\tmin: z.number().int(),\n\t\tmax: z.number().int(),\n\t}),\n]);\nexport const hmiSchema = z.strictObject({\n\ttitle: z.string().nonempty(),\n\tcontrols: z.array(hmiControlSchema).default([]),\n\t/** The PLC reports whether each position of these conveyors is occupied, in this order. */\n\tconveyors: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tlabel: z.string().nonempty(),\n\t\t\t\tpositions: z.number().int().positive(),\n\t\t\t\t/** Positions that are diverters, drawn differently. */\n\t\t\t\tdiverters: z.array(z.number().int().nonnegative()).default([]),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type HmiConfig = z.input<typeof hmiSchema>;\nexport type ResolvedHmiConfig = z.output<typeof hmiSchema>;\n\nexport const tsplcConfigSchema = z.strictObject({\n\tname: z.string().default(\"Application\"),\n\tbackend: z.literal(\"codesys\"),\n\tpublish: publicationSchema.optional(),\n\tserver: z\n\t\t.strictObject({\n\t\t\tbaseUrlEnv: z.string().optional(),\n\t\t\ttransport: z.enum([\"http\", \"opcua\"]).default(\"http\"),\n\t\t\truntime: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tentry: z.string(),\n\t\t\t\t\ttarget: z\n\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\"bun-linux-x64\",\n\t\t\t\t\t\t\t\"bun-linux-arm64\",\n\t\t\t\t\t\t\t\"bun-darwin-x64\",\n\t\t\t\t\t\t\t\"bun-darwin-arm64\",\n\t\t\t\t\t\t\t\"bun-windows-x64\",\n\t\t\t\t\t\t])\n\t\t\t\t\t\t.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\tcompiler: z\n\t\t.strictObject({\n\t\t\ttsconfig: z.string().default(\"tsconfig.json\"),\n\t\t\tprograms: z.record(\n\t\t\t\tz.string(),\n\t\t\t\tz.strictObject({ module: z.string(), export: z.string() }),\n\t\t\t),\n\t\t})\n\t\t.optional(),\n\ttasks: z.array(codesysTaskSchema).nonempty().optional(),\n\t// Keep an authored legacy task distinguishable from resolveConfig's default.\n\t// An explicit shared schedule must have a single owner.\n\tbuild: configSchema\n\t\t.extend({ task: configSchema.shape.task.unwrap().optional() })\n\t\t.optional(),\n\tcodesys: z\n\t\t.strictObject({\n\t\t\thttp: httpOptionsSchema.optional(),\n\t\t\tprogramNames: z.record(z.string(), z.string()).optional(),\n\t\t\t// Generate an EtherNet/IP scanner with one adapter per entry in devices.\n\t\t\tdeviceTree: z\n\t\t\t\t.strictObject({ ethernet: ethernetSchema.optional() })\n\t\t\t\t.optional(),\n\t\t\t// Each omitted controller keeps the template's device. See controllerFor.\n\t\t\tcontrollers: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tproduction: controllerTargetSchema.optional(),\n\t\t\t\t\tdevelopment: controllerTargetSchema.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\teds: z.union([z.string(), z.array(z.string())]).default(\"eds\"),\n\tdevices: z.record(z.string(), hardwareDeviceSchema).default({}),\n\tio: z.record(z.string(), ioBindingSchema).default({}),\n\tdependencies: z.record(z.string(), dependencySchema).default({}),\n\t// Raw ST builds opt into PLC contract generation by configuring this section.\n\ttypegen: typegenSchema.optional(),\n\tmonitor: monitorSchema.optional(),\n\thmi: hmiSchema.optional(),\n\ttelemetry: telemetrySchema.optional(),\n\tdebug: debugSchema.optional(),\n\t/**\n\t * Where the program runs, each with literal values for environment variables, which win over the\n\t * environment, and the plant agent that deploys to it.\n\t */\n\ttargets: z\n\t\t.record(\n\t\t\tz.string().nonempty(),\n\t\t\tz.strictObject({\n\t\t\t\tvalues: z.record(envName, z.string()).default({}),\n\t\t\t\tagent: z.strictObject({ url: z.url() }).optional(),\n\t\t\t}),\n\t\t)\n\t\t.default({}),\n\t/** Variables a release for the plant agent leaves to it, which reads them from Bun.secrets on its own PC. */\n\tsecrets: z\n\t\t.strictObject({\n\t\t\tservice: z.string().nonempty(),\n\t\t\tnames: z.array(envName).nonempty(),\n\t\t})\n\t\t.optional(),\n});\nexport type TsplcConfig = z.input<typeof tsplcConfigSchema>;\nexport type ResolvedTsplcConfig = z.output<typeof tsplcConfigSchema>;\nexport type HardwareDevice = z.infer<typeof hardwareDeviceSchema>;\nexport type ResolvedTelemetryConfig = z.output<typeof telemetrySchema>;\nexport type ResolvedDebugConfig = z.output<typeof debugSchema>;\nexport type LibraryDependency = z.infer<typeof dependencySchema>;\n/** A binding resolved to its process-image address, as `compilerConfig` receives it. */\ntype DirectIoBinding = z.infer<typeof directIoBindingSchema>;\n\n/**\n * `build` compiles for the production controller. `run` and controller\n * operations target the local runtime, so they compile for the development one.\n */\nexport const buildTargetFor = (command: string): BuildTarget =>\n\t[\"run\", \"download\", \"online-change\", \"inspect\"].includes(command)\n\t\t? \"development\"\n\t\t: \"production\";\nexport const controllerFor = (config: ResolvedTsplcConfig, command: string) => {\n\tconst controller = config.codesys?.controllers?.[buildTargetFor(command)];\n\treturn (\n\t\tcontroller && {\n\t\t\t...controllerDevices[controller.target],\n\t\t\tversion: controller.version,\n\t\t}\n\t);\n};\n\n/** The name of the device `command` runs on: the configured controller, else Linux SL, the local runtime `run` deploys to. */\nexport const controllerDeviceName = (\n\tconfig: ResolvedTsplcConfig,\n\tcommand: string,\n) =>\n\tcontrollerDeviceNames[\n\t\tconfig.codesys?.controllers?.[buildTargetFor(command)]?.target ?? \"linux-sl\"\n\t];\n\n/**\n * The variable holding the bearer token the PLC sends the project's own server: the HTTP\n * credential for the server's base URL.\n */\nexport const serverTokenEnv = (config: ResolvedTsplcConfig) =>\n\tconfig.codesys?.http?.credentials.find(\n\t\t({ originEnv }) => originEnv === config.server?.baseUrlEnv,\n\t)?.bearerTokenEnv;\n\n/**\n * The project without fieldbus I/O, for a plant simulator that writes inputs over\n * OPC UA: fieldbus input copies would overwrite those writes every scan.\n */\nexport const simulationConfig = (\n\tconfig: ResolvedTsplcConfig,\n): ResolvedTsplcConfig => ({\n\t...config,\n\teds: [],\n\tdevices: {},\n\tio: {},\n\t...(config.codesys && {\n\t\tcodesys: {\n\t\t\t...config.codesys,\n\t\t\tdeviceTree: undefined,\n\t\t},\n\t}),\n});\n\n/** All paths are relative to this file; no package has a second project config. */\nexport function defineConfig<const C extends TsplcConfig>(config: C): C {\n\treturn config;\n}\n\n/** Raw ST program names already are IEC names; use the shared schedule directly. */\nexport function rawBuildConfig(\n\tconfig: ResolvedTsplcConfig,\n): CodesysBuildConfig {\n\tif (config.compiler) {\n\t\tthrow new Error(\"Use the compiler build plan for TypeScript projects.\");\n\t}\n\tif (!config.build) {\n\t\tthrow new Error(\"Configure build settings.\");\n\t}\n\tif (!config.tasks) {\n\t\treturn config.build;\n\t}\n\tif (config.build.tasks || config.build.task !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"Configure the raw ST schedule in tasks or build.tasks/build.task, not both.\",\n\t\t);\n\t}\n\treturn {\n\t\t...config.build,\n\t\ttasks: cyclicTasksSchema.parse(\n\t\t\tconfig.tasks.map((task) => ({\n\t\t\t\tname: task.name,\n\t\t\t\tintervalNanoseconds: task.schedule.interval.nanoseconds,\n\t\t\t\tpriority: task.priority,\n\t\t\t\tprograms: task.programs,\n\t\t\t})),\n\t\t),\n\t};\n}\n\n/** Adapt the shared project to the compiler's backend-independent scan model. */\nexport function compilerConfig(\n\tconfig: ResolvedTsplcConfig,\n\tio: Record<string, DirectIoBinding>,\n\tbuildTarget: BuildTarget = \"production\",\n) {\n\tif (!config.compiler || !config.tasks) {\n\t\tthrow new Error(\n\t\t\t\"This project uses raw Structured Text; no TypeScript compiler is configured.\",\n\t\t);\n\t}\n\t// The device tree and controllers are build-time engineering; the compiler only sees addresses.\n\tconst {\n\t\tdeviceTree: _deviceTree,\n\t\tcontrollers: _controllers,\n\t\t...codesys\n\t} = config.codesys ?? {};\n\tconst value: PlcConfig = {\n\t\tname: config.name,\n\t\ttsconfig: config.compiler.tsconfig,\n\t\tprograms: config.compiler.programs,\n\t\ttasks: config.tasks,\n\t\ttarget: {\n\t\t\tkind: config.backend,\n\t\t\toptions: {\n\t\t\t\t...codesys,\n\t\t\t\tpublish: config.publish,\n\t\t\t\tbuildTarget,\n\t\t\t\tio: Object.fromEntries(\n\t\t\t\t\tObject.entries(io).map(([name, binding]) => [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"direct\",\n\t\t\t\t\t\t\t...binding,\n\t\t\t\t\t\t\t...(mappedChannel(config, name, binding) && { mapped: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tengineering: {\n\t\t\t\t\tkind: \"v3.5\",\n\t\t\t\t\t...(config.build\n\t\t\t\t\t\t? { build: engineeringBuildOptions(config.build) }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n\tconst validated = validateCompilerConfig(value);\n\tif (!validated.config) {\n\t\tthrow new Error(\n\t\t\tvalidated.diagnostics.map((item) => item.message).join(\"\\n\"),\n\t\t);\n\t}\n\treturn validated.config;\n}\n\n/**\n * A generated device tree maps a device's bit or byte scalar to its variable in the\n * I/O mapping. Wider values span several byte channels and keep an AT declaration.\n */\nfunction mappedChannel(\n\tconfig: ResolvedTsplcConfig,\n\tname: string,\n\tbinding: DirectIoBinding,\n) {\n\tconst source = config.io[name];\n\treturn (\n\t\tconfig.codesys?.deviceTree !== undefined &&\n\t\tsource !== undefined &&\n\t\t\"device\" in source &&\n\t\t// A channel maps to one variable as it stands, so these need an AT wire and a copy.\n\t\t!binding.inverted &&\n\t\t!binding.shared &&\n\t\t/^%[IQ][XB]/.test(binding.address) &&\n\t\t!/^ARRAY/i.test(binding.type ?? \"\")\n\t);\n}\n",
|
|
9
|
+
"import { z } from \"zod\";\nimport { nanosecondsPattern } from \"./compiler.ts\";\n\nexport const commandArgumentSchema = z\n\t.string()\n\t.refine(\n\t\t(value) => value.trim().length > 0,\n\t\t\"Command arguments must not be empty\",\n\t)\n\t.refine(\n\t\t(value) => !/[\"\\r\\n\\0]/.test(value),\n\t\t\"Command arguments must not contain quotes, line breaks, or null bytes\",\n\t);\n// CODESYS startup and project loading can each take several minutes.\nexport const codesysTimeouts = {\n\tbuild: 20 * 60 * 1000,\n\thostCommand: 15_000,\n\truntime: 60_000,\n\tstartup: 20 * 60 * 1000,\n\tstop: 10_000,\n\tterminate: 5000,\n\t// A transfer past this is reported, never interrupted.\n\ttransfer: 30 * 60 * 1000,\n};\n\nconst positiveMilliseconds = z.number().int().positive();\nconst pathSchema = z.string().trim().nonempty();\nexport const tcpPort = z.number().int().min(1).max(65535);\n/** A SHA-256 digest as lowercase hex, the form `node:crypto` writes. */\nexport const sha256Digest = z.string().regex(/^[a-f0-9]{64}$/);\n/** The name of an environment variable a credential is read from, so the config never holds it. */\nexport const envName = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst wineSchema = z.strictObject({\n\tprefix: pathSchema,\n\tbinary: pathSchema.default(\"wine\"),\n\tpathBinary: pathSchema.default(\"winepath\"),\n\tdebug: z.string().default(\"-all\"),\n\tnativeExit: z.boolean().default(false),\n});\nexport const localCodesysSchema = z.strictObject({\n\texecutable: commandArgumentSchema,\n\tprofile: commandArgumentSchema,\n\twine: wineSchema.optional(),\n\tcommandProcessor: pathSchema.default(\"cmd.exe\"),\n});\n\n// `tsplc configure` builds this tag; every project compiles with it.\nexport const dockerImage = \"tsplc-build:latest\";\nexport const containerCodesys = {\n\texecutable:\n\t\t\"/tmp/codesys-wine/drive_c/CODESYS-3.5.22.30/CODESYS/Common/CODESYS.exe\",\n\tprofile: \"CODESYS V3.5 SP22 Patch 3\",\n\twine: { prefix: \"/tmp/codesys-wine\", nativeExit: true },\n};\nexport const iecName = z.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/);\nexport const taskPriority = z.number().int().min(0).max(31);\nexport const cyclicTasksSchema = z\n\t.array(\n\t\tz.strictObject({\n\t\t\tname: iecName,\n\t\t\tintervalNanoseconds: z\n\t\t\t\t.string()\n\t\t\t\t.regex(nanosecondsPattern)\n\t\t\t\t.refine((value) => {\n\t\t\t\t\t// zod runs this refinement even when the pattern fails, and BigInt throws on a non-integer.\n\t\t\t\t\tif (!nanosecondsPattern.test(value)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tconst ns = BigInt(value);\n\t\t\t\t\treturn ns % 1_000_000n === 0n && ns <= 4_294_967_295_000_000n;\n\t\t\t\t}, \"Cyclic tasks require an exact positive TIME interval in milliseconds\"),\n\t\t\tpriority: taskPriority,\n\t\t\tprograms: z.array(iecName).nonempty(),\n\t\t}),\n\t)\n\t.nonempty()\n\t.superRefine((tasks, context) => {\n\t\tconst names = new Set<string>();\n\t\tconst programs = new Set<string>();\n\t\ttasks.forEach((task, index) => {\n\t\t\tif (names.has(task.name.toLowerCase())) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index, \"name\"],\n\t\t\t\t\tmessage: \"Task names must be unique\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tnames.add(task.name.toLowerCase());\n\t\t\ttask.programs.forEach((program, position) => {\n\t\t\t\tif (programs.has(program.toLowerCase())) {\n\t\t\t\t\tcontext.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [index, \"programs\", position],\n\t\t\t\t\t\tmessage: \"A program can be scheduled only once\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tprograms.add(program.toLowerCase());\n\t\t\t});\n\t\t});\n\t});\nexport type CyclicTask = z.infer<typeof cyclicTasksSchema>[number];\n/** `inverted` reads a BOOL input as its opposite; `shared` lets several bindings read one input. */\nexport const ioBindingOptions = {\n\tinverted: z.boolean().optional(),\n\tshared: z.boolean().optional(),\n};\n/** A process-image address in CODESYS byte addressing, with an optional IEC type. */\nexport const directIoBindingSchema = z.strictObject({\n\taddress: z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|[BWD]\\d+)$/),\n\ttype: z.string().optional(),\n\t...ioBindingOptions,\n});\n/** The controller's Ethernet interface; omitted settings keep the CODESYS defaults. */\nexport const ethernetSchema = z.strictObject({\n\tinterface: z.string().nonempty().optional(),\n\taddress: z.ipv4().optional(),\n\tsubnet: z.ipv4().optional(),\n\tgateway: z.ipv4().optional(),\n});\n/** The byte where a device's input or output assembly starts in the process image. */\nexport const assemblyAddress = z.string().regex(/^%[IQ]B\\d+$/);\nconst processImageSchema = z.strictObject({\n\taddress: assemblyAddress,\n\tsize: z.number().int().positive(),\n});\n/** A bit or byte channel of a generated device tree. */\nconst channelAddress = z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|B\\d+)$/);\n/**\n * An EtherNet/IP scanner tree generated from EDS files. Each adapter's EDS is\n * already reduced to its selected connection and raw byte assemblies, so every\n * payload byte becomes one channel pinned at its region's address plus offset.\n */\nexport const deviceTreeSchema = z.strictObject({\n\tethernet: ethernetSchema.default({}),\n\tdevices: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tname: iecName,\n\t\t\t\teds: z.string().nonempty(),\n\t\t\t\taddress: z.ipv4().optional(),\n\t\t\t\trpiMicroseconds: z.number().int().positive().optional(),\n\t\t\t\tinputs: processImageSchema.optional(),\n\t\t\t\toutputs: processImageSchema.optional(),\n\t\t\t\t// Registers written over Modbus TCP at the adapter's address, with their pinned channels.\n\t\t\t\tmodbus: z\n\t\t\t\t\t.strictObject({\n\t\t\t\t\t\tport: tcpPort,\n\t\t\t\t\t\tregisters: z.array(\n\t\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\t\tname: iecName,\n\t\t\t\t\t\t\t\toffset: z.number().int().nonnegative(),\n\t\t\t\t\t\t\t\tvalue: z.string().regex(/^%QW\\d+$/),\n\t\t\t\t\t\t\t\twrite: z.string().regex(/^%QX\\d+\\.[0-7]$/),\n\t\t\t\t\t\t\t\tstatus: z.string().regex(/^%IB\\d+$/),\n\t\t\t\t\t\t\t\trequests: z.string().regex(/^%ID\\d+$/),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\t// Channel comments name the logical IO bound at a pinned byte or bit.\n\t\t\t\tcomments: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\taddress: channelAddress,\n\t\t\t\t\t\t\ttext: z.string().nonempty(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\t.default([]),\n\t\t\t}),\n\t\t)\n\t\t.nonempty(),\n\t// Variables mapped to pinned bit or byte channels, relative to the application.\n\tmappings: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\taddress: channelAddress,\n\t\t\t\tvariable: z.string().nonempty(),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type DeviceTree = z.input<typeof deviceTreeSchema>;\n/** A device or library version as CODESYS repositories spell it: four numbers. */\nexport const fourPartVersion = z.string().regex(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/);\n/** A controller's device repository identity, as CODESYS shows it under Device > Information. */\nexport const controllerSchema = z.strictObject({\n\ttype: z.number().int().positive(),\n\tid: z.string().regex(/^[0-9A-F]{4} [0-9A-F]{4}$/),\n\tversion: fourPartVersion,\n});\nexport type Controller = z.infer<typeof controllerSchema>;\n/** A controller the build image carries, named instead of spelled as its repository identity. */\nexport const controllerTargetSchema = controllerSchema\n\t.pick({ version: true })\n\t.extend({\n\t\ttarget: z.enum([\"linux-sl\", \"virtual-linux-arm64-sl\"]),\n\t});\nexport const controllerDevices = {\n\t\"linux-sl\": { type: 4102, id: \"0000 0005\" },\n\t\"virtual-linux-arm64-sl\": { type: 4096, id: \"0000 1008\" },\n} satisfies Record<\n\tz.infer<typeof controllerTargetSchema>[\"target\"],\n\tOmit<Controller, \"version\">\n>;\n/** The device name each controller target's runtime reports, as its OPC UA node ids spell it. */\nexport const controllerDeviceNames = {\n\t\"linux-sl\": \"CODESYS Control for Linux SL\",\n\t\"virtual-linux-arm64-sl\": \"CODESYS Virtual Control for Linux ARM64 SL\",\n} satisfies Record<z.infer<typeof controllerTargetSchema>[\"target\"], string>;\nexport const configSchema = z.strictObject({\n\tio: z.record(z.string(), directIoBindingSchema).optional(),\n\tdeviceTree: deviceTreeSchema.optional(),\n\t// Replaces the template's controller; the build image must carry its description.\n\tcontroller: controllerSchema.optional(),\n\tlibraryReferences: z.array(z.string().nonempty()).default([]),\n\tlibraries: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\ttitle: z.string(),\n\t\t\t\tcompany: z.string().optional(),\n\t\t\t\tversion: z.string().optional(),\n\t\t\t\tnamespace: z.string().optional(),\n\t\t\t\tpath: pathSchema,\n\t\t\t\tsha256: sha256Digest,\n\t\t\t\turl: z.string().optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n\tdocker: z\n\t\t.strictObject({\n\t\t\tcpuSet: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+(?:-\\d+)?(?:,\\d+(?:-\\d+)?)*$/)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttemplate: pathSchema.optional(),\n\tsourceDir: pathSchema.default(\"src\"),\n\tentry: pathSchema.default(\"src/Main.st\"),\n\toutDir: pathSchema.default(\"build\"),\n\ttask: z.string().nonempty().default(\"MainTask\"),\n\ttasks: cyclicTasksSchema.optional(),\n\tremoveObjects: z.array(z.string().nonempty()).default([]),\n\tsymbols: z.boolean().default(false),\n\t/**\n\t * Experimental: a project imported into the template, as a build without a cached project or a\n\t * download without a baseline does, brings its POUs in one PLCopenXML import instead of one\n\t * call each, and falls back to one at a time on any error. A host setting, like `docker`.\n\t */\n\tbulkImport: z.boolean().optional(),\n\tonline: z\n\t\t.strictObject({\n\t\t\tnetwork: pathSchema.default(\"bridge\"),\n\t\t\tgateway: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(1217),\n\t\t\t}),\n\t\t\tdevice: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(11740),\n\t\t\t}),\n\t\t\tcredentials: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tusernameEnv: envName,\n\t\t\t\t\tpasswordEnv: envName,\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttimeouts: z\n\t\t.strictObject({\n\t\t\tstartup: positiveMilliseconds.default(codesysTimeouts.startup),\n\t\t\tbuild: positiveMilliseconds.default(codesysTimeouts.build),\n\t\t\tstop: positiveMilliseconds.default(codesysTimeouts.stop),\n\t\t\tterminate: positiveMilliseconds.default(codesysTimeouts.terminate),\n\t\t\thostCommand: positiveMilliseconds.default(codesysTimeouts.hostCommand),\n\t\t\truntime: positiveMilliseconds.default(codesysTimeouts.runtime),\n\t\t\t// Unset rather than defaulted, so a release's config still loads on agents that predate them.\n\t\t\t/** A controller operation's work before it touches the controller; `build` when unset. */\n\t\t\tprepare: positiveMilliseconds.optional(),\n\t\t\t/** How long a controller transfer runs before it is reported overdue; it is never interrupted. */\n\t\t\ttransfer: positiveMilliseconds.optional(),\n\t\t})\n\t\t.prefault({}),\n});\nexport type CodesysBuildConfig = z.input<typeof configSchema>;\n\n/**\n * A controller operation's budgets: `prepare` for opening, importing and compiling, after which the\n * worker may be stopped because the controller is untouched; `transfer` for the transfer and what\n * confirms it, after which the operation is only reported overdue, since stopping CODESYS then could\n * leave the controller without an application.\n */\nexport const controllerBudgets = (\n\ttimeouts: z.output<typeof configSchema>[\"timeouts\"],\n) => ({\n\tprepare: timeouts.prepare ?? timeouts.build,\n\ttransfer: timeouts.transfer ?? codesysTimeouts.transfer,\n});\n\n/**\n * The build config a release carries to the plant agent. The agent supplies the output\n * directory and the controller connection; Docker settings belong to the host that built it.\n */\nexport const releaseConfigSchema = configSchema.omit({\n\tdocker: true,\n\toutDir: true,\n\tonline: true,\n\tbulkImport: true,\n});\nexport type ReleaseConfig = z.input<typeof releaseConfigSchema>;\n\n/** The build settings a TypeScript project passes its compiler; the compiler decides the rest. */\nexport const engineeringBuildSchema = configSchema.omit({\n\tsourceDir: true,\n\tentry: true,\n\toutDir: true,\n\ttask: true,\n\ttasks: true,\n});\n\nexport function engineeringBuildOptions(\n\tbuild: CodesysBuildConfig,\n): z.input<typeof engineeringBuildSchema> {\n\tconst {\n\t\tsourceDir: _source,\n\t\tentry: _entry,\n\t\toutDir: _out,\n\t\ttask: _task,\n\t\ttasks: _tasks,\n\t\t...settings\n\t} = build;\n\treturn settings;\n}\n",
|
|
10
10
|
"/** Generated project state, relative to the directory that holds a project's config. */\nexport const generatedDirectory = \".tsplc\";\n\n/** The ST the compiler emits, with the files it publishes beside it for typegen and the debugger. */\nexport const emittedStDirectory = `${generatedDirectory}/artifacts/st`;\n\n/** The files the compiler writes into `emittedStDirectory` for other tools to read. */\nexport const emittedFiles = {\n\tioSymbols: \"io-symbols.json\",\n\tpublication: \"publication.json\",\n\tmachines: \"machines.ts\",\n} as const;\n\n/** Typegen's materialized config and symbols, which the editor reads instead of executing the config. */\nexport const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 -249,6 +249,10 @@ var controllerDevices = {
|
|
|
249
249
|
"linux-sl": { type: 4102, id: "0000 0005" },
|
|
250
250
|
"virtual-linux-arm64-sl": { type: 4096, id: "0000 1008" }
|
|
251
251
|
};
|
|
252
|
+
var controllerDeviceNames = {
|
|
253
|
+
"linux-sl": "CODESYS Control for Linux SL",
|
|
254
|
+
"virtual-linux-arm64-sl": "CODESYS Virtual Control for Linux ARM64 SL"
|
|
255
|
+
};
|
|
252
256
|
var configSchema = z2.strictObject({
|
|
253
257
|
io: z2.record(z2.string(), directIoBindingSchema).optional(),
|
|
254
258
|
deviceTree: deviceTreeSchema.optional(),
|
|
@@ -538,6 +542,7 @@ var controllerFor = (config, command) => {
|
|
|
538
542
|
version: controller.version
|
|
539
543
|
};
|
|
540
544
|
};
|
|
545
|
+
var controllerDeviceName = (config, command) => controllerDeviceNames[config.codesys?.controllers?.[buildTargetFor(command)]?.target ?? "linux-sl"];
|
|
541
546
|
var serverTokenEnv = (config) => config.codesys?.http?.credentials.find(({ originEnv }) => originEnv === config.server?.baseUrlEnv)?.bearerTokenEnv;
|
|
542
547
|
var simulationConfig = (config) => ({
|
|
543
548
|
...config,
|
|
@@ -627,6 +632,7 @@ export {
|
|
|
627
632
|
buildTargetFor,
|
|
628
633
|
buildTargetSchema,
|
|
629
634
|
compilerConfig,
|
|
635
|
+
controllerDeviceName,
|
|
630
636
|
controllerFor,
|
|
631
637
|
defineConfig,
|
|
632
638
|
definePlcConfig,
|
|
@@ -647,5 +653,5 @@ export {
|
|
|
647
653
|
validateConfig
|
|
648
654
|
};
|
|
649
655
|
|
|
650
|
-
//# debugId=
|
|
656
|
+
//# debugId=2D91383D4EF3BB6E64756E2164756E21
|
|
651
657
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/schema.ts", "../src/build-schema.ts", "../src/compiler.ts", "../src/project-files.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod\";\nimport {\n\tassemblyAddress,\n\ttype CodesysBuildConfig,\n\tconfigSchema,\n\tcontrollerDevices,\n\tcontrollerTargetSchema,\n\tcyclicTasksSchema,\n\tdirectIoBindingSchema,\n\tengineeringBuildOptions,\n\tenvName,\n\tethernetSchema,\n\tfourPartVersion,\n\tiecName,\n\tioBindingOptions,\n\ttaskPriority,\n\ttcpPort,\n} from \"./build-schema.ts\";\nimport {\n\tdurationSchema,\n\ttype PlcConfig,\n\ttaskSchema,\n\tvalidateConfig as validateCompilerConfig,\n} from \"./compiler.ts\";\nimport { generatedDirectory } from \"./project-files.ts\";\n\nexport type {\n\tCodesysBuildConfig,\n\tController,\n\tDeviceTree,\n} from \"./build-schema.ts\";\nexport {\n\ttype Duration,\n\tdefinePlcConfig,\n\tdurationHelpers,\n\tms,\n\ttype NormalizedConfig,\n\tns,\n\ttype PlcConfig,\n\ttype SourceExport,\n\tseconds,\n\ttype TargetDescriptor,\n\ttype TaskConfig,\n\tvalidateConfig,\n} from \"./compiler.ts\";\n\nexport const httpOptionsSchema = z\n\t.strictObject({\n\t\ttimeoutMs: z.number().int().positive().max(60000).default(2000),\n\t\tcredentials: z\n\t\t\t.array(\n\t\t\t\tz.strictObject({\n\t\t\t\t\toriginEnv: envName,\n\t\t\t\t\tbearerTokenEnv: envName,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.default([]),\n\t})\n\t.prefault({});\nexport type HttpOptions = z.infer<typeof httpOptionsSchema>;\n\nconst ioBindingSchema = z.union([\n\tdirectIoBindingSchema,\n\tz.strictObject({\n\t\tdevice: z.string().min(1),\n\t\tchannel: z.string().min(1),\n\t\t...ioBindingOptions,\n\t}),\n]);\n// Each field defaults: the assembly from the connection, the size from the EDS and,\n// with a generated device tree, the address from tsPLC's process-image layout.\nconst assemblySchema = z.strictObject({\n\tassembly: z.number().int().nonnegative().optional(),\n\tsize: z.number().int().positive().optional(),\n\taddress: assemblyAddress.optional(),\n});\nconst hardwareDeviceSchema = z.strictObject({\n\tfile: z.string().min(1),\n\tconnection: z.string().min(1).optional(),\n\tinputs: assemblySchema.optional(),\n\toutputs: assemblySchema.optional(),\n\t// Registers the generated device tree writes over Modbus TCP, at network.address.\n\t// Each maps a name to its wire offset, and is written with FC06 when its write channel rises.\n\tmodbus: z\n\t\t.strictObject({\n\t\t\tport: tcpPort.default(502),\n\t\t\tregisters: z.record(iecName, z.number().int().min(0).max(65535)),\n\t\t})\n\t\t.optional(),\n\tstatusSymbols: z.record(z.string(), z.string()).optional(),\n\t// The adapter's network identity in a generated device tree.\n\tnetwork: z\n\t\t.strictObject({\n\t\t\taddress: z.ipv4().optional(),\n\t\t\trpi: durationSchema\n\t\t\t\t.refine(\n\t\t\t\t\t(rpi) => BigInt(rpi.nanoseconds) % 1000n === 0n,\n\t\t\t\t\t\"An RPI must be a whole number of microseconds.\",\n\t\t\t\t)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n});\nconst dependencySchema = z.union([\n\tfourPartVersion,\n\tz.strictObject({\n\t\tversion: fourPartVersion,\n\t\tcompany: z.string().optional(),\n\t\tnamespace: z.string().optional(),\n\t}),\n\tz.strictObject({ path: z.string().min(1), namespace: z.string().optional() }),\n]);\n// `backend` is always CODESYS, so tasks get its name and priority rules here, as raw ST schedules do in cyclicTasksSchema.\nconst codesysTaskSchema = taskSchema.extend({\n\tname: iecName,\n\tpriority: taskPriority,\n});\nconst monitorSchema = z\n\t.strictObject({\n\t\tendpoint: z.string().url(),\n\t\tnamespaceUri: z.string().optional(),\n\t\tsymbols: z.array(z.string().min(1)).optional(),\n\t\tsecurityMode: z\n\t\t\t.enum([\"None\", \"Sign\", \"SignAndEncrypt\"])\n\t\t\t.default(\"SignAndEncrypt\"),\n\t\tsecurityPolicy: z.enum([\"None\", \"Basic256Sha256\"]).optional(),\n\t\tcertificateDirectory: z\n\t\t\t.string()\n\t\t\t.min(1)\n\t\t\t.default(`${generatedDirectory}/opcua-pki`),\n\t\tusername: z.string().min(1).optional(),\n\t\tpasswordEnv: envName.optional(),\n\t})\n\t.superRefine((monitor, context) => {\n\t\tif (\n\t\t\tmonitor.securityPolicy &&\n\t\t\t(monitor.securityMode === \"None\") !== (monitor.securityPolicy === \"None\")\n\t\t) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityPolicy\"],\n\t\t\t\tmessage:\n\t\t\t\t\t\"None mode requires None policy; secure modes require Basic256Sha256.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.passwordEnv && !monitor.username) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"username\"],\n\t\t\t\tmessage: \"Configure username when passwordEnv is used.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.username && monitor.securityMode === \"None\") {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityMode\"],\n\t\t\t\tmessage: \"Username authentication requires a secure OPC-UA connection.\",\n\t\t\t});\n\t\t}\n\t})\n\t.transform((monitor) => ({\n\t\t...monitor,\n\t\tsecurityPolicy:\n\t\t\tmonitor.securityPolicy ??\n\t\t\t(monitor.securityMode === \"None\"\n\t\t\t\t? (\"None\" as const)\n\t\t\t\t: (\"Basic256Sha256\" as const)),\n\t}));\n/**\n * The records each PLC task keeps for its sender (docs/language/telemetry.md): used whenever the\n * program calls `@tsplc/compiler/telemetry`, records unhandled job failures or traces for the debugger.\n */\nexport const telemetrySchema = z.strictObject({\n\t/** Records in each task's ring; older unsent records are overwritten and counted as dropped. */\n\tcapacity: z.number().int().min(4).max(4096).default(64),\n\t/**\n\t * The largest encoded JSON of one record, checked for every call when the program compiles.\n\t * It is fixed rather than fitted to the program, so that a ring keeps its layout from one build\n\t * to the next: CODESYS cannot apply an online change that moves a ring.\n\t */\n\trecordBytes: z.number().int().min(128).max(1024).default(512),\n});\n/**\n * The debugger's fixed-size instrumentation (docs/design/debugging.md). It reads state through\n * the engineering login, so it publishes nothing. Without it a build only carries its build id.\n */\nconst debugSchema = z.strictObject({\n\t/** Records enum state changes, decisions and job starts and ends; for local debugging sessions. */\n\ttrace: z\n\t\t.union([\n\t\t\tz.literal(false),\n\t\t\tz.strictObject({\n\t\t\t\tcapacity: z.number().int().min(16).max(4096).default(256),\n\t\t\t\toperands: z.number().int().min(0).max(8).default(4),\n\t\t\t}),\n\t\t])\n\t\t.default(false),\n\twriters: z.boolean().default(true),\n\tjobs: z.boolean().default(true),\n\t/** Watch groups the debugger opens with: TypeScript paths, `*` matching one path segment. */\n\twatch: z.record(z.string(), z.array(z.string().min(1))).default({}),\n\trequests: z\n\t\t.strictObject({\n\t\t\tcapacity: z.number().int().min(1).max(100_000).default(1000),\n\t\t\t/** Keep service call inputs and outputs; off by default because they may carry data that isn't the debugger's to show. */\n\t\t\tbodies: z.boolean().default(false),\n\t\t})\n\t\t.prefault({}),\n});\nexport const typegenSchema = z.strictObject({\n\ttypes: z.union([z.string(), z.array(z.string())]).optional(),\n\tglobals: z.union([z.string(), z.array(z.string())]).optional(),\n\t/** Directory for the generated `plc.ts`, `hardware.ts` and `machines.ts`. */\n\tdir: z.string().default(\"generated\"),\n\t/** Emit TypeScript declarations in `plc.ts`, not just the runtime field and symbol tables. */\n\tdeclarations: z.boolean().default(true),\n\t/** Emit the I/O binding types and device catalog in `hardware.ts`, not just the publication selectors. */\n\tioTypes: z.boolean().default(true),\n});\nexport const buildTargetSchema = z.enum([\"production\", \"development\"]);\nexport type BuildTarget = z.infer<typeof buildTargetSchema>;\nexport const publicationSchema = z.strictObject({\n\tproduction: z.array(z.string().nonempty()),\n\tdevelopment: z.array(z.string().nonempty()),\n});\nexport type Publication = Readonly<Record<BuildTarget, readonly string[]>>;\n/** Each IO binding's name with the published symbol path the compiler gave it. */\nexport const ioSymbolsSchema = z.record(z.string(), z.string());\n/** A published PLC variable, as `Global.Field`. */\nconst hmiTarget = z.string().regex(/^\\w+(\\.\\w+|\\[\\d+\\])+$/);\nconst hmiControlSchema = z.discriminatedUnion(\"kind\", [\n\t/** Pulses a BOOL on for 200 ms, like a pushbutton. */\n\tz.strictObject({\n\t\tkind: z.literal(\"button\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\ttone: z.enum([\"start\", \"stop\"]).optional(),\n\t\t/** Ask before pressing, for controls that start motion. */\n\t\tconfirm: z.boolean().optional(),\n\t}),\n\t/** Switches a BOOL on or off, and shows its current state. */\n\tz.strictObject({\n\t\tkind: z.literal(\"toggle\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t}),\n\t/** Writes an integer when released, and shows its current value. */\n\tz.strictObject({\n\t\tkind: z.literal(\"slider\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\tmin: z.number().int(),\n\t\tmax: z.number().int(),\n\t}),\n]);\nexport const hmiSchema = z.strictObject({\n\ttitle: z.string().nonempty(),\n\tcontrols: z.array(hmiControlSchema).default([]),\n\t/** The PLC reports whether each position of these conveyors is occupied, in this order. */\n\tconveyors: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tlabel: z.string().nonempty(),\n\t\t\t\tpositions: z.number().int().positive(),\n\t\t\t\t/** Positions that are diverters, drawn differently. */\n\t\t\t\tdiverters: z.array(z.number().int().nonnegative()).default([]),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type HmiConfig = z.input<typeof hmiSchema>;\nexport type ResolvedHmiConfig = z.output<typeof hmiSchema>;\n\nexport const tsplcConfigSchema = z.strictObject({\n\tname: z.string().default(\"Application\"),\n\tbackend: z.literal(\"codesys\"),\n\tpublish: publicationSchema.optional(),\n\tserver: z\n\t\t.strictObject({\n\t\t\tbaseUrlEnv: z.string().optional(),\n\t\t\ttransport: z.enum([\"http\", \"opcua\"]).default(\"http\"),\n\t\t\truntime: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tentry: z.string(),\n\t\t\t\t\ttarget: z\n\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\"bun-linux-x64\",\n\t\t\t\t\t\t\t\"bun-linux-arm64\",\n\t\t\t\t\t\t\t\"bun-darwin-x64\",\n\t\t\t\t\t\t\t\"bun-darwin-arm64\",\n\t\t\t\t\t\t\t\"bun-windows-x64\",\n\t\t\t\t\t\t])\n\t\t\t\t\t\t.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\tcompiler: z\n\t\t.strictObject({\n\t\t\ttsconfig: z.string().default(\"tsconfig.json\"),\n\t\t\tprograms: z.record(\n\t\t\t\tz.string(),\n\t\t\t\tz.strictObject({ module: z.string(), export: z.string() }),\n\t\t\t),\n\t\t})\n\t\t.optional(),\n\ttasks: z.array(codesysTaskSchema).nonempty().optional(),\n\t// Keep an authored legacy task distinguishable from resolveConfig's default.\n\t// An explicit shared schedule must have a single owner.\n\tbuild: configSchema\n\t\t.extend({ task: configSchema.shape.task.unwrap().optional() })\n\t\t.optional(),\n\tcodesys: z\n\t\t.strictObject({\n\t\t\thttp: httpOptionsSchema.optional(),\n\t\t\tprogramNames: z.record(z.string(), z.string()).optional(),\n\t\t\t// Generate an EtherNet/IP scanner with one adapter per entry in devices.\n\t\t\tdeviceTree: z\n\t\t\t\t.strictObject({ ethernet: ethernetSchema.optional() })\n\t\t\t\t.optional(),\n\t\t\t// Each omitted controller keeps the template's device. See controllerFor.\n\t\t\tcontrollers: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tproduction: controllerTargetSchema.optional(),\n\t\t\t\t\tdevelopment: controllerTargetSchema.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\teds: z.union([z.string(), z.array(z.string())]).default(\"eds\"),\n\tdevices: z.record(z.string(), hardwareDeviceSchema).default({}),\n\tio: z.record(z.string(), ioBindingSchema).default({}),\n\tdependencies: z.record(z.string(), dependencySchema).default({}),\n\t// Raw ST builds opt into PLC contract generation by configuring this section.\n\ttypegen: typegenSchema.optional(),\n\tmonitor: monitorSchema.optional(),\n\thmi: hmiSchema.optional(),\n\ttelemetry: telemetrySchema.optional(),\n\tdebug: debugSchema.optional(),\n\t/**\n\t * Where the program runs, each with literal values for environment variables, which win over the\n\t * environment, and the plant agent that deploys to it.\n\t */\n\ttargets: z\n\t\t.record(\n\t\t\tz.string().nonempty(),\n\t\t\tz.strictObject({\n\t\t\t\tvalues: z.record(envName, z.string()).default({}),\n\t\t\t\tagent: z.strictObject({ url: z.url() }).optional(),\n\t\t\t}),\n\t\t)\n\t\t.default({}),\n\t/** Variables a release for the plant agent leaves to it, which reads them from Bun.secrets on its own PC. */\n\tsecrets: z\n\t\t.strictObject({\n\t\t\tservice: z.string().nonempty(),\n\t\t\tnames: z.array(envName).nonempty(),\n\t\t})\n\t\t.optional(),\n});\nexport type TsplcConfig = z.input<typeof tsplcConfigSchema>;\nexport type ResolvedTsplcConfig = z.output<typeof tsplcConfigSchema>;\nexport type HardwareDevice = z.infer<typeof hardwareDeviceSchema>;\nexport type ResolvedTelemetryConfig = z.output<typeof telemetrySchema>;\nexport type ResolvedDebugConfig = z.output<typeof debugSchema>;\nexport type LibraryDependency = z.infer<typeof dependencySchema>;\n/** A binding resolved to its process-image address, as `compilerConfig` receives it. */\ntype DirectIoBinding = z.infer<typeof directIoBindingSchema>;\n\n/**\n * `build` compiles for the production controller. `run` and controller\n * operations target the local runtime, so they compile for the development one.\n */\nexport const buildTargetFor = (command: string): BuildTarget =>\n\t[\"run\", \"download\", \"online-change\", \"inspect\"].includes(command)\n\t\t? \"development\"\n\t\t: \"production\";\nexport const controllerFor = (config: ResolvedTsplcConfig, command: string) => {\n\tconst controller = config.codesys?.controllers?.[buildTargetFor(command)];\n\treturn (\n\t\tcontroller && {\n\t\t\t...controllerDevices[controller.target],\n\t\t\tversion: controller.version,\n\t\t}\n\t);\n};\n\n/**\n * The variable holding the bearer token the PLC sends the project's own server: the HTTP\n * credential for the server's base URL.\n */\nexport const serverTokenEnv = (config: ResolvedTsplcConfig) =>\n\tconfig.codesys?.http?.credentials.find(\n\t\t({ originEnv }) => originEnv === config.server?.baseUrlEnv,\n\t)?.bearerTokenEnv;\n\n/**\n * The project without fieldbus I/O, for a plant simulator that writes inputs over\n * OPC UA: fieldbus input copies would overwrite those writes every scan.\n */\nexport const simulationConfig = (\n\tconfig: ResolvedTsplcConfig,\n): ResolvedTsplcConfig => ({\n\t...config,\n\teds: [],\n\tdevices: {},\n\tio: {},\n\t...(config.codesys && {\n\t\tcodesys: {\n\t\t\t...config.codesys,\n\t\t\tdeviceTree: undefined,\n\t\t},\n\t}),\n});\n\n/** All paths are relative to this file; no package has a second project config. */\nexport function defineConfig<const C extends TsplcConfig>(config: C): C {\n\treturn config;\n}\n\n/** Raw ST program names already are IEC names; use the shared schedule directly. */\nexport function rawBuildConfig(\n\tconfig: ResolvedTsplcConfig,\n): CodesysBuildConfig {\n\tif (config.compiler) {\n\t\tthrow new Error(\"Use the compiler build plan for TypeScript projects.\");\n\t}\n\tif (!config.build) {\n\t\tthrow new Error(\"Configure build settings.\");\n\t}\n\tif (!config.tasks) {\n\t\treturn config.build;\n\t}\n\tif (config.build.tasks || config.build.task !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"Configure the raw ST schedule in tasks or build.tasks/build.task, not both.\",\n\t\t);\n\t}\n\treturn {\n\t\t...config.build,\n\t\ttasks: cyclicTasksSchema.parse(\n\t\t\tconfig.tasks.map((task) => ({\n\t\t\t\tname: task.name,\n\t\t\t\tintervalNanoseconds: task.schedule.interval.nanoseconds,\n\t\t\t\tpriority: task.priority,\n\t\t\t\tprograms: task.programs,\n\t\t\t})),\n\t\t),\n\t};\n}\n\n/** Adapt the shared project to the compiler's backend-independent scan model. */\nexport function compilerConfig(\n\tconfig: ResolvedTsplcConfig,\n\tio: Record<string, DirectIoBinding>,\n\tbuildTarget: BuildTarget = \"production\",\n) {\n\tif (!config.compiler || !config.tasks) {\n\t\tthrow new Error(\n\t\t\t\"This project uses raw Structured Text; no TypeScript compiler is configured.\",\n\t\t);\n\t}\n\t// The device tree and controllers are build-time engineering; the compiler only sees addresses.\n\tconst {\n\t\tdeviceTree: _deviceTree,\n\t\tcontrollers: _controllers,\n\t\t...codesys\n\t} = config.codesys ?? {};\n\tconst value: PlcConfig = {\n\t\tname: config.name,\n\t\ttsconfig: config.compiler.tsconfig,\n\t\tprograms: config.compiler.programs,\n\t\ttasks: config.tasks,\n\t\ttarget: {\n\t\t\tkind: config.backend,\n\t\t\toptions: {\n\t\t\t\t...codesys,\n\t\t\t\tpublish: config.publish,\n\t\t\t\tbuildTarget,\n\t\t\t\tio: Object.fromEntries(\n\t\t\t\t\tObject.entries(io).map(([name, binding]) => [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"direct\",\n\t\t\t\t\t\t\t...binding,\n\t\t\t\t\t\t\t...(mappedChannel(config, name, binding) && { mapped: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tengineering: {\n\t\t\t\t\tkind: \"v3.5\",\n\t\t\t\t\t...(config.build\n\t\t\t\t\t\t? { build: engineeringBuildOptions(config.build) }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n\tconst validated = validateCompilerConfig(value);\n\tif (!validated.config) {\n\t\tthrow new Error(\n\t\t\tvalidated.diagnostics.map((item) => item.message).join(\"\\n\"),\n\t\t);\n\t}\n\treturn validated.config;\n}\n\n/**\n * A generated device tree maps a device's bit or byte scalar to its variable in the\n * I/O mapping. Wider values span several byte channels and keep an AT declaration.\n */\nfunction mappedChannel(\n\tconfig: ResolvedTsplcConfig,\n\tname: string,\n\tbinding: DirectIoBinding,\n) {\n\tconst source = config.io[name];\n\treturn (\n\t\tconfig.codesys?.deviceTree !== undefined &&\n\t\tsource !== undefined &&\n\t\t\"device\" in source &&\n\t\t// A channel maps to one variable as it stands, so these need an AT wire and a copy.\n\t\t!binding.inverted &&\n\t\t!binding.shared &&\n\t\t/^%[IQ][XB]/.test(binding.address) &&\n\t\t!/^ARRAY/i.test(binding.type ?? \"\")\n\t);\n}\n",
|
|
6
|
-
"import { z } from \"zod\";\nimport { nanosecondsPattern } from \"./compiler.ts\";\n\nexport const commandArgumentSchema = z\n\t.string()\n\t.refine(\n\t\t(value) => value.trim().length > 0,\n\t\t\"Command arguments must not be empty\",\n\t)\n\t.refine(\n\t\t(value) => !/[\"\\r\\n\\0]/.test(value),\n\t\t\"Command arguments must not contain quotes, line breaks, or null bytes\",\n\t);\n// CODESYS startup and project loading can each take several minutes.\nexport const codesysTimeouts = {\n\tbuild: 20 * 60 * 1000,\n\thostCommand: 15_000,\n\truntime: 60_000,\n\tstartup: 20 * 60 * 1000,\n\tstop: 10_000,\n\tterminate: 5000,\n\t// A transfer past this is reported, never interrupted.\n\ttransfer: 30 * 60 * 1000,\n};\n\nconst positiveMilliseconds = z.number().int().positive();\nconst pathSchema = z.string().trim().nonempty();\nexport const tcpPort = z.number().int().min(1).max(65535);\n/** A SHA-256 digest as lowercase hex, the form `node:crypto` writes. */\nexport const sha256Digest = z.string().regex(/^[a-f0-9]{64}$/);\n/** The name of an environment variable a credential is read from, so the config never holds it. */\nexport const envName = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst wineSchema = z.strictObject({\n\tprefix: pathSchema,\n\tbinary: pathSchema.default(\"wine\"),\n\tpathBinary: pathSchema.default(\"winepath\"),\n\tdebug: z.string().default(\"-all\"),\n\tnativeExit: z.boolean().default(false),\n});\nexport const localCodesysSchema = z.strictObject({\n\texecutable: commandArgumentSchema,\n\tprofile: commandArgumentSchema,\n\twine: wineSchema.optional(),\n\tcommandProcessor: pathSchema.default(\"cmd.exe\"),\n});\n\n// `tsplc configure` builds this tag; every project compiles with it.\nexport const dockerImage = \"tsplc-build:latest\";\nexport const containerCodesys = {\n\texecutable:\n\t\t\"/tmp/codesys-wine/drive_c/CODESYS-3.5.22.30/CODESYS/Common/CODESYS.exe\",\n\tprofile: \"CODESYS V3.5 SP22 Patch 3\",\n\twine: { prefix: \"/tmp/codesys-wine\", nativeExit: true },\n};\nexport const iecName = z.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/);\nexport const taskPriority = z.number().int().min(0).max(31);\nexport const cyclicTasksSchema = z\n\t.array(\n\t\tz.strictObject({\n\t\t\tname: iecName,\n\t\t\tintervalNanoseconds: z\n\t\t\t\t.string()\n\t\t\t\t.regex(nanosecondsPattern)\n\t\t\t\t.refine((value) => {\n\t\t\t\t\t// zod runs this refinement even when the pattern fails, and BigInt throws on a non-integer.\n\t\t\t\t\tif (!nanosecondsPattern.test(value)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tconst ns = BigInt(value);\n\t\t\t\t\treturn ns % 1_000_000n === 0n && ns <= 4_294_967_295_000_000n;\n\t\t\t\t}, \"Cyclic tasks require an exact positive TIME interval in milliseconds\"),\n\t\t\tpriority: taskPriority,\n\t\t\tprograms: z.array(iecName).nonempty(),\n\t\t}),\n\t)\n\t.nonempty()\n\t.superRefine((tasks, context) => {\n\t\tconst names = new Set<string>();\n\t\tconst programs = new Set<string>();\n\t\ttasks.forEach((task, index) => {\n\t\t\tif (names.has(task.name.toLowerCase())) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index, \"name\"],\n\t\t\t\t\tmessage: \"Task names must be unique\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tnames.add(task.name.toLowerCase());\n\t\t\ttask.programs.forEach((program, position) => {\n\t\t\t\tif (programs.has(program.toLowerCase())) {\n\t\t\t\t\tcontext.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [index, \"programs\", position],\n\t\t\t\t\t\tmessage: \"A program can be scheduled only once\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tprograms.add(program.toLowerCase());\n\t\t\t});\n\t\t});\n\t});\nexport type CyclicTask = z.infer<typeof cyclicTasksSchema>[number];\n/** `inverted` reads a BOOL input as its opposite; `shared` lets several bindings read one input. */\nexport const ioBindingOptions = {\n\tinverted: z.boolean().optional(),\n\tshared: z.boolean().optional(),\n};\n/** A process-image address in CODESYS byte addressing, with an optional IEC type. */\nexport const directIoBindingSchema = z.strictObject({\n\taddress: z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|[BWD]\\d+)$/),\n\ttype: z.string().optional(),\n\t...ioBindingOptions,\n});\n/** The controller's Ethernet interface; omitted settings keep the CODESYS defaults. */\nexport const ethernetSchema = z.strictObject({\n\tinterface: z.string().nonempty().optional(),\n\taddress: z.ipv4().optional(),\n\tsubnet: z.ipv4().optional(),\n\tgateway: z.ipv4().optional(),\n});\n/** The byte where a device's input or output assembly starts in the process image. */\nexport const assemblyAddress = z.string().regex(/^%[IQ]B\\d+$/);\nconst processImageSchema = z.strictObject({\n\taddress: assemblyAddress,\n\tsize: z.number().int().positive(),\n});\n/** A bit or byte channel of a generated device tree. */\nconst channelAddress = z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|B\\d+)$/);\n/**\n * An EtherNet/IP scanner tree generated from EDS files. Each adapter's EDS is\n * already reduced to its selected connection and raw byte assemblies, so every\n * payload byte becomes one channel pinned at its region's address plus offset.\n */\nexport const deviceTreeSchema = z.strictObject({\n\tethernet: ethernetSchema.default({}),\n\tdevices: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tname: iecName,\n\t\t\t\teds: z.string().nonempty(),\n\t\t\t\taddress: z.ipv4().optional(),\n\t\t\t\trpiMicroseconds: z.number().int().positive().optional(),\n\t\t\t\tinputs: processImageSchema.optional(),\n\t\t\t\toutputs: processImageSchema.optional(),\n\t\t\t\t// Registers written over Modbus TCP at the adapter's address, with their pinned channels.\n\t\t\t\tmodbus: z\n\t\t\t\t\t.strictObject({\n\t\t\t\t\t\tport: tcpPort,\n\t\t\t\t\t\tregisters: z.array(\n\t\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\t\tname: iecName,\n\t\t\t\t\t\t\t\toffset: z.number().int().nonnegative(),\n\t\t\t\t\t\t\t\tvalue: z.string().regex(/^%QW\\d+$/),\n\t\t\t\t\t\t\t\twrite: z.string().regex(/^%QX\\d+\\.[0-7]$/),\n\t\t\t\t\t\t\t\tstatus: z.string().regex(/^%IB\\d+$/),\n\t\t\t\t\t\t\t\trequests: z.string().regex(/^%ID\\d+$/),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\t// Channel comments name the logical IO bound at a pinned byte or bit.\n\t\t\t\tcomments: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\taddress: channelAddress,\n\t\t\t\t\t\t\ttext: z.string().nonempty(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\t.default([]),\n\t\t\t}),\n\t\t)\n\t\t.nonempty(),\n\t// Variables mapped to pinned bit or byte channels, relative to the application.\n\tmappings: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\taddress: channelAddress,\n\t\t\t\tvariable: z.string().nonempty(),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type DeviceTree = z.input<typeof deviceTreeSchema>;\n/** A device or library version as CODESYS repositories spell it: four numbers. */\nexport const fourPartVersion = z.string().regex(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/);\n/** A controller's device repository identity, as CODESYS shows it under Device > Information. */\nexport const controllerSchema = z.strictObject({\n\ttype: z.number().int().positive(),\n\tid: z.string().regex(/^[0-9A-F]{4} [0-9A-F]{4}$/),\n\tversion: fourPartVersion,\n});\nexport type Controller = z.infer<typeof controllerSchema>;\n/** A controller the build image carries, named instead of spelled as its repository identity. */\nexport const controllerTargetSchema = controllerSchema\n\t.pick({ version: true })\n\t.extend({\n\t\ttarget: z.enum([\"linux-sl\", \"virtual-linux-arm64-sl\"]),\n\t});\nexport const controllerDevices = {\n\t\"linux-sl\": { type: 4102, id: \"0000 0005\" },\n\t\"virtual-linux-arm64-sl\": { type: 4096, id: \"0000 1008\" },\n} satisfies Record<\n\tz.infer<typeof controllerTargetSchema>[\"target\"],\n\tOmit<Controller, \"version\">\n>;\nexport const configSchema = z.strictObject({\n\tio: z.record(z.string(), directIoBindingSchema).optional(),\n\tdeviceTree: deviceTreeSchema.optional(),\n\t// Replaces the template's controller; the build image must carry its description.\n\tcontroller: controllerSchema.optional(),\n\tlibraryReferences: z.array(z.string().nonempty()).default([]),\n\tlibraries: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\ttitle: z.string(),\n\t\t\t\tcompany: z.string().optional(),\n\t\t\t\tversion: z.string().optional(),\n\t\t\t\tnamespace: z.string().optional(),\n\t\t\t\tpath: pathSchema,\n\t\t\t\tsha256: sha256Digest,\n\t\t\t\turl: z.string().optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n\tdocker: z\n\t\t.strictObject({\n\t\t\tcpuSet: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+(?:-\\d+)?(?:,\\d+(?:-\\d+)?)*$/)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttemplate: pathSchema.optional(),\n\tsourceDir: pathSchema.default(\"src\"),\n\tentry: pathSchema.default(\"src/Main.st\"),\n\toutDir: pathSchema.default(\"build\"),\n\ttask: z.string().nonempty().default(\"MainTask\"),\n\ttasks: cyclicTasksSchema.optional(),\n\tremoveObjects: z.array(z.string().nonempty()).default([]),\n\tsymbols: z.boolean().default(false),\n\t/**\n\t * Experimental: a project imported into the template, as a build without a cached project or a\n\t * download without a baseline does, brings its POUs in one PLCopenXML import instead of one\n\t * call each, and falls back to one at a time on any error. A host setting, like `docker`.\n\t */\n\tbulkImport: z.boolean().optional(),\n\tonline: z\n\t\t.strictObject({\n\t\t\tnetwork: pathSchema.default(\"bridge\"),\n\t\t\tgateway: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(1217),\n\t\t\t}),\n\t\t\tdevice: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(11740),\n\t\t\t}),\n\t\t\tcredentials: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tusernameEnv: envName,\n\t\t\t\t\tpasswordEnv: envName,\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttimeouts: z\n\t\t.strictObject({\n\t\t\tstartup: positiveMilliseconds.default(codesysTimeouts.startup),\n\t\t\tbuild: positiveMilliseconds.default(codesysTimeouts.build),\n\t\t\tstop: positiveMilliseconds.default(codesysTimeouts.stop),\n\t\t\tterminate: positiveMilliseconds.default(codesysTimeouts.terminate),\n\t\t\thostCommand: positiveMilliseconds.default(codesysTimeouts.hostCommand),\n\t\t\truntime: positiveMilliseconds.default(codesysTimeouts.runtime),\n\t\t\t// Unset rather than defaulted, so a release's config still loads on agents that predate them.\n\t\t\t/** A controller operation's work before it touches the controller; `build` when unset. */\n\t\t\tprepare: positiveMilliseconds.optional(),\n\t\t\t/** How long a controller transfer runs before it is reported overdue; it is never interrupted. */\n\t\t\ttransfer: positiveMilliseconds.optional(),\n\t\t})\n\t\t.prefault({}),\n});\nexport type CodesysBuildConfig = z.input<typeof configSchema>;\n\n/**\n * A controller operation's budgets: `prepare` for opening, importing and compiling, after which the\n * worker may be stopped because the controller is untouched; `transfer` for the transfer and what\n * confirms it, after which the operation is only reported overdue, since stopping CODESYS then could\n * leave the controller without an application.\n */\nexport const controllerBudgets = (\n\ttimeouts: z.output<typeof configSchema>[\"timeouts\"],\n) => ({\n\tprepare: timeouts.prepare ?? timeouts.build,\n\ttransfer: timeouts.transfer ?? codesysTimeouts.transfer,\n});\n\n/**\n * The build config a release carries to the plant agent. The agent supplies the output\n * directory and the controller connection; Docker settings belong to the host that built it.\n */\nexport const releaseConfigSchema = configSchema.omit({\n\tdocker: true,\n\toutDir: true,\n\tonline: true,\n\tbulkImport: true,\n});\nexport type ReleaseConfig = z.input<typeof releaseConfigSchema>;\n\n/** The build settings a TypeScript project passes its compiler; the compiler decides the rest. */\nexport const engineeringBuildSchema = configSchema.omit({\n\tsourceDir: true,\n\tentry: true,\n\toutDir: true,\n\ttask: true,\n\ttasks: true,\n});\n\nexport function engineeringBuildOptions(\n\tbuild: CodesysBuildConfig,\n): z.input<typeof engineeringBuildSchema> {\n\tconst {\n\t\tsourceDir: _source,\n\t\tentry: _entry,\n\t\toutDir: _out,\n\t\ttask: _task,\n\t\ttasks: _tasks,\n\t\t...settings\n\t} = build;\n\treturn settings;\n}\n",
|
|
5
|
+
"import { z } from \"zod\";\nimport {\n\tassemblyAddress,\n\ttype CodesysBuildConfig,\n\tconfigSchema,\n\tcontrollerDeviceNames,\n\tcontrollerDevices,\n\tcontrollerTargetSchema,\n\tcyclicTasksSchema,\n\tdirectIoBindingSchema,\n\tengineeringBuildOptions,\n\tenvName,\n\tethernetSchema,\n\tfourPartVersion,\n\tiecName,\n\tioBindingOptions,\n\ttaskPriority,\n\ttcpPort,\n} from \"./build-schema.ts\";\nimport {\n\tdurationSchema,\n\ttype PlcConfig,\n\ttaskSchema,\n\tvalidateConfig as validateCompilerConfig,\n} from \"./compiler.ts\";\nimport { generatedDirectory } from \"./project-files.ts\";\n\nexport type {\n\tCodesysBuildConfig,\n\tController,\n\tDeviceTree,\n} from \"./build-schema.ts\";\nexport {\n\ttype Duration,\n\tdefinePlcConfig,\n\tdurationHelpers,\n\tms,\n\ttype NormalizedConfig,\n\tns,\n\ttype PlcConfig,\n\ttype SourceExport,\n\tseconds,\n\ttype TargetDescriptor,\n\ttype TaskConfig,\n\tvalidateConfig,\n} from \"./compiler.ts\";\n\nexport const httpOptionsSchema = z\n\t.strictObject({\n\t\ttimeoutMs: z.number().int().positive().max(60000).default(2000),\n\t\tcredentials: z\n\t\t\t.array(\n\t\t\t\tz.strictObject({\n\t\t\t\t\toriginEnv: envName,\n\t\t\t\t\tbearerTokenEnv: envName,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.default([]),\n\t})\n\t.prefault({});\nexport type HttpOptions = z.infer<typeof httpOptionsSchema>;\n\nconst ioBindingSchema = z.union([\n\tdirectIoBindingSchema,\n\tz.strictObject({\n\t\tdevice: z.string().min(1),\n\t\tchannel: z.string().min(1),\n\t\t...ioBindingOptions,\n\t}),\n]);\n// Each field defaults: the assembly from the connection, the size from the EDS and,\n// with a generated device tree, the address from tsPLC's process-image layout.\nconst assemblySchema = z.strictObject({\n\tassembly: z.number().int().nonnegative().optional(),\n\tsize: z.number().int().positive().optional(),\n\taddress: assemblyAddress.optional(),\n});\nconst hardwareDeviceSchema = z.strictObject({\n\tfile: z.string().min(1),\n\tconnection: z.string().min(1).optional(),\n\tinputs: assemblySchema.optional(),\n\toutputs: assemblySchema.optional(),\n\t// Registers the generated device tree writes over Modbus TCP, at network.address.\n\t// Each maps a name to its wire offset, and is written with FC06 when its write channel rises.\n\tmodbus: z\n\t\t.strictObject({\n\t\t\tport: tcpPort.default(502),\n\t\t\tregisters: z.record(iecName, z.number().int().min(0).max(65535)),\n\t\t})\n\t\t.optional(),\n\tstatusSymbols: z.record(z.string(), z.string()).optional(),\n\t// The adapter's network identity in a generated device tree.\n\tnetwork: z\n\t\t.strictObject({\n\t\t\taddress: z.ipv4().optional(),\n\t\t\trpi: durationSchema\n\t\t\t\t.refine(\n\t\t\t\t\t(rpi) => BigInt(rpi.nanoseconds) % 1000n === 0n,\n\t\t\t\t\t\"An RPI must be a whole number of microseconds.\",\n\t\t\t\t)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n});\nconst dependencySchema = z.union([\n\tfourPartVersion,\n\tz.strictObject({\n\t\tversion: fourPartVersion,\n\t\tcompany: z.string().optional(),\n\t\tnamespace: z.string().optional(),\n\t}),\n\tz.strictObject({ path: z.string().min(1), namespace: z.string().optional() }),\n]);\n// `backend` is always CODESYS, so tasks get its name and priority rules here, as raw ST schedules do in cyclicTasksSchema.\nconst codesysTaskSchema = taskSchema.extend({\n\tname: iecName,\n\tpriority: taskPriority,\n});\nconst monitorSchema = z\n\t.strictObject({\n\t\tendpoint: z.string().url(),\n\t\tnamespaceUri: z.string().optional(),\n\t\tsymbols: z.array(z.string().min(1)).optional(),\n\t\tsecurityMode: z\n\t\t\t.enum([\"None\", \"Sign\", \"SignAndEncrypt\"])\n\t\t\t.default(\"SignAndEncrypt\"),\n\t\tsecurityPolicy: z.enum([\"None\", \"Basic256Sha256\"]).optional(),\n\t\tcertificateDirectory: z\n\t\t\t.string()\n\t\t\t.min(1)\n\t\t\t.default(`${generatedDirectory}/opcua-pki`),\n\t\tusername: z.string().min(1).optional(),\n\t\tpasswordEnv: envName.optional(),\n\t})\n\t.superRefine((monitor, context) => {\n\t\tif (\n\t\t\tmonitor.securityPolicy &&\n\t\t\t(monitor.securityMode === \"None\") !== (monitor.securityPolicy === \"None\")\n\t\t) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityPolicy\"],\n\t\t\t\tmessage:\n\t\t\t\t\t\"None mode requires None policy; secure modes require Basic256Sha256.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.passwordEnv && !monitor.username) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"username\"],\n\t\t\t\tmessage: \"Configure username when passwordEnv is used.\",\n\t\t\t});\n\t\t}\n\t\tif (monitor.username && monitor.securityMode === \"None\") {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"securityMode\"],\n\t\t\t\tmessage: \"Username authentication requires a secure OPC-UA connection.\",\n\t\t\t});\n\t\t}\n\t})\n\t.transform((monitor) => ({\n\t\t...monitor,\n\t\tsecurityPolicy:\n\t\t\tmonitor.securityPolicy ??\n\t\t\t(monitor.securityMode === \"None\"\n\t\t\t\t? (\"None\" as const)\n\t\t\t\t: (\"Basic256Sha256\" as const)),\n\t}));\n/**\n * The records each PLC task keeps for its sender (docs/language/telemetry.md): used whenever the\n * program calls `@tsplc/compiler/telemetry`, records unhandled job failures or traces for the debugger.\n */\nexport const telemetrySchema = z.strictObject({\n\t/** Records in each task's ring; older unsent records are overwritten and counted as dropped. */\n\tcapacity: z.number().int().min(4).max(4096).default(64),\n\t/**\n\t * The largest encoded JSON of one record, checked for every call when the program compiles.\n\t * It is fixed rather than fitted to the program, so that a ring keeps its layout from one build\n\t * to the next: CODESYS cannot apply an online change that moves a ring.\n\t */\n\trecordBytes: z.number().int().min(128).max(1024).default(512),\n});\n/**\n * The debugger's fixed-size instrumentation (docs/design/debugging.md). It reads state through\n * the engineering login, so it publishes nothing. Without it a build only carries its build id.\n */\nconst debugSchema = z.strictObject({\n\t/** Records enum state changes, decisions and job starts and ends; for local debugging sessions. */\n\ttrace: z\n\t\t.union([\n\t\t\tz.literal(false),\n\t\t\tz.strictObject({\n\t\t\t\tcapacity: z.number().int().min(16).max(4096).default(256),\n\t\t\t\toperands: z.number().int().min(0).max(8).default(4),\n\t\t\t}),\n\t\t])\n\t\t.default(false),\n\twriters: z.boolean().default(true),\n\tjobs: z.boolean().default(true),\n\t/** Watch groups the debugger opens with: TypeScript paths, `*` matching one path segment. */\n\twatch: z.record(z.string(), z.array(z.string().min(1))).default({}),\n\trequests: z\n\t\t.strictObject({\n\t\t\tcapacity: z.number().int().min(1).max(100_000).default(1000),\n\t\t\t/** Keep service call inputs and outputs; off by default because they may carry data that isn't the debugger's to show. */\n\t\t\tbodies: z.boolean().default(false),\n\t\t})\n\t\t.prefault({}),\n});\nexport const typegenSchema = z.strictObject({\n\ttypes: z.union([z.string(), z.array(z.string())]).optional(),\n\tglobals: z.union([z.string(), z.array(z.string())]).optional(),\n\t/** Directory for the generated `plc.ts`, `hardware.ts` and `machines.ts`. */\n\tdir: z.string().default(\"generated\"),\n\t/** Emit TypeScript declarations in `plc.ts`, not just the runtime field and symbol tables. */\n\tdeclarations: z.boolean().default(true),\n\t/** Emit the I/O binding types and device catalog in `hardware.ts`, not just the publication selectors. */\n\tioTypes: z.boolean().default(true),\n});\nexport const buildTargetSchema = z.enum([\"production\", \"development\"]);\nexport type BuildTarget = z.infer<typeof buildTargetSchema>;\nexport const publicationSchema = z.strictObject({\n\tproduction: z.array(z.string().nonempty()),\n\tdevelopment: z.array(z.string().nonempty()),\n});\nexport type Publication = Readonly<Record<BuildTarget, readonly string[]>>;\n/** Each IO binding's name with the published symbol path the compiler gave it. */\nexport const ioSymbolsSchema = z.record(z.string(), z.string());\n/** A published PLC variable, as `Global.Field`. */\nconst hmiTarget = z.string().regex(/^\\w+(\\.\\w+|\\[\\d+\\])+$/);\nconst hmiControlSchema = z.discriminatedUnion(\"kind\", [\n\t/** Pulses a BOOL on for 200 ms, like a pushbutton. */\n\tz.strictObject({\n\t\tkind: z.literal(\"button\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\ttone: z.enum([\"start\", \"stop\"]).optional(),\n\t\t/** Ask before pressing, for controls that start motion. */\n\t\tconfirm: z.boolean().optional(),\n\t}),\n\t/** Switches a BOOL on or off, and shows its current state. */\n\tz.strictObject({\n\t\tkind: z.literal(\"toggle\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t}),\n\t/** Writes an integer when released, and shows its current value. */\n\tz.strictObject({\n\t\tkind: z.literal(\"slider\"),\n\t\tlabel: z.string().nonempty(),\n\t\ttarget: hmiTarget,\n\t\tmin: z.number().int(),\n\t\tmax: z.number().int(),\n\t}),\n]);\nexport const hmiSchema = z.strictObject({\n\ttitle: z.string().nonempty(),\n\tcontrols: z.array(hmiControlSchema).default([]),\n\t/** The PLC reports whether each position of these conveyors is occupied, in this order. */\n\tconveyors: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tlabel: z.string().nonempty(),\n\t\t\t\tpositions: z.number().int().positive(),\n\t\t\t\t/** Positions that are diverters, drawn differently. */\n\t\t\t\tdiverters: z.array(z.number().int().nonnegative()).default([]),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type HmiConfig = z.input<typeof hmiSchema>;\nexport type ResolvedHmiConfig = z.output<typeof hmiSchema>;\n\nexport const tsplcConfigSchema = z.strictObject({\n\tname: z.string().default(\"Application\"),\n\tbackend: z.literal(\"codesys\"),\n\tpublish: publicationSchema.optional(),\n\tserver: z\n\t\t.strictObject({\n\t\t\tbaseUrlEnv: z.string().optional(),\n\t\t\ttransport: z.enum([\"http\", \"opcua\"]).default(\"http\"),\n\t\t\truntime: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tentry: z.string(),\n\t\t\t\t\ttarget: z\n\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\"bun-linux-x64\",\n\t\t\t\t\t\t\t\"bun-linux-arm64\",\n\t\t\t\t\t\t\t\"bun-darwin-x64\",\n\t\t\t\t\t\t\t\"bun-darwin-arm64\",\n\t\t\t\t\t\t\t\"bun-windows-x64\",\n\t\t\t\t\t\t])\n\t\t\t\t\t\t.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\tcompiler: z\n\t\t.strictObject({\n\t\t\ttsconfig: z.string().default(\"tsconfig.json\"),\n\t\t\tprograms: z.record(\n\t\t\t\tz.string(),\n\t\t\t\tz.strictObject({ module: z.string(), export: z.string() }),\n\t\t\t),\n\t\t})\n\t\t.optional(),\n\ttasks: z.array(codesysTaskSchema).nonempty().optional(),\n\t// Keep an authored legacy task distinguishable from resolveConfig's default.\n\t// An explicit shared schedule must have a single owner.\n\tbuild: configSchema\n\t\t.extend({ task: configSchema.shape.task.unwrap().optional() })\n\t\t.optional(),\n\tcodesys: z\n\t\t.strictObject({\n\t\t\thttp: httpOptionsSchema.optional(),\n\t\t\tprogramNames: z.record(z.string(), z.string()).optional(),\n\t\t\t// Generate an EtherNet/IP scanner with one adapter per entry in devices.\n\t\t\tdeviceTree: z\n\t\t\t\t.strictObject({ ethernet: ethernetSchema.optional() })\n\t\t\t\t.optional(),\n\t\t\t// Each omitted controller keeps the template's device. See controllerFor.\n\t\t\tcontrollers: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tproduction: controllerTargetSchema.optional(),\n\t\t\t\t\tdevelopment: controllerTargetSchema.optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\teds: z.union([z.string(), z.array(z.string())]).default(\"eds\"),\n\tdevices: z.record(z.string(), hardwareDeviceSchema).default({}),\n\tio: z.record(z.string(), ioBindingSchema).default({}),\n\tdependencies: z.record(z.string(), dependencySchema).default({}),\n\t// Raw ST builds opt into PLC contract generation by configuring this section.\n\ttypegen: typegenSchema.optional(),\n\tmonitor: monitorSchema.optional(),\n\thmi: hmiSchema.optional(),\n\ttelemetry: telemetrySchema.optional(),\n\tdebug: debugSchema.optional(),\n\t/**\n\t * Where the program runs, each with literal values for environment variables, which win over the\n\t * environment, and the plant agent that deploys to it.\n\t */\n\ttargets: z\n\t\t.record(\n\t\t\tz.string().nonempty(),\n\t\t\tz.strictObject({\n\t\t\t\tvalues: z.record(envName, z.string()).default({}),\n\t\t\t\tagent: z.strictObject({ url: z.url() }).optional(),\n\t\t\t}),\n\t\t)\n\t\t.default({}),\n\t/** Variables a release for the plant agent leaves to it, which reads them from Bun.secrets on its own PC. */\n\tsecrets: z\n\t\t.strictObject({\n\t\t\tservice: z.string().nonempty(),\n\t\t\tnames: z.array(envName).nonempty(),\n\t\t})\n\t\t.optional(),\n});\nexport type TsplcConfig = z.input<typeof tsplcConfigSchema>;\nexport type ResolvedTsplcConfig = z.output<typeof tsplcConfigSchema>;\nexport type HardwareDevice = z.infer<typeof hardwareDeviceSchema>;\nexport type ResolvedTelemetryConfig = z.output<typeof telemetrySchema>;\nexport type ResolvedDebugConfig = z.output<typeof debugSchema>;\nexport type LibraryDependency = z.infer<typeof dependencySchema>;\n/** A binding resolved to its process-image address, as `compilerConfig` receives it. */\ntype DirectIoBinding = z.infer<typeof directIoBindingSchema>;\n\n/**\n * `build` compiles for the production controller. `run` and controller\n * operations target the local runtime, so they compile for the development one.\n */\nexport const buildTargetFor = (command: string): BuildTarget =>\n\t[\"run\", \"download\", \"online-change\", \"inspect\"].includes(command)\n\t\t? \"development\"\n\t\t: \"production\";\nexport const controllerFor = (config: ResolvedTsplcConfig, command: string) => {\n\tconst controller = config.codesys?.controllers?.[buildTargetFor(command)];\n\treturn (\n\t\tcontroller && {\n\t\t\t...controllerDevices[controller.target],\n\t\t\tversion: controller.version,\n\t\t}\n\t);\n};\n\n/** The name of the device `command` runs on: the configured controller, else Linux SL, the local runtime `run` deploys to. */\nexport const controllerDeviceName = (\n\tconfig: ResolvedTsplcConfig,\n\tcommand: string,\n) =>\n\tcontrollerDeviceNames[\n\t\tconfig.codesys?.controllers?.[buildTargetFor(command)]?.target ?? \"linux-sl\"\n\t];\n\n/**\n * The variable holding the bearer token the PLC sends the project's own server: the HTTP\n * credential for the server's base URL.\n */\nexport const serverTokenEnv = (config: ResolvedTsplcConfig) =>\n\tconfig.codesys?.http?.credentials.find(\n\t\t({ originEnv }) => originEnv === config.server?.baseUrlEnv,\n\t)?.bearerTokenEnv;\n\n/**\n * The project without fieldbus I/O, for a plant simulator that writes inputs over\n * OPC UA: fieldbus input copies would overwrite those writes every scan.\n */\nexport const simulationConfig = (\n\tconfig: ResolvedTsplcConfig,\n): ResolvedTsplcConfig => ({\n\t...config,\n\teds: [],\n\tdevices: {},\n\tio: {},\n\t...(config.codesys && {\n\t\tcodesys: {\n\t\t\t...config.codesys,\n\t\t\tdeviceTree: undefined,\n\t\t},\n\t}),\n});\n\n/** All paths are relative to this file; no package has a second project config. */\nexport function defineConfig<const C extends TsplcConfig>(config: C): C {\n\treturn config;\n}\n\n/** Raw ST program names already are IEC names; use the shared schedule directly. */\nexport function rawBuildConfig(\n\tconfig: ResolvedTsplcConfig,\n): CodesysBuildConfig {\n\tif (config.compiler) {\n\t\tthrow new Error(\"Use the compiler build plan for TypeScript projects.\");\n\t}\n\tif (!config.build) {\n\t\tthrow new Error(\"Configure build settings.\");\n\t}\n\tif (!config.tasks) {\n\t\treturn config.build;\n\t}\n\tif (config.build.tasks || config.build.task !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"Configure the raw ST schedule in tasks or build.tasks/build.task, not both.\",\n\t\t);\n\t}\n\treturn {\n\t\t...config.build,\n\t\ttasks: cyclicTasksSchema.parse(\n\t\t\tconfig.tasks.map((task) => ({\n\t\t\t\tname: task.name,\n\t\t\t\tintervalNanoseconds: task.schedule.interval.nanoseconds,\n\t\t\t\tpriority: task.priority,\n\t\t\t\tprograms: task.programs,\n\t\t\t})),\n\t\t),\n\t};\n}\n\n/** Adapt the shared project to the compiler's backend-independent scan model. */\nexport function compilerConfig(\n\tconfig: ResolvedTsplcConfig,\n\tio: Record<string, DirectIoBinding>,\n\tbuildTarget: BuildTarget = \"production\",\n) {\n\tif (!config.compiler || !config.tasks) {\n\t\tthrow new Error(\n\t\t\t\"This project uses raw Structured Text; no TypeScript compiler is configured.\",\n\t\t);\n\t}\n\t// The device tree and controllers are build-time engineering; the compiler only sees addresses.\n\tconst {\n\t\tdeviceTree: _deviceTree,\n\t\tcontrollers: _controllers,\n\t\t...codesys\n\t} = config.codesys ?? {};\n\tconst value: PlcConfig = {\n\t\tname: config.name,\n\t\ttsconfig: config.compiler.tsconfig,\n\t\tprograms: config.compiler.programs,\n\t\ttasks: config.tasks,\n\t\ttarget: {\n\t\t\tkind: config.backend,\n\t\t\toptions: {\n\t\t\t\t...codesys,\n\t\t\t\tpublish: config.publish,\n\t\t\t\tbuildTarget,\n\t\t\t\tio: Object.fromEntries(\n\t\t\t\t\tObject.entries(io).map(([name, binding]) => [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"direct\",\n\t\t\t\t\t\t\t...binding,\n\t\t\t\t\t\t\t...(mappedChannel(config, name, binding) && { mapped: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tengineering: {\n\t\t\t\t\tkind: \"v3.5\",\n\t\t\t\t\t...(config.build\n\t\t\t\t\t\t? { build: engineeringBuildOptions(config.build) }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n\tconst validated = validateCompilerConfig(value);\n\tif (!validated.config) {\n\t\tthrow new Error(\n\t\t\tvalidated.diagnostics.map((item) => item.message).join(\"\\n\"),\n\t\t);\n\t}\n\treturn validated.config;\n}\n\n/**\n * A generated device tree maps a device's bit or byte scalar to its variable in the\n * I/O mapping. Wider values span several byte channels and keep an AT declaration.\n */\nfunction mappedChannel(\n\tconfig: ResolvedTsplcConfig,\n\tname: string,\n\tbinding: DirectIoBinding,\n) {\n\tconst source = config.io[name];\n\treturn (\n\t\tconfig.codesys?.deviceTree !== undefined &&\n\t\tsource !== undefined &&\n\t\t\"device\" in source &&\n\t\t// A channel maps to one variable as it stands, so these need an AT wire and a copy.\n\t\t!binding.inverted &&\n\t\t!binding.shared &&\n\t\t/^%[IQ][XB]/.test(binding.address) &&\n\t\t!/^ARRAY/i.test(binding.type ?? \"\")\n\t);\n}\n",
|
|
6
|
+
"import { z } from \"zod\";\nimport { nanosecondsPattern } from \"./compiler.ts\";\n\nexport const commandArgumentSchema = z\n\t.string()\n\t.refine(\n\t\t(value) => value.trim().length > 0,\n\t\t\"Command arguments must not be empty\",\n\t)\n\t.refine(\n\t\t(value) => !/[\"\\r\\n\\0]/.test(value),\n\t\t\"Command arguments must not contain quotes, line breaks, or null bytes\",\n\t);\n// CODESYS startup and project loading can each take several minutes.\nexport const codesysTimeouts = {\n\tbuild: 20 * 60 * 1000,\n\thostCommand: 15_000,\n\truntime: 60_000,\n\tstartup: 20 * 60 * 1000,\n\tstop: 10_000,\n\tterminate: 5000,\n\t// A transfer past this is reported, never interrupted.\n\ttransfer: 30 * 60 * 1000,\n};\n\nconst positiveMilliseconds = z.number().int().positive();\nconst pathSchema = z.string().trim().nonempty();\nexport const tcpPort = z.number().int().min(1).max(65535);\n/** A SHA-256 digest as lowercase hex, the form `node:crypto` writes. */\nexport const sha256Digest = z.string().regex(/^[a-f0-9]{64}$/);\n/** The name of an environment variable a credential is read from, so the config never holds it. */\nexport const envName = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst wineSchema = z.strictObject({\n\tprefix: pathSchema,\n\tbinary: pathSchema.default(\"wine\"),\n\tpathBinary: pathSchema.default(\"winepath\"),\n\tdebug: z.string().default(\"-all\"),\n\tnativeExit: z.boolean().default(false),\n});\nexport const localCodesysSchema = z.strictObject({\n\texecutable: commandArgumentSchema,\n\tprofile: commandArgumentSchema,\n\twine: wineSchema.optional(),\n\tcommandProcessor: pathSchema.default(\"cmd.exe\"),\n});\n\n// `tsplc configure` builds this tag; every project compiles with it.\nexport const dockerImage = \"tsplc-build:latest\";\nexport const containerCodesys = {\n\texecutable:\n\t\t\"/tmp/codesys-wine/drive_c/CODESYS-3.5.22.30/CODESYS/Common/CODESYS.exe\",\n\tprofile: \"CODESYS V3.5 SP22 Patch 3\",\n\twine: { prefix: \"/tmp/codesys-wine\", nativeExit: true },\n};\nexport const iecName = z.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/);\nexport const taskPriority = z.number().int().min(0).max(31);\nexport const cyclicTasksSchema = z\n\t.array(\n\t\tz.strictObject({\n\t\t\tname: iecName,\n\t\t\tintervalNanoseconds: z\n\t\t\t\t.string()\n\t\t\t\t.regex(nanosecondsPattern)\n\t\t\t\t.refine((value) => {\n\t\t\t\t\t// zod runs this refinement even when the pattern fails, and BigInt throws on a non-integer.\n\t\t\t\t\tif (!nanosecondsPattern.test(value)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tconst ns = BigInt(value);\n\t\t\t\t\treturn ns % 1_000_000n === 0n && ns <= 4_294_967_295_000_000n;\n\t\t\t\t}, \"Cyclic tasks require an exact positive TIME interval in milliseconds\"),\n\t\t\tpriority: taskPriority,\n\t\t\tprograms: z.array(iecName).nonempty(),\n\t\t}),\n\t)\n\t.nonempty()\n\t.superRefine((tasks, context) => {\n\t\tconst names = new Set<string>();\n\t\tconst programs = new Set<string>();\n\t\ttasks.forEach((task, index) => {\n\t\t\tif (names.has(task.name.toLowerCase())) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index, \"name\"],\n\t\t\t\t\tmessage: \"Task names must be unique\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tnames.add(task.name.toLowerCase());\n\t\t\ttask.programs.forEach((program, position) => {\n\t\t\t\tif (programs.has(program.toLowerCase())) {\n\t\t\t\t\tcontext.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [index, \"programs\", position],\n\t\t\t\t\t\tmessage: \"A program can be scheduled only once\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tprograms.add(program.toLowerCase());\n\t\t\t});\n\t\t});\n\t});\nexport type CyclicTask = z.infer<typeof cyclicTasksSchema>[number];\n/** `inverted` reads a BOOL input as its opposite; `shared` lets several bindings read one input. */\nexport const ioBindingOptions = {\n\tinverted: z.boolean().optional(),\n\tshared: z.boolean().optional(),\n};\n/** A process-image address in CODESYS byte addressing, with an optional IEC type. */\nexport const directIoBindingSchema = z.strictObject({\n\taddress: z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|[BWD]\\d+)$/),\n\ttype: z.string().optional(),\n\t...ioBindingOptions,\n});\n/** The controller's Ethernet interface; omitted settings keep the CODESYS defaults. */\nexport const ethernetSchema = z.strictObject({\n\tinterface: z.string().nonempty().optional(),\n\taddress: z.ipv4().optional(),\n\tsubnet: z.ipv4().optional(),\n\tgateway: z.ipv4().optional(),\n});\n/** The byte where a device's input or output assembly starts in the process image. */\nexport const assemblyAddress = z.string().regex(/^%[IQ]B\\d+$/);\nconst processImageSchema = z.strictObject({\n\taddress: assemblyAddress,\n\tsize: z.number().int().positive(),\n});\n/** A bit or byte channel of a generated device tree. */\nconst channelAddress = z.string().regex(/^%[IQ](?:X\\d+\\.[0-7]|B\\d+)$/);\n/**\n * An EtherNet/IP scanner tree generated from EDS files. Each adapter's EDS is\n * already reduced to its selected connection and raw byte assemblies, so every\n * payload byte becomes one channel pinned at its region's address plus offset.\n */\nexport const deviceTreeSchema = z.strictObject({\n\tethernet: ethernetSchema.default({}),\n\tdevices: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\tname: iecName,\n\t\t\t\teds: z.string().nonempty(),\n\t\t\t\taddress: z.ipv4().optional(),\n\t\t\t\trpiMicroseconds: z.number().int().positive().optional(),\n\t\t\t\tinputs: processImageSchema.optional(),\n\t\t\t\toutputs: processImageSchema.optional(),\n\t\t\t\t// Registers written over Modbus TCP at the adapter's address, with their pinned channels.\n\t\t\t\tmodbus: z\n\t\t\t\t\t.strictObject({\n\t\t\t\t\t\tport: tcpPort,\n\t\t\t\t\t\tregisters: z.array(\n\t\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\t\tname: iecName,\n\t\t\t\t\t\t\t\toffset: z.number().int().nonnegative(),\n\t\t\t\t\t\t\t\tvalue: z.string().regex(/^%QW\\d+$/),\n\t\t\t\t\t\t\t\twrite: z.string().regex(/^%QX\\d+\\.[0-7]$/),\n\t\t\t\t\t\t\t\tstatus: z.string().regex(/^%IB\\d+$/),\n\t\t\t\t\t\t\t\trequests: z.string().regex(/^%ID\\d+$/),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\t// Channel comments name the logical IO bound at a pinned byte or bit.\n\t\t\t\tcomments: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz.strictObject({\n\t\t\t\t\t\t\taddress: channelAddress,\n\t\t\t\t\t\t\ttext: z.string().nonempty(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\t.default([]),\n\t\t\t}),\n\t\t)\n\t\t.nonempty(),\n\t// Variables mapped to pinned bit or byte channels, relative to the application.\n\tmappings: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\taddress: channelAddress,\n\t\t\t\tvariable: z.string().nonempty(),\n\t\t\t}),\n\t\t)\n\t\t.default([]),\n});\nexport type DeviceTree = z.input<typeof deviceTreeSchema>;\n/** A device or library version as CODESYS repositories spell it: four numbers. */\nexport const fourPartVersion = z.string().regex(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/);\n/** A controller's device repository identity, as CODESYS shows it under Device > Information. */\nexport const controllerSchema = z.strictObject({\n\ttype: z.number().int().positive(),\n\tid: z.string().regex(/^[0-9A-F]{4} [0-9A-F]{4}$/),\n\tversion: fourPartVersion,\n});\nexport type Controller = z.infer<typeof controllerSchema>;\n/** A controller the build image carries, named instead of spelled as its repository identity. */\nexport const controllerTargetSchema = controllerSchema\n\t.pick({ version: true })\n\t.extend({\n\t\ttarget: z.enum([\"linux-sl\", \"virtual-linux-arm64-sl\"]),\n\t});\nexport const controllerDevices = {\n\t\"linux-sl\": { type: 4102, id: \"0000 0005\" },\n\t\"virtual-linux-arm64-sl\": { type: 4096, id: \"0000 1008\" },\n} satisfies Record<\n\tz.infer<typeof controllerTargetSchema>[\"target\"],\n\tOmit<Controller, \"version\">\n>;\n/** The device name each controller target's runtime reports, as its OPC UA node ids spell it. */\nexport const controllerDeviceNames = {\n\t\"linux-sl\": \"CODESYS Control for Linux SL\",\n\t\"virtual-linux-arm64-sl\": \"CODESYS Virtual Control for Linux ARM64 SL\",\n} satisfies Record<z.infer<typeof controllerTargetSchema>[\"target\"], string>;\nexport const configSchema = z.strictObject({\n\tio: z.record(z.string(), directIoBindingSchema).optional(),\n\tdeviceTree: deviceTreeSchema.optional(),\n\t// Replaces the template's controller; the build image must carry its description.\n\tcontroller: controllerSchema.optional(),\n\tlibraryReferences: z.array(z.string().nonempty()).default([]),\n\tlibraries: z\n\t\t.array(\n\t\t\tz.strictObject({\n\t\t\t\ttitle: z.string(),\n\t\t\t\tcompany: z.string().optional(),\n\t\t\t\tversion: z.string().optional(),\n\t\t\t\tnamespace: z.string().optional(),\n\t\t\t\tpath: pathSchema,\n\t\t\t\tsha256: sha256Digest,\n\t\t\t\turl: z.string().optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n\tdocker: z\n\t\t.strictObject({\n\t\t\tcpuSet: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+(?:-\\d+)?(?:,\\d+(?:-\\d+)?)*$/)\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttemplate: pathSchema.optional(),\n\tsourceDir: pathSchema.default(\"src\"),\n\tentry: pathSchema.default(\"src/Main.st\"),\n\toutDir: pathSchema.default(\"build\"),\n\ttask: z.string().nonempty().default(\"MainTask\"),\n\ttasks: cyclicTasksSchema.optional(),\n\tremoveObjects: z.array(z.string().nonempty()).default([]),\n\tsymbols: z.boolean().default(false),\n\t/**\n\t * Experimental: a project imported into the template, as a build without a cached project or a\n\t * download without a baseline does, brings its POUs in one PLCopenXML import instead of one\n\t * call each, and falls back to one at a time on any error. A host setting, like `docker`.\n\t */\n\tbulkImport: z.boolean().optional(),\n\tonline: z\n\t\t.strictObject({\n\t\t\tnetwork: pathSchema.default(\"bridge\"),\n\t\t\tgateway: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(1217),\n\t\t\t}),\n\t\t\tdevice: z.strictObject({\n\t\t\t\thost: pathSchema,\n\t\t\t\tport: tcpPort.default(11740),\n\t\t\t}),\n\t\t\tcredentials: z\n\t\t\t\t.strictObject({\n\t\t\t\t\tusernameEnv: envName,\n\t\t\t\t\tpasswordEnv: envName,\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n\ttimeouts: z\n\t\t.strictObject({\n\t\t\tstartup: positiveMilliseconds.default(codesysTimeouts.startup),\n\t\t\tbuild: positiveMilliseconds.default(codesysTimeouts.build),\n\t\t\tstop: positiveMilliseconds.default(codesysTimeouts.stop),\n\t\t\tterminate: positiveMilliseconds.default(codesysTimeouts.terminate),\n\t\t\thostCommand: positiveMilliseconds.default(codesysTimeouts.hostCommand),\n\t\t\truntime: positiveMilliseconds.default(codesysTimeouts.runtime),\n\t\t\t// Unset rather than defaulted, so a release's config still loads on agents that predate them.\n\t\t\t/** A controller operation's work before it touches the controller; `build` when unset. */\n\t\t\tprepare: positiveMilliseconds.optional(),\n\t\t\t/** How long a controller transfer runs before it is reported overdue; it is never interrupted. */\n\t\t\ttransfer: positiveMilliseconds.optional(),\n\t\t})\n\t\t.prefault({}),\n});\nexport type CodesysBuildConfig = z.input<typeof configSchema>;\n\n/**\n * A controller operation's budgets: `prepare` for opening, importing and compiling, after which the\n * worker may be stopped because the controller is untouched; `transfer` for the transfer and what\n * confirms it, after which the operation is only reported overdue, since stopping CODESYS then could\n * leave the controller without an application.\n */\nexport const controllerBudgets = (\n\ttimeouts: z.output<typeof configSchema>[\"timeouts\"],\n) => ({\n\tprepare: timeouts.prepare ?? timeouts.build,\n\ttransfer: timeouts.transfer ?? codesysTimeouts.transfer,\n});\n\n/**\n * The build config a release carries to the plant agent. The agent supplies the output\n * directory and the controller connection; Docker settings belong to the host that built it.\n */\nexport const releaseConfigSchema = configSchema.omit({\n\tdocker: true,\n\toutDir: true,\n\tonline: true,\n\tbulkImport: true,\n});\nexport type ReleaseConfig = z.input<typeof releaseConfigSchema>;\n\n/** The build settings a TypeScript project passes its compiler; the compiler decides the rest. */\nexport const engineeringBuildSchema = configSchema.omit({\n\tsourceDir: true,\n\tentry: true,\n\toutDir: true,\n\ttask: true,\n\ttasks: true,\n});\n\nexport function engineeringBuildOptions(\n\tbuild: CodesysBuildConfig,\n): z.input<typeof engineeringBuildSchema> {\n\tconst {\n\t\tsourceDir: _source,\n\t\tentry: _entry,\n\t\toutDir: _out,\n\t\ttask: _task,\n\t\ttasks: _tasks,\n\t\t...settings\n\t} = build;\n\treturn settings;\n}\n",
|
|
7
7
|
"import { z } from \"zod\";\n\ninterface Diagnostic {\n\torigin: \"config\";\n\tcode: string;\n\tseverity: \"error\";\n\tmessage: string;\n}\n\nexport const nanosecondsPattern = /^[1-9][0-9]*$/;\nexport const durationSchema = z\n\t.object({\n\t\tkind: z.literal(\"duration\"),\n\t\tnanoseconds: z.string().regex(nanosecondsPattern),\n\t})\n\t.strict();\n\nexport type Duration = z.infer<typeof durationSchema>;\n\nfunction duration(value: number, scale: number): Duration {\n\tif (!Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(\"Task duration must be finite and positive.\");\n\t}\n\t// Keep task periods exact before serializing them for the compiler/backend.\n\tconst nanoseconds = value * scale;\n\tif (!Number.isSafeInteger(nanoseconds)) {\n\t\tthrow new Error(\n\t\t\t\"Task duration must be an exact, safe number of nanoseconds.\",\n\t\t);\n\t}\n\treturn { kind: \"duration\", nanoseconds: String(nanoseconds) };\n}\n\nexport const ns = (value: number): Duration => duration(value, 1);\nexport const ms = (value: number): Duration => duration(value, 1_000_000);\nexport const seconds = (value: number): Duration =>\n\tduration(value, 1_000_000_000);\n\n/** The helpers a config calls to write a duration, by the name it calls them. */\nexport const durationHelpers = { ns, ms, seconds };\n\nconst sourceExportSchema = z\n\t.object({ module: z.string().min(1), export: z.string().min(1) })\n\t.strict();\n// Names and priorities are only bounded here; a backend narrows them to what its scheduler accepts.\nexport const taskSchema = z.strictObject({\n\tname: z.string().nonempty(),\n\tschedule: z.strictObject({\n\t\tkind: z.literal(\"cyclic\"),\n\t\tinterval: durationSchema,\n\t}),\n\tpriority: z.number().int().nonnegative(),\n\tprograms: z.array(z.string().nonempty()).nonempty(),\n});\n\n// Shared configuration validates the target envelope. Each backend owns its\n// options schema and hardware-specific scheduling/addressing constraints.\nconst targetSchema = z\n\t.object({\n\t\tkind: z.string().min(1),\n\t\toptions: z.unknown().refine((value) => value !== undefined, {\n\t\t\tmessage: \"Target options are required.\",\n\t\t}),\n\t})\n\t.strict();\nconst common = {\n\tname: z.string().min(1),\n\ttsconfig: z.string().min(1),\n\ttasks: z.array(taskSchema).min(1),\n\ttarget: targetSchema,\n};\nconst entryConfigSchema = z\n\t.object({ ...common, entry: sourceExportSchema })\n\t.strict();\nconst programsConfigSchema = z\n\t.object({\n\t\t...common,\n\t\tprograms: z.record(z.string().min(1), sourceExportSchema),\n\t})\n\t.strict();\n\nexport interface TargetDescriptor<Options = unknown> {\n\tkind: string;\n\toptions: Options;\n}\nexport type SourceExport = z.infer<typeof sourceExportSchema>;\nexport type TaskConfig = Omit<z.infer<typeof taskSchema>, \"programs\"> & {\n\tprograms: readonly string[];\n};\n\nexport type PlcConfig<Target extends TargetDescriptor = TargetDescriptor> = {\n\tname: string;\n\ttsconfig: string;\n\ttasks: readonly TaskConfig[];\n\ttarget: Target;\n} & (\n\t| { entry: SourceExport; programs?: never }\n\t| { programs: Readonly<Record<string, SourceExport>>; entry?: never }\n);\n\nexport interface NormalizedConfig {\n\tname: string;\n\ttsconfig: string;\n\tprograms: Readonly<Record<string, SourceExport>>;\n\ttasks: readonly TaskConfig[];\n\ttarget: TargetDescriptor;\n}\n\nexport function definePlcConfig<const C extends PlcConfig>(config: C): C {\n\treturn config;\n}\n\nexport function validateConfig(value: unknown): {\n\tconfig?: NormalizedConfig;\n\tdiagnostics: readonly Diagnostic[];\n} {\n\tconst multiplePrograms =\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\tObject.hasOwn(value, \"programs\") &&\n\t\t!Object.hasOwn(value, \"entry\");\n\tconst parsed = (\n\t\tmultiplePrograms ? programsConfigSchema : entryConfigSchema\n\t).safeParse(value);\n\tif (!parsed.success) {\n\t\treturn {\n\t\t\tdiagnostics: parsed.error.issues.map((issue) => ({\n\t\t\t\torigin: \"config\",\n\t\t\t\tcode: \"PLC5001\",\n\t\t\t\tseverity: \"error\",\n\t\t\t\tmessage: `${issue.path.join(\".\") || \"config\"}: ${issue.message}`,\n\t\t\t})),\n\t\t};\n\t}\n\n\tconst { data } = parsed;\n\tconst programs = \"entry\" in data ? { main: data.entry } : data.programs;\n\tconst diagnostics: Diagnostic[] = [];\n\tconst report = (message: string): void => {\n\t\tdiagnostics.push({\n\t\t\torigin: \"config\",\n\t\t\tcode: \"PLC5002\",\n\t\t\tseverity: \"error\",\n\t\t\tmessage,\n\t\t});\n\t};\n\tif (Object.keys(programs).length === 0) {\n\t\treport(\"At least one program is required.\");\n\t}\n\n\t// A program has one scan owner. Preserve task call order while rejecting\n\t// unknown, duplicated, or unassigned program keys.\n\tconst taskNames = new Set<string>();\n\tconst assigned = new Set<string>();\n\tfor (const task of data.tasks) {\n\t\tif (taskNames.has(task.name)) {\n\t\t\treport(`Duplicate task name: ${task.name}.`);\n\t\t}\n\t\ttaskNames.add(task.name);\n\t\tfor (const program of task.programs) {\n\t\t\tif (!Object.hasOwn(programs, program)) {\n\t\t\t\treport(`Task ${task.name} references unknown program ${program}.`);\n\t\t\t}\n\t\t\tif (assigned.has(program)) {\n\t\t\t\treport(`Program ${program} must belong to exactly one task.`);\n\t\t\t}\n\t\t\tassigned.add(program);\n\t\t}\n\t}\n\tfor (const program of Object.keys(programs)) {\n\t\tif (!assigned.has(program)) {\n\t\t\treport(`Program ${program} is not assigned to a task.`);\n\t\t}\n\t}\n\n\tif (diagnostics.length) {\n\t\treturn { diagnostics };\n\t}\n\treturn {\n\t\tconfig: {\n\t\t\tname: data.name,\n\t\t\ttsconfig: data.tsconfig,\n\t\t\tprograms,\n\t\t\ttasks: data.tasks,\n\t\t\ttarget: data.target,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n",
|
|
8
8
|
"/** Generated project state, relative to the directory that holds a project's config. */\nexport const generatedDirectory = \".tsplc\";\n\n/** The ST the compiler emits, with the files it publishes beside it for typegen and the debugger. */\nexport const emittedStDirectory = `${generatedDirectory}/artifacts/st`;\n\n/** The files the compiler writes into `emittedStDirectory` for other tools to read. */\nexport const emittedFiles = {\n\tioSymbols: \"io-symbols.json\",\n\tpublication: \"publication.json\",\n\tmachines: \"machines.ts\",\n} as const;\n\n/** Typegen's materialized config and symbols, which the editor reads instead of executing the config. */\nexport const projectSnapshotFile = `${generatedDirectory}/project.json`;\n"
|
|
9
9
|
],
|
|
10
|
-
"mappings": ";AAAA,cAAS;;;ACAT,cAAS;;;ACAT;AASO,IAAM,qBAAqB;AAC3B,IAAM,iBAAiB,EAC5B,OAAO;AAAA,EACP,MAAM,EAAE,QAAQ,UAAU;AAAA,EAC1B,aAAa,EAAE,OAAO,EAAE,MAAM,kBAAkB;AACjD,CAAC,EACA,OAAO;AAIT,SAAS,QAAQ,CAAC,OAAe,OAAyB;AAAA,EACzD,IAAI,CAAC,OAAO,SAAS,KAAK,KAAK,SAAS,GAAG;AAAA,IAC1C,MAAM,IAAI,MAAM,4CAA4C;AAAA,EAC7D;AAAA,EAEA,MAAM,cAAc,QAAQ;AAAA,EAC5B,IAAI,CAAC,OAAO,cAAc,WAAW,GAAG;AAAA,IACvC,MAAM,IAAI,MACT,6DACD;AAAA,EACD;AAAA,EACA,OAAO,EAAE,MAAM,YAAY,aAAa,OAAO,WAAW,EAAE;AAAA;AAGtD,IAAM,KAAK,CAAC,UAA4B,SAAS,OAAO,CAAC;AACzD,IAAM,KAAK,CAAC,UAA4B,SAAS,OAAO,GAAS;AACjE,IAAM,UAAU,CAAC,UACvB,SAAS,OAAO,GAAa;AAGvB,IAAM,kBAAkB,EAAE,IAAI,IAAI,QAAQ;AAEjD,IAAM,qBAAqB,EACzB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,EAC/D,OAAO;AAEF,IAAM,aAAa,EAAE,aAAa;AAAA,EACxC,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,UAAU,EAAE,aAAa;AAAA,IACxB,MAAM,EAAE,QAAQ,QAAQ;AAAA,IACxB,UAAU;AAAA,EACX,CAAC;AAAA,EACD,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY;AAAA,EACvC,UAAU,E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@ -202,6 +202,11 @@ export const controllerDevices = {
|
|
|
202
202
|
z.infer<typeof controllerTargetSchema>["target"],
|
|
203
203
|
Omit<Controller, "version">
|
|
204
204
|
>;
|
|
205
|
+
/** The device name each controller target's runtime reports, as its OPC UA node ids spell it. */
|
|
206
|
+
export const controllerDeviceNames = {
|
|
207
|
+
"linux-sl": "CODESYS Control for Linux SL",
|
|
208
|
+
"virtual-linux-arm64-sl": "CODESYS Virtual Control for Linux ARM64 SL",
|
|
209
|
+
} satisfies Record<z.infer<typeof controllerTargetSchema>["target"], string>;
|
|
205
210
|
export const configSchema = z.strictObject({
|
|
206
211
|
io: z.record(z.string(), directIoBindingSchema).optional(),
|
|
207
212
|
deviceTree: deviceTreeSchema.optional(),
|
package/src/index.ts
CHANGED
package/src/schema.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
assemblyAddress,
|
|
4
4
|
type CodesysBuildConfig,
|
|
5
5
|
configSchema,
|
|
6
|
+
controllerDeviceNames,
|
|
6
7
|
controllerDevices,
|
|
7
8
|
controllerTargetSchema,
|
|
8
9
|
cyclicTasksSchema,
|
|
@@ -385,6 +386,15 @@ export const controllerFor = (config: ResolvedTsplcConfig, command: string) => {
|
|
|
385
386
|
);
|
|
386
387
|
};
|
|
387
388
|
|
|
389
|
+
/** The name of the device `command` runs on: the configured controller, else Linux SL, the local runtime `run` deploys to. */
|
|
390
|
+
export const controllerDeviceName = (
|
|
391
|
+
config: ResolvedTsplcConfig,
|
|
392
|
+
command: string,
|
|
393
|
+
) =>
|
|
394
|
+
controllerDeviceNames[
|
|
395
|
+
config.codesys?.controllers?.[buildTargetFor(command)]?.target ?? "linux-sl"
|
|
396
|
+
];
|
|
397
|
+
|
|
388
398
|
/**
|
|
389
399
|
* The variable holding the bearer token the PLC sends the project's own server: the HTTP
|
|
390
400
|
* credential for the server's base URL.
|