@verentis/cli 0.2.20 → 0.2.21

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 CHANGED
@@ -984,6 +984,10 @@ async function loadManifest(path) {
984
984
  const kind = normalizeKind(manifest.kind);
985
985
  const launchKindError = validateLaunchManifestKind(kind, manifest.spec);
986
986
  if (launchKindError) throw new Error(`Invalid manifest at ${path}: ${launchKindError}.`);
987
+ const operationErrors = validateWopiOperationsSection(manifest.spec);
988
+ if (operationErrors.length > 0) {
989
+ throw new Error(`Invalid manifest at ${path}: ${operationErrors.join(" ")}`);
990
+ }
987
991
  const splashErrors = validateApplicationSplashSection(kind, manifest.spec);
988
992
  if (splashErrors.length > 0) {
989
993
  throw new Error(`Invalid manifest at ${path}: ${splashErrors.join(" ")}`);
@@ -1032,6 +1036,16 @@ function validateApplicationSplashSection(kind, spec) {
1032
1036
  }
1033
1037
  return errors;
1034
1038
  }
1039
+ function validateWopiOperationsSection(spec) {
1040
+ if (!spec || typeof spec !== "object" || Array.isArray(spec)) return [];
1041
+ const wopi = spec.wopi;
1042
+ if (!wopi || typeof wopi !== "object" || Array.isArray(wopi) || !Object.prototype.hasOwnProperty.call(wopi, "operations")) return [];
1043
+ const operations = wopi.operations;
1044
+ if (!Array.isArray(operations) || operations.length > 2 || operations.some((operation) => operation !== "rename" && operation !== "delete") || new Set(operations).size !== operations.length) {
1045
+ return ["spec.wopi.operations must be a unique list containing only rename and delete; omit it to request neither."];
1046
+ }
1047
+ return [];
1048
+ }
1035
1049
  function validateMarketplaceSection(marketplace2) {
1036
1050
  if (marketplace2 === void 0) return [];
1037
1051
  if (!marketplace2 || typeof marketplace2 !== "object" || Array.isArray(marketplace2)) {
@@ -1154,6 +1168,7 @@ function validateManifest(manifest) {
1154
1168
  validateManifestIcons(meta, spec, issues);
1155
1169
  const launchKindError = validateLaunchManifestKind(kind, spec);
1156
1170
  if (launchKindError) error(launchKindError);
1171
+ for (const message of validateWopiOperationsSection(spec)) error(message);
1157
1172
  if (kind === "ExecutionEngine") {
1158
1173
  const runtimes = spec.runtimes ?? {};
1159
1174
  if (Object.keys(runtimes).length === 0) {