@alva-ai/toolkit 0.9.5 → 0.11.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
@@ -1703,6 +1703,17 @@ function metadataSummaryForSkill(skill) {
1703
1703
  }
1704
1704
 
1705
1705
  // src/resources/playbookSkills.ts
1706
+ function normalizePlaybookSkillSummary(raw) {
1707
+ return {
1708
+ username: raw.username,
1709
+ name: raw.name,
1710
+ display_name: raw.display_name,
1711
+ description: raw.description,
1712
+ tags: raw.tags,
1713
+ creator_uid: raw.creator_uid,
1714
+ updated_at: raw.updated_at
1715
+ };
1716
+ }
1706
1717
  function parsePlaybookSkillId(s) {
1707
1718
  const parts = s.split("/");
1708
1719
  if (parts.length !== 2 || !parts[0] || !parts[1]) {
@@ -1726,7 +1737,7 @@ var PlaybookSkillsResource = class {
1726
1737
  const res = await this.client._request("GET", "/api/v1/skills", {
1727
1738
  query
1728
1739
  });
1729
- return { skills: res.data ?? [] };
1740
+ return { skills: (res.data ?? []).map(normalizePlaybookSkillSummary) };
1730
1741
  }
1731
1742
  async tags() {
1732
1743
  const res = await this.client._request(
@@ -1751,7 +1762,10 @@ var PlaybookSkillsResource = class {
1751
1762
  0
1752
1763
  );
1753
1764
  }
1754
- return meta;
1765
+ return {
1766
+ ...normalizePlaybookSkillSummary(meta),
1767
+ files: meta.files ?? []
1768
+ };
1755
1769
  }
1756
1770
  async file(id, path) {
1757
1771
  const { username, name } = parsePlaybookSkillId(id);
@@ -2062,66 +2076,56 @@ var NotificationPreferencesResource = class {
2062
2076
  }
2063
2077
  };
2064
2078
 
2065
- // src/resources/pushSubscriptions.ts
2066
- var PushSubscriptionsResource = class {
2079
+ // src/resources/subscriptions.ts
2080
+ var SubscriptionsResource = class {
2067
2081
  constructor(client) {
2068
2082
  this.client = client;
2069
2083
  }
2070
2084
  client;
2071
2085
  /**
2072
- * Opt into personal push for one playbook `(username, name)`.
2073
- * Fires for any feed of that playbook. Idempotent. Auth: callers must
2074
- * be able to read the playbook (public/paid pass; private requires
2075
- * explicit alfs grant).
2086
+ * Subscribe to a playbook `(username, name)`: follow it and enable alerts
2087
+ * on all its push-enabled automations. Idempotent. Auth: the caller must be
2088
+ * able to read the playbook — public passes; paid requires an active unlock;
2089
+ * private requires owner/admin.
2076
2090
  */
2077
2091
  async subscribePlaybook(params) {
2078
2092
  this.client._requireAuth();
2079
- const path = `/api/v1/push-subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2093
+ const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2080
2094
  return this.client._request(
2081
2095
  "POST",
2082
2096
  path
2083
2097
  );
2084
2098
  }
2085
2099
  /**
2086
- * Soft-disable personal push for one playbook `(username, name)`.
2087
- * Does NOT remove any social follow. Idempotent.
2100
+ * Unsubscribe from a playbook `(username, name)`: unfollow it and disable
2101
+ * all of its push alerts for the caller. Idempotent.
2088
2102
  */
2089
2103
  async unsubscribePlaybook(params) {
2090
2104
  this.client._requireAuth();
2091
- const path = `/api/v1/push-subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2092
- return this.client._request(
2093
- "DELETE",
2094
- path
2095
- );
2105
+ const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2106
+ return this.client._request("DELETE", path);
2096
2107
  }
2097
2108
  /**
2098
- * Opt into personal push for one feed `(username, name)`. Fires for
2099
- * that specific feed regardless of which playbook(s) consume it; if
2100
- * the feed is shared across playbooks the subscriber receives one
2101
- * push per playbook context. Idempotent.
2109
+ * Subscribe to one feed `(username, name)` — enable personal push for that
2110
+ * single automation's alerts, regardless of which playbook(s) consume it.
2111
+ * Does NOT follow any playbook. Idempotent.
2102
2112
  */
2103
2113
  async subscribeFeed(params) {
2104
2114
  this.client._requireAuth();
2105
- const path = `/api/v1/push-subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2106
- return this.client._request(
2107
- "POST",
2108
- path
2109
- );
2115
+ const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2116
+ return this.client._request("POST", path);
2110
2117
  }
2111
2118
  /**
2112
- * Soft-disable personal push for one feed `(username, name)`.
2113
- * Idempotent.
2119
+ * Unsubscribe from one feed `(username, name)` — disable that automation's
2120
+ * alerts for the caller. Idempotent.
2114
2121
  */
2115
2122
  async unsubscribeFeed(params) {
2116
2123
  this.client._requireAuth();
2117
- const path = `/api/v1/push-subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2118
- return this.client._request(
2119
- "DELETE",
2120
- path
2121
- );
2124
+ const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2125
+ return this.client._request("DELETE", path);
2122
2126
  }
2123
2127
  /**
2124
- * List the caller's currently active personal push subscriptions.
2128
+ * List the caller's currently active subscriptions.
2125
2129
  * Results are cursor-paginated.
2126
2130
  */
2127
2131
  async list(params = {}) {
@@ -2131,7 +2135,7 @@ var PushSubscriptionsResource = class {
2131
2135
  query.first = String(params.first);
2132
2136
  }
2133
2137
  if (params.cursor) query.cursor = params.cursor;
2134
- return this.client._request("GET", "/api/v1/me/push-subscriptions", {
2138
+ return this.client._request("GET", "/api/v1/me/subscriptions", {
2135
2139
  query
2136
2140
  });
2137
2141
  }
@@ -2231,7 +2235,7 @@ var AlvaClient = class {
2231
2235
  _arraysJwt;
2232
2236
  _notifications;
2233
2237
  _notificationPreferences;
2234
- _pushSubscriptions;
2238
+ _subscriptions;
2235
2239
  _channelGroupSubscriptions;
2236
2240
  constructor(config) {
2237
2241
  this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
@@ -2300,8 +2304,8 @@ var AlvaClient = class {
2300
2304
  get notificationPreferences() {
2301
2305
  return this._notificationPreferences ??= new NotificationPreferencesResource(this);
2302
2306
  }
2303
- get pushSubscriptions() {
2304
- return this._pushSubscriptions ??= new PushSubscriptionsResource(this);
2307
+ get subscriptions() {
2308
+ return this._subscriptions ??= new SubscriptionsResource(this);
2305
2309
  }
2306
2310
  get channelGroupSubscriptions() {
2307
2311
  return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
@@ -2790,7 +2794,7 @@ var installPlaybookRuntime = (targetWindow) => {
2790
2794
  };
2791
2795
 
2792
2796
  // src/index.ts
2793
- var VERSION = true ? "0.9.5" : "dev";
2797
+ var VERSION = true ? "0.11.0" : "dev";
2794
2798
  // Annotate the CommonJS export names for ESM import in node:
2795
2799
  0 && (module.exports = {
2796
2800
  AlvaClient,