@tsplc/config 0.2.17 → 0.2.19
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/README.md +2 -2
- package/dist/build.js +164 -133
- package/dist/build.js.map +7 -7
- package/dist/index.js +291 -208
- package/dist/index.js.map +8 -7
- package/dist/schema.js +249 -204
- package/dist/schema.js.map +5 -5
- package/package.json +50 -51
- package/src/build-schema.ts +220 -197
- package/src/build.ts +73 -63
- package/src/compiler.ts +140 -122
- package/src/environment.ts +72 -0
- package/src/index.ts +52 -1
- package/src/loader.ts +33 -15
- package/src/schema.ts +429 -356
- package/templates/provenance.json +6 -6
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @tsplc/config
|
|
2
2
|
|
|
3
|
-
Part of [tsPLC](https://github.com/
|
|
3
|
+
Part of [tsPLC](https://github.com/rip-technologies/tsplc).
|
|
4
4
|
|
|
5
5
|
The shared `tsplc.config.ts` schema: `defineConfig`, tasks, build and Docker settings, hardware devices, IO bindings, library dependencies, typegen and monitor options. Every tsPLC package and the editor read the same file.
|
|
6
6
|
|
|
7
|
-
See the [documentation](https://github.com/
|
|
7
|
+
See the [documentation](https://github.com/rip-technologies/tsplc/tree/main/docs). MIT licensed.
|
package/dist/build.js
CHANGED
|
@@ -10,11 +10,50 @@ var __esm = (fn, res, err) => () => {
|
|
|
10
10
|
return res;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
// packages/config/src/
|
|
13
|
+
// packages/config/src/compiler.ts
|
|
14
14
|
import { z } from "zod";
|
|
15
|
-
var
|
|
15
|
+
var nanosecondsPattern, durationSchema, sourceExportSchema, taskSchema, targetSchema, common, entryConfigSchema, programsConfigSchema;
|
|
16
|
+
var init_compiler = __esm(() => {
|
|
17
|
+
nanosecondsPattern = /^[1-9][0-9]*$/;
|
|
18
|
+
durationSchema = z.object({
|
|
19
|
+
kind: z.literal("duration"),
|
|
20
|
+
nanoseconds: z.string().regex(nanosecondsPattern)
|
|
21
|
+
}).strict();
|
|
22
|
+
sourceExportSchema = z.object({ module: z.string().min(1), export: z.string().min(1) }).strict();
|
|
23
|
+
taskSchema = z.strictObject({
|
|
24
|
+
name: z.string().nonempty(),
|
|
25
|
+
schedule: z.strictObject({
|
|
26
|
+
kind: z.literal("cyclic"),
|
|
27
|
+
interval: durationSchema
|
|
28
|
+
}),
|
|
29
|
+
priority: z.number().int().nonnegative(),
|
|
30
|
+
programs: z.array(z.string().nonempty()).nonempty()
|
|
31
|
+
});
|
|
32
|
+
targetSchema = z.object({
|
|
33
|
+
kind: z.string().min(1),
|
|
34
|
+
options: z.unknown().refine((value) => value !== undefined, {
|
|
35
|
+
message: "Target options are required."
|
|
36
|
+
})
|
|
37
|
+
}).strict();
|
|
38
|
+
common = {
|
|
39
|
+
name: z.string().min(1),
|
|
40
|
+
tsconfig: z.string().min(1),
|
|
41
|
+
tasks: z.array(taskSchema).min(1),
|
|
42
|
+
target: targetSchema
|
|
43
|
+
};
|
|
44
|
+
entryConfigSchema = z.object({ ...common, entry: sourceExportSchema }).strict();
|
|
45
|
+
programsConfigSchema = z.object({
|
|
46
|
+
...common,
|
|
47
|
+
programs: z.record(z.string().min(1), sourceExportSchema)
|
|
48
|
+
}).strict();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// packages/config/src/build-schema.ts
|
|
52
|
+
import { z as z2 } from "zod";
|
|
53
|
+
var commandArgumentSchema, codesysTimeouts, positiveMilliseconds, pathSchema, tcpPort, sha256Digest, envName, wineSchema, localCodesysSchema, dockerImage = "tsplc-build:latest", containerCodesys, iecName, taskPriority, cyclicTasksSchema, ioBindingOptions, directIoBindingSchema, ethernetSchema, assemblyAddress, processImageSchema, channelAddress, deviceTreeSchema, fourPartVersion, controllerSchema, controllerTargetSchema, configSchema;
|
|
16
54
|
var init_build_schema = __esm(() => {
|
|
17
|
-
|
|
55
|
+
init_compiler();
|
|
56
|
+
commandArgumentSchema = z2.string().refine((value) => value.trim().length > 0, "Command arguments must not be empty").refine((value) => !/["\r\n\0]/.test(value), "Command arguments must not contain quotes, line breaks, or null bytes");
|
|
18
57
|
codesysTimeouts = {
|
|
19
58
|
build: 20 * 60 * 1000,
|
|
20
59
|
hostCommand: 15000,
|
|
@@ -23,16 +62,19 @@ var init_build_schema = __esm(() => {
|
|
|
23
62
|
stop: 1e4,
|
|
24
63
|
terminate: 5000
|
|
25
64
|
};
|
|
26
|
-
positiveMilliseconds =
|
|
27
|
-
pathSchema =
|
|
28
|
-
|
|
65
|
+
positiveMilliseconds = z2.number().int().positive();
|
|
66
|
+
pathSchema = z2.string().trim().nonempty();
|
|
67
|
+
tcpPort = z2.number().int().min(1).max(65535);
|
|
68
|
+
sha256Digest = z2.string().regex(/^[a-f0-9]{64}$/);
|
|
69
|
+
envName = z2.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);
|
|
70
|
+
wineSchema = z2.strictObject({
|
|
29
71
|
prefix: pathSchema,
|
|
30
72
|
binary: pathSchema.default("wine"),
|
|
31
73
|
pathBinary: pathSchema.default("winepath"),
|
|
32
|
-
debug:
|
|
33
|
-
nativeExit:
|
|
74
|
+
debug: z2.string().default("-all"),
|
|
75
|
+
nativeExit: z2.boolean().default(false)
|
|
34
76
|
});
|
|
35
|
-
localCodesysSchema =
|
|
77
|
+
localCodesysSchema = z2.strictObject({
|
|
36
78
|
executable: commandArgumentSchema,
|
|
37
79
|
profile: commandArgumentSchema,
|
|
38
80
|
wine: wineSchema.optional(),
|
|
@@ -43,20 +85,22 @@ var init_build_schema = __esm(() => {
|
|
|
43
85
|
profile: "CODESYS V3.5 SP22 Patch 3",
|
|
44
86
|
wine: { prefix: "/tmp/codesys-wine", nativeExit: true }
|
|
45
87
|
};
|
|
46
|
-
iecName =
|
|
47
|
-
|
|
88
|
+
iecName = z2.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/);
|
|
89
|
+
taskPriority = z2.number().int().min(0).max(31);
|
|
90
|
+
cyclicTasksSchema = z2.array(z2.strictObject({
|
|
48
91
|
name: iecName,
|
|
49
|
-
intervalNanoseconds:
|
|
50
|
-
if (
|
|
92
|
+
intervalNanoseconds: z2.string().regex(nanosecondsPattern).refine((value) => {
|
|
93
|
+
if (!nanosecondsPattern.test(value)) {
|
|
51
94
|
return false;
|
|
52
95
|
}
|
|
53
96
|
const ns = BigInt(value);
|
|
54
97
|
return ns % 1000000n === 0n && ns <= 4294967295000000n;
|
|
55
98
|
}, "Cyclic tasks require an exact positive TIME interval in milliseconds"),
|
|
56
|
-
priority:
|
|
57
|
-
programs:
|
|
99
|
+
priority: taskPriority,
|
|
100
|
+
programs: z2.array(iecName).nonempty()
|
|
58
101
|
})).nonempty().superRefine((tasks, context) => {
|
|
59
|
-
const names = new Set
|
|
102
|
+
const names = new Set;
|
|
103
|
+
const programs = new Set;
|
|
60
104
|
tasks.forEach((task, index) => {
|
|
61
105
|
if (names.has(task.name.toLowerCase())) {
|
|
62
106
|
context.addIssue({
|
|
@@ -79,103 +123,106 @@ var init_build_schema = __esm(() => {
|
|
|
79
123
|
});
|
|
80
124
|
});
|
|
81
125
|
ioBindingOptions = {
|
|
82
|
-
inverted:
|
|
83
|
-
shared:
|
|
126
|
+
inverted: z2.boolean().optional(),
|
|
127
|
+
shared: z2.boolean().optional()
|
|
84
128
|
};
|
|
85
|
-
directIoBindingSchema =
|
|
86
|
-
address:
|
|
87
|
-
type:
|
|
129
|
+
directIoBindingSchema = z2.strictObject({
|
|
130
|
+
address: z2.string().regex(/^%[IQ](?:X\d+\.[0-7]|[BWD]\d+)$/),
|
|
131
|
+
type: z2.string().optional(),
|
|
88
132
|
...ioBindingOptions
|
|
89
133
|
});
|
|
90
|
-
ethernetSchema =
|
|
91
|
-
interface:
|
|
92
|
-
address:
|
|
93
|
-
subnet:
|
|
94
|
-
gateway:
|
|
134
|
+
ethernetSchema = z2.strictObject({
|
|
135
|
+
interface: z2.string().nonempty().optional(),
|
|
136
|
+
address: z2.ipv4().optional(),
|
|
137
|
+
subnet: z2.ipv4().optional(),
|
|
138
|
+
gateway: z2.ipv4().optional()
|
|
95
139
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
140
|
+
assemblyAddress = z2.string().regex(/^%[IQ]B\d+$/);
|
|
141
|
+
processImageSchema = z2.strictObject({
|
|
142
|
+
address: assemblyAddress,
|
|
143
|
+
size: z2.number().int().positive()
|
|
99
144
|
});
|
|
100
|
-
|
|
145
|
+
channelAddress = z2.string().regex(/^%[IQ](?:X\d+\.[0-7]|B\d+)$/);
|
|
146
|
+
deviceTreeSchema = z2.strictObject({
|
|
101
147
|
ethernet: ethernetSchema.default({}),
|
|
102
|
-
devices:
|
|
148
|
+
devices: z2.array(z2.strictObject({
|
|
103
149
|
name: iecName,
|
|
104
|
-
eds:
|
|
105
|
-
address:
|
|
106
|
-
rpiMicroseconds:
|
|
150
|
+
eds: z2.string().nonempty(),
|
|
151
|
+
address: z2.ipv4().optional(),
|
|
152
|
+
rpiMicroseconds: z2.number().int().positive().optional(),
|
|
107
153
|
inputs: processImageSchema.optional(),
|
|
108
154
|
outputs: processImageSchema.optional(),
|
|
109
|
-
modbus:
|
|
110
|
-
port:
|
|
111
|
-
registers:
|
|
155
|
+
modbus: z2.strictObject({
|
|
156
|
+
port: tcpPort,
|
|
157
|
+
registers: z2.array(z2.strictObject({
|
|
112
158
|
name: iecName,
|
|
113
|
-
offset:
|
|
114
|
-
value:
|
|
115
|
-
write:
|
|
116
|
-
status:
|
|
117
|
-
requests:
|
|
159
|
+
offset: z2.number().int().nonnegative(),
|
|
160
|
+
value: z2.string().regex(/^%QW\d+$/),
|
|
161
|
+
write: z2.string().regex(/^%QX\d+\.[0-7]$/),
|
|
162
|
+
status: z2.string().regex(/^%IB\d+$/),
|
|
163
|
+
requests: z2.string().regex(/^%ID\d+$/)
|
|
118
164
|
}))
|
|
119
165
|
}).optional(),
|
|
120
|
-
comments:
|
|
121
|
-
address:
|
|
122
|
-
text:
|
|
166
|
+
comments: z2.array(z2.strictObject({
|
|
167
|
+
address: channelAddress,
|
|
168
|
+
text: z2.string().nonempty()
|
|
123
169
|
})).default([])
|
|
124
170
|
})).nonempty(),
|
|
125
|
-
mappings:
|
|
126
|
-
address:
|
|
127
|
-
variable:
|
|
171
|
+
mappings: z2.array(z2.strictObject({
|
|
172
|
+
address: channelAddress,
|
|
173
|
+
variable: z2.string().nonempty()
|
|
128
174
|
})).default([])
|
|
129
175
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
176
|
+
fourPartVersion = z2.string().regex(/^\d+\.\d+\.\d+\.\d+$/);
|
|
177
|
+
controllerSchema = z2.strictObject({
|
|
178
|
+
type: z2.number().int().positive(),
|
|
179
|
+
id: z2.string().regex(/^[0-9A-F]{4} [0-9A-F]{4}$/),
|
|
180
|
+
version: fourPartVersion
|
|
134
181
|
});
|
|
135
182
|
controllerTargetSchema = controllerSchema.pick({ version: true }).extend({
|
|
136
|
-
target:
|
|
183
|
+
target: z2.enum(["linux-sl", "virtual-linux-arm64-sl"])
|
|
137
184
|
});
|
|
138
|
-
configSchema =
|
|
139
|
-
io:
|
|
185
|
+
configSchema = z2.strictObject({
|
|
186
|
+
io: z2.record(z2.string(), directIoBindingSchema).optional(),
|
|
140
187
|
deviceTree: deviceTreeSchema.optional(),
|
|
141
188
|
controller: controllerSchema.optional(),
|
|
142
|
-
libraryReferences:
|
|
143
|
-
libraries:
|
|
144
|
-
title:
|
|
145
|
-
company:
|
|
146
|
-
version:
|
|
147
|
-
namespace:
|
|
189
|
+
libraryReferences: z2.array(z2.string().nonempty()).default([]),
|
|
190
|
+
libraries: z2.array(z2.strictObject({
|
|
191
|
+
title: z2.string(),
|
|
192
|
+
company: z2.string().optional(),
|
|
193
|
+
version: z2.string().optional(),
|
|
194
|
+
namespace: z2.string().optional(),
|
|
148
195
|
path: pathSchema,
|
|
149
|
-
sha256:
|
|
150
|
-
url:
|
|
196
|
+
sha256: sha256Digest,
|
|
197
|
+
url: z2.string().optional()
|
|
151
198
|
})).optional(),
|
|
152
|
-
docker:
|
|
153
|
-
cpuSet:
|
|
199
|
+
docker: z2.strictObject({
|
|
200
|
+
cpuSet: z2.string().regex(/^\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*$/).optional()
|
|
154
201
|
}).optional(),
|
|
155
202
|
template: pathSchema.optional(),
|
|
156
203
|
sourceDir: pathSchema.default("src"),
|
|
157
204
|
entry: pathSchema.default("src/Main.st"),
|
|
158
205
|
outDir: pathSchema.default("build"),
|
|
159
|
-
task:
|
|
206
|
+
task: z2.string().nonempty().default("MainTask"),
|
|
160
207
|
tasks: cyclicTasksSchema.optional(),
|
|
161
|
-
removeObjects:
|
|
162
|
-
symbols:
|
|
163
|
-
online:
|
|
208
|
+
removeObjects: z2.array(z2.string().nonempty()).default([]),
|
|
209
|
+
symbols: z2.boolean().default(false),
|
|
210
|
+
online: z2.strictObject({
|
|
164
211
|
network: pathSchema.default("bridge"),
|
|
165
|
-
gateway:
|
|
212
|
+
gateway: z2.strictObject({
|
|
166
213
|
host: pathSchema,
|
|
167
|
-
port:
|
|
214
|
+
port: tcpPort.default(1217)
|
|
168
215
|
}),
|
|
169
|
-
device:
|
|
216
|
+
device: z2.strictObject({
|
|
170
217
|
host: pathSchema,
|
|
171
|
-
port:
|
|
218
|
+
port: tcpPort.default(11740)
|
|
172
219
|
}),
|
|
173
|
-
credentials:
|
|
174
|
-
usernameEnv:
|
|
175
|
-
passwordEnv:
|
|
220
|
+
credentials: z2.strictObject({
|
|
221
|
+
usernameEnv: envName,
|
|
222
|
+
passwordEnv: envName
|
|
176
223
|
}).optional()
|
|
177
224
|
}).optional(),
|
|
178
|
-
timeouts:
|
|
225
|
+
timeouts: z2.strictObject({
|
|
179
226
|
startup: positiveMilliseconds.default(codesysTimeouts.startup),
|
|
180
227
|
build: positiveMilliseconds.default(codesysTimeouts.build),
|
|
181
228
|
stop: positiveMilliseconds.default(codesysTimeouts.stop),
|
|
@@ -186,46 +233,21 @@ var init_build_schema = __esm(() => {
|
|
|
186
233
|
});
|
|
187
234
|
});
|
|
188
235
|
|
|
189
|
-
// packages/config/src/compiler.ts
|
|
190
|
-
import { z as z2 } from "zod";
|
|
191
|
-
var durationSchema, sourceExportSchema, taskSchema, targetSchema, common, entryConfigSchema, programsConfigSchema;
|
|
192
|
-
var init_compiler = __esm(() => {
|
|
193
|
-
durationSchema = z2.object({
|
|
194
|
-
kind: z2.literal("duration"),
|
|
195
|
-
nanoseconds: z2.string().regex(/^[1-9][0-9]*$/)
|
|
196
|
-
}).strict();
|
|
197
|
-
sourceExportSchema = z2.object({ module: z2.string().min(1), export: z2.string().min(1) }).strict();
|
|
198
|
-
taskSchema = z2.object({
|
|
199
|
-
name: z2.string().min(1),
|
|
200
|
-
schedule: z2.object({ kind: z2.literal("cyclic"), interval: durationSchema }).strict(),
|
|
201
|
-
priority: z2.number().int().nonnegative(),
|
|
202
|
-
programs: z2.array(z2.string().min(1)).min(1)
|
|
203
|
-
}).strict();
|
|
204
|
-
targetSchema = z2.object({
|
|
205
|
-
kind: z2.string().min(1),
|
|
206
|
-
options: z2.unknown().refine((value) => value !== undefined, { message: "Target options are required." })
|
|
207
|
-
}).strict();
|
|
208
|
-
common = {
|
|
209
|
-
name: z2.string().min(1),
|
|
210
|
-
tsconfig: z2.string().min(1),
|
|
211
|
-
tasks: z2.array(taskSchema).min(1),
|
|
212
|
-
target: targetSchema
|
|
213
|
-
};
|
|
214
|
-
entryConfigSchema = z2.object({ ...common, entry: sourceExportSchema }).strict();
|
|
215
|
-
programsConfigSchema = z2.object({ ...common, programs: z2.record(z2.string().min(1), sourceExportSchema) }).strict();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
236
|
// packages/config/src/schema.ts
|
|
219
237
|
import { z as z3 } from "zod";
|
|
220
238
|
function rawBuildConfig(config) {
|
|
221
|
-
if (config.compiler)
|
|
239
|
+
if (config.compiler) {
|
|
222
240
|
throw new Error("Use the compiler build plan for TypeScript projects.");
|
|
223
|
-
|
|
241
|
+
}
|
|
242
|
+
if (!config.build) {
|
|
224
243
|
throw new Error("Configure build settings.");
|
|
225
|
-
|
|
244
|
+
}
|
|
245
|
+
if (!config.tasks) {
|
|
226
246
|
return config.build;
|
|
227
|
-
|
|
247
|
+
}
|
|
248
|
+
if (config.build.tasks || config.build.task !== undefined) {
|
|
228
249
|
throw new Error("Configure the raw ST schedule in tasks or build.tasks/build.task, not both.");
|
|
250
|
+
}
|
|
229
251
|
return {
|
|
230
252
|
...config.build,
|
|
231
253
|
tasks: cyclicTasksSchema.parse(config.tasks.map((task) => ({
|
|
@@ -236,7 +258,7 @@ function rawBuildConfig(config) {
|
|
|
236
258
|
})))
|
|
237
259
|
};
|
|
238
260
|
}
|
|
239
|
-
var httpOptionsSchema, ioBindingSchema, assemblySchema, hardwareDeviceSchema, dependencySchema,
|
|
261
|
+
var httpOptionsSchema, ioBindingSchema, assemblySchema, hardwareDeviceSchema, dependencySchema, codesysTaskSchema, monitorSchema, telemetrySchema, debugSchema, typegenSchema, buildTargetSchema, publicationSchema, hmiTarget, hmiControlSchema, hmiSchema, tsplcConfigSchema;
|
|
240
262
|
var init_schema = __esm(() => {
|
|
241
263
|
init_build_schema();
|
|
242
264
|
init_compiler();
|
|
@@ -244,10 +266,10 @@ var init_schema = __esm(() => {
|
|
|
244
266
|
httpOptionsSchema = z3.strictObject({
|
|
245
267
|
timeoutMs: z3.number().int().positive().max(60000).default(2000),
|
|
246
268
|
credentials: z3.array(z3.strictObject({
|
|
247
|
-
originEnv:
|
|
248
|
-
bearerTokenEnv:
|
|
269
|
+
originEnv: envName,
|
|
270
|
+
bearerTokenEnv: envName
|
|
249
271
|
})).default([])
|
|
250
|
-
}).
|
|
272
|
+
}).prefault({});
|
|
251
273
|
ioBindingSchema = z3.union([
|
|
252
274
|
directIoBindingSchema,
|
|
253
275
|
z3.strictObject({
|
|
@@ -259,7 +281,7 @@ var init_schema = __esm(() => {
|
|
|
259
281
|
assemblySchema = z3.strictObject({
|
|
260
282
|
assembly: z3.number().int().nonnegative().optional(),
|
|
261
283
|
size: z3.number().int().positive().optional(),
|
|
262
|
-
address:
|
|
284
|
+
address: assemblyAddress.optional()
|
|
263
285
|
});
|
|
264
286
|
hardwareDeviceSchema = z3.strictObject({
|
|
265
287
|
file: z3.string().min(1),
|
|
@@ -267,8 +289,8 @@ var init_schema = __esm(() => {
|
|
|
267
289
|
inputs: assemblySchema.optional(),
|
|
268
290
|
outputs: assemblySchema.optional(),
|
|
269
291
|
modbus: z3.strictObject({
|
|
270
|
-
port:
|
|
271
|
-
registers: z3.record(
|
|
292
|
+
port: tcpPort.default(502),
|
|
293
|
+
registers: z3.record(iecName, z3.number().int().min(0).max(65535))
|
|
272
294
|
}).optional(),
|
|
273
295
|
statusSymbols: z3.record(z3.string(), z3.string()).optional(),
|
|
274
296
|
network: z3.strictObject({
|
|
@@ -277,19 +299,17 @@ var init_schema = __esm(() => {
|
|
|
277
299
|
}).optional()
|
|
278
300
|
});
|
|
279
301
|
dependencySchema = z3.union([
|
|
280
|
-
|
|
302
|
+
fourPartVersion,
|
|
281
303
|
z3.strictObject({
|
|
282
|
-
version:
|
|
304
|
+
version: fourPartVersion,
|
|
283
305
|
company: z3.string().optional(),
|
|
284
306
|
namespace: z3.string().optional()
|
|
285
307
|
}),
|
|
286
308
|
z3.strictObject({ path: z3.string().min(1), namespace: z3.string().optional() })
|
|
287
309
|
]);
|
|
288
|
-
|
|
289
|
-
name:
|
|
290
|
-
|
|
291
|
-
priority: z3.number().int().min(0).max(31),
|
|
292
|
-
programs: z3.array(z3.string().min(1)).nonempty()
|
|
310
|
+
codesysTaskSchema = taskSchema.extend({
|
|
311
|
+
name: iecName,
|
|
312
|
+
priority: taskPriority
|
|
293
313
|
});
|
|
294
314
|
monitorSchema = z3.strictObject({
|
|
295
315
|
endpoint: z3.string().url(),
|
|
@@ -299,26 +319,29 @@ var init_schema = __esm(() => {
|
|
|
299
319
|
securityPolicy: z3.enum(["None", "Basic256Sha256"]).optional(),
|
|
300
320
|
certificateDirectory: z3.string().min(1).default(".tsplc/opcua-pki"),
|
|
301
321
|
username: z3.string().min(1).optional(),
|
|
302
|
-
passwordEnv:
|
|
322
|
+
passwordEnv: envName.optional()
|
|
303
323
|
}).superRefine((monitor, context) => {
|
|
304
|
-
if (monitor.securityPolicy && monitor.securityMode === "None" !== (monitor.securityPolicy === "None"))
|
|
324
|
+
if (monitor.securityPolicy && monitor.securityMode === "None" !== (monitor.securityPolicy === "None")) {
|
|
305
325
|
context.addIssue({
|
|
306
326
|
code: "custom",
|
|
307
327
|
path: ["securityPolicy"],
|
|
308
328
|
message: "None mode requires None policy; secure modes require Basic256Sha256."
|
|
309
329
|
});
|
|
310
|
-
|
|
330
|
+
}
|
|
331
|
+
if (monitor.passwordEnv && !monitor.username) {
|
|
311
332
|
context.addIssue({
|
|
312
333
|
code: "custom",
|
|
313
334
|
path: ["username"],
|
|
314
335
|
message: "Configure username when passwordEnv is used."
|
|
315
336
|
});
|
|
316
|
-
|
|
337
|
+
}
|
|
338
|
+
if (monitor.username && monitor.securityMode === "None") {
|
|
317
339
|
context.addIssue({
|
|
318
340
|
code: "custom",
|
|
319
341
|
path: ["securityMode"],
|
|
320
342
|
message: "Username authentication requires a secure OPC-UA connection."
|
|
321
343
|
});
|
|
344
|
+
}
|
|
322
345
|
}).transform((monitor) => ({
|
|
323
346
|
...monitor,
|
|
324
347
|
securityPolicy: monitor.securityPolicy ?? (monitor.securityMode === "None" ? "None" : "Basic256Sha256")
|
|
@@ -341,7 +364,7 @@ var init_schema = __esm(() => {
|
|
|
341
364
|
requests: z3.strictObject({
|
|
342
365
|
capacity: z3.number().int().min(1).max(1e5).default(1000),
|
|
343
366
|
bodies: z3.boolean().default(false)
|
|
344
|
-
}).
|
|
367
|
+
}).prefault({})
|
|
345
368
|
});
|
|
346
369
|
typegenSchema = z3.strictObject({
|
|
347
370
|
types: z3.union([z3.string(), z3.array(z3.string())]).optional(),
|
|
@@ -408,7 +431,7 @@ var init_schema = __esm(() => {
|
|
|
408
431
|
tsconfig: z3.string().default("tsconfig.json"),
|
|
409
432
|
programs: z3.record(z3.string(), z3.strictObject({ module: z3.string(), export: z3.string() }))
|
|
410
433
|
}).optional(),
|
|
411
|
-
tasks: z3.array(
|
|
434
|
+
tasks: z3.array(codesysTaskSchema).nonempty().optional(),
|
|
412
435
|
build: configSchema.extend({ task: configSchema.shape.task.unwrap().optional() }).optional(),
|
|
413
436
|
codesys: z3.strictObject({
|
|
414
437
|
http: httpOptionsSchema.optional(),
|
|
@@ -427,7 +450,12 @@ var init_schema = __esm(() => {
|
|
|
427
450
|
monitor: monitorSchema.optional(),
|
|
428
451
|
hmi: hmiSchema.optional(),
|
|
429
452
|
telemetry: telemetrySchema.optional(),
|
|
430
|
-
debug: debugSchema.optional()
|
|
453
|
+
debug: debugSchema.optional(),
|
|
454
|
+
targets: z3.record(z3.string().nonempty(), z3.strictObject({ values: z3.record(envName, z3.string()) })).default({}),
|
|
455
|
+
secrets: z3.strictObject({
|
|
456
|
+
service: z3.string().nonempty(),
|
|
457
|
+
names: z3.array(envName).nonempty()
|
|
458
|
+
}).optional()
|
|
431
459
|
});
|
|
432
460
|
});
|
|
433
461
|
|
|
@@ -486,9 +514,12 @@ export {
|
|
|
486
514
|
directIoBindingSchema,
|
|
487
515
|
dockerImage,
|
|
488
516
|
ethernetSchema,
|
|
517
|
+
iecName,
|
|
489
518
|
loadConfig,
|
|
490
|
-
resolveConfig
|
|
519
|
+
resolveConfig,
|
|
520
|
+
sha256Digest,
|
|
521
|
+
tcpPort
|
|
491
522
|
};
|
|
492
523
|
|
|
493
|
-
//# debugId=
|
|
524
|
+
//# debugId=7A1CA68A674161A564756E2164756E21
|
|
494
525
|
//# sourceMappingURL=build.js.map
|