@nivaro/sdk 0.2.7 → 0.3.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.
Files changed (4) hide show
  1. package/README.md +286 -195
  2. package/dist/index.d.ts +1509 -93
  3. package/dist/index.js +791 -120
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ function cmd(method, path, params, body) {
5
5
  function withSignal(command, signal) {
6
6
  return signal ? { ...command, _signal: signal } : command;
7
7
  }
8
+ function withHeaders(command, headers) {
9
+ return headers && Object.keys(headers).length > 0 ? { ...command, _headers: headers } : command;
10
+ }
8
11
 
9
12
  // src/commands/admin.ts
10
13
  function listRoles() {
@@ -521,8 +524,8 @@ function readIntegrationHealth() {
521
524
  function askHuman(body) {
522
525
  return cmd("POST", "/agent-questions", void 0, body);
523
526
  }
524
- function readAgentQuestion(id, wait) {
525
- return cmd("GET", `/agent-questions/${encodeURIComponent(id)}`, wait ? { wait } : void 0);
527
+ function readAgentQuestion(id, wait2) {
528
+ return cmd("GET", `/agent-questions/${encodeURIComponent(id)}`, wait2 ? { wait: wait2 } : void 0);
526
529
  }
527
530
  function listMyAgentQuestions() {
528
531
  return cmd("GET", "/agent-questions/mine");
@@ -695,6 +698,11 @@ function listNotifications(query) {
695
698
  if (query?.page != null) params.page = query.page;
696
699
  if (query?.limit != null) params.limit = query.limit;
697
700
  if (query?.status) params.status = query.status;
701
+ if (query?.unread) params.unread = "true";
702
+ if (query?.search) params.search = query.search;
703
+ if (query?.collection) params.collection = query.collection;
704
+ if (query?.sender) params.sender = query.sender;
705
+ if (query?.snoozed) params.snoozed = "true";
698
706
  if (query?.app) params.app = query.app;
699
707
  if (query?.lane) params.lane = query.lane;
700
708
  if (query?.category) params.category = query.category;
@@ -839,8 +847,12 @@ function createChatChannel(body) {
839
847
  function updateChatChannel(id, body) {
840
848
  return cmd("PATCH", `/chat/channels/${id}`, void 0, body);
841
849
  }
842
- function listChatChannelMembers(id) {
843
- return cmd("GET", `/chat/channels/${id}/members`);
850
+ function listChatChannelMembers(id, opts) {
851
+ const query = {};
852
+ if (opts?.limit !== void 0) query.limit = opts.limit;
853
+ if (opts?.offset !== void 0) query.offset = opts.offset;
854
+ if (opts?.q !== void 0) query.q = opts.q;
855
+ return cmd("GET", `/chat/channels/${id}/members`, Object.keys(query).length ? query : void 0);
844
856
  }
845
857
  function addChatChannelMember(id, userId) {
846
858
  return cmd("POST", `/chat/channels/${id}/members`, void 0, { user_id: userId });
@@ -1160,6 +1172,24 @@ function readDashboardWidgetData(widgetId, filters) {
1160
1172
  filters?.length ? { extra_filters: JSON.stringify(filters) } : void 0
1161
1173
  );
1162
1174
  }
1175
+ function createDashboard(body) {
1176
+ return cmd("POST", "/dashboards", void 0, body);
1177
+ }
1178
+ function updateDashboard(id, body) {
1179
+ return cmd("PATCH", `/dashboards/${id}`, void 0, body);
1180
+ }
1181
+ function deleteDashboard(id) {
1182
+ return cmd("DELETE", `/dashboards/${id}`);
1183
+ }
1184
+ function createDashboardWidget(dashboardId, body) {
1185
+ return cmd("POST", `/dashboards/${dashboardId}/widgets`, void 0, body);
1186
+ }
1187
+ function updateDashboardWidget(widgetId, body) {
1188
+ return cmd("PATCH", `/dashboards/widgets/${widgetId}`, void 0, body);
1189
+ }
1190
+ function deleteDashboardWidget(widgetId) {
1191
+ return cmd("DELETE", `/dashboards/widgets/${widgetId}`);
1192
+ }
1163
1193
 
1164
1194
  // src/commands/devex.ts
1165
1195
  function getPostmanCollection() {
@@ -1207,8 +1237,8 @@ function updateSavedView(id, body) {
1207
1237
  function deleteSavedView(id) {
1208
1238
  return cmd("DELETE", `/saved-views/${id}`);
1209
1239
  }
1210
- function globalSearch(q) {
1211
- return cmd("GET", "/global-search", { q });
1240
+ function globalSearch(q, opts) {
1241
+ return cmd("GET", "/global-search", opts?.labels ? { q, labels: 1 } : { q });
1212
1242
  }
1213
1243
  function listApiKeys() {
1214
1244
  return cmd("GET", "/api-keys");
@@ -1582,6 +1612,85 @@ function discardHelpVideoPackageImport(id) {
1582
1612
  var listImportTemplates = (collection) => cmd("GET", "/import-templates", { collection });
1583
1613
  var executeImportTemplate = (id, payload) => cmd("POST", `/import-templates/${id}/execute`, void 0, payload);
1584
1614
 
1615
+ // src/commands/inbox.ts
1616
+ function snoozeNotification(id, opts) {
1617
+ return cmd(
1618
+ "POST",
1619
+ `/notifications/${id}/snooze`,
1620
+ void 0,
1621
+ opts.untilChange ? { until_change: true } : { until: opts.until ?? null }
1622
+ );
1623
+ }
1624
+ function acknowledgeNotification(id) {
1625
+ return cmd("POST", `/notifications/${id}/acknowledge`);
1626
+ }
1627
+ function filterBody(f) {
1628
+ const out = {};
1629
+ for (const [k, v] of Object.entries(f)) {
1630
+ if (v === void 0 || v === "") continue;
1631
+ out[k] = String(v);
1632
+ }
1633
+ return out;
1634
+ }
1635
+ function bulkNotificationAction(body) {
1636
+ return cmd("POST", "/notifications/bulk-action", void 0, {
1637
+ action: body.action,
1638
+ ...body.ids ? { ids: body.ids } : {},
1639
+ ...body.filter ? { filter: filterBody(body.filter) } : {},
1640
+ ...body.until ? { until: body.until } : {}
1641
+ });
1642
+ }
1643
+ function archiveReadNotifications(days) {
1644
+ return cmd("POST", "/notifications/archive-read", void 0, { days });
1645
+ }
1646
+ function listSentNotifications(query) {
1647
+ const params = {};
1648
+ if (query?.lane) params.lane = query.lane;
1649
+ if (query?.limit != null) params.limit = query.limit;
1650
+ return cmd("GET", "/notifications/sent", params);
1651
+ }
1652
+ function readRecordMute(collection, item) {
1653
+ return cmd("GET", `/notifications/mutes/${collection}/${item}`);
1654
+ }
1655
+ function toggleRecordMute(collection, item) {
1656
+ return cmd("POST", `/notifications/mutes/${collection}/${item}/toggle`);
1657
+ }
1658
+ function listReminders(includeSent) {
1659
+ return cmd("GET", "/reminders", includeSent ? { include_sent: "true" } : void 0);
1660
+ }
1661
+ function createReminder(body) {
1662
+ return cmd("POST", "/reminders", void 0, body);
1663
+ }
1664
+ function updateReminder(id, body) {
1665
+ return cmd("PATCH", `/reminders/${id}`, void 0, body);
1666
+ }
1667
+ function deleteReminder(id) {
1668
+ return cmd("DELETE", `/reminders/${id}`);
1669
+ }
1670
+ function listSavedSearches() {
1671
+ return cmd("GET", "/global-search/saved");
1672
+ }
1673
+ function createSavedSearch(body) {
1674
+ return cmd("POST", "/global-search/saved", void 0, body);
1675
+ }
1676
+ function deleteSavedSearch(id) {
1677
+ return cmd("DELETE", `/global-search/saved/${encodeURIComponent(id)}`);
1678
+ }
1679
+ function readSearchCounts(q, collections, opts) {
1680
+ return cmd("GET", "/global-search/counts", {
1681
+ q,
1682
+ collections: collections.join(","),
1683
+ ...opts?.labels ? { labels: 1 } : {}
1684
+ });
1685
+ }
1686
+ function readSearchRecords(q, collection, opts) {
1687
+ const params = { q, collection };
1688
+ if (opts?.offset != null) params.offset = opts.offset;
1689
+ if (opts?.limit != null) params.limit = opts.limit;
1690
+ if (opts?.labels) params.labels = 1;
1691
+ return cmd("GET", "/global-search/records", params);
1692
+ }
1693
+
1585
1694
  // src/commands/infra.ts
1586
1695
  function listWorkspaces() {
1587
1696
  return cmd("GET", "/workspaces");
@@ -1904,6 +2013,93 @@ function readMcpCapabilities() {
1904
2013
  return cmd("GET", "/mcp/capabilities");
1905
2014
  }
1906
2015
 
2016
+ // src/commands/observability.ts
2017
+ function readActivityEntry(id) {
2018
+ return cmd("GET", `/activity/${id}`);
2019
+ }
2020
+ function listActivityActions() {
2021
+ return cmd("GET", "/activity/actions");
2022
+ }
2023
+ function logExport(body) {
2024
+ return cmd("POST", "/activity/export-log", void 0, body);
2025
+ }
2026
+ function createActivityEntry(body) {
2027
+ return cmd("POST", "/activity", void 0, body);
2028
+ }
2029
+ function readChanges(query) {
2030
+ const params = {};
2031
+ if (query?.cursor) params.cursor = query.cursor;
2032
+ if (query?.since) params.since = query.since;
2033
+ if (query?.collections?.length) params.collections = query.collections.join(",");
2034
+ if (query?.limit != null) params.limit = query.limit;
2035
+ return cmd("GET", "/changes", params);
2036
+ }
2037
+ function readJobRunLog(id, after) {
2038
+ return cmd("GET", `/job-runs/${id}/log`, after ? { after } : void 0);
2039
+ }
2040
+ function cancelJobRun(id) {
2041
+ return cmd("POST", `/job-runs/${id}/cancel`);
2042
+ }
2043
+ function readBusyJobs() {
2044
+ return cmd("GET", "/job-runs/busy");
2045
+ }
2046
+ function listMyJobs() {
2047
+ return cmd("GET", "/my-jobs");
2048
+ }
2049
+ function estimateBackgroundRun(method, url) {
2050
+ return cmd("GET", "/background-runs/estimate", { method, url });
2051
+ }
2052
+ function startBackgroundRun(body) {
2053
+ return cmd("POST", "/background-runs", void 0, body);
2054
+ }
2055
+ function listBackgroundRuns() {
2056
+ return cmd("GET", "/background-runs");
2057
+ }
2058
+ function readBackgroundRun(id) {
2059
+ return cmd("GET", `/background-runs/${id}`);
2060
+ }
2061
+ function readBackgroundRunResult(id) {
2062
+ return cmd("GET", `/background-runs/${id}/result`);
2063
+ }
2064
+ function listApiRequests(query) {
2065
+ const params = {};
2066
+ for (const [k, v] of Object.entries(query ?? {})) {
2067
+ if (v === void 0 || v === "" || v === false) continue;
2068
+ if (k === "all_instances") params.instances = "all";
2069
+ else params[k] = v === true ? 1 : v;
2070
+ }
2071
+ return cmd("GET", "/api-analytics/requests", params);
2072
+ }
2073
+ function readApiAnalyticsByKey(hours) {
2074
+ return cmd("GET", "/api-analytics/by-key", hours != null ? { hours } : void 0);
2075
+ }
2076
+ function readApiKeyUsage(id) {
2077
+ return cmd("GET", `/api-keys/${id}/usage`);
2078
+ }
2079
+ function readApiKeyMonthlyUsage(id, month, format) {
2080
+ return cmd("GET", `/api-keys/${id}/usage`, format === "csv" ? { month, format } : { month });
2081
+ }
2082
+ function listMailLog(query) {
2083
+ const params = {};
2084
+ for (const [k, v] of Object.entries(query ?? {})) if (v !== void 0 && v !== "") params[k] = v;
2085
+ return cmd("GET", "/mail-log", params);
2086
+ }
2087
+ function readMailLogEntry(id) {
2088
+ return cmd("GET", `/mail-log/${id}`);
2089
+ }
2090
+ function resendMail(id) {
2091
+ return cmd("POST", `/mail-log/${id}/resend`);
2092
+ }
2093
+ function readMailStats(days) {
2094
+ return cmd("GET", "/mail-log/stats", days ? { days } : void 0);
2095
+ }
2096
+ function listRecordMail(collection, item) {
2097
+ return cmd("GET", `/mail-log/record/${collection}/${item}`);
2098
+ }
2099
+ function readNotificationHistory(limit) {
2100
+ return cmd("GET", "/users/me/notification-history", limit != null ? { limit } : void 0);
2101
+ }
2102
+
1907
2103
  // src/commands/ops.ts
1908
2104
  function readReadiness() {
1909
2105
  return cmd("GET", "/ready");
@@ -2004,6 +2200,108 @@ function setQueueDefaultView(id, viewId) {
2004
2200
  return cmd("PUT", `/queues/${id}/default-view`, void 0, { view_id: viewId });
2005
2201
  }
2006
2202
 
2203
+ // src/commands/records.ts
2204
+ function rehearseUpdateItem(collection, id, data) {
2205
+ return cmd("PATCH", `/items/${collection}/${id}`, { dry_run: 1 }, data);
2206
+ }
2207
+ function checkItemFilter(collection, filter) {
2208
+ return cmd("GET", `/items/${collection}/filter-check`, { filter: JSON.stringify(filter) });
2209
+ }
2210
+ function readItemBySlug(collection, slug, query) {
2211
+ return cmd(
2212
+ "GET",
2213
+ `/items/${collection}/by-slug/${encodeURIComponent(slug)}`,
2214
+ query?.fields?.length ? { fields: query.fields.join(",") } : void 0
2215
+ );
2216
+ }
2217
+ function readItemDistinct(collection, field, limit) {
2218
+ return cmd("GET", `/items/${collection}/distinct`, limit != null ? { field, limit } : { field });
2219
+ }
2220
+ function bulkUpdateItems(collection, ids, data, opts) {
2221
+ return cmd("POST", `/items/${collection}/bulk-update`, void 0, {
2222
+ ids,
2223
+ data,
2224
+ ...opts?.by_form ? { by_form: true } : {}
2225
+ });
2226
+ }
2227
+ function bulkDeleteItems(collection, ids) {
2228
+ return cmd("POST", `/items/${collection}/bulk-delete`, void 0, { ids });
2229
+ }
2230
+ function bulkTransitionItems(collection, ids, transitionId, comment) {
2231
+ return cmd("POST", `/items/${collection}/bulk-transition`, void 0, {
2232
+ ids,
2233
+ transition_id: transitionId,
2234
+ ...comment ? { comment } : {}
2235
+ });
2236
+ }
2237
+ function batchItems(collection, body) {
2238
+ return cmd("POST", `/items/${collection}/batch`, void 0, body);
2239
+ }
2240
+ function bulkWriteItems(collection, rows, opts) {
2241
+ return cmd("POST", `/items/${collection}/bulk`, opts?.returnIds ? { return: "ids" } : void 0, {
2242
+ rows,
2243
+ ...opts?.atomic ? { atomic: true } : {}
2244
+ });
2245
+ }
2246
+ function queueBulkWriteItems(collection, rows, opts) {
2247
+ return cmd(
2248
+ "POST",
2249
+ `/items/${collection}/bulk`,
2250
+ { async: 1, ...opts?.returnIds ? { return: "ids" } : {} },
2251
+ { rows, ...opts?.atomic ? { atomic: true } : {} }
2252
+ );
2253
+ }
2254
+ function readBulkRun(collection, runId) {
2255
+ return cmd("GET", `/items/${collection}/bulk/${runId}`);
2256
+ }
2257
+ function listTrash(query) {
2258
+ const params = {};
2259
+ for (const [k, v] of Object.entries(query ?? {})) if (v !== void 0 && v !== "") params[k] = v;
2260
+ return cmd("GET", "/trash", params);
2261
+ }
2262
+ function readRecordDeletion(collection, item) {
2263
+ return cmd("GET", "/trash/record", { collection, item });
2264
+ }
2265
+ function restoreTrashItem(trashId) {
2266
+ return cmd("POST", `/trash/${trashId}/restore`);
2267
+ }
2268
+ function bulkRestoreTrash(ids) {
2269
+ return cmd("POST", "/trash/bulk-restore", void 0, { ids });
2270
+ }
2271
+ function purgeTrashItem(trashId) {
2272
+ return cmd("DELETE", `/trash/${trashId}`);
2273
+ }
2274
+ function readOwnerHistory(collection, item) {
2275
+ return cmd("GET", `/owner-history/${collection}/${item}`);
2276
+ }
2277
+ function readCommentCounts(collection, ids) {
2278
+ return cmd("GET", "/comments/counts", { collection, ids: ids.join(",") });
2279
+ }
2280
+ function toggleCommentReaction(commentId, emoji) {
2281
+ return cmd("POST", `/comments/${commentId}/reactions`, void 0, { emoji });
2282
+ }
2283
+ function toggleEntryReaction(body) {
2284
+ return cmd("POST", "/comments/entry-reactions", void 0, body);
2285
+ }
2286
+ function readPipelineOutline(templateId) {
2287
+ return cmd("GET", `/pipelines/${templateId}/outline`);
2288
+ }
2289
+ function readMyOwnerSeats() {
2290
+ return cmd("GET", "/pipelines/my-seats");
2291
+ }
2292
+ function logout() {
2293
+ return cmd("POST", "/auth/logout");
2294
+ }
2295
+ function logoutAll() {
2296
+ return cmd("POST", "/auth/logout-all");
2297
+ }
2298
+ function readWsToken() {
2299
+ return cmd("GET", "/auth/ws-token");
2300
+ }
2301
+ function readAuthProviders() {
2302
+ return cmd("GET", "/auth/providers");
2303
+ }
2304
+
2007
2305
  // src/commands/schema-proposals.ts
2008
2306
  function proposeSchemaChange(body) {
2009
2307
  return cmd("POST", "/schema-proposals", void 0, body);
@@ -2147,71 +2445,113 @@ function createPresence(options) {
2147
2445
 
2148
2446
  // src/realtime.ts
2149
2447
  import { io } from "socket.io-client";
2448
+ var NOTIFICATIONS_CHANNEL = "cms_notifications";
2449
+ function parseRealtimeChanges(payload) {
2450
+ const collection = String(payload?.collection ?? "");
2451
+ if (!collection) return [];
2452
+ const action = payload.action === "create" || payload.action === "delete" ? payload.action : "update";
2453
+ const base = {
2454
+ collection,
2455
+ action,
2456
+ ...payload.changed_fields?.length ? { changed_fields: payload.changed_fields } : {},
2457
+ ...payload.source ? { source: payload.source } : {}
2458
+ };
2459
+ if (payload.coalesced || payload.items || payload.many) {
2460
+ if (payload.many || !payload.items)
2461
+ return [{ ...base, item: null, coalesced: true, many: true }];
2462
+ return payload.items.map((item) => ({ ...base, item, coalesced: true }));
2463
+ }
2464
+ return [{ ...base, item: payload.item ?? null }];
2465
+ }
2150
2466
  function createRealtime() {
2151
2467
  let socket = null;
2468
+ let signedIn = false;
2152
2469
  const subs = /* @__PURE__ */ new Map();
2153
2470
  const connectHandlers = [];
2154
2471
  const disconnectHandlers = [];
2472
+ const authHandlers = [];
2155
2473
  function subscriptionKey(collection, event) {
2156
- return event ? `${collection}:${event}` : `${collection}:*`;
2474
+ return event && event !== "*" ? `${collection}:${event}` : `${collection}:*`;
2475
+ }
2476
+ function subscribedCollections() {
2477
+ const out = /* @__PURE__ */ new Set();
2478
+ for (const s of subs.values()) if (s.collection !== NOTIFICATIONS_CHANNEL) out.add(s.collection);
2479
+ return [...out];
2480
+ }
2481
+ function dispatch(change, collection, action) {
2482
+ if (change.length === 0) return;
2483
+ const specific = subs.get(subscriptionKey(collection, action))?.callback;
2484
+ const any = subs.get(subscriptionKey(collection))?.callback;
2485
+ specific?.(change);
2486
+ if (any && any !== specific) any(change);
2157
2487
  }
2158
2488
  return {
2159
2489
  get connected() {
2160
2490
  return socket?.connected ?? false;
2161
2491
  },
2492
+ get authenticated() {
2493
+ return signedIn;
2494
+ },
2162
2495
  connect(url, token) {
2163
2496
  if (socket?.connected) return;
2164
2497
  socket = io(url.replace(/\/$/, ""), {
2165
2498
  path: "/socket.io",
2166
- auth: token ? { token } : void 0,
2167
2499
  withCredentials: true,
2168
2500
  // Websocket first; when a proxy blocks the upgrade, long-polling on the same attempt.
2169
2501
  transports: ["websocket", "polling"],
2170
2502
  tryAllTransports: true
2171
2503
  });
2172
- socket.on("connect", () => {
2504
+ const s = socket;
2505
+ s.on("connect", () => {
2506
+ signedIn = false;
2173
2507
  for (const fn of connectHandlers) fn();
2174
- for (const sub of subs.values()) {
2175
- socket?.emit("subscribe", {
2176
- collection: sub.collection,
2177
- event: sub.event
2178
- });
2179
- }
2180
- });
2181
- socket.on("disconnect", (reason) => {
2182
- for (const fn of disconnectHandlers) fn(reason);
2508
+ void (async () => {
2509
+ try {
2510
+ const t = typeof token === "function" ? await token() : token;
2511
+ if (t && s.connected) s.emit("auth", { token: t });
2512
+ } catch {
2513
+ }
2514
+ })();
2183
2515
  });
2184
- socket.on("items:create", ({ collection, data }) => {
2185
- const cb = subs.get(subscriptionKey(collection, "create"))?.callback ?? subs.get(subscriptionKey(collection))?.callback;
2186
- cb?.(data);
2516
+ s.on("auth:ok", (payload) => {
2517
+ signedIn = true;
2518
+ for (const collection of subscribedCollections()) s.emit("collection:join", { collection });
2519
+ for (const fn of authHandlers) fn(String(payload?.userId ?? ""));
2187
2520
  });
2188
- socket.on("items:update", ({ collection, data }) => {
2189
- const cb = subs.get(subscriptionKey(collection, "update"))?.callback ?? subs.get(subscriptionKey(collection))?.callback;
2190
- cb?.(data);
2521
+ s.on("disconnect", (reason) => {
2522
+ signedIn = false;
2523
+ for (const fn of disconnectHandlers) fn(reason);
2191
2524
  });
2192
- socket.on("items:delete", ({ collection, ids }) => {
2193
- const cb = subs.get(subscriptionKey(collection, "delete"))?.callback ?? subs.get(subscriptionKey(collection))?.callback;
2194
- cb?.(ids);
2525
+ s.on("collection:update", (payload) => {
2526
+ const changes = parseRealtimeChanges(payload);
2527
+ if (changes.length === 0) return;
2528
+ const collection = changes[0].collection;
2529
+ const byAction = /* @__PURE__ */ new Map();
2530
+ for (const c of changes) byAction.set(c.action, [...byAction.get(c.action) ?? [], c]);
2531
+ for (const [action, list] of byAction) dispatch(list, collection, action);
2195
2532
  });
2196
- socket.on("notification", (data) => {
2197
- const cb = subs.get("cms_notifications:*")?.callback;
2198
- cb?.([data]);
2533
+ s.on("notification:new", (data) => {
2534
+ subs.get(`${NOTIFICATIONS_CHANNEL}:*`)?.callback([data]);
2199
2535
  });
2200
2536
  },
2201
2537
  disconnect() {
2202
2538
  socket?.disconnect();
2203
2539
  socket = null;
2540
+ signedIn = false;
2204
2541
  },
2205
2542
  subscribe(collection, opts, callback) {
2206
2543
  const key = subscriptionKey(collection, opts.event);
2544
+ const already = subscribedCollections().includes(collection);
2207
2545
  subs.set(key, { collection, event: opts.event, callback });
2208
- if (socket?.connected) {
2209
- socket.emit("subscribe", { collection, event: opts.event, query: opts.query });
2546
+ if (socket?.connected && signedIn && !already && collection !== NOTIFICATIONS_CHANNEL) {
2547
+ socket.emit("collection:join", { collection });
2210
2548
  }
2211
2549
  return () => {
2550
+ if (subs.get(key)?.callback !== callback) return;
2212
2551
  subs.delete(key);
2213
- if (socket?.connected) {
2214
- socket.emit("unsubscribe", { collection, event: opts.event });
2552
+ const still = subscribedCollections().includes(collection);
2553
+ if (socket?.connected && !still && collection !== NOTIFICATIONS_CHANNEL) {
2554
+ socket.emit("collection:leave", { collection });
2215
2555
  }
2216
2556
  };
2217
2557
  },
@@ -2220,10 +2560,68 @@ function createRealtime() {
2220
2560
  },
2221
2561
  onDisconnect(fn) {
2222
2562
  disconnectHandlers.push(fn);
2563
+ },
2564
+ onAuthenticated(fn) {
2565
+ authHandlers.push(fn);
2223
2566
  }
2224
2567
  };
2225
2568
  }
2226
2569
 
2570
+ // src/errors.ts
2571
+ var REQUEST_ID_HEADER = "x-nivaro-request-id";
2572
+ var NivaroError = class extends Error {
2573
+ /** HTTP status of the answer. */
2574
+ status;
2575
+ /** The API's machine code (`body.code`, e.g. `QUOTA_EXCEEDED`, `SERVER_BUSY`), else null. */
2576
+ code;
2577
+ /**
2578
+ * The `x-nivaro-request-id` the server stamped — the id its slow-trace buffer, access
2579
+ * log and API request log carry. Null when the header was absent or unreadable (a
2580
+ * cross-origin browser call only sees it if the API exposes the header through CORS).
2581
+ */
2582
+ requestId;
2583
+ /** The parsed JSON body (or `{ error: statusText }` when the body was not JSON). */
2584
+ response;
2585
+ method;
2586
+ /** Path under `/api` (no query string). */
2587
+ path;
2588
+ /** Milliseconds from a `Retry-After` header (429 / 503), else null. */
2589
+ retryAfterMs;
2590
+ /** Import parse refusals: the per-row problems the API listed. */
2591
+ issues;
2592
+ constructor(init) {
2593
+ super(init.message);
2594
+ this.name = "NivaroError";
2595
+ this.status = init.status;
2596
+ this.code = init.code ?? null;
2597
+ this.requestId = init.requestId ?? null;
2598
+ this.response = init.response;
2599
+ this.method = init.method;
2600
+ this.path = init.path;
2601
+ this.retryAfterMs = init.retryAfterMs ?? null;
2602
+ if (init.issues !== void 0) this.issues = init.issues;
2603
+ }
2604
+ };
2605
+ function isNivaroError(err) {
2606
+ return err instanceof NivaroError || !!err && typeof err === "object" && err.name === "NivaroError" && typeof err.status === "number";
2607
+ }
2608
+ function errorBodyMessage(body) {
2609
+ if (!body || typeof body !== "object") return null;
2610
+ const b = body;
2611
+ const fastifyShaped = typeof b.statusCode === "number" && typeof b.message === "string";
2612
+ if (fastifyShaped && b.message) return b.message;
2613
+ if (typeof b.error === "string" && b.error) return b.error;
2614
+ if (typeof b.message === "string" && b.message) return b.message;
2615
+ return null;
2616
+ }
2617
+ function retryAfterMs(value, now = Date.now()) {
2618
+ if (!value) return null;
2619
+ const secs = Number(value);
2620
+ if (Number.isFinite(secs) && secs >= 0) return Math.round(secs * 1e3);
2621
+ const at = Date.parse(value);
2622
+ return Number.isFinite(at) ? Math.max(0, at - now) : null;
2623
+ }
2624
+
2227
2625
  // src/index.ts
2228
2626
  function readItems(collection, query) {
2229
2627
  const params = {};
@@ -2234,8 +2632,12 @@ function readItems(collection, query) {
2234
2632
  if (query?.offset != null) params.offset = query.offset;
2235
2633
  if (query?.page != null) params.page = query.page;
2236
2634
  if (query?.search) params.search = query.search;
2635
+ if (query?.search_fields?.length) params.search_fields = query.search_fields.join(",");
2636
+ if (query?.search_rank) params.search_rank = 1;
2237
2637
  if (query?.after != null) params.after = query.after;
2238
2638
  if (query?.count === false) params.count = 0;
2639
+ else if (query?.count === "approx") params.count = "approx";
2640
+ if (query?.labels) params.labels = 1;
2239
2641
  return cmd("GET", `/items/${collection}`, params);
2240
2642
  }
2241
2643
  function aggregateItems(collection, query) {
@@ -2260,8 +2662,12 @@ function aggregateItems(collection, query) {
2260
2662
  if (query.offset != null) params.offset = query.offset;
2261
2663
  return cmd("GET", `/items/${collection}/aggregate`, params);
2262
2664
  }
2263
- function readItem(collection, id) {
2264
- return cmd("GET", `/items/${collection}/${id}`);
2665
+ function readItem(collection, id, query) {
2666
+ return cmd(
2667
+ "GET",
2668
+ `/items/${collection}/${id}`,
2669
+ query?.fields?.length ? { fields: query.fields.join(",") } : void 0
2670
+ );
2265
2671
  }
2266
2672
  var READ_MANY_MAX = 20;
2267
2673
  function readMany(reads) {
@@ -2343,6 +2749,9 @@ function readCollection(collection) {
2343
2749
  function readRevisions(collection, item) {
2344
2750
  return cmd("GET", "/revisions", { collection, item });
2345
2751
  }
2752
+ function readLatestRevisionId(collection, item) {
2753
+ return cmd("GET", "/revisions", { collection, item, latest_only: 1 });
2754
+ }
2346
2755
  function readRevision(id) {
2347
2756
  return cmd("GET", `/revisions/${id}`);
2348
2757
  }
@@ -2661,18 +3070,51 @@ function getPresence(collection, itemId) {
2661
3070
  function listActivePresence() {
2662
3071
  return cmd("GET", "/presence/sessions");
2663
3072
  }
3073
+ var DEFAULT_RETRY_STATUSES = [408, 429, 502, 503, 504];
3074
+ function abortError() {
3075
+ return Object.assign(new Error("The operation was aborted"), { name: "AbortError" });
3076
+ }
3077
+ function wait(ms, signal) {
3078
+ return new Promise((resolve, reject) => {
3079
+ if (signal?.aborted) return reject(abortError());
3080
+ const onAbort = () => {
3081
+ clearTimeout(t);
3082
+ reject(abortError());
3083
+ };
3084
+ const t = setTimeout(() => {
3085
+ signal?.removeEventListener("abort", onAbort);
3086
+ resolve();
3087
+ }, ms);
3088
+ signal?.addEventListener("abort", onAbort, { once: true });
3089
+ });
3090
+ }
2664
3091
  function createNivaro(url, options = {}) {
2665
3092
  const baseUrl = url.replace(/\/$/, "");
2666
3093
  const fetcher = options.fetch ?? globalThis.fetch;
2667
3094
  let currentToken = options.token;
3095
+ const retry = (() => {
3096
+ const r = options.retry;
3097
+ if (r == null || r === 0) return null;
3098
+ const o = typeof r === "number" ? { retries: r } : r;
3099
+ const retries = Math.max(0, Math.floor(o.retries ?? 2));
3100
+ if (retries === 0) return null;
3101
+ return {
3102
+ retries,
3103
+ methods: o.methods ?? ["GET"],
3104
+ statuses: o.statuses ?? DEFAULT_RETRY_STATUSES,
3105
+ baseDelayMs: o.baseDelayMs ?? 300,
3106
+ maxDelayMs: o.maxDelayMs ?? 1e4
3107
+ };
3108
+ })();
2668
3109
  function setToken(token) {
2669
3110
  currentToken = token ?? void 0;
2670
3111
  }
2671
3112
  function getToken() {
2672
3113
  return currentToken;
2673
3114
  }
2674
- function authHeaders(json = true) {
2675
- const h = {};
3115
+ function baseHeaders(json, own) {
3116
+ const extra = typeof options.headers === "function" ? options.headers() : options.headers;
3117
+ const h = { ...extra ?? {}, ...own ?? {} };
2676
3118
  if (json) h["Content-Type"] = "application/json";
2677
3119
  if (currentToken) h.Authorization = `Bearer ${currentToken}`;
2678
3120
  return h;
@@ -2680,6 +3122,117 @@ function createNivaro(url, options = {}) {
2680
3122
  function credentialsMode() {
2681
3123
  return options.credentials ?? (currentToken ? "omit" : "include");
2682
3124
  }
3125
+ function log(line, details) {
3126
+ const d = options.debug;
3127
+ if (!d) return;
3128
+ try {
3129
+ if (typeof d === "function") d(line, details);
3130
+ else console.debug(`[nivaro] ${line}`);
3131
+ } catch {
3132
+ }
3133
+ }
3134
+ function backoff(attempt, res) {
3135
+ if (!retry) return 0;
3136
+ const after = retryAfterMs(res?.headers.get("retry-after"));
3137
+ if (after != null) return Math.min(after, retry.maxDelayMs);
3138
+ const exp = retry.baseDelayMs * 2 ** attempt;
3139
+ return Math.min(retry.maxDelayMs, Math.round(exp / 2 + Math.random() * (exp / 2)));
3140
+ }
3141
+ async function send(kind, method, path, fullUrl, headers, run, signal) {
3142
+ const mayRetry = !!retry && retry.methods.includes(method);
3143
+ for (let attempt = 0; ; attempt++) {
3144
+ const info = {
3145
+ method,
3146
+ path,
3147
+ url: fullUrl,
3148
+ headers: { ...headers },
3149
+ attempt,
3150
+ kind
3151
+ };
3152
+ if (options.onRequest) await options.onRequest(info);
3153
+ const started = Date.now();
3154
+ let res;
3155
+ try {
3156
+ res = await run(info.headers);
3157
+ } catch (err) {
3158
+ const name = err?.name;
3159
+ const retryable = mayRetry && attempt < (retry?.retries ?? 0) && name !== "AbortError" && name !== "TimeoutError";
3160
+ log(
3161
+ `${method} ${path} failed (${err?.message ?? err})${retryable ? ", retrying" : ""}`,
3162
+ {
3163
+ method,
3164
+ path,
3165
+ attempt,
3166
+ error: err?.message
3167
+ }
3168
+ );
3169
+ if (!retryable) throw err;
3170
+ await wait(backoff(attempt, null), signal);
3171
+ continue;
3172
+ }
3173
+ const requestId = res.headers?.get?.(REQUEST_ID_HEADER) ?? null;
3174
+ const willRetry = mayRetry && !res.ok && attempt < (retry?.retries ?? 0) && !!retry?.statuses.includes(res.status);
3175
+ const durationMs = Date.now() - started;
3176
+ if (options.onResponse) {
3177
+ try {
3178
+ options.onResponse({
3179
+ method,
3180
+ path,
3181
+ url: fullUrl,
3182
+ attempt,
3183
+ kind,
3184
+ status: res.status,
3185
+ ok: res.ok,
3186
+ requestId,
3187
+ durationMs,
3188
+ willRetry
3189
+ });
3190
+ } catch {
3191
+ }
3192
+ }
3193
+ log(
3194
+ `${method} ${path} \u2192 ${res.status} in ${durationMs}ms${requestId ? ` (req ${requestId})` : ""}`,
3195
+ {
3196
+ method,
3197
+ path,
3198
+ status: res.status,
3199
+ durationMs,
3200
+ requestId,
3201
+ attempt
3202
+ }
3203
+ );
3204
+ if (!willRetry) return res;
3205
+ const delay = backoff(attempt, res);
3206
+ try {
3207
+ await res.body?.cancel();
3208
+ } catch {
3209
+ }
3210
+ await wait(delay, signal);
3211
+ }
3212
+ }
3213
+ async function httpError(res, method, path) {
3214
+ const body = await res.json().catch(() => ({ error: res.statusText }));
3215
+ const b = body ?? {};
3216
+ return new NivaroError({
3217
+ message: errorBodyMessage(body) || res.statusText || `HTTP ${res.status}`,
3218
+ status: res.status,
3219
+ code: typeof b.code === "string" ? b.code : null,
3220
+ requestId: res.headers?.get?.(REQUEST_ID_HEADER) ?? null,
3221
+ response: body,
3222
+ method,
3223
+ path,
3224
+ retryAfterMs: retryAfterMs(res.headers?.get?.("retry-after")),
3225
+ issues: b.issues
3226
+ });
3227
+ }
3228
+ function reportError(err, info, callerSignal) {
3229
+ if (!options.onError) return;
3230
+ if (callerSignal?.aborted && err?.name === "AbortError") return;
3231
+ try {
3232
+ options.onError(err instanceof Error ? err : new Error(String(err)), info);
3233
+ } catch {
3234
+ }
3235
+ }
2683
3236
  async function request(command) {
2684
3237
  const qs = command._params ? "?" + new URLSearchParams(
2685
3238
  Object.fromEntries(
@@ -2688,45 +3241,57 @@ function createNivaro(url, options = {}) {
2688
3241
  ).toString() : "";
2689
3242
  const timeoutMs = options.timeoutMs ?? 0;
2690
3243
  const timed = command._method === "GET" && timeoutMs > 0;
2691
- const ctrl = timed ? new AbortController() : null;
2692
- const timer = ctrl ? setTimeout(() => ctrl.abort(), timeoutMs) : null;
2693
3244
  const callerSignal = command._signal;
3245
+ let ctrl = null;
3246
+ let timer = null;
2694
3247
  const onCallerAbort = () => ctrl?.abort();
2695
- if (callerSignal && ctrl) {
2696
- if (callerSignal.aborted) ctrl.abort();
2697
- else callerSignal.addEventListener("abort", onCallerAbort, { once: true });
2698
- }
2699
- const signal = ctrl ? ctrl.signal : callerSignal;
3248
+ let wired = false;
3249
+ const fullUrl = `${baseUrl}/api${command._path}${qs}`;
3250
+ const where = { method: command._method, path: command._path, kind: "request" };
2700
3251
  try {
2701
- let res;
2702
- try {
2703
- res = await fetcher(`${baseUrl}/api${command._path}${qs}`, {
2704
- method: command._method,
2705
- headers: authHeaders(),
2706
- credentials: credentialsMode(),
2707
- body: command._body != null ? JSON.stringify(command._body) : void 0,
2708
- ...signal ? { signal } : {}
2709
- });
2710
- } catch (e) {
2711
- if (callerSignal?.aborted) throw e;
2712
- if (ctrl?.signal.aborted)
2713
- throw Object.assign(new Error(`Request timed out after ${timeoutMs / 1e3}s`), {
2714
- name: "TimeoutError"
2715
- });
2716
- throw e;
2717
- } finally {
2718
- if (timer) clearTimeout(timer);
2719
- }
3252
+ const res = await send(
3253
+ "request",
3254
+ command._method,
3255
+ command._path,
3256
+ fullUrl,
3257
+ baseHeaders(true, command._headers),
3258
+ async (headers) => {
3259
+ ctrl = timed ? new AbortController() : null;
3260
+ const attemptCtrl = ctrl;
3261
+ timer = attemptCtrl ? setTimeout(() => attemptCtrl.abort(), timeoutMs) : null;
3262
+ if (callerSignal && attemptCtrl) {
3263
+ if (callerSignal.aborted) attemptCtrl.abort();
3264
+ else if (!wired) {
3265
+ callerSignal.addEventListener("abort", onCallerAbort, { once: true });
3266
+ wired = true;
3267
+ }
3268
+ }
3269
+ const signal = attemptCtrl ? attemptCtrl.signal : callerSignal;
3270
+ try {
3271
+ return await fetcher(fullUrl, {
3272
+ method: command._method,
3273
+ headers,
3274
+ credentials: credentialsMode(),
3275
+ body: command._body != null ? JSON.stringify(command._body) : void 0,
3276
+ ...signal ? { signal } : {}
3277
+ });
3278
+ } catch (e) {
3279
+ if (callerSignal?.aborted) throw e;
3280
+ if (attemptCtrl?.signal.aborted)
3281
+ throw Object.assign(new Error(`Request timed out after ${timeoutMs / 1e3}s`), {
3282
+ name: "TimeoutError"
3283
+ });
3284
+ throw e;
3285
+ } finally {
3286
+ if (timer) clearTimeout(timer);
3287
+ }
3288
+ },
3289
+ callerSignal
3290
+ );
2720
3291
  if (command._method === "DELETE" && res.status === 204) {
2721
3292
  return void 0;
2722
3293
  }
2723
- if (!res.ok) {
2724
- const err = await res.json().catch(() => ({ error: res.statusText }));
2725
- throw Object.assign(new Error(err.error ?? res.statusText), {
2726
- status: res.status,
2727
- response: err
2728
- });
2729
- }
3294
+ if (!res.ok) throw await httpError(res, command._method, command._path);
2730
3295
  const contentType = res.headers.get("content-type") ?? "";
2731
3296
  if (!contentType.includes("application/json")) {
2732
3297
  if (contentType.includes("application/pdf") || contentType.includes("application/octet-stream")) {
@@ -2735,8 +3300,11 @@ function createNivaro(url, options = {}) {
2735
3300
  return await res.text();
2736
3301
  }
2737
3302
  return await res.json();
3303
+ } catch (err) {
3304
+ reportError(err, where, callerSignal);
3305
+ throw err;
2738
3306
  } finally {
2739
- callerSignal?.removeEventListener("abort", onCallerAbort);
3307
+ if (wired) callerSignal?.removeEventListener("abort", onCallerAbort);
2740
3308
  }
2741
3309
  }
2742
3310
  async function upload(file, opts = {}) {
@@ -2744,20 +3312,24 @@ function createNivaro(url, options = {}) {
2744
3312
  fd.append("file", file);
2745
3313
  if (opts.title) fd.append("title", opts.title);
2746
3314
  if (opts.folder) fd.append("folder", opts.folder);
2747
- const res = await fetcher(`${baseUrl}/api/files/upload`, {
2748
- method: "POST",
2749
- headers: currentToken ? { Authorization: `Bearer ${currentToken}` } : {},
2750
- credentials: credentialsMode(),
2751
- body: fd
2752
- });
2753
- if (!res.ok) {
2754
- const err = await res.json().catch(() => ({ error: res.statusText }));
2755
- throw Object.assign(new Error(err.error ?? res.statusText), {
2756
- status: res.status
2757
- });
3315
+ const path = "/files/upload";
3316
+ const fullUrl = `${baseUrl}/api${path}`;
3317
+ try {
3318
+ const res = await send(
3319
+ "upload",
3320
+ "POST",
3321
+ path,
3322
+ fullUrl,
3323
+ baseHeaders(false),
3324
+ (headers) => fetcher(fullUrl, { method: "POST", headers, credentials: credentialsMode(), body: fd })
3325
+ );
3326
+ if (!res.ok) throw await httpError(res, "POST", path);
3327
+ const result = await res.json();
3328
+ return result.data;
3329
+ } catch (err) {
3330
+ reportError(err, { method: "POST", path, kind: "upload" });
3331
+ throw err;
2758
3332
  }
2759
- const result = await res.json();
2760
- return result.data;
2761
3333
  }
2762
3334
  function fileUrl(fileId) {
2763
3335
  return `${baseUrl}/api/files/${fileId}`;
@@ -2765,44 +3337,63 @@ function createNivaro(url, options = {}) {
2765
3337
  async function importParse(templateId, file, fileName) {
2766
3338
  const form = new FormData();
2767
3339
  form.append("file", file, fileName ?? file.name ?? "import.xlsx");
2768
- const res = await fetcher(`${baseUrl}/api/import-templates/${templateId}/parse`, {
2769
- method: "POST",
2770
- headers: currentToken ? { Authorization: `Bearer ${currentToken}` } : {},
2771
- credentials: credentialsMode(),
2772
- body: form
2773
- });
2774
- const json = await res.json().catch(() => ({ error: res.statusText }));
2775
- if (!res.ok)
2776
- throw Object.assign(new Error(json?.error || "Import parse failed"), {
2777
- status: res.status,
2778
- issues: json?.issues
2779
- });
2780
- return json.data;
3340
+ const path = `/import-templates/${templateId}/parse`;
3341
+ const fullUrl = `${baseUrl}/api${path}`;
3342
+ try {
3343
+ const res = await send(
3344
+ "import-parse",
3345
+ "POST",
3346
+ path,
3347
+ fullUrl,
3348
+ baseHeaders(false),
3349
+ (headers) => fetcher(fullUrl, { method: "POST", headers, credentials: credentialsMode(), body: form })
3350
+ );
3351
+ if (!res.ok) {
3352
+ const err = await httpError(res, "POST", path);
3353
+ if (!errorBodyMessage(err.response)) err.message = "Import parse failed";
3354
+ throw err;
3355
+ }
3356
+ const json = await res.json();
3357
+ return json.data;
3358
+ } catch (err) {
3359
+ reportError(err, { method: "POST", path, kind: "import-parse" });
3360
+ throw err;
3361
+ }
2781
3362
  }
2782
3363
  async function graphql(query, variables, operationName) {
2783
- const res = await fetcher(`${baseUrl}/api/graphql`, {
2784
- method: "POST",
2785
- headers: authHeaders(),
2786
- credentials: credentialsMode(),
2787
- body: JSON.stringify({ query, variables, operationName })
2788
- });
2789
- if (!res.ok) {
2790
- const err = await res.json().catch(() => ({ error: res.statusText }));
2791
- throw Object.assign(new Error(err.error ?? res.statusText), {
2792
- status: res.status,
2793
- response: err
2794
- });
2795
- }
2796
- const json = await res.json();
2797
- if (json.errors?.length) {
2798
- const first = json.errors[0];
2799
- throw Object.assign(new Error(first.message), {
2800
- graphqlErrors: json.errors,
2801
- extensions: first.extensions
2802
- });
3364
+ const path = "/graphql";
3365
+ const fullUrl = `${baseUrl}/api${path}`;
3366
+ const where = { method: "POST", path, kind: "graphql" };
3367
+ try {
3368
+ const res = await send(
3369
+ "graphql",
3370
+ "POST",
3371
+ path,
3372
+ fullUrl,
3373
+ baseHeaders(true),
3374
+ (headers) => fetcher(fullUrl, {
3375
+ method: "POST",
3376
+ headers,
3377
+ credentials: credentialsMode(),
3378
+ body: JSON.stringify({ query, variables, operationName })
3379
+ })
3380
+ );
3381
+ if (!res.ok) throw await httpError(res, "POST", path);
3382
+ const json = await res.json();
3383
+ if (json.errors?.length) {
3384
+ const first = json.errors[0];
3385
+ throw Object.assign(new Error(first.message), {
3386
+ graphqlErrors: json.errors,
3387
+ extensions: first.extensions,
3388
+ requestId: res.headers?.get?.(REQUEST_ID_HEADER) ?? null
3389
+ });
3390
+ }
3391
+ if (!json.data) throw new Error("GraphQL response contained no data");
3392
+ return json.data;
3393
+ } catch (err) {
3394
+ reportError(err, where);
3395
+ throw err;
2803
3396
  }
2804
- if (!json.data) throw new Error("GraphQL response contained no data");
2805
- return json.data;
2806
3397
  }
2807
3398
  return { request, graphql, upload, importParse, fileUrl, setToken, getToken, url: baseUrl };
2808
3399
  }
@@ -3034,8 +3625,11 @@ export {
3034
3625
  EDITOR_NOTE_MAX,
3035
3626
  GROUP_PATCH_KEYS,
3036
3627
  LAYOUT_PATCH_KEYS,
3628
+ NOTIFICATIONS_CHANNEL,
3629
+ NivaroError,
3037
3630
  PLACEMENT_PATCH_KEYS,
3038
3631
  READ_MANY_MAX,
3632
+ REQUEST_ID_HEADER,
3039
3633
  _and,
3040
3634
  _contains,
3041
3635
  _ends_with,
@@ -3055,6 +3649,7 @@ export {
3055
3649
  _some,
3056
3650
  _starts_with,
3057
3651
  abandonHelpVideoUpload,
3652
+ acknowledgeNotification,
3058
3653
  acquireItemLock,
3059
3654
  activateLayout,
3060
3655
  addChatChannelMember,
@@ -3081,22 +3676,32 @@ export {
3081
3676
  approveAddendum,
3082
3677
  approveAiProposal,
3083
3678
  archiveHelpVideo,
3679
+ archiveReadNotifications,
3084
3680
  asc,
3085
3681
  askHuman,
3086
3682
  attachFileToRecord,
3087
3683
  backupExportPath,
3684
+ batchItems,
3088
3685
  batchPickerExclusionStatus,
3686
+ bulkDeleteItems,
3687
+ bulkNotificationAction,
3089
3688
  bulkPickerExclusion,
3689
+ bulkRestoreTrash,
3690
+ bulkTransitionItems,
3691
+ bulkUpdateItems,
3692
+ bulkWriteItems,
3090
3693
  callExternalApi,
3091
3694
  callExternalApiEndpoint,
3092
3695
  callInstanceTool,
3093
3696
  cancelAgentQuestion,
3697
+ cancelJobRun,
3094
3698
  cancelScheduledChange,
3095
3699
  cancelStagedImport,
3096
3700
  captureCpuProfile,
3097
3701
  cascadeFieldDependencies,
3098
3702
  chaosWhatIf,
3099
3703
  checkBlackoutDate,
3704
+ checkItemFilter,
3100
3705
  claimQueueItem,
3101
3706
  claimSupportTicket,
3102
3707
  claimTask,
@@ -3108,6 +3713,7 @@ export {
3108
3713
  completeTask,
3109
3714
  copyReportWidget,
3110
3715
  createAccessAudit,
3716
+ createActivityEntry,
3111
3717
  createAddendum,
3112
3718
  createAlertDefinition,
3113
3719
  createAlertSubscription,
@@ -3121,6 +3727,8 @@ export {
3121
3727
  createChatRoomType,
3122
3728
  createCollectionLayout,
3123
3729
  createComment,
3730
+ createDashboard,
3731
+ createDashboardWidget,
3124
3732
  createDataQualityRule,
3125
3733
  createExternalApi,
3126
3734
  createExternalApiEndpoint,
@@ -3148,6 +3756,7 @@ export {
3148
3756
  createRealtime,
3149
3757
  createRecordLink,
3150
3758
  createRecordTemplate,
3759
+ createReminder,
3151
3760
  createReport,
3152
3761
  createReportAlert,
3153
3762
  createReportAnnotation,
@@ -3158,6 +3767,7 @@ export {
3158
3767
  createRole,
3159
3768
  createRolePolicy,
3160
3769
  createRule,
3770
+ createSavedSearch,
3161
3771
  createSavedView,
3162
3772
  createScheduledChange,
3163
3773
  createScheduledReport,
@@ -3188,6 +3798,8 @@ export {
3188
3798
  deleteChatMessage,
3189
3799
  deleteCollectionLayout,
3190
3800
  deleteComment,
3801
+ deleteDashboard,
3802
+ deleteDashboardWidget,
3191
3803
  deleteDataQualityRule,
3192
3804
  deleteExternalApi,
3193
3805
  deleteExternalApiEndpoint,
@@ -3211,6 +3823,7 @@ export {
3211
3823
  deleteQueueView,
3212
3824
  deleteRecordLink,
3213
3825
  deleteRecordTemplate,
3826
+ deleteReminder,
3214
3827
  deleteReport,
3215
3828
  deleteReportAlert,
3216
3829
  deleteReportAnnotation,
@@ -3222,6 +3835,7 @@ export {
3222
3835
  deleteRole,
3223
3836
  deleteRolePolicy,
3224
3837
  deleteRule,
3838
+ deleteSavedSearch,
3225
3839
  deleteSavedView,
3226
3840
  deleteScheduledReport,
3227
3841
  deleteSessionRecording,
@@ -3249,6 +3863,8 @@ export {
3249
3863
  drillReportWidgetRows,
3250
3864
  editChatMessage,
3251
3865
  endSessionRecording,
3866
+ errorBodyMessage,
3867
+ estimateBackgroundRun,
3252
3868
  evaluateAlerts,
3253
3869
  evaluateAtRisk,
3254
3870
  evaluateFieldDefaults,
@@ -3307,6 +3923,7 @@ export {
3307
3923
  installBlueprint,
3308
3924
  installCollectionPreset,
3309
3925
  invokeInternalWidgetAction,
3926
+ isNivaroError,
3310
3927
  isPageSlot,
3311
3928
  joinChatRoom,
3312
3929
  leaveChatRoom,
@@ -3314,6 +3931,7 @@ export {
3314
3931
  listAccessAudits,
3315
3932
  listActiveAtRiskRules,
3316
3933
  listActivePresence,
3934
+ listActivityActions,
3317
3935
  listAddendums,
3318
3936
  listAgentTasks,
3319
3937
  listAgentTriggerDeliveries,
@@ -3324,11 +3942,13 @@ export {
3324
3942
  listAnomalyDefinitions,
3325
3943
  listAnomalyRules,
3326
3944
  listApiKeys,
3945
+ listApiRequests,
3327
3946
  listApprovalChains,
3328
3947
  listApprovalInstances,
3329
3948
  listAskedQuestions,
3330
3949
  listAtRiskRules,
3331
3950
  listAttributeDefinitions,
3951
+ listBackgroundRuns,
3332
3952
  listBlackoutDates,
3333
3953
  listBulkActions,
3334
3954
  listChangeOrders,
@@ -3371,11 +3991,13 @@ export {
3371
3991
  listItemScheduledChanges,
3372
3992
  listJobRuns,
3373
3993
  listLayoutVersions,
3994
+ listMailLog,
3374
3995
  listMetricAlertRules,
3375
3996
  listMetricAlertSubscriptions,
3376
3997
  listMetricDefinitions,
3377
3998
  listMyAgentQuestions,
3378
3999
  listMyHelpVideoUploads,
4000
+ listMyJobs,
3379
4001
  listMyTasks,
3380
4002
  listNotificationSubscriptions,
3381
4003
  listNotifications,
@@ -3388,11 +4010,13 @@ export {
3388
4010
  listQueueViews,
3389
4011
  listQueues,
3390
4012
  listRecordLinks,
4013
+ listRecordMail,
3391
4014
  listRecordTemplates,
3392
4015
  listRegisteredExtensions,
3393
4016
  listRegisteredFlowOperations,
3394
4017
  listRegisteredFlowTriggers,
3395
4018
  listRelatedComments,
4019
+ listReminders,
3396
4020
  listReportAlerts,
3397
4021
  listReportAnnotations,
3398
4022
  listReportFilterPresets,
@@ -3408,10 +4032,12 @@ export {
3408
4032
  listRoleUsers,
3409
4033
  listRoles,
3410
4034
  listRules,
4035
+ listSavedSearches,
3411
4036
  listSavedViews,
3412
4037
  listScheduledChanges,
3413
4038
  listScheduledReports,
3414
4039
  listScopeDimensions,
4040
+ listSentNotifications,
3415
4041
  listSessionRecordings,
3416
4042
  listShareLinks,
3417
4043
  listSlaRules,
@@ -3425,6 +4051,7 @@ export {
3425
4051
  listTeamTasks,
3426
4052
  listThroughputCollections,
3427
4053
  listTraces,
4054
+ listTrash,
3428
4055
  listTreePermissions,
3429
4056
  listViewSubscriptions,
3430
4057
  listVirtualCollections,
@@ -3433,6 +4060,9 @@ export {
3433
4060
  listWidgetFeeds,
3434
4061
  listWorkspaceTemplates,
3435
4062
  listWorkspaces,
4063
+ logExport,
4064
+ logout,
4065
+ logoutAll,
3436
4066
  markAllNotificationsRead,
3437
4067
  markChatRoomRead,
3438
4068
  markNotificationRead,
@@ -3442,6 +4072,7 @@ export {
3442
4072
  omniSearch,
3443
4073
  openHelpVideoPackageImport,
3444
4074
  openHelpVideoUpload,
4075
+ parseRealtimeChanges,
3445
4076
  presignFileUpload,
3446
4077
  previewContentBundle,
3447
4078
  previewHelpVideoPackageImport,
@@ -3452,10 +4083,13 @@ export {
3452
4083
  proposeSchemaChange,
3453
4084
  publishHelpVideo,
3454
4085
  publishItem,
4086
+ purgeTrashItem,
3455
4087
  queryVirtualCollection,
4088
+ queueBulkWriteItems,
3456
4089
  readAccessAuditFindings,
3457
4090
  readActiveLayout,
3458
4091
  readActivity,
4092
+ readActivityEntry,
3459
4093
  readActivityReportSummary,
3460
4094
  readAddendum,
3461
4095
  readAgentQuestion,
@@ -3463,16 +4097,25 @@ export {
3463
4097
  readAlertLog,
3464
4098
  readAllStateOwners,
3465
4099
  readAnomalyLog,
4100
+ readApiAnalyticsByKey,
3466
4101
  readApiAnalyticsErrors,
3467
4102
  readApiAnalyticsSummary,
3468
4103
  readApiAnalyticsTimeseries,
3469
4104
  readApiAnalyticsTopCollections,
3470
4105
  readApiAnalyticsTopPaths,
3471
4106
  readApiKey,
4107
+ readApiKeyMonthlyUsage,
4108
+ readApiKeyUsage,
3472
4109
  readApprovalBrief,
3473
4110
  readApprovalChain,
3474
4111
  readAtRiskSummary,
4112
+ readAuthProviders,
4113
+ readBackgroundRun,
4114
+ readBackgroundRunResult,
3475
4115
  readBackupManifest,
4116
+ readBulkRun,
4117
+ readBusyJobs,
4118
+ readChanges,
3476
4119
  readChatConfig,
3477
4120
  readChatDirectory,
3478
4121
  readChatPeerRead,
@@ -3480,6 +4123,7 @@ export {
3480
4123
  readCollectionLayout,
3481
4124
  readCollectionLayouts,
3482
4125
  readCollections,
4126
+ readCommentCounts,
3483
4127
  readConfigInventory,
3484
4128
  readCoverageGaps,
3485
4129
  readDashboard,
@@ -3520,11 +4164,15 @@ export {
3520
4164
  readIssue,
3521
4165
  readIssueSummary,
3522
4166
  readItem,
4167
+ readItemBySlug,
4168
+ readItemDistinct,
3523
4169
  readItemLock,
3524
4170
  readItemLockConfig,
3525
4171
  readItems,
3526
4172
  readJobRegistry,
4173
+ readJobRunLog,
3527
4174
  readLastTouch,
4175
+ readLatestRevisionId,
3528
4176
  readLayoutAssignments,
3529
4177
  readLayoutBundle,
3530
4178
  readLayoutDrift,
@@ -3533,17 +4181,22 @@ export {
3533
4181
  readLayoutOverview,
3534
4182
  readLayoutProposals,
3535
4183
  readLayoutVersion,
4184
+ readMailLogEntry,
4185
+ readMailStats,
3536
4186
  readMany,
3537
4187
  readMcpCapabilities,
3538
4188
  readMcpToolsConfig,
3539
4189
  readMe,
3540
4190
  readMetricAlertLog,
4191
+ readMyOwnerSeats,
3541
4192
  readMyScopes,
3542
4193
  readMyWork,
3543
4194
  readNotificationCount,
4195
+ readNotificationHistory,
3544
4196
  readNotificationSubscriptionStats,
3545
4197
  readOnlinePresence,
3546
4198
  readOwnerGroups,
4199
+ readOwnerHistory,
3547
4200
  readPage,
3548
4201
  readPageWidgetData,
3549
4202
  readPdfTemplate,
@@ -3551,6 +4204,7 @@ export {
3551
4204
  readPickerExclusion,
3552
4205
  readPickerExclusions,
3553
4206
  readPipelineFlowMap,
4207
+ readPipelineOutline,
3554
4208
  readPipelineReplay,
3555
4209
  readPipelineTemplate,
3556
4210
  readPipelineTemplates,
@@ -3563,7 +4217,9 @@ export {
3563
4217
  readQueueTrends,
3564
4218
  readQueueWorkload,
3565
4219
  readReadiness,
4220
+ readRecordDeletion,
3566
4221
  readRecordGraph,
4222
+ readRecordMute,
3567
4223
  readRelationOptions,
3568
4224
  readReport,
3569
4225
  readReportAlertLog,
@@ -3581,6 +4237,8 @@ export {
3581
4237
  readRuntimeStats,
3582
4238
  readSchemaProposal,
3583
4239
  readScopeDimensionCoverage,
4240
+ readSearchCounts,
4241
+ readSearchRecords,
3584
4242
  readSessionRecordingEvents,
3585
4243
  readSettings,
3586
4244
  readSingleton,
@@ -3618,10 +4276,12 @@ export {
3618
4276
  readWorkflowInstances,
3619
4277
  readWorkspace,
3620
4278
  readWorkspaceUsage,
4279
+ readWsToken,
3621
4280
  rebuildTreePaths,
3622
4281
  recordHelpVideoProgress,
3623
4282
  registerHelpVideoPage,
3624
4283
  rehearseCreateItem,
4284
+ rehearseUpdateItem,
3625
4285
  reindexSemanticSearch,
3626
4286
  rejectAddendum,
3627
4287
  rejectAiProposal,
@@ -3645,6 +4305,7 @@ export {
3645
4305
  requeueStagedImport,
3646
4306
  rerecordHelpVideo,
3647
4307
  rerenderHelpVideo,
4308
+ resendMail,
3648
4309
  resetReportCache,
3649
4310
  resolveLayoutProposal,
3650
4311
  resolveReportAlert,
@@ -3653,6 +4314,7 @@ export {
3653
4314
  restoreLayoutVersion,
3654
4315
  restorePipelineVersion,
3655
4316
  restoreReportVersion,
4317
+ restoreTrashItem,
3656
4318
  retryDeadLetter,
3657
4319
  retryErpSubmission,
3658
4320
  retryWebhookDelivery,
@@ -3694,7 +4356,9 @@ export {
3694
4356
  simulatePermissions,
3695
4357
  simulatePipeline,
3696
4358
  simulatePipelineImpact,
4359
+ snoozeNotification,
3697
4360
  startApproval,
4361
+ startBackgroundRun,
3698
4362
  startMasquerade,
3699
4363
  startSessionRecording,
3700
4364
  startWorkflow,
@@ -3714,7 +4378,10 @@ export {
3714
4378
  testWebhook,
3715
4379
  toggleChatPin,
3716
4380
  toggleChatReaction,
4381
+ toggleCommentReaction,
4382
+ toggleEntryReaction,
3717
4383
  togglePinnedItem,
4384
+ toggleRecordMute,
3718
4385
  toggleReportAlert,
3719
4386
  touchRecordView,
3720
4387
  transitionWorkflow,
@@ -3738,6 +4405,8 @@ export {
3738
4405
  updateChatRoomType,
3739
4406
  updateCollectionLayout,
3740
4407
  updateComment,
4408
+ updateDashboard,
4409
+ updateDashboardWidget,
3741
4410
  updateDataQualityRule,
3742
4411
  updateDraftPublishConfig,
3743
4412
  updateErpSubmissionStatus,
@@ -3767,6 +4436,7 @@ export {
3767
4436
  updateQueueSources,
3768
4437
  updateQueueView,
3769
4438
  updateRecordTemplate,
4439
+ updateReminder,
3770
4440
  updateReport,
3771
4441
  updateReportAlert,
3772
4442
  updateReportWidgetPreset,
@@ -3792,5 +4462,6 @@ export {
3792
4462
  validateVirtualCollectionSql,
3793
4463
  verifyTwoFactor,
3794
4464
  whichLayoutForm,
4465
+ withHeaders,
3795
4466
  withSignal
3796
4467
  };