@erdoai/cli 0.272.0 → 0.274.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 +25 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1769,6 +1769,11 @@ var ErdoClient = class {
|
|
|
1769
1769
|
upsertDeclaration(input) {
|
|
1770
1770
|
return this.request("PUT", "/v1/declarations", input, false);
|
|
1771
1771
|
}
|
|
1772
|
+
listDeclarations(params = {}) {
|
|
1773
|
+
const query = new URLSearchParams();
|
|
1774
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0) query.set(key, String(value));
|
|
1775
|
+
return this.request("GET", `/v1/declarations${query.size ? `?${query}` : ""}`, void 0, false);
|
|
1776
|
+
}
|
|
1772
1777
|
importLeadSourceRows(input) {
|
|
1773
1778
|
return this.request("POST", "/v1/provider-lead-sources/import", input, false);
|
|
1774
1779
|
}
|
|
@@ -2453,9 +2458,10 @@ var ErdoClient = class {
|
|
|
2453
2458
|
const qs = params.toString();
|
|
2454
2459
|
return this.request("GET", `/v1/knowledge${qs ? `?${qs}` : ""}`);
|
|
2455
2460
|
}
|
|
2456
|
-
searchKnowledge(query, limit) {
|
|
2461
|
+
searchKnowledge(query, limit, offset) {
|
|
2457
2462
|
const params = new URLSearchParams({ query });
|
|
2458
2463
|
if (limit) params.set("limit", String(limit));
|
|
2464
|
+
if (offset !== void 0) params.set("offset", String(offset));
|
|
2459
2465
|
return this.request("GET", `/v1/knowledge-search?${params.toString()}`);
|
|
2460
2466
|
}
|
|
2461
2467
|
deleteKnowledge(id) {
|
|
@@ -11571,6 +11577,22 @@ pipelinesCmd.command("mark-handled <slug>").description("Record that failed exec
|
|
|
11571
11577
|
}
|
|
11572
11578
|
});
|
|
11573
11579
|
var declarationsCmd = program.command("declarations").description("Metric and other declarations an app commits for this organization");
|
|
11580
|
+
declarationsCmd.command("list").description("List declarations and their semantic resolution").option("--namespace <namespace>", "exact namespace").option("--kind <kind>", "exact kind").option("--key <key>", "exact key").option("--source <source>", "exact source").option("--table <table>", "exact table").option("--limit <number>", "page size").option("--offset <number>", "page offset").action(async (opts) => {
|
|
11581
|
+
try {
|
|
11582
|
+
if (Boolean(opts.source) !== Boolean(opts.table)) throw new Error("--source and --table must be set together");
|
|
11583
|
+
print(await new ErdoClient().listDeclarations({
|
|
11584
|
+
namespace: opts.namespace,
|
|
11585
|
+
kind: opts.kind,
|
|
11586
|
+
key: opts.key,
|
|
11587
|
+
source: opts.source,
|
|
11588
|
+
table: opts.table,
|
|
11589
|
+
limit: opts.limit ? Number(opts.limit) : void 0,
|
|
11590
|
+
offset: opts.offset ? Number(opts.offset) : void 0
|
|
11591
|
+
}));
|
|
11592
|
+
} catch (e) {
|
|
11593
|
+
fail(e);
|
|
11594
|
+
}
|
|
11595
|
+
});
|
|
11574
11596
|
declarationsCmd.command("upsert").description("Write one declaration. The same namespace, kind, key and scope update the existing row").requiredOption("--namespace <namespace>", "the owning app's namespace").requiredOption("--kind <kind>", "declaration kind, for example metric").requiredOption("--key <key>", "what is declared, for example spend").option("--meaning <meaning>", "the expression; leave empty with --adopt to take the connector template").option("--status <status>", "confirmed only after the owning app merged it through a reviewed pull request; anything else is a draft", "draft").option("--source <source>", "synced source the declaration covers (requires --table)").option("--table <table>", "synced table the declaration covers (requires --source)").option("--adopt", "copy the connector template for this kind, key, source and table").option("--reasoning <text>", "why").option("--confidence <level>", "confidence in a proposal").action(async (opts) => {
|
|
11575
11597
|
try {
|
|
11576
11598
|
if (Boolean(opts.source) !== Boolean(opts.table)) throw new Error("--source and --table must be set together");
|
|
@@ -11724,9 +11746,9 @@ knowledgeCmd.command("list").description("List knowledge objects").option(
|
|
|
11724
11746
|
fail(e);
|
|
11725
11747
|
}
|
|
11726
11748
|
});
|
|
11727
|
-
knowledgeCmd.command("search <query>").description("Semantic search over knowledge").option("-l, --limit <n>", "max results", (v) => parseInt(v, 10)).action(async (query, opts) => {
|
|
11749
|
+
knowledgeCmd.command("search <query>").description("Semantic search over knowledge").option("-l, --limit <n>", "max results", (v) => parseInt(v, 10)).option("--offset <n>", "offset within the ranked window", (v) => parseInt(v, 10)).action(async (query, opts) => {
|
|
11728
11750
|
try {
|
|
11729
|
-
print(await new ErdoClient().searchKnowledge(query, opts.limit));
|
|
11751
|
+
print(await new ErdoClient().searchKnowledge(query, opts.limit, opts.offset));
|
|
11730
11752
|
} catch (e) {
|
|
11731
11753
|
fail(e);
|
|
11732
11754
|
}
|