@erdoai/cli 0.85.0 → 0.86.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 +20 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1225,10 +1225,11 @@ var ErdoClient = class {
|
|
|
1225
1225
|
`/v1/integrations/${encodeURIComponent(integrationId)}`
|
|
1226
1226
|
);
|
|
1227
1227
|
}
|
|
1228
|
-
getConnectionScope(integrationId) {
|
|
1228
|
+
getConnectionScope(integrationId, params = {}) {
|
|
1229
|
+
const query = params.include_options === void 0 ? "" : `?include_options=${params.include_options}`;
|
|
1229
1230
|
return this.request(
|
|
1230
1231
|
"GET",
|
|
1231
|
-
`/v1/integrations/${encodeURIComponent(integrationId)}/connection-scope`
|
|
1232
|
+
`/v1/integrations/${encodeURIComponent(integrationId)}/connection-scope${query}`
|
|
1232
1233
|
);
|
|
1233
1234
|
}
|
|
1234
1235
|
setConnectionScope(integrationId, accountId) {
|
|
@@ -1317,9 +1318,12 @@ var ErdoClient = class {
|
|
|
1317
1318
|
);
|
|
1318
1319
|
}
|
|
1319
1320
|
// --- knowledge ---
|
|
1320
|
-
listKnowledge(visibility) {
|
|
1321
|
+
listKnowledge(visibility, options) {
|
|
1321
1322
|
const params = new URLSearchParams();
|
|
1322
1323
|
if (visibility) params.set("visibility", visibility);
|
|
1324
|
+
if (options?.record_type) params.set("record_type", options.record_type);
|
|
1325
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
1326
|
+
if (options?.offset !== void 0) params.set("offset", String(options.offset));
|
|
1323
1327
|
const qs = params.toString();
|
|
1324
1328
|
return this.request("GET", `/v1/knowledge${qs ? `?${qs}` : ""}`);
|
|
1325
1329
|
}
|
|
@@ -6147,20 +6151,24 @@ integrationsCmd.command("status <app>").description("Check whether an app is con
|
|
|
6147
6151
|
}
|
|
6148
6152
|
});
|
|
6149
6153
|
var accountCmd = integrationsCmd.command("account").description("Read or set which provider account a connection operates");
|
|
6150
|
-
accountCmd.command("show <integration-id>").description("Show which account a connection operates, and which it could (see: erdo integrations list)").action(async (integrationId) => {
|
|
6154
|
+
accountCmd.command("show <integration-id>").description("Show which account a connection operates, and which it could (see: erdo integrations list)").option("--no-options", "Read the stored account without contacting the provider").action(async (integrationId, opts) => {
|
|
6151
6155
|
try {
|
|
6152
|
-
const scope = await new ErdoClient().getConnectionScope(integrationId);
|
|
6156
|
+
const scope = await new ErdoClient().getConnectionScope(integrationId, { include_options: opts.options });
|
|
6153
6157
|
if (!scope.has_connection_scope) {
|
|
6154
6158
|
console.log("This integration does not choose a provider account per connection.");
|
|
6155
6159
|
return;
|
|
6156
6160
|
}
|
|
6157
6161
|
console.log(scope.description);
|
|
6158
6162
|
const selected = new Set(scope.selected.map((a) => a.id));
|
|
6159
|
-
for (const account of scope.options) {
|
|
6163
|
+
for (const account of opts.options ? scope.options : scope.selected) {
|
|
6160
6164
|
const marker = selected.has(account.id) ? "*" : " ";
|
|
6161
6165
|
const owner = account.parent ? ` ${account.parent}` : "";
|
|
6162
6166
|
console.log(`${marker} ${account.id} ${account.name} ${account.type}${owner}`);
|
|
6163
6167
|
}
|
|
6168
|
+
if (!opts.options) {
|
|
6169
|
+
if (scope.selected.length === 0) console.error("No account recorded on this connection.");
|
|
6170
|
+
return;
|
|
6171
|
+
}
|
|
6164
6172
|
if (scope.options.length === 0) {
|
|
6165
6173
|
console.error(
|
|
6166
6174
|
`
|
|
@@ -6339,9 +6347,13 @@ var knowledgeCmd = program.command("knowledge").description("Knowledge objects")
|
|
|
6339
6347
|
knowledgeCmd.command("list").description("List knowledge objects").option(
|
|
6340
6348
|
"--public",
|
|
6341
6349
|
"only entries opted into anonymous external surfaces (website widgets)"
|
|
6342
|
-
).action(async (opts) => {
|
|
6350
|
+
).option("--record-type <type>", "inspect typed records, including drafts (excludes archived)").option("--limit <n>", "page size (default 20, maximum 100)", (v) => parseInt(v, 10)).option("--offset <n>", "page offset; follow next_offset for typed records", (v) => parseInt(v, 10)).action(async (opts) => {
|
|
6343
6351
|
try {
|
|
6344
|
-
print(await new ErdoClient().listKnowledge(opts.public ? "public" : void 0
|
|
6352
|
+
print(await new ErdoClient().listKnowledge(opts.public ? "public" : void 0, {
|
|
6353
|
+
record_type: opts.recordType,
|
|
6354
|
+
limit: opts.limit,
|
|
6355
|
+
offset: opts.offset
|
|
6356
|
+
}));
|
|
6345
6357
|
} catch (e) {
|
|
6346
6358
|
fail(e);
|
|
6347
6359
|
}
|