@alva-ai/toolkit 0.15.0 → 0.15.1-beta.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.cjs CHANGED
@@ -20,8 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ AlertsResource: () => AlertsResource,
23
24
  AlvaClient: () => AlvaClient,
24
25
  AlvaError: () => AlvaError,
26
+ AutomationResource: () => AutomationResource,
25
27
  CliUsageError: () => CliUsageError,
26
28
  PBSV_UPDATE_MESSAGE: () => PBSV_UPDATE_MESSAGE,
27
29
  SUBSCRIBE_PROPOSE_MESSAGE: () => SUBSCRIBE_PROPOSE_MESSAGE,
@@ -452,6 +454,19 @@ var FeedResource = class {
452
454
  this.client = client;
453
455
  }
454
456
  client;
457
+ /**
458
+ * List feeds owned by the caller. Backed by GET /api/v1/feed.
459
+ */
460
+ async list(params = {}) {
461
+ this.client._requireAuth();
462
+ return this.client._request("GET", "/api/v1/feed", {
463
+ query: {
464
+ limit: params.limit,
465
+ cursor: params.cursor,
466
+ status: params.status
467
+ }
468
+ });
469
+ }
455
470
  /**
456
471
  * Stop a feed's producer cronjob. This pauses future scheduled runs while
457
472
  * preserving the feed and its existing data.
@@ -503,6 +518,46 @@ function requireFeedID(id) {
503
518
  return id;
504
519
  }
505
520
 
521
+ // src/resources/automation.ts
522
+ var AutomationResource = class {
523
+ constructor(client) {
524
+ this.client = client;
525
+ }
526
+ client;
527
+ list(params = {}) {
528
+ return this.client.feed.list(params);
529
+ }
530
+ /**
531
+ * Inspect one automation. Backed by GET /api/v1/automation/:id.
532
+ */
533
+ async inspect(params) {
534
+ this.client._requireAuth();
535
+ const id = requireAutomationID(params.id);
536
+ return this.client._request(
537
+ "GET",
538
+ `/api/v1/automation/${encodeURIComponent(String(id))}`
539
+ );
540
+ }
541
+ stop(params) {
542
+ return this.client.feed.stop(params);
543
+ }
544
+ resume(params) {
545
+ return this.client.feed.resume(params);
546
+ }
547
+ delete(params) {
548
+ return this.client.feed.delete(params);
549
+ }
550
+ publish(params) {
551
+ return this.client.release.feed(params);
552
+ }
553
+ };
554
+ function requireAutomationID(id) {
555
+ if (!Number.isInteger(id) || id <= 0) {
556
+ throw new Error("automation id must be a positive integer");
557
+ }
558
+ return id;
559
+ }
560
+
506
561
  // src/resources/playbooks.ts
507
562
  var PLAYBOOK_VISIBILITIES = [
508
563
  "public",
@@ -2417,6 +2472,44 @@ var SubscriptionsResource = class {
2417
2472
  }
2418
2473
  };
2419
2474
 
2475
+ // src/resources/alerts.ts
2476
+ var AlertsResource = class {
2477
+ constructor(client) {
2478
+ this.client = client;
2479
+ }
2480
+ client;
2481
+ list(params = {}) {
2482
+ return this.client.subscriptions.list(params);
2483
+ }
2484
+ enableAutomation(params) {
2485
+ return this.client.subscriptions.subscribeFeed(params);
2486
+ }
2487
+ disableAutomation(params) {
2488
+ return this.client.subscriptions.unsubscribeFeed(params);
2489
+ }
2490
+ enablePlaybook(params) {
2491
+ return this.client.subscriptions.subscribePlaybook(params);
2492
+ }
2493
+ disablePlaybook(params) {
2494
+ return this.client.subscriptions.unsubscribePlaybook(params);
2495
+ }
2496
+ disableBatch(params) {
2497
+ return this.client.subscriptions.unsubscribeBatch(params);
2498
+ }
2499
+ historyAutomation(params) {
2500
+ return this.client.notifications.listFeed(params);
2501
+ }
2502
+ historyPlaybook(params) {
2503
+ return this.client.notifications.listPlaybook(params);
2504
+ }
2505
+ preferences() {
2506
+ return this.client.notificationPreferences.list();
2507
+ }
2508
+ updatePreference(params) {
2509
+ return this.client.notificationPreferences.update(params);
2510
+ }
2511
+ };
2512
+
2420
2513
  // src/resources/channelGroupSubscriptions.ts
2421
2514
  var ChannelGroupSubscriptionsResource = class {
2422
2515
  constructor(client) {
@@ -2849,6 +2942,7 @@ var AlvaClient = class {
2849
2942
  _serviceAccount;
2850
2943
  _release;
2851
2944
  _feed;
2945
+ _automation;
2852
2946
  _playbooks;
2853
2947
  _secrets;
2854
2948
  _sdk;
@@ -2864,6 +2958,7 @@ var AlvaClient = class {
2864
2958
  _notifications;
2865
2959
  _notificationPreferences;
2866
2960
  _subscriptions;
2961
+ _alerts;
2867
2962
  _channelGroupSubscriptions;
2868
2963
  _feedback;
2869
2964
  _functions;
@@ -2898,6 +2993,9 @@ var AlvaClient = class {
2898
2993
  get feed() {
2899
2994
  return this._feed ??= new FeedResource(this);
2900
2995
  }
2996
+ get automation() {
2997
+ return this._automation ??= new AutomationResource(this);
2998
+ }
2901
2999
  get playbooks() {
2902
3000
  return this._playbooks ??= new PlaybooksResource(this);
2903
3001
  }
@@ -2943,6 +3041,9 @@ var AlvaClient = class {
2943
3041
  get subscriptions() {
2944
3042
  return this._subscriptions ??= new SubscriptionsResource(this);
2945
3043
  }
3044
+ get alerts() {
3045
+ return this._alerts ??= new AlertsResource(this);
3046
+ }
2946
3047
  get channelGroupSubscriptions() {
2947
3048
  return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
2948
3049
  }
@@ -3556,11 +3657,13 @@ var installPlaybookRuntime = (targetWindow) => {
3556
3657
  };
3557
3658
 
3558
3659
  // src/index.ts
3559
- var VERSION = true ? "0.15.0" : "dev";
3660
+ var VERSION = true ? "0.15.1-beta.0" : "dev";
3560
3661
  // Annotate the CommonJS export names for ESM import in node:
3561
3662
  0 && (module.exports = {
3663
+ AlertsResource,
3562
3664
  AlvaClient,
3563
3665
  AlvaError,
3666
+ AutomationResource,
3564
3667
  CliUsageError,
3565
3668
  PBSV_UPDATE_MESSAGE,
3566
3669
  SUBSCRIBE_PROPOSE_MESSAGE,