@alva-ai/toolkit 0.16.1-beta.1 → 0.16.1-beta.2
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/browser.global.js +2 -2
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +49 -84
- package/dist/cli.js +163 -151
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +36 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -85
- package/dist/index.d.ts +50 -85
- package/dist/index.js +36 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9506,6 +9506,7 @@ var CliUsageError = class extends Error {
|
|
|
9506
9506
|
};
|
|
9507
9507
|
|
|
9508
9508
|
// src/resources/fs.ts
|
|
9509
|
+
var WRITE_FLAG_APPEND = 1 << 0;
|
|
9509
9510
|
function isValidUtf8(bytes) {
|
|
9510
9511
|
let i = 0;
|
|
9511
9512
|
while (i < bytes.length) {
|
|
@@ -9573,7 +9574,8 @@ var FsResource = class {
|
|
|
9573
9574
|
body: {
|
|
9574
9575
|
path: params.path,
|
|
9575
9576
|
data: params.data,
|
|
9576
|
-
mkdir_parents: params.mkdir_parents
|
|
9577
|
+
mkdir_parents: params.mkdir_parents,
|
|
9578
|
+
...params.append ? { flags: WRITE_FLAG_APPEND } : {}
|
|
9577
9579
|
}
|
|
9578
9580
|
});
|
|
9579
9581
|
}
|
|
@@ -9583,7 +9585,8 @@ var FsResource = class {
|
|
|
9583
9585
|
return this.client._request("POST", "/api/v1/fs/write", {
|
|
9584
9586
|
query: {
|
|
9585
9587
|
path: params.path,
|
|
9586
|
-
mkdir_parents: params.mkdir_parents
|
|
9588
|
+
mkdir_parents: params.mkdir_parents,
|
|
9589
|
+
...params.append ? { flags: WRITE_FLAG_APPEND } : {}
|
|
9587
9590
|
},
|
|
9588
9591
|
rawBody: params.body
|
|
9589
9592
|
});
|
|
@@ -11821,19 +11824,6 @@ var NotificationsResource = class {
|
|
|
11821
11824
|
this.client = client;
|
|
11822
11825
|
}
|
|
11823
11826
|
client;
|
|
11824
|
-
/**
|
|
11825
|
-
* List the caller's notification history for one playbook
|
|
11826
|
-
* `(username, name)`. Returns `NOT_FOUND` when the playbook is
|
|
11827
|
-
* private or does not exist (the two cases are deliberately
|
|
11828
|
-
* indistinguishable to prevent namespace enumeration).
|
|
11829
|
-
*/
|
|
11830
|
-
async listPlaybook(params) {
|
|
11831
|
-
this.client._requireAuth();
|
|
11832
|
-
const path = `/api/v1/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}/notifications`;
|
|
11833
|
-
return this.client._request("GET", path, {
|
|
11834
|
-
query: buildQuery(params)
|
|
11835
|
-
});
|
|
11836
|
-
}
|
|
11837
11827
|
/**
|
|
11838
11828
|
* List the caller's notification history for one feed
|
|
11839
11829
|
* `(username, name)`. Authorization is alfs read on
|
|
@@ -11900,27 +11890,27 @@ var SubscriptionsResource = class {
|
|
|
11900
11890
|
}
|
|
11901
11891
|
client;
|
|
11902
11892
|
/**
|
|
11903
|
-
*
|
|
11904
|
-
*
|
|
11905
|
-
* able to read the playbook — public passes; paid requires an active unlock;
|
|
11906
|
-
* private requires owner/admin.
|
|
11893
|
+
* Follow a playbook `(username, name)`. Alerts are independent and require
|
|
11894
|
+
* explicit FEED subscriptions. Idempotent.
|
|
11907
11895
|
*/
|
|
11908
|
-
async
|
|
11896
|
+
async followPlaybook(params) {
|
|
11909
11897
|
this.client._requireAuth();
|
|
11910
|
-
const path = `/api/v1/
|
|
11898
|
+
const path = `/api/v1/follows/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
11911
11899
|
return this.client._request(
|
|
11912
11900
|
"POST",
|
|
11913
11901
|
path
|
|
11914
11902
|
);
|
|
11915
11903
|
}
|
|
11916
11904
|
/**
|
|
11917
|
-
*
|
|
11918
|
-
* all of its push alerts for the caller. Idempotent.
|
|
11905
|
+
* Unfollow a playbook `(username, name)` without changing FEED alerts.
|
|
11919
11906
|
*/
|
|
11920
|
-
async
|
|
11907
|
+
async unfollowPlaybook(params) {
|
|
11921
11908
|
this.client._requireAuth();
|
|
11922
|
-
const path = `/api/v1/
|
|
11923
|
-
return this.client._request(
|
|
11909
|
+
const path = `/api/v1/follows/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
11910
|
+
return this.client._request(
|
|
11911
|
+
"DELETE",
|
|
11912
|
+
path
|
|
11913
|
+
);
|
|
11924
11914
|
}
|
|
11925
11915
|
/**
|
|
11926
11916
|
* Subscribe to one feed `(username, name)` — enable personal push for that
|
|
@@ -11972,12 +11962,23 @@ var SubscriptionsResource = class {
|
|
|
11972
11962
|
query
|
|
11973
11963
|
});
|
|
11974
11964
|
}
|
|
11965
|
+
/** Atomically enable alerts for FEED target ids (max 100). */
|
|
11966
|
+
async subscribeBatch(params) {
|
|
11967
|
+
this.client._requireAuth();
|
|
11968
|
+
return this.client._request(
|
|
11969
|
+
"POST",
|
|
11970
|
+
"/api/v1/subscriptions/subscribe-batch",
|
|
11971
|
+
{
|
|
11972
|
+
body: {
|
|
11973
|
+
feed_ids: params.feedIds,
|
|
11974
|
+
channel_id: params.channelId
|
|
11975
|
+
}
|
|
11976
|
+
}
|
|
11977
|
+
);
|
|
11978
|
+
}
|
|
11975
11979
|
/**
|
|
11976
|
-
* Disable alerts for many
|
|
11977
|
-
*
|
|
11978
|
-
* for ghost rows (deleted targets) because no name resolution happens —
|
|
11979
|
-
* the per-id results report `INVALID_ID` for malformed entries while
|
|
11980
|
-
* valid ones proceed. Safe to re-run: already-gone rows are no-ops.
|
|
11980
|
+
* Disable alerts for many FEED targets by id in one idempotent call (max
|
|
11981
|
+
* 100 ids). The per-id results report `INVALID_ID` for malformed entries.
|
|
11981
11982
|
*/
|
|
11982
11983
|
async unsubscribeBatch(params) {
|
|
11983
11984
|
this.client._requireAuth();
|
|
@@ -11986,8 +11987,7 @@ var SubscriptionsResource = class {
|
|
|
11986
11987
|
"/api/v1/subscriptions/unsubscribe-batch",
|
|
11987
11988
|
{
|
|
11988
11989
|
body: {
|
|
11989
|
-
|
|
11990
|
-
feed_ids: params.feedIds ?? []
|
|
11990
|
+
feed_ids: params.feedIds
|
|
11991
11991
|
}
|
|
11992
11992
|
}
|
|
11993
11993
|
);
|
|
@@ -12012,11 +12012,8 @@ var AlertsResource = class {
|
|
|
12012
12012
|
disableAutomation(params) {
|
|
12013
12013
|
return this.client.subscriptions.unsubscribeFeed(params);
|
|
12014
12014
|
}
|
|
12015
|
-
|
|
12016
|
-
return this.client.subscriptions.
|
|
12017
|
-
}
|
|
12018
|
-
disablePlaybook(params) {
|
|
12019
|
-
return this.client.subscriptions.unsubscribePlaybook(params);
|
|
12015
|
+
enableBatch(params) {
|
|
12016
|
+
return this.client.subscriptions.subscribeBatch(params);
|
|
12020
12017
|
}
|
|
12021
12018
|
disableBatch(params) {
|
|
12022
12019
|
return this.client.subscriptions.unsubscribeBatch(params);
|
|
@@ -12024,9 +12021,6 @@ var AlertsResource = class {
|
|
|
12024
12021
|
historyAutomation(params) {
|
|
12025
12022
|
return this.client.notifications.listFeed(params);
|
|
12026
12023
|
}
|
|
12027
|
-
historyPlaybook(params) {
|
|
12028
|
-
return this.client.notifications.listPlaybook(params);
|
|
12029
|
-
}
|
|
12030
12024
|
preferences() {
|
|
12031
12025
|
return this.client.notificationPreferences.list();
|
|
12032
12026
|
}
|
|
@@ -13649,9 +13643,6 @@ function formatAlertList(result) {
|
|
|
13649
13643
|
return lines.join("\n");
|
|
13650
13644
|
}
|
|
13651
13645
|
function alertTitle(alert) {
|
|
13652
|
-
if (alert.playbook) {
|
|
13653
|
-
return `${alert.playbook.owner_username}/${alert.playbook.name}`;
|
|
13654
|
-
}
|
|
13655
13646
|
if (alert.feed_name) return alert.feed_name;
|
|
13656
13647
|
return alert.target?.id ? `target ${alert.target.id}` : "(unknown target)";
|
|
13657
13648
|
}
|
|
@@ -13661,7 +13652,7 @@ import * as fs2 from "fs";
|
|
|
13661
13652
|
import * as os2 from "os";
|
|
13662
13653
|
import * as fsPromises2 from "fs/promises";
|
|
13663
13654
|
import { Agent, setGlobalDispatcher } from "undici";
|
|
13664
|
-
var CLI_VERSION = true ? "0.16.1-beta.
|
|
13655
|
+
var CLI_VERSION = true ? "0.16.1-beta.2" : "dev";
|
|
13665
13656
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
13666
13657
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
13667
13658
|
var configuredRunFetchTimeoutMs;
|
|
@@ -13706,10 +13697,10 @@ Commands:
|
|
|
13706
13697
|
skillhub Playbook skills (list, tags, get, file)
|
|
13707
13698
|
data-skills Data-skill documentation from the Arrays backend (list, summary, endpoint)
|
|
13708
13699
|
comments Playbook comments (create, pin, unpin)
|
|
13709
|
-
notification-history
|
|
13700
|
+
notification-history Feed notification delivery history (list-feed)
|
|
13710
13701
|
notification-preferences Notification preferences (list, enable-session-completed, disable-session-completed)
|
|
13711
13702
|
feedback Submit user-confirmed Alva platform feedback (submit)
|
|
13712
|
-
subscriptions
|
|
13703
|
+
subscriptions Playbook follows and feed alert subscriptions
|
|
13713
13704
|
channel Channel group operations (group-subscriptions context, list, subscribe, unsubscribe)
|
|
13714
13705
|
remix Save playbook remix lineage
|
|
13715
13706
|
portfolio Connected-account portfolio (accounts, summary, activities)
|
|
@@ -13863,7 +13854,7 @@ Subcommands:
|
|
|
13863
13854
|
Subcommand flags:
|
|
13864
13855
|
read --path (required), [--offset <n>], [--size <n>]
|
|
13865
13856
|
write --path (required), --data <text> OR --file <local-path> (one required),
|
|
13866
|
-
[--mkdir-parents | --no-mkdir-parents]
|
|
13857
|
+
[--append], [--mkdir-parents | --no-mkdir-parents]
|
|
13867
13858
|
stat --path (required)
|
|
13868
13859
|
readdir --path (required), [--recursive | --no-recursive]
|
|
13869
13860
|
mkdir --path (required)
|
|
@@ -13901,6 +13892,7 @@ Examples:
|
|
|
13901
13892
|
alva fs read --path "~/feeds/btc-ema/v1/data/metrics/prices/@last/100"
|
|
13902
13893
|
alva fs read --path /alva/home/alice/feeds/btc-ema/v1/data/metrics/prices/@last/10
|
|
13903
13894
|
alva fs write --path "~/hello.txt" --data "Hello, world!"
|
|
13895
|
+
alva fs write --path "~/journal.md" --data "New entry" --append
|
|
13904
13896
|
alva fs write --path "~/feeds/my-feed/v1/src/index.js" --file ./local-script.js --mkdir-parents
|
|
13905
13897
|
alva fs stat --path "~/hello.txt"
|
|
13906
13898
|
alva fs mkdir --path "~/feeds/my-feed/v1/src"
|
|
@@ -14140,27 +14132,25 @@ Examples:
|
|
|
14140
14132
|
alva automation delete --id 42`,
|
|
14141
14133
|
alert: `Usage: alva alert <subcommand> [options]
|
|
14142
14134
|
|
|
14143
|
-
Manage alerts.
|
|
14144
|
-
|
|
14135
|
+
Manage alerts. Alert subscriptions target automations (feeds) only. Playbook
|
|
14136
|
+
follows are independent; delivery history and global preferences live here too.
|
|
14145
14137
|
|
|
14146
14138
|
Subcommands:
|
|
14147
14139
|
list List the caller's active alerts
|
|
14148
14140
|
follows List the playbooks the caller follows
|
|
14149
|
-
enable Enable
|
|
14150
|
-
disable Disable alerts by automation
|
|
14151
|
-
history List alert delivery history for an automation
|
|
14141
|
+
enable Enable alerts by automation name or ids
|
|
14142
|
+
disable Disable alerts by automation name or ids
|
|
14143
|
+
history List alert delivery history for an automation
|
|
14152
14144
|
preferences List global alert preferences
|
|
14153
14145
|
enable-session-completed
|
|
14154
14146
|
disable-session-completed
|
|
14155
14147
|
|
|
14156
14148
|
Target flags:
|
|
14157
14149
|
--automation <owner/name> Automation target
|
|
14158
|
-
--playbook <owner/name> Playbook target
|
|
14159
14150
|
|
|
14160
|
-
|
|
14151
|
+
Enable/disable-by-id flags:
|
|
14161
14152
|
--automation-ids <a,b> Comma-separated automation target ids
|
|
14162
|
-
--
|
|
14163
|
-
--feed-ids <a,b> Legacy alias for --automation-ids
|
|
14153
|
+
--channel-id <id> Delivery channel for batch enable (optional)
|
|
14164
14154
|
|
|
14165
14155
|
List flags:
|
|
14166
14156
|
--first <n> Optional page size
|
|
@@ -14181,9 +14171,8 @@ Examples:
|
|
|
14181
14171
|
alva alert follows --limit 20
|
|
14182
14172
|
alva alert enable --automation alice/btc-ema
|
|
14183
14173
|
alva alert disable --automation alice/btc-ema
|
|
14184
|
-
alva alert enable --
|
|
14174
|
+
alva alert enable --automation-ids 13292,13293
|
|
14185
14175
|
alva alert disable --automation-ids 13292
|
|
14186
|
-
alva alert disable --feed-ids 13292
|
|
14187
14176
|
alva alert history --automation alice/btc-ema --status sent
|
|
14188
14177
|
alva alert preferences`,
|
|
14189
14178
|
feed: `Usage: alva feed <subcommand> [options]
|
|
@@ -14577,16 +14566,15 @@ Examples:
|
|
|
14577
14566
|
alva comments unpin --comment-id 12`,
|
|
14578
14567
|
"notification-history": `Usage: alva notification-history <subcommand> [options]
|
|
14579
14568
|
|
|
14580
|
-
Read the caller's delivered notification history scoped to a
|
|
14569
|
+
Read the caller's delivered notification history scoped to a feed.
|
|
14581
14570
|
This is an audit/history surface, not a subscription toggle.
|
|
14582
14571
|
|
|
14583
14572
|
Subcommands:
|
|
14584
|
-
list-playbook List notification history for a playbook
|
|
14585
14573
|
list-feed List notification history for a feed
|
|
14586
14574
|
|
|
14587
14575
|
Common flags:
|
|
14588
14576
|
--username <user> Owner's username (required)
|
|
14589
|
-
--name <name> URL-safe
|
|
14577
|
+
--name <name> URL-safe feed name (required)
|
|
14590
14578
|
--channel <name> Optional delivery channel filter (telegram, web, ...)
|
|
14591
14579
|
--status <status> Optional status filter (sent, failed, filtered)
|
|
14592
14580
|
--since <seconds> Optional Unix seconds lower bound
|
|
@@ -14594,7 +14582,6 @@ Common flags:
|
|
|
14594
14582
|
--cursor <token> Optional cursor from the previous page
|
|
14595
14583
|
|
|
14596
14584
|
Examples:
|
|
14597
|
-
alva notification-history list-playbook --username alice --name btc-dashboard --first 5
|
|
14598
14585
|
alva notification-history list-feed --username alice --name btc-ema --status sent`,
|
|
14599
14586
|
"notification-preferences": `Usage: alva notification-preferences <subcommand>
|
|
14600
14587
|
|
|
@@ -14639,33 +14626,28 @@ Three DISTINCT concepts share the word "subscribe" in the product:
|
|
|
14639
14626
|
- PURCHASE \u2014 paid playbook access / the SaaS plan. NOT this command.
|
|
14640
14627
|
|
|
14641
14628
|
Operations:
|
|
14642
|
-
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
- subscribe-feed / unsubscribe-feed toggle ONE feed's alert (a single
|
|
14647
|
-
automation) without touching the playbook follow.
|
|
14648
|
-
- unsubscribe disables alerts BY TARGET ID \u2014 bulk, idempotent, and the
|
|
14649
|
-
only way to clear ghost rows whose playbook/feed was deleted
|
|
14650
|
-
(name-addressed unsubscribe 404s on deleted targets).
|
|
14629
|
+
- follow-playbook / unfollow-playbook change only the social follow.
|
|
14630
|
+
- subscribe-feed / unsubscribe-feed toggle one feed's alert.
|
|
14631
|
+
- subscribe / unsubscribe toggle alerts for FEED ids in a batch. They never
|
|
14632
|
+
follow or unfollow a playbook.
|
|
14651
14633
|
|
|
14652
14634
|
Subcommands:
|
|
14653
|
-
|
|
14654
|
-
|
|
14635
|
+
follow-playbook Follow a playbook without changing alerts
|
|
14636
|
+
unfollow-playbook Unfollow a playbook without changing alerts
|
|
14655
14637
|
subscribe-feed Enable alerts for a single feed
|
|
14656
14638
|
unsubscribe-feed Disable alerts for a single feed
|
|
14657
|
-
|
|
14639
|
+
subscribe Bulk enable alerts by feed id
|
|
14640
|
+
unsubscribe Bulk disable alerts by feed id
|
|
14658
14641
|
list List the caller's active alert subscriptions
|
|
14659
14642
|
follows List the playbooks the caller follows
|
|
14660
14643
|
|
|
14661
|
-
|
|
14644
|
+
Name-addressed flags:
|
|
14662
14645
|
--username <user> Owner's username (required)
|
|
14663
14646
|
--name <name> URL-safe playbook or feed name (required)
|
|
14664
14647
|
|
|
14665
|
-
|
|
14666
|
-
--playbook-ids <a,b> Comma-separated playbook target ids
|
|
14648
|
+
Batch flags:
|
|
14667
14649
|
--feed-ids <a,b> Comma-separated feed target ids
|
|
14668
|
-
|
|
14650
|
+
--channel-id <id> Delivery channel for subscribe (optional)
|
|
14669
14651
|
|
|
14670
14652
|
List flags:
|
|
14671
14653
|
--first <n> Optional page size (response carries total_count \u2014
|
|
@@ -14677,42 +14659,41 @@ Follows flags:
|
|
|
14677
14659
|
--cursor <token> Optional cursor from the previous page
|
|
14678
14660
|
|
|
14679
14661
|
List response notes:
|
|
14680
|
-
items[].kind
|
|
14681
|
-
items[].target_status ACTIVE | TARGET_DELETED
|
|
14682
|
-
unsubscribe --playbook-ids/--feed-ids) | PAUSED
|
|
14683
|
-
items[].playbook {owner_username, name, display_name} for PLAYBOOK rows
|
|
14662
|
+
items[].kind FEED_ALERT
|
|
14663
|
+
items[].target_status ACTIVE | TARGET_DELETED | PAUSED
|
|
14684
14664
|
|
|
14685
14665
|
Examples:
|
|
14686
|
-
alva subscriptions
|
|
14666
|
+
alva subscriptions follow-playbook --username alice --name btc-dashboard
|
|
14687
14667
|
alva subscriptions subscribe-feed --username alice --name btc-ema-cross
|
|
14688
|
-
alva subscriptions
|
|
14668
|
+
alva subscriptions subscribe --feed-ids 13292,13293
|
|
14669
|
+
alva subscriptions unsubscribe --feed-ids 13292,13293
|
|
14689
14670
|
alva subscriptions list --first 200
|
|
14690
14671
|
alva subscriptions follows`,
|
|
14691
14672
|
channel: `Usage: alva channel group-subscriptions <subcommand> [options]
|
|
14692
14673
|
|
|
14693
14674
|
Manage push notifications delivered into the external group chat attached
|
|
14694
|
-
to a channel session. The group can subscribe to public feeds
|
|
14675
|
+
to a channel session. The group can subscribe to public feeds.
|
|
14695
14676
|
Subscribe/unsubscribe are idempotent no-ops unless the authenticated caller
|
|
14696
14677
|
is that group's Alva admin.
|
|
14697
14678
|
|
|
14698
14679
|
Subcommands:
|
|
14699
14680
|
context Show group admin status and current subscriptions
|
|
14700
14681
|
list List active subscriptions for the group
|
|
14701
|
-
subscribe Subscribe the group to a public feed
|
|
14702
|
-
unsubscribe Unsubscribe the group from a feed
|
|
14682
|
+
subscribe Subscribe the group to a public feed
|
|
14683
|
+
unsubscribe Unsubscribe the group from a feed
|
|
14703
14684
|
|
|
14704
14685
|
Common flags:
|
|
14705
14686
|
--session-id <id> Channel session id for the group (required)
|
|
14706
14687
|
|
|
14707
14688
|
Subscribe/unsubscribe flags:
|
|
14708
|
-
--target-type <type> feed
|
|
14709
|
-
--target-id <id> Numeric feed_id
|
|
14689
|
+
--target-type <type> feed (required)
|
|
14690
|
+
--target-id <id> Numeric feed_id (required)
|
|
14710
14691
|
|
|
14711
14692
|
Examples:
|
|
14712
14693
|
alva channel group-subscriptions context --session-id 123
|
|
14713
14694
|
alva channel group-subscriptions list --session-id 123
|
|
14714
14695
|
alva channel group-subscriptions subscribe --session-id 123 --target-type feed --target-id 8169
|
|
14715
|
-
alva channel group-subscriptions unsubscribe --session-id 123 --target-type
|
|
14696
|
+
alva channel group-subscriptions unsubscribe --session-id 123 --target-type feed --target-id 8169`,
|
|
14716
14697
|
remix: `Usage: alva remix --child-username <u> --child-name <n> --parents <json>
|
|
14717
14698
|
|
|
14718
14699
|
Record remix lineage when creating a playbook based on existing playbooks.
|
|
@@ -14893,6 +14874,7 @@ async function handleConfigure(args, deps) {
|
|
|
14893
14874
|
var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
14894
14875
|
"recursive",
|
|
14895
14876
|
"mkdir-parents",
|
|
14877
|
+
"append",
|
|
14896
14878
|
"push-notify",
|
|
14897
14879
|
"help",
|
|
14898
14880
|
"execute-latest",
|
|
@@ -15082,9 +15064,9 @@ function configureRunFetchTimeout(timeoutMs, deps) {
|
|
|
15082
15064
|
}
|
|
15083
15065
|
function requireGroupSubscriptionTargetType(flags, command) {
|
|
15084
15066
|
const val = requireFlag(flags, "target-type", command).trim().toLowerCase();
|
|
15085
|
-
if (val === "feed"
|
|
15067
|
+
if (val === "feed") return val;
|
|
15086
15068
|
throw new CliUsageError(
|
|
15087
|
-
`--target-type must be feed
|
|
15069
|
+
`--target-type must be feed for '${command}', got '${val}'`,
|
|
15088
15070
|
command.split(" ")[0]
|
|
15089
15071
|
);
|
|
15090
15072
|
}
|
|
@@ -15109,25 +15091,20 @@ function parseOwnerNameTarget(value, flag, command) {
|
|
|
15109
15091
|
}
|
|
15110
15092
|
return { username, name };
|
|
15111
15093
|
}
|
|
15112
|
-
function
|
|
15113
|
-
|
|
15114
|
-
const playbook = flags["playbook"];
|
|
15115
|
-
if ((automation ? 1 : 0) + (playbook ? 1 : 0) !== 1) {
|
|
15094
|
+
function rejectPlaybookAlertTarget(flags, command) {
|
|
15095
|
+
if (flags["playbook"] !== void 0 || flags["playbook-ids"] !== void 0) {
|
|
15116
15096
|
throw new CliUsageError(
|
|
15117
|
-
`
|
|
15097
|
+
`Playbook alert targets are unsupported for '${command}'; use --automation or --automation-ids`,
|
|
15118
15098
|
"alert"
|
|
15119
15099
|
);
|
|
15120
15100
|
}
|
|
15121
|
-
|
|
15122
|
-
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
kind: "playbook",
|
|
15129
|
-
target: parseOwnerNameTarget(playbook, "playbook", command)
|
|
15130
|
-
};
|
|
15101
|
+
}
|
|
15102
|
+
function requireAutomationAlertTarget(flags, command) {
|
|
15103
|
+
return parseOwnerNameTarget(
|
|
15104
|
+
requireFlag(flags, "automation", command),
|
|
15105
|
+
"automation",
|
|
15106
|
+
command
|
|
15107
|
+
);
|
|
15131
15108
|
}
|
|
15132
15109
|
function feedReleaseParams(flags, command) {
|
|
15133
15110
|
return {
|
|
@@ -15548,13 +15525,15 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15548
15525
|
return client.fs.rawWrite({
|
|
15549
15526
|
path: requireFlag(flags, "path", "fs write"),
|
|
15550
15527
|
body: fileData,
|
|
15551
|
-
mkdir_parents: boolFlag(flags["mkdir-parents"]) ?? true
|
|
15528
|
+
mkdir_parents: boolFlag(flags["mkdir-parents"]) ?? true,
|
|
15529
|
+
append: boolFlag(flags["append"])
|
|
15552
15530
|
});
|
|
15553
15531
|
}
|
|
15554
15532
|
return client.fs.write({
|
|
15555
15533
|
path: requireFlag(flags, "path", "fs write"),
|
|
15556
15534
|
data: requireFlag(flags, "data", "fs write"),
|
|
15557
|
-
mkdir_parents: boolFlag(flags["mkdir-parents"]) ?? true
|
|
15535
|
+
mkdir_parents: boolFlag(flags["mkdir-parents"]) ?? true,
|
|
15536
|
+
append: boolFlag(flags["append"])
|
|
15558
15537
|
});
|
|
15559
15538
|
case "stat":
|
|
15560
15539
|
return client.fs.stat({
|
|
@@ -16410,8 +16389,6 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16410
16389
|
cursor: flags["cursor"]
|
|
16411
16390
|
};
|
|
16412
16391
|
switch (subcommand) {
|
|
16413
|
-
case "list-playbook":
|
|
16414
|
-
return client.notifications.listPlaybook(params);
|
|
16415
16392
|
case "list-feed":
|
|
16416
16393
|
return client.notifications.listFeed(params);
|
|
16417
16394
|
default:
|
|
@@ -16481,31 +16458,23 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16481
16458
|
"subscriptions"
|
|
16482
16459
|
);
|
|
16483
16460
|
switch (subcommand) {
|
|
16484
|
-
case "
|
|
16485
|
-
return client.subscriptions.
|
|
16461
|
+
case "follow-playbook":
|
|
16462
|
+
return client.subscriptions.followPlaybook({
|
|
16486
16463
|
username: requireFlag(
|
|
16487
16464
|
flags,
|
|
16488
16465
|
"username",
|
|
16489
|
-
|
|
16466
|
+
`subscriptions ${subcommand}`
|
|
16490
16467
|
),
|
|
16491
|
-
name: requireFlag(
|
|
16492
|
-
flags,
|
|
16493
|
-
"name",
|
|
16494
|
-
"subscriptions subscribe-playbook"
|
|
16495
|
-
)
|
|
16468
|
+
name: requireFlag(flags, "name", `subscriptions ${subcommand}`)
|
|
16496
16469
|
});
|
|
16497
|
-
case "
|
|
16498
|
-
return client.subscriptions.
|
|
16470
|
+
case "unfollow-playbook":
|
|
16471
|
+
return client.subscriptions.unfollowPlaybook({
|
|
16499
16472
|
username: requireFlag(
|
|
16500
16473
|
flags,
|
|
16501
16474
|
"username",
|
|
16502
|
-
|
|
16475
|
+
`subscriptions ${subcommand}`
|
|
16503
16476
|
),
|
|
16504
|
-
name: requireFlag(
|
|
16505
|
-
flags,
|
|
16506
|
-
"name",
|
|
16507
|
-
"subscriptions unsubscribe-playbook"
|
|
16508
|
-
)
|
|
16477
|
+
name: requireFlag(flags, "name", `subscriptions ${subcommand}`)
|
|
16509
16478
|
});
|
|
16510
16479
|
case "subscribe-feed":
|
|
16511
16480
|
return client.subscriptions.subscribeFeed({
|
|
@@ -16535,20 +16504,39 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16535
16504
|
limit: num(flags["limit"]),
|
|
16536
16505
|
cursor: flags["cursor"]
|
|
16537
16506
|
});
|
|
16538
|
-
case "
|
|
16539
|
-
|
|
16540
|
-
const feedIds = csvList(flags["feed-ids"]) ?? [];
|
|
16541
|
-
if (playbookIds.length === 0 && feedIds.length === 0) {
|
|
16507
|
+
case "subscribe": {
|
|
16508
|
+
if (flags["playbook-ids"] !== void 0) {
|
|
16542
16509
|
throw new CliUsageError(
|
|
16543
|
-
"
|
|
16510
|
+
"Playbook alert targets are unsupported; use --feed-ids",
|
|
16544
16511
|
"subscriptions"
|
|
16545
16512
|
);
|
|
16546
16513
|
}
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16514
|
+
const feedIds = csvList(flags["feed-ids"]) ?? [];
|
|
16515
|
+
if (feedIds.length === 0) {
|
|
16516
|
+
throw new CliUsageError("--feed-ids is required", "subscriptions");
|
|
16517
|
+
}
|
|
16518
|
+
return client.subscriptions.subscribeBatch({
|
|
16519
|
+
feedIds,
|
|
16520
|
+
channelId: flags["channel-id"] === void 0 ? void 0 : requirePositiveIntegerStringFlag(
|
|
16521
|
+
flags,
|
|
16522
|
+
"channel-id",
|
|
16523
|
+
"subscriptions subscribe"
|
|
16524
|
+
)
|
|
16550
16525
|
});
|
|
16551
16526
|
}
|
|
16527
|
+
case "unsubscribe": {
|
|
16528
|
+
if (flags["playbook-ids"] !== void 0) {
|
|
16529
|
+
throw new CliUsageError(
|
|
16530
|
+
"Playbook alert targets are unsupported; use --feed-ids",
|
|
16531
|
+
"subscriptions"
|
|
16532
|
+
);
|
|
16533
|
+
}
|
|
16534
|
+
const feedIds = csvList(flags["feed-ids"]) ?? [];
|
|
16535
|
+
if (feedIds.length === 0) {
|
|
16536
|
+
throw new CliUsageError("--feed-ids is required", "subscriptions");
|
|
16537
|
+
}
|
|
16538
|
+
return client.subscriptions.unsubscribeBatch({ feedIds });
|
|
16539
|
+
}
|
|
16552
16540
|
default:
|
|
16553
16541
|
throw new CliUsageError(
|
|
16554
16542
|
`Unknown subcommand: subscriptions ${subcommand}`,
|
|
@@ -16573,33 +16561,57 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16573
16561
|
cursor: flags["cursor"]
|
|
16574
16562
|
});
|
|
16575
16563
|
case "enable": {
|
|
16576
|
-
|
|
16577
|
-
|
|
16564
|
+
rejectPlaybookAlertTarget(flags, "alert enable");
|
|
16565
|
+
const automationIds = csvList(flags["automation-ids"]) ?? [];
|
|
16566
|
+
if (automationIds.length > 0) {
|
|
16567
|
+
if (flags["automation"] !== void 0) {
|
|
16568
|
+
throw new CliUsageError(
|
|
16569
|
+
"Provide either --automation or --automation-ids for 'alert enable'",
|
|
16570
|
+
"alert"
|
|
16571
|
+
);
|
|
16572
|
+
}
|
|
16573
|
+
return client.alerts.enableBatch({
|
|
16574
|
+
feedIds: automationIds,
|
|
16575
|
+
channelId: flags["channel-id"] === void 0 ? void 0 : requirePositiveIntegerStringFlag(
|
|
16576
|
+
flags,
|
|
16577
|
+
"channel-id",
|
|
16578
|
+
"alert enable"
|
|
16579
|
+
)
|
|
16580
|
+
});
|
|
16581
|
+
}
|
|
16582
|
+
return client.alerts.enableAutomation(
|
|
16583
|
+
requireAutomationAlertTarget(flags, "alert enable")
|
|
16584
|
+
);
|
|
16578
16585
|
}
|
|
16579
16586
|
case "disable": {
|
|
16580
|
-
|
|
16581
|
-
const
|
|
16582
|
-
if (automationIds.length > 0
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
+
rejectPlaybookAlertTarget(flags, "alert disable");
|
|
16588
|
+
const automationIds = csvList(flags["automation-ids"]) ?? [];
|
|
16589
|
+
if (automationIds.length > 0) {
|
|
16590
|
+
if (flags["automation"] !== void 0) {
|
|
16591
|
+
throw new CliUsageError(
|
|
16592
|
+
"Provide either --automation or --automation-ids for 'alert disable'",
|
|
16593
|
+
"alert"
|
|
16594
|
+
);
|
|
16595
|
+
}
|
|
16596
|
+
return client.alerts.disableBatch({ feedIds: automationIds });
|
|
16587
16597
|
}
|
|
16588
|
-
|
|
16589
|
-
|
|
16598
|
+
return client.alerts.disableAutomation(
|
|
16599
|
+
requireAutomationAlertTarget(flags, "alert disable")
|
|
16600
|
+
);
|
|
16590
16601
|
}
|
|
16591
16602
|
case "history": {
|
|
16592
|
-
|
|
16603
|
+
rejectPlaybookAlertTarget(flags, "alert history");
|
|
16604
|
+
const target = requireAutomationAlertTarget(flags, "alert history");
|
|
16593
16605
|
const params = {
|
|
16594
|
-
username: target.
|
|
16595
|
-
name: target.
|
|
16606
|
+
username: target.username,
|
|
16607
|
+
name: target.name,
|
|
16596
16608
|
channel: flags["channel"],
|
|
16597
16609
|
status: flags["status"],
|
|
16598
16610
|
since_time: num(flags["since"]),
|
|
16599
16611
|
first: num(flags["first"]),
|
|
16600
16612
|
cursor: flags["cursor"]
|
|
16601
16613
|
};
|
|
16602
|
-
return
|
|
16614
|
+
return client.alerts.historyAutomation(params);
|
|
16603
16615
|
}
|
|
16604
16616
|
case "preferences":
|
|
16605
16617
|
return client.alerts.preferences();
|