@verentis/cli 0.2.19 → 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 +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -316,7 +316,9 @@ var SCOPES = {
|
|
|
316
316
|
packageCreate: "marketplace.package.create",
|
|
317
317
|
packagePublish: "marketplace.package.publish",
|
|
318
318
|
installCreate: "marketplace.install.create",
|
|
319
|
-
installDelete: "marketplace.install.delete"
|
|
319
|
+
installDelete: "marketplace.install.delete",
|
|
320
|
+
resourceReadAll: "resources.resource.read-all",
|
|
321
|
+
resourceUpdate: "resources.resource.update"
|
|
320
322
|
};
|
|
321
323
|
|
|
322
324
|
// src/api/scopes.ts
|
|
@@ -982,6 +984,10 @@ async function loadManifest(path) {
|
|
|
982
984
|
const kind = normalizeKind(manifest.kind);
|
|
983
985
|
const launchKindError = validateLaunchManifestKind(kind, manifest.spec);
|
|
984
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
|
+
}
|
|
985
991
|
const splashErrors = validateApplicationSplashSection(kind, manifest.spec);
|
|
986
992
|
if (splashErrors.length > 0) {
|
|
987
993
|
throw new Error(`Invalid manifest at ${path}: ${splashErrors.join(" ")}`);
|
|
@@ -1030,6 +1036,16 @@ function validateApplicationSplashSection(kind, spec) {
|
|
|
1030
1036
|
}
|
|
1031
1037
|
return errors;
|
|
1032
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
|
+
}
|
|
1033
1049
|
function validateMarketplaceSection(marketplace2) {
|
|
1034
1050
|
if (marketplace2 === void 0) return [];
|
|
1035
1051
|
if (!marketplace2 || typeof marketplace2 !== "object" || Array.isArray(marketplace2)) {
|
|
@@ -1152,6 +1168,7 @@ function validateManifest(manifest) {
|
|
|
1152
1168
|
validateManifestIcons(meta, spec, issues);
|
|
1153
1169
|
const launchKindError = validateLaunchManifestKind(kind, spec);
|
|
1154
1170
|
if (launchKindError) error(launchKindError);
|
|
1171
|
+
for (const message of validateWopiOperationsSection(spec)) error(message);
|
|
1155
1172
|
if (kind === "ExecutionEngine") {
|
|
1156
1173
|
const runtimes = spec.runtimes ?? {};
|
|
1157
1174
|
if (Object.keys(runtimes).length === 0) {
|
|
@@ -3291,9 +3308,13 @@ function registerRegistry(program2) {
|
|
|
3291
3308
|
const api = await createApiClient();
|
|
3292
3309
|
const { package: pkg } = await resolvePackageRef(api, ref);
|
|
3293
3310
|
const installationId = await api.request("POST", "/v1/installations", {
|
|
3294
|
-
// Marketplace forwards this token to Node for
|
|
3295
|
-
//
|
|
3296
|
-
scopes: [
|
|
3311
|
+
// Marketplace forwards this workspace-bound token to Node for extraction
|
|
3312
|
+
// and to Resource for the administrator's consent decision.
|
|
3313
|
+
scopes: [
|
|
3314
|
+
SCOPES.installCreate,
|
|
3315
|
+
"node.node.create",
|
|
3316
|
+
...pkg.kind === "Application" ? [SCOPES.resourceReadAll, SCOPES.resourceUpdate] : []
|
|
3317
|
+
],
|
|
3297
3318
|
tokenWorkspaceId: workspaceId,
|
|
3298
3319
|
body: {
|
|
3299
3320
|
workspaceId,
|