@erdoai/cli 0.78.0 → 0.79.0
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 +26 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -689,6 +689,16 @@ var ErdoClient = class {
|
|
|
689
689
|
input
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
|
+
// The reverse of attachWorkstreamResource. The API reads a DELETE's fields
|
|
693
|
+
// from the query string, so these ride there rather than in a body. Omitting
|
|
694
|
+
// relationship_type removes every link the workstream holds to the resource.
|
|
695
|
+
detachWorkstreamResource(slug, input) {
|
|
696
|
+
const q = new URLSearchParams();
|
|
697
|
+
q.set("resource_type", input.resource_type);
|
|
698
|
+
q.set("resource_id", input.resource_id);
|
|
699
|
+
if (input.relationship_type) q.set("relationship_type", input.relationship_type);
|
|
700
|
+
return this.request("DELETE", `/v1/workstreams/${encodeURIComponent(slug)}/resources?${q.toString()}`);
|
|
701
|
+
}
|
|
692
702
|
// --- experiments ---
|
|
693
703
|
listExperiments(params) {
|
|
694
704
|
const q = new URLSearchParams();
|
|
@@ -2440,6 +2450,22 @@ wsCmd.command("attach <slug>").description("Link a resource (page, dataset, hear
|
|
|
2440
2450
|
}
|
|
2441
2451
|
}
|
|
2442
2452
|
);
|
|
2453
|
+
wsCmd.command("detach <slug>").description("Unlink a resource from a workstream (the reverse of attach)").requiredOption("--type <resourceType>", "resource type (page, dataset, heartbeat, experiment_run, \u2026)").requiredOption("--id <resourceId>", "the resource's UUID").option(
|
|
2454
|
+
"--rel <relationshipType>",
|
|
2455
|
+
"which link to remove: output | input | evidence | monitoring | subject | parent | child | running. Omit to remove every link to this resource"
|
|
2456
|
+
).action(async (slug, opts) => {
|
|
2457
|
+
try {
|
|
2458
|
+
print(
|
|
2459
|
+
await new ErdoClient().detachWorkstreamResource(slug, {
|
|
2460
|
+
resource_type: opts.type,
|
|
2461
|
+
resource_id: opts.id,
|
|
2462
|
+
relationship_type: opts.rel
|
|
2463
|
+
})
|
|
2464
|
+
);
|
|
2465
|
+
} catch (e) {
|
|
2466
|
+
fail(e);
|
|
2467
|
+
}
|
|
2468
|
+
});
|
|
2443
2469
|
var VARIANT_SPEC_KEYS = /* @__PURE__ */ new Set([
|
|
2444
2470
|
"key",
|
|
2445
2471
|
"label",
|