@verentis/cli 0.2.28 → 0.2.29
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/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1215,6 +1215,7 @@ function validateActorSection(kind, spec) {
|
|
|
1215
1215
|
errors.push(`spec.actor.surfaces declares more than ${MAX_ACTOR_SURFACES} surfaces.`);
|
|
1216
1216
|
return errors;
|
|
1217
1217
|
}
|
|
1218
|
+
const appTools = declaredTools(applicationSpec);
|
|
1218
1219
|
surfaces.forEach((value, index) => {
|
|
1219
1220
|
const path = `spec.actor.surfaces[${index}]`;
|
|
1220
1221
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -1249,12 +1250,36 @@ function validateActorSection(kind, spec) {
|
|
|
1249
1250
|
if (surfaceKind === "native-collaboration" && applicationSpec.collaboration?.mode !== "native-scene-v1") {
|
|
1250
1251
|
errors.push(`${path} (native-collaboration) requires spec.collaboration.mode native-scene-v1.`);
|
|
1251
1252
|
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1253
|
+
for (const name of ["read-tool", "apply-tool"]) {
|
|
1254
|
+
const key = surface[name];
|
|
1255
|
+
if (key === void 0) continue;
|
|
1256
|
+
if (!ACTOR_FILE_KINDS.has(surfaceKind)) {
|
|
1257
|
+
errors.push(`${path}.${name} is only for file surfaces (${[...ACTOR_FILE_KINDS].join(", ")}).`);
|
|
1258
|
+
continue;
|
|
1259
|
+
}
|
|
1260
|
+
const tool = typeof key === "string" ? appTools.get(key) : void 0;
|
|
1261
|
+
if (!tool) {
|
|
1262
|
+
errors.push(`${path}.${name} must name a tool declared in spec.tools.`);
|
|
1263
|
+
} else if (name === "read-tool" && (tool.effect !== "read" || tool.approval === "always")) {
|
|
1264
|
+
errors.push(`${path}.read-tool '${key}' must be a read tool (effect: read) without approval: always.`);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
if (surfaceKind === "document" && surface["read-tool"] === void 0 && !Object.prototype.hasOwnProperty.call(applicationSpec, "wopi")) {
|
|
1268
|
+
errors.push(`${path} (document) requires spec.wopi or a read-tool.`);
|
|
1254
1269
|
}
|
|
1255
1270
|
});
|
|
1256
1271
|
return errors;
|
|
1257
1272
|
}
|
|
1273
|
+
function declaredTools(spec) {
|
|
1274
|
+
const tools = /* @__PURE__ */ new Map();
|
|
1275
|
+
if (!Array.isArray(spec.tools)) return tools;
|
|
1276
|
+
for (const tool of spec.tools) {
|
|
1277
|
+
if (tool && typeof tool === "object" && typeof tool.key === "string") {
|
|
1278
|
+
tools.set(tool.key, tool);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
return tools;
|
|
1282
|
+
}
|
|
1258
1283
|
function validateNativeCollaborationSection(kind, spec) {
|
|
1259
1284
|
if (!spec || typeof spec !== "object" || Array.isArray(spec) || !Object.prototype.hasOwnProperty.call(spec, "collaboration")) return [];
|
|
1260
1285
|
if (kind !== "Application") return ["spec.collaboration is only supported for Application manifests."];
|