@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.js CHANGED
@@ -218,7 +218,8 @@ var DeployResource = class {
218
218
  cron_expression: params.cron_expression,
219
219
  args: params.args,
220
220
  push_notify: params.push_notify,
221
- max_heap_size_mb: params.max_heap_size_mb
221
+ max_heap_size_mb: params.max_heap_size_mb,
222
+ run_as_user_id: params.run_as_user_id
222
223
  }
223
224
  });
224
225
  }
@@ -298,6 +299,50 @@ var DeployResource = class {
298
299
  }
299
300
  };
300
301
 
302
+ // src/resources/serviceAccount.ts
303
+ var ServiceAccountResource = class {
304
+ constructor(client) {
305
+ this.client = client;
306
+ }
307
+ client;
308
+ async create(params) {
309
+ this.client._requireAuth();
310
+ return this.client._request("POST", "/api/v1/service-account", {
311
+ body: { display_name: params.display_name }
312
+ });
313
+ }
314
+ async list() {
315
+ this.client._requireAuth();
316
+ return this.client._request(
317
+ "GET",
318
+ "/api/v1/service-accounts"
319
+ );
320
+ }
321
+ async delete(params) {
322
+ this.client._requireAuth();
323
+ await this.client._request(
324
+ "DELETE",
325
+ `/api/v1/service-account/${params.id}`
326
+ );
327
+ }
328
+ async grant(params) {
329
+ this.client._requireAuth();
330
+ await this.client._request(
331
+ "POST",
332
+ `/api/v1/service-account/${params.id}/grant`,
333
+ { body: { path: params.path, permission: params.permission } }
334
+ );
335
+ }
336
+ async revoke(params) {
337
+ this.client._requireAuth();
338
+ await this.client._request(
339
+ "POST",
340
+ `/api/v1/service-account/${params.id}/revoke`,
341
+ { body: { path: params.path, permission: params.permission } }
342
+ );
343
+ }
344
+ };
345
+
301
346
  // src/resources/release.ts
302
347
  var ReleaseResource = class {
303
348
  constructor(client) {
@@ -352,6 +397,19 @@ var FeedResource = class {
352
397
  this.client = client;
353
398
  }
354
399
  client;
400
+ /**
401
+ * List feeds owned by the caller. Backed by GET /api/v1/feed.
402
+ */
403
+ async list(params = {}) {
404
+ this.client._requireAuth();
405
+ return this.client._request("GET", "/api/v1/feed", {
406
+ query: {
407
+ limit: params.limit,
408
+ cursor: params.cursor,
409
+ status: params.status
410
+ }
411
+ });
412
+ }
355
413
  /**
356
414
  * Stop a feed's producer cronjob. This pauses future scheduled runs while
357
415
  * preserving the feed and its existing data.
@@ -403,6 +461,46 @@ function requireFeedID(id) {
403
461
  return id;
404
462
  }
405
463
 
464
+ // src/resources/automation.ts
465
+ var AutomationResource = class {
466
+ constructor(client) {
467
+ this.client = client;
468
+ }
469
+ client;
470
+ list(params = {}) {
471
+ return this.client.feed.list(params);
472
+ }
473
+ /**
474
+ * Inspect one automation. Backed by GET /api/v1/automation/:id.
475
+ */
476
+ async inspect(params) {
477
+ this.client._requireAuth();
478
+ const id = requireAutomationID(params.id);
479
+ return this.client._request(
480
+ "GET",
481
+ `/api/v1/automation/${encodeURIComponent(String(id))}`
482
+ );
483
+ }
484
+ stop(params) {
485
+ return this.client.feed.stop(params);
486
+ }
487
+ resume(params) {
488
+ return this.client.feed.resume(params);
489
+ }
490
+ delete(params) {
491
+ return this.client.feed.delete(params);
492
+ }
493
+ publish(params) {
494
+ return this.client.release.feed(params);
495
+ }
496
+ };
497
+ function requireAutomationID(id) {
498
+ if (!Number.isInteger(id) || id <= 0) {
499
+ throw new Error("automation id must be a positive integer");
500
+ }
501
+ return id;
502
+ }
503
+
406
504
  // src/resources/playbooks.ts
407
505
  var PLAYBOOK_VISIBILITIES = [
408
506
  "public",
@@ -2317,6 +2415,44 @@ var SubscriptionsResource = class {
2317
2415
  }
2318
2416
  };
2319
2417
 
2418
+ // src/resources/alerts.ts
2419
+ var AlertsResource = class {
2420
+ constructor(client) {
2421
+ this.client = client;
2422
+ }
2423
+ client;
2424
+ list(params = {}) {
2425
+ return this.client.subscriptions.list(params);
2426
+ }
2427
+ enableAutomation(params) {
2428
+ return this.client.subscriptions.subscribeFeed(params);
2429
+ }
2430
+ disableAutomation(params) {
2431
+ return this.client.subscriptions.unsubscribeFeed(params);
2432
+ }
2433
+ enablePlaybook(params) {
2434
+ return this.client.subscriptions.subscribePlaybook(params);
2435
+ }
2436
+ disablePlaybook(params) {
2437
+ return this.client.subscriptions.unsubscribePlaybook(params);
2438
+ }
2439
+ disableBatch(params) {
2440
+ return this.client.subscriptions.unsubscribeBatch(params);
2441
+ }
2442
+ historyAutomation(params) {
2443
+ return this.client.notifications.listFeed(params);
2444
+ }
2445
+ historyPlaybook(params) {
2446
+ return this.client.notifications.listPlaybook(params);
2447
+ }
2448
+ preferences() {
2449
+ return this.client.notificationPreferences.list();
2450
+ }
2451
+ updatePreference(params) {
2452
+ return this.client.notificationPreferences.update(params);
2453
+ }
2454
+ };
2455
+
2320
2456
  // src/resources/channelGroupSubscriptions.ts
2321
2457
  var ChannelGroupSubscriptionsResource = class {
2322
2458
  constructor(client) {
@@ -2408,7 +2544,8 @@ var FunctionsResource = class {
2408
2544
  function_name: params.function_name,
2409
2545
  entry_script_path: params.entry_script_path,
2410
2546
  params_schema: params.params_schema,
2411
- allow_charges: params.allow_charges
2547
+ allow_charges: params.allow_charges,
2548
+ run_as_user_id: params.run_as_user_id
2412
2549
  }
2413
2550
  });
2414
2551
  }
