@soat/sdk 0.14.0 → 0.14.1

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
@@ -107,7 +107,8 @@ function createSseClient({ onRequest, onSseError, onSseEvent, responseTransforme
107
107
  } catch (error) {
108
108
  onSseError?.(error);
109
109
  if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
110
- await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
110
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
111
+ await sleep(backoff);
111
112
  }
112
113
  }
113
114
  };
@@ -2459,7 +2460,8 @@ var Sessions = class {
2459
2460
  /**
2460
2461
  * Delete a session
2461
2462
  *
2462
- * Deletes the session and its underlying conversation and actors.
2463
+ * Deletes the session and its underlying conversation and messages. The session's actor is not deleted. Generations and traces produced by the session are not deleted either, since they are not linked to the session or conversation.
2464
+ *
2463
2465
  */
2464
2466
  static deleteSession(options) {
2465
2467
  return (options.client ?? client).delete({
@@ -2702,6 +2704,130 @@ var Traces = class {
2702
2704
  });
2703
2705
  }
2704
2706
  };
2707
+ var Triggers = class {
2708
+ /**
2709
+ * List triggers
2710
+ *
2711
+ * Lists triggers. Filter by project, starter type, or target type.
2712
+ */
2713
+ static listTriggers(options) {
2714
+ return (options?.client ?? client).get({
2715
+ url: "/api/v1/triggers",
2716
+ ...options
2717
+ });
2718
+ }
2719
+ /**
2720
+ * Create a trigger
2721
+ *
2722
+ * Creates a new trigger for a project
2723
+ */
2724
+ static createTrigger(options) {
2725
+ return (options.client ?? client).post({
2726
+ url: "/api/v1/triggers",
2727
+ ...options,
2728
+ headers: {
2729
+ "Content-Type": "application/json",
2730
+ ...options.headers
2731
+ }
2732
+ });
2733
+ }
2734
+ /**
2735
+ * Delete a trigger
2736
+ *
2737
+ * Deletes a trigger
2738
+ */
2739
+ static deleteTrigger(options) {
2740
+ return (options.client ?? client).delete({
2741
+ url: "/api/v1/triggers/{trigger_id}",
2742
+ ...options
2743
+ });
2744
+ }
2745
+ /**
2746
+ * Get a trigger
2747
+ *
2748
+ * Retrieves the details of a specific trigger
2749
+ */
2750
+ static getTrigger(options) {
2751
+ return (options.client ?? client).get({
2752
+ url: "/api/v1/triggers/{trigger_id}",
2753
+ ...options
2754
+ });
2755
+ }
2756
+ /**
2757
+ * Update a trigger
2758
+ *
2759
+ * Updates an existing trigger's configuration. The type is immutable.
2760
+ */
2761
+ static updateTrigger(options) {
2762
+ return (options.client ?? client).patch({
2763
+ url: "/api/v1/triggers/{trigger_id}",
2764
+ ...options,
2765
+ headers: {
2766
+ "Content-Type": "application/json",
2767
+ ...options.headers
2768
+ }
2769
+ });
2770
+ }
2771
+ /**
2772
+ * Fire a trigger
2773
+ *
2774
+ * Fires a trigger synchronously and returns the terminal firing record.
2775
+ */
2776
+ static fireTrigger(options) {
2777
+ return (options.client ?? client).post({
2778
+ url: "/api/v1/triggers/{trigger_id}/fire",
2779
+ ...options,
2780
+ headers: {
2781
+ "Content-Type": "application/json",
2782
+ ...options.headers
2783
+ }
2784
+ });
2785
+ }
2786
+ /**
2787
+ * Get trigger secret
2788
+ *
2789
+ * Retrieves the signing secret for a webhook trigger
2790
+ */
2791
+ static getTriggerSecret(options) {
2792
+ return (options.client ?? client).get({
2793
+ url: "/api/v1/triggers/{trigger_id}/secret",
2794
+ ...options
2795
+ });
2796
+ }
2797
+ /**
2798
+ * Rotate trigger secret
2799
+ *
2800
+ * Rotates the signing secret for a webhook trigger
2801
+ */
2802
+ static rotateTriggerSecret(options) {
2803
+ return (options.client ?? client).post({
2804
+ url: "/api/v1/triggers/{trigger_id}/rotate-secret",
2805
+ ...options
2806
+ });
2807
+ }
2808
+ /**
2809
+ * List trigger firings
2810
+ *
2811
+ * Lists firings for a trigger (trigger_id is required).
2812
+ */
2813
+ static listTriggerFirings(options) {
2814
+ return (options.client ?? client).get({
2815
+ url: "/api/v1/trigger-firings",
2816
+ ...options
2817
+ });
2818
+ }
2819
+ /**
2820
+ * Get a trigger firing
2821
+ *
2822
+ * Retrieves the details of a specific trigger firing
2823
+ */
2824
+ static getTriggerFiring(options) {
2825
+ return (options.client ?? client).get({
2826
+ url: "/api/v1/trigger-firings/{firing_id}",
2827
+ ...options
2828
+ });
2829
+ }
2830
+ };
2705
2831
  var Users = class {
2706
2832
  /**
2707
2833
  * Get the current authenticated user
@@ -2980,6 +3106,7 @@ var SoatClient = class {
2980
3106
  sessions;
2981
3107
  tools;
2982
3108
  traces;
3109
+ triggers;
2983
3110
  users;
2984
3111
  webhooks;
2985
3112
  constructor({ baseUrl, token, headers } = {}) {
@@ -3010,6 +3137,7 @@ var SoatClient = class {
3010
3137
  this.sessions = bindResource(Sessions, httpClient);
3011
3138
  this.tools = bindResource(Tools, httpClient);
3012
3139
  this.traces = bindResource(Traces, httpClient);
3140
+ this.triggers = bindResource(Triggers, httpClient);
3013
3141
  this.users = bindResource(Users, httpClient);
3014
3142
  this.webhooks = bindResource(Webhooks, httpClient);
3015
3143
  }
@@ -3039,6 +3167,7 @@ exports.Sessions = Sessions;
3039
3167
  exports.SoatClient = SoatClient;
3040
3168
  exports.Tools = Tools;
3041
3169
  exports.Traces = Traces;
3170
+ exports.Triggers = Triggers;
3042
3171
  exports.Users = Users;
3043
3172
  exports.Webhooks = Webhooks;
3044
3173
  exports.createClient = createClient;