@alva-ai/toolkit 0.14.1-beta.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,
@@ -273,7 +275,8 @@ var DeployResource = class {
273
275
  cron_expression: params.cron_expression,
274
276
  args: params.args,
275
277
  push_notify: params.push_notify,
276
- max_heap_size_mb: params.max_heap_size_mb
278
+ max_heap_size_mb: params.max_heap_size_mb,
279
+ run_as_user_id: params.run_as_user_id
277
280
  }
278
281
  });
279
282
  }
@@ -353,6 +356,50 @@ var DeployResource = class {
353
356
  }
354
357
  };
355
358
 
359
+ // src/resources/serviceAccount.ts
360
+ var ServiceAccountResource = class {
361
+ constructor(client) {
362
+ this.client = client;
363
+ }
364
+ client;
365
+ async create(params) {
366
+ this.client._requireAuth();
367
+ return this.client._request("POST", "/api/v1/service-account", {
368
+ body: { display_name: params.display_name }
369
+ });
370
+ }
371
+ async list() {
372
+ this.client._requireAuth();
373
+ return this.client._request(
374
+ "GET",
375
+ "/api/v1/service-accounts"
376
+ );
377
+ }
378
+ async delete(params) {
379
+ this.client._requireAuth();
380
+ await this.client._request(
381
+ "DELETE",
382
+ `/api/v1/service-account/${params.id}`
383
+ );
384
+ }
385
+ async grant(params) {
386
+ this.client._requireAuth();
387
+ await this.client._request(
388
+ "POST",
389
+ `/api/v1/service-account/${params.id}/grant`,
390
+ { body: { path: params.path, permission: params.permission } }
391
+ );
392
+ }
393
+ async revoke(params) {
394
+ this.client._requireAuth();
395
+ await this.client._request(
396
+ "POST",
397
+ `/api/v1/service-account/${params.id}/revoke`,
398
+ { body: { path: params.path, permission: params.permission } }
399
+ );
400
+ }
401
+ };
402
+
356
403
  // src/resources/release.ts
357
404
  var ReleaseResource = class {
358
405
  constructor(client) {
@@ -407,6 +454,19 @@ var FeedResource = class {
407
454
  this.client = client;
408
455
  }
409
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
+ }
410
470
  /**
411
471
  * Stop a feed's producer cronjob. This pauses future scheduled runs while
412
472
  * preserving the feed and its existing data.
@@ -458,6 +518,46 @@ function requireFeedID(id) {
458
518
  return id;
459
519
  }
460
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
+
461
561
  // src/resources/playbooks.ts
462
562
  var PLAYBOOK_VISIBILITIES = [
463
563
  "public",
@@ -2372,6 +2472,44 @@ var SubscriptionsResource = class {
2372
2472
  }
2373
2473
  };
2374
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
+
2375
2513
  // src/resources/channelGroupSubscriptions.ts
2376
2514
  var ChannelGroupSubscriptionsResource = class {
2377
2515
  constructor(client) {
@@ -2463,7 +2601,8 @@ var FunctionsResource = class {
2463
2601
  function_name: params.function_name,
2464
2602
  entry_script_path: params.entry_script_path,
2465
2603
  params_schema: params.params_schema,
2466
- allow_charges: params.allow_charges
2604
+ allow_charges: params.allow_charges,
2605
+ run_as_user_id: params.run_as_user_id
2467
2606
  }
2468
2607
  });
2469
2608
  }
@@ -2800,8 +2939,10 @@ var AlvaClient = class {
2800
2939
  _fs;
2801
2940
  _run;
2802
2941
  _deploy;
2942
+ _serviceAccount;
2803
2943
  _release;
2804
2944
  _feed;
2945
+ _automation;
2805
2946
  _playbooks;
2806
2947
  _secrets;
2807
2948
  _sdk;
@@ -2817,6 +2958,7 @@ var AlvaClient = class {
2817
2958
  _notifications;
2818
2959
  _notificationPreferences;
2819
2960
  _subscriptions;
2961
+ _alerts;
2820
2962
  _channelGroupSubscriptions;
2821
2963
  _feedback;
2822
2964
  _functions;
@@ -2842,12 +2984,18 @@ var AlvaClient = class {
2842
2984
  get deploy() {
2843
2985
  return this._deploy ??= new DeployResource(this);
2844
2986
  }
2987
+ get serviceAccount() {
2988
+ return this._serviceAccount ??= new ServiceAccountResource(this);
2989
+ }
2845
2990
  get release() {
2846
2991
  return this._release ??= new ReleaseResource(this);
2847
2992
  }
2848
2993
  get feed() {
2849
2994
  return this._feed ??= new FeedResource(this);
2850
2995
  }
2996
+ get automation() {
2997
+ return this._automation ??= new AutomationResource(this);
2998
+ }
2851
2999
  get playbooks() {
2852
3000
  return this._playbooks ??= new PlaybooksResource(this);
2853
3001
  }
@@ -2893,6 +3041,9 @@ var AlvaClient = class {
2893
3041
  get subscriptions() {
2894
3042
  return this._subscriptions ??= new SubscriptionsResource(this);
2895
3043
  }
3044
+ get alerts() {
3045
+ return this._alerts ??= new AlertsResource(this);
3046
+ }
2896
3047
  get channelGroupSubscriptions() {
2897
3048
  return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
2898
3049
  }
@@ -3506,11 +3657,13 @@ var installPlaybookRuntime = (targetWindow) => {
3506
3657
  };
3507
3658
 
3508
3659
  // src/index.ts
3509
- var VERSION = true ? "0.14.1-beta.0" : "dev";
3660
+ var VERSION = true ? "0.15.1-beta.0" : "dev";
3510
3661
  // Annotate the CommonJS export names for ESM import in node:
3511
3662
  0 && (module.exports = {
3663
+ AlertsResource,
3512
3664
  AlvaClient,
3513
3665
  AlvaError,
3666
+ AutomationResource,
3514
3667
  CliUsageError,
3515
3668
  PBSV_UPDATE_MESSAGE,
3516
3669
  SUBSCRIBE_PROPOSE_MESSAGE,