@@ -2745,8 +2882,10 @@ var AlvaClient = class {
2745
2882
  _fs;
2746
2883
  _run;
2747
2884
  _deploy;
2885
+ _serviceAccount;
2748
2886
  _release;
2749
2887
  _feed;
2888
+ _automation;
2750
2889
  _playbooks;
2751
2890
  _secrets;
2752
2891
  _sdk;
@@ -2762,6 +2901,7 @@ var AlvaClient = class {
2762
2901
  _notifications;
2763
2902
  _notificationPreferences;
2764
2903
  _subscriptions;
2904
+ _alerts;
2765
2905
  _channelGroupSubscriptions;
2766
2906
  _feedback;
2767
2907
  _functions;
@@ -2787,12 +2927,18 @@ var AlvaClient = class {
2787
2927
  get deploy() {
2788
2928
  return this._deploy ??= new DeployResource(this);
2789
2929
  }
2930
+ get serviceAccount() {
2931
+ return this._serviceAccount ??= new ServiceAccountResource(this);
2932
+ }
2790
2933
  get release() {
2791
2934
  return this._release ??= new ReleaseResource(this);
2792
2935
  }
2793
2936
  get feed() {
2794
2937
  return this._feed ??= new FeedResource(this);
2795
2938
  }
2939
+ get automation() {
2940
+ return this._automation ??= new AutomationResource(this);
2941
+ }
2796
2942
  get playbooks() {
2797
2943
  return this._playbooks ??= new PlaybooksResource(this);
2798
2944
  }
@@ -2838,6 +2984,9 @@ var AlvaClient = class {
2838
2984
  get subscriptions() {
2839
2985
  return this._subscriptions ??= new SubscriptionsResource(this);
2840
2986
  }
2987
+ get alerts() {
2988
+ return this._alerts ??= new AlertsResource(this);
2989
+ }
2841
2990
  get channelGroupSubscriptions() {
2842
2991
  return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
2843
2992
  }
@@ -3451,10 +3600,12 @@ var installPlaybookRuntime = (targetWindow) => {
3451
3600
  };
3452
3601
 
3453
3602
  // src/index.ts
3454
- var VERSION = true ? "0.14.1-beta.0" : "dev";
3603
+ var VERSION = true ? "0.15.1-beta.0" : "dev";
3455
3604
  export {
3605
+ AlertsResource,
3456
3606
  AlvaClient,
3457
3607
  AlvaError,
3608
+ AutomationResource,
3458
3609
  CliUsageError,
3459
3610
  PBSV_UPDATE_MESSAGE,
3460
3611
  SUBSCRIBE_PROPOSE_MESSAGE,