@zapier/zapier-sdk 0.106.0 → 0.107.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/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.107.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 274d411: `getConnection` now:
8
+ - Raises a `ZapierValidationError` (`ZAPIER_VALIDATION_ERROR`) when the response
9
+ does not match the connection schema; previously some malformed responses
10
+ surfaced as `ZapierApiError`.
11
+ - Preserves error status codes and messages. Previously, some 4xx messages were
12
+ replaced with generic text and some 5xx responses were reported as generic
13
+ 502 errors.
14
+
15
+ Output is unchanged for conforming responses.
16
+
17
+ ## 0.107.0
18
+
19
+ ### Minor Changes
20
+
21
+ - 17927b2: Added six experimental methods for putting a workflow under agentic management,
22
+ available from `@zapier/zapier-sdk/experimental`:
23
+ - `enableAgenticManagement` / `disableAgenticManagement` — turn management on or
24
+ off for one workflow. Disabling keeps the workflow's settings rather than
25
+ deleting them, so enabling it again resumes with the modes and approval choice
26
+ it had before.
27
+ - `getAgenticManagementConfig` / `updateAgenticManagementConfig` — read or change
28
+ the modes a workflow runs and whether fixes need approval. A `modes` list
29
+ replaces the whole current set in one step rather than adding to it; omit it to
30
+ change only the approval setting.
31
+ - `getAgenticManagementIntent` / `updateAgenticManagementIntent` — read or record
32
+ what a workflow version is meant to do. Each version stores its own intent and
33
+ never picks up another version's, so a newly published version starts with
34
+ none.
35
+
36
+ These operate on the same workflow `getWorkflow` and `listWorkflows` return, so
37
+ `workflow` accepts the id from either, and the methods resolve it the way the
38
+ other workflow methods do.
39
+
40
+ A workflow runs one or more modes — `heal`, `expand`, or `harden` — each
41
+ described on the `modes` parameter. `autoApprove` decides whether proposed fixes
42
+ are applied without prompting. Omit it and they are: a first enable applies
43
+ fixes without asking, and an update leaves the setting alone — so `false` is a
44
+ distinct third state rather than the same as leaving it out.
45
+
3
46
  ## 0.106.0
4
47
 
5
48
  ### Minor Changes
package/README.md CHANGED
@@ -33,9 +33,13 @@
33
33
  - [`createWorkflow`](#createworkflow--experimental)
34
34
  - [`createWorkflowDraft`](#createworkflowdraft--experimental)
35
35
  - [`deleteWorkflow`](#deleteworkflow--experimental)
36
+ - [`disableAgenticManagement`](#disableagenticmanagement--experimental)
36
37
  - [`disableWorkflow`](#disableworkflow--experimental)
37
38
  - [`discardWorkflowDraft`](#discardworkflowdraft--experimental)
39
+ - [`enableAgenticManagement`](#enableagenticmanagement--experimental)
38
40
  - [`enableWorkflow`](#enableworkflow--experimental)
41
+ - [`getAgenticManagementConfig`](#getagenticmanagementconfig--experimental)
42
+ - [`getAgenticManagementIntent`](#getagenticmanagementintent--experimental)
39
43
  - [`getDurableRun`](#getdurablerun--experimental)
40
44
  - [`getTriggerRun`](#gettriggerrun--experimental)
41
45
  - [`getWorkflow`](#getworkflow--experimental)
@@ -52,6 +56,8 @@
52
56
  - [`publishWorkflowVersion`](#publishworkflowversion--experimental)
53
57
  - [`runDurable`](#rundurable--experimental)
54
58
  - [`triggerWorkflow`](#triggerworkflow--experimental)
59
+ - [`updateAgenticManagementConfig`](#updateagenticmanagementconfig--experimental)
60
+ - [`updateAgenticManagementIntent`](#updateagenticmanagementintent--experimental)
55
61
  - [`updateWorkflow`](#updateworkflow--experimental)
56
62
  - [`updateWorkflowDraft`](#updateworkflowdraft--experimental)
57
63
  - [`validateWorkflow`](#validateworkflow--experimental)
@@ -1336,6 +1342,32 @@ const result = await zapier.deleteWorkflow({
1336
1342
  });
1337
1343
  ```
1338
1344
 
1345
+ #### `disableAgenticManagement` 🧪 _experimental_
1346
+
1347
+ Stop Agentic Management from working on one workflow. Its settings are kept, not deleted: the modes and auto-approve choice stay on file, so calling enableAgenticManagement later resumes with those settings instead of the defaults.
1348
+
1349
+ **Parameters:**
1350
+
1351
+ | Name | Type | Required | Default | Possible Values | Description |
1352
+ | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------- |
1353
+ | `options` | `object` | ✅ | — | — | |
1354
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to take out of agentic management. |
1355
+
1356
+ **Returns:** `Promise<{ success: boolean }>`
1357
+
1358
+ | Name | Type | Required | Possible Values | Description |
1359
+ | -------- | --------- | -------- | --------------- | -------------------------------------------------------------------- |
1360
+ | `data` | `object` | ✅ | — | |
1361
+ | ​ ↳ `ok` | `boolean` | ✅ | — | True when Zapier accepted the request to stop managing the workflow. |
1362
+
1363
+ **Example:**
1364
+
1365
+ ```typescript
1366
+ const result = await zapier.disableAgenticManagement({
1367
+ workflow: "example-workflow",
1368
+ });
1369
+ ```
1370
+
1339
1371
  #### `disableWorkflow` 🧪 _experimental_
1340
1372
 
1341
1373
  Disable a durable workflow so it stops accepting triggers
@@ -1408,6 +1440,35 @@ const result = await zapier.discardWorkflowDraft({
1408
1440
  });
1409
1441
  ```
1410
1442
 
1443
+ #### `enableAgenticManagement` 🧪 _experimental_
1444
+
1445
+ Put one workflow under Agentic Management. A workflow disabled earlier comes back with the modes and auto-approve choice it had, unless you pass new ones here.
1446
+
1447
+ **Parameters:**
1448
+
1449
+ | Name | Type | Required | Default | Possible Values | Description |
1450
+ | ----------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1451
+ | `options` | `object` | ✅ | — | — | |
1452
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to put under agentic management. |
1453
+ | ​ ↳ `modes` | `array` | ❌ | — | — | The modes to run for this workflow. Omit it and the workflow starts on `heal` alone. A mode is what Agentic Management watches for and what it changes in response. `heal` monitors runs for errors and, when something breaks, diagnoses the cause and drafts and tests a fix; it is the mode a workflow gets by default. `expand` grows what the workflow covers: it reviews runs that succeeded without actually doing anything — a lookup that matched nothing, a filter that passed no items, a trigger payload no branch handles — and proposes a new branch or step to handle that case, rather than rewriting the ones that already work. `harden` watches the AI steps: when an AI step keeps doing the same work the same way, it converts that step into fixed code, so the workflow runs faster, costs less, and behaves the same way every time. Modes stack — each one you name runs alongside the others, and a mode you leave out does nothing, so a workflow on `expand` alone does not repair failed runs. Whether a change goes live on its own or waits for someone to approve it is `autoApprove`, not the mode. |
1454
+ | ​ ↳ `autoApprove` | `boolean` | ❌ | — | — | Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it. Omit it and fixes are applied without asking, which is what a workflow enabled for the first time gets; a workflow being re-enabled keeps the setting it had before. |
1455
+
1456
+ **Returns:** `Promise<AgenticManagementEnableResultItem>`
1457
+
1458
+ | Name | Type | Required | Possible Values | Description |
1459
+ | ---------------- | -------- | -------- | --------------- | ----------------------------------------------------------------------- |
1460
+ | `data` | `object` | ✅ | — | |
1461
+ | ​ ↳ `manager_id` | `string` | ✅ | — | ID of the manager automation Zapier provisioned to watch this workflow. |
1462
+
1463
+ **Example:**
1464
+
1465
+ ```typescript
1466
+ const { data: agenticManagementEnableResult } =
1467
+ await zapier.enableAgenticManagement({
1468
+ workflow: "example-workflow",
1469
+ });
1470
+ ```
1471
+
1411
1472
  #### `enableWorkflow` 🧪 _experimental_
1412
1473
 
1413
1474
  Enable a durable workflow so it accepts triggers
@@ -1435,6 +1496,68 @@ const { data: workflow } = await zapier.enableWorkflow({
1435
1496
  });
1436
1497
  ```
1437
1498
 
1499
+ #### `getAgenticManagementConfig` 🧪 _experimental_
1500
+
1501
+ Read the Agentic Management config for one workflow.
1502
+
1503
+ **Parameters:**
1504
+
1505
+ | Name | Type | Required | Default | Possible Values | Description |
1506
+ | -------------- | -------- | -------- | ------- | --------------- | --------------------------- |
1507
+ | `options` | `object` | ✅ | — | — | |
1508
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to read. |
1509
+
1510
+ **Returns:** `Promise<AgenticManagementConfigItem>`
1511
+
1512
+ | Name | Type | Required | Possible Values | Description |
1513
+ | ------------------ | --------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1514
+ | `data` | `object` | ✅ | — | |
1515
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow this config describes. |
1516
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether Agentic Management is currently active for this workflow. |
1517
+ | ​ ↳ `auto_approve` | `boolean` | ✅ | — | Whether fixes are applied without asking for approval first. `false` when Agentic Management has never been set up for this workflow. |
1518
+ | ​ ↳ `modes` | `array` | ✅ | — | The modes the workflow runs. Still listed while `enabled` is false, because the settings are kept for a later re-enable — so read `enabled` to tell whether they are in effect, not this list. |
1519
+ | ​ ↳ `manager_id` | `string` | ❌ | — | ID of the manager automation Zapier provisioned for this workflow, once one exists; `null` otherwise. Use it to link to that automation to see the runs it has taken. |
1520
+
1521
+ **Example:**
1522
+
1523
+ ```typescript
1524
+ const { data: agenticManagementConfig } =
1525
+ await zapier.getAgenticManagementConfig({
1526
+ workflow: "example-workflow",
1527
+ });
1528
+ ```
1529
+
1530
+ #### `getAgenticManagementIntent` 🧪 _experimental_
1531
+
1532
+ Read the intent recorded for one workflow version: the plain-language description of what that version of the workflow is meant to do.
1533
+
1534
+ **Parameters:**
1535
+
1536
+ | Name | Type | Required | Default | Possible Values | Description |
1537
+ | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1538
+ | `options` | `object` | ✅ | — | — | |
1539
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to read. |
1540
+ | ​ ↳ `version` | `string` | ❌ | — | — | The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version. |
1541
+
1542
+ **Returns:** `Promise<AgenticManagementIntentItem>`
1543
+
1544
+ | Name | Type | Required | Possible Values | Description |
1545
+ | ------------------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1546
+ | `data` | `object` | ✅ | — | |
1547
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow the intent belongs to. |
1548
+ | ​ ↳ `workflow_version_id` | `string` | ✅ | — | The version this read or write actually landed on, so you can tell which one answered when you omitted `version`. `null` only when you read a workflow that has nothing published yet. |
1549
+ | ​ ↳ `intent` | `string` | ✅ | — | The intent stored for this version, or `null` when this version has none. Intent is never carried over from another version. |
1550
+ | ​ ↳ `updated_at` | `string` | ❌ | — | When the intent was last written; `null` when never captured. |
1551
+
1552
+ **Example:**
1553
+
1554
+ ```typescript
1555
+ const { data: agenticManagementIntent } =
1556
+ await zapier.getAgenticManagementIntent({
1557
+ workflow: "example-workflow",
1558
+ });
1559
+ ```
1560
+
1438
1561
  #### `getDurableRun` 🧪 _experimental_
1439
1562
 
1440
1563
  Get the full state of a run-once durable run, including its operations journal
@@ -2206,6 +2329,70 @@ const { data: workflowRun } = await zapier.triggerWorkflow({
2206
2329
  });
2207
2330
  ```
2208
2331
 
2332
+ #### `updateAgenticManagementConfig` 🧪 _experimental_
2333
+
2334
+ Change the modes a workflow runs, whether fixes are applied without approval, or both. A `modes` list replaces the whole current set rather than adding to it.
2335
+
2336
+ **Parameters:**
2337
+
2338
+ | Name | Type | Required | Default | Possible Values | Description |
2339
+ | ----------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2340
+ | `options` | `object` | ✅ | — | — | |
2341
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to update. |
2342
+ | ​ ↳ `modes` | `array` | ❌ | — | — | The modes to run. The list you pass replaces the whole current set in one step; it is not added to what is already active. Omit it to leave the active modes as they are. A mode is what Agentic Management watches for and what it changes in response. `heal` monitors runs for errors and, when something breaks, diagnoses the cause and drafts and tests a fix; it is the mode a workflow gets by default. `expand` grows what the workflow covers: it reviews runs that succeeded without actually doing anything — a lookup that matched nothing, a filter that passed no items, a trigger payload no branch handles — and proposes a new branch or step to handle that case, rather than rewriting the ones that already work. `harden` watches the AI steps: when an AI step keeps doing the same work the same way, it converts that step into fixed code, so the workflow runs faster, costs less, and behaves the same way every time. Modes stack — each one you name runs alongside the others, and a mode you leave out does nothing, so a workflow on `expand` alone does not repair failed runs. Whether a change goes live on its own or waits for someone to approve it is `autoApprove`, not the mode. |
2343
+ | ​ ↳ `autoApprove` | `boolean` | ❌ | — | — | Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it before anything changes. Omit it to leave the current setting alone. |
2344
+
2345
+ **Returns:** `Promise<AgenticManagementConfigItem>`
2346
+
2347
+ | Name | Type | Required | Possible Values | Description |
2348
+ | ------------------ | --------- | -------- | --------------- | ------------------------------------------------------------- |
2349
+ | `data` | `object` | ✅ | — | |
2350
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow whose config was updated. |
2351
+ | ​ ↳ `modes` | `array` | ✅ | — | The modes the workflow runs after this update. |
2352
+ | ​ ↳ `auto_approve` | `boolean` | ✅ | — | Whether fixes are applied without approval after this update. |
2353
+
2354
+ **Example:**
2355
+
2356
+ ```typescript
2357
+ const { data: agenticManagementConfig } =
2358
+ await zapier.updateAgenticManagementConfig({
2359
+ workflow: "example-workflow",
2360
+ });
2361
+ ```
2362
+
2363
+ #### `updateAgenticManagementIntent` 🧪 _experimental_
2364
+
2365
+ Record what one workflow version is meant to do. Writing again for the same version replaces the text already stored, so there is no separate create and update.
2366
+
2367
+ **Parameters:**
2368
+
2369
+ | Name | Type | Required | Default | Possible Values | Description |
2370
+ | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2371
+ | `options` | `object` | ✅ | — | — | |
2372
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to write to. |
2373
+ | ​ ↳ `intent` | `string` | ✅ | — | — | What this version of the workflow is for, in your own words: the outcome it produces, what sets it off, and anything that must always hold true. Plain prose, not code. |
2374
+ | ​ ↳ `version` | `string` | ❌ | — | — | The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version. |
2375
+
2376
+ **Returns:** `Promise<AgenticManagementIntentItem>`
2377
+
2378
+ | Name | Type | Required | Possible Values | Description |
2379
+ | ------------------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2380
+ | `data` | `object` | ✅ | — | |
2381
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow the intent belongs to. |
2382
+ | ​ ↳ `workflow_version_id` | `string` | ✅ | — | The version this read or write actually landed on, so you can tell which one answered when you omitted `version`. `null` only when you read a workflow that has nothing published yet. |
2383
+ | ​ ↳ `intent` | `string` | ✅ | — | The intent stored for this version, or `null` when this version has none. Intent is never carried over from another version. |
2384
+ | ​ ↳ `updated_at` | `string` | ❌ | — | When the intent was last written; `null` when never captured. |
2385
+
2386
+ **Example:**
2387
+
2388
+ ```typescript
2389
+ const { data: agenticManagementIntent } =
2390
+ await zapier.updateAgenticManagementIntent({
2391
+ workflow: "example-workflow",
2392
+ intent: "example-intent",
2393
+ });
2394
+ ```
2395
+
2209
2396
  #### `updateWorkflow` 🧪 _experimental_
2210
2397
 
2211
2398
  Update a durable workflow's name and/or description
@@ -4,7 +4,7 @@ import { withPositional, declareOptionalProperty, defineProperty, createDeprecat
4
4
  export { CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, addPlugin, composePlugins, createController, createCorePlugin, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, defineOverride, definePlugin, defineProperty, defineResolver, disposeSdk, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getNegatable, getRegistryPlugin, isCoreCancelledSignal, isCoreError, isCoreSignal, isPositional, omitExports, resolvePlugin, runInMethodScope, runWithTelemetryContext, selectExports, toSnakeCase, toTitleCase } from '@zapier/kitcore';
5
5
  import { buildHttpRequestContext, buildActionRunContext } from '@zapier/policy-context';
6
6
  import { ListAppsQuerySchema, AppItemSchema as AppItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/apps';
7
- import { ListConnectionsQuerySchema as ListConnectionsQuerySchema$1, ConnectionItemSchema } from '@zapier/zapier-sdk-core/v0/schemas/connections';
7
+ import { ListConnectionsQuerySchema as ListConnectionsQuerySchema$1, ConnectionSchema, ConnectionItemSchema } from '@zapier/zapier-sdk-core/v0/schemas/connections';
8
8
  import { ListClientCredentialsQuerySchema as ListClientCredentialsQuerySchema$1, ClientCredentialsItemSchema as ClientCredentialsItemSchema$1, CreateClientCredentialsRequestSchema, ClientCredentialsCreatedItemSchema as ClientCredentialsCreatedItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/client-credentials';
9
9
 
10
10
  // src/constants.ts
@@ -2226,6 +2226,16 @@ var pathConfig = {
2226
2226
  "/forms": {
2227
2227
  authHeader: "Authorization",
2228
2228
  subdomain: "api"
2229
+ },
2230
+ // e.g. /agentic-management/v0/<workflow-id> ->
2231
+ // https://api.zapier.com/agentic-management/v0/<workflow-id>
2232
+ // Like Forms, the Agentic Management API is registered on the Public API
2233
+ // Gateway and has no sdkapi proxy route, so it goes straight to the
2234
+ // gateway. Its governance metadata rewrites /agentic-management/v0/... to
2235
+ // the service's internal route, which is why no pathPrefix is applied here.
2236
+ "/agentic-management": {
2237
+ authHeader: "Authorization",
2238
+ subdomain: "api"
2229
2239
  }
2230
2240
  };
2231
2241
 
@@ -2674,7 +2684,7 @@ function logRouteOverride({
2674
2684
  }
2675
2685
 
2676
2686
  // src/sdk-version.ts
2677
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.106.0" : void 0) || "unknown";
2687
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.107.1" : void 0) || "unknown";
2678
2688
 
2679
2689
  // src/utils/open-url.ts
2680
2690
  var nodePrefix = "node:";
@@ -7967,6 +7977,13 @@ var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
7967
7977
  // SDK specific property for pagination/iterable helpers
7968
7978
  cursor: z.string().optional().describe("Cursor to start from")
7969
7979
  }).describe("List available connections with optional filtering");
7980
+ ConnectionSchema.extend({
7981
+ is_stale: z.boolean().optional(),
7982
+ is_shared: z.boolean().optional(),
7983
+ members: z.array(z.record(z.string(), z.any())).optional(),
7984
+ customuser_id: z.number().nullable().optional(),
7985
+ customuser_public_id: z.string().nullable().optional()
7986
+ });
7970
7987
  function formatConnectionItem(item) {
7971
7988
  const details = [];
7972
7989
  const appKey = item.app_key ?? "unknown";
@@ -8278,6 +8295,76 @@ var getAppPlugin = defineMethod({
8278
8295
  throw new ZapierAppNotFoundError("App not found", { appKey });
8279
8296
  }
8280
8297
  });
8298
+
8299
+ // src/normalizers/shared.ts
8300
+ function fastifyToString(value) {
8301
+ if (value === void 0) {
8302
+ return void 0;
8303
+ }
8304
+ if (typeof value === "string") {
8305
+ return value;
8306
+ }
8307
+ if (value === null) {
8308
+ return "";
8309
+ }
8310
+ if (value instanceof Date) {
8311
+ return value.toISOString();
8312
+ }
8313
+ if (value instanceof RegExp) {
8314
+ return value.source;
8315
+ }
8316
+ try {
8317
+ return String(value.toString());
8318
+ } catch {
8319
+ return "[unserializable]";
8320
+ }
8321
+ }
8322
+
8323
+ // src/normalizers/connection.ts
8324
+ function normalizeConnectionItem({
8325
+ connection,
8326
+ appKey: providedAppKey,
8327
+ appVersion: providedAppVersion,
8328
+ adaptError
8329
+ }) {
8330
+ let appKey = providedAppKey;
8331
+ let appVersion = providedAppVersion;
8332
+ if (connection.selected_api && typeof connection.selected_api === "string") {
8333
+ const [extractedAppKey, extractedVersion] = splitVersionedKey(
8334
+ connection.selected_api
8335
+ );
8336
+ if (!appKey) {
8337
+ appKey = extractedAppKey;
8338
+ }
8339
+ if (!appVersion) {
8340
+ appVersion = extractedVersion;
8341
+ }
8342
+ }
8343
+ const {
8344
+ selected_api: selectedApi,
8345
+ customuser_id: profileId,
8346
+ id,
8347
+ account_id: accountId,
8348
+ ...restOfConnection
8349
+ } = connection;
8350
+ const normalized = {
8351
+ ...restOfConnection,
8352
+ id: String(id),
8353
+ account_id: String(accountId),
8354
+ implementation_id: selectedApi,
8355
+ title: connection.title || connection.label || void 0,
8356
+ is_stale: fastifyToString(connection.is_stale),
8357
+ is_expired: fastifyToString(connection.is_stale),
8358
+ is_shared: fastifyToString(connection.is_shared),
8359
+ members: fastifyToString(connection.members),
8360
+ customuser_public_id: fastifyToString(connection.customuser_public_id),
8361
+ expired_at: connection.marked_stale_at,
8362
+ app_key: appKey,
8363
+ app_version: appVersion,
8364
+ profile_id: profileId != null ? String(profileId) : void 0
8365
+ };
8366
+ return createValidator(ConnectionItemSchema, { adaptError })(normalized);
8367
+ }
8281
8368
  var GetConnectionDescription = "Get details for a specific connection";
8282
8369
  var GetConnectionSchema = z.object({
8283
8370
  connection: ConnectionPropertySchema
@@ -8299,7 +8386,7 @@ var GetConnectionInputSchema = z.union([
8299
8386
  // src/plugins/getConnection/index.ts
8300
8387
  var getConnectionPlugin = defineMethod({
8301
8388
  name: "getConnection",
8302
- imports: [apiPluginRef],
8389
+ imports: [apiPluginRef, coreOptionsPluginRef],
8303
8390
  categories: ["connection"],
8304
8391
  itemType: "Connection",
8305
8392
  inputSchema: GetConnectionInputSchema,
@@ -8311,8 +8398,8 @@ var getConnectionPlugin = defineMethod({
8311
8398
  run: async ({ imports, input }) => {
8312
8399
  const api = imports.api;
8313
8400
  const resolvedConnectionId = "connection" in input ? input.connection : "connectionId" in input ? input.connectionId : input.authenticationId;
8314
- const response = await api.get(
8315
- `/api/v0/connections/${encodeURIComponent(String(resolvedConnectionId))}`,
8401
+ const raw = await api.get(
8402
+ `/zapier/api/v4/authentications/${encodeURIComponent(String(resolvedConnectionId))}/`,
8316
8403
  {
8317
8404
  resource: {
8318
8405
  type: "connection",
@@ -8320,7 +8407,14 @@ var getConnectionPlugin = defineMethod({
8320
8407
  }
8321
8408
  }
8322
8409
  );
8323
- return { data: transformConnectionItem(response.data) };
8410
+ return {
8411
+ data: transformConnectionItem(
8412
+ normalizeConnectionItem({
8413
+ connection: raw,
8414
+ adaptError: imports.coreOptions?.adaptError
8415
+ })
8416
+ )
8417
+ };
8324
8418
  }
8325
8419
  });
8326
8420
 
@@ -2227,6 +2227,16 @@ var pathConfig = {
2227
2227
  "/forms": {
2228
2228
  authHeader: "Authorization",
2229
2229
  subdomain: "api"
2230
+ },
2231
+ // e.g. /agentic-management/v0/<workflow-id> ->
2232
+ // https://api.zapier.com/agentic-management/v0/<workflow-id>
2233
+ // Like Forms, the Agentic Management API is registered on the Public API
2234
+ // Gateway and has no sdkapi proxy route, so it goes straight to the
2235
+ // gateway. Its governance metadata rewrites /agentic-management/v0/... to
2236
+ // the service's internal route, which is why no pathPrefix is applied here.
2237
+ "/agentic-management": {
2238
+ authHeader: "Authorization",
2239
+ subdomain: "api"
2230
2240
  }
2231
2241
  };
2232
2242
 
@@ -2675,7 +2685,7 @@ function logRouteOverride({
2675
2685
  }
2676
2686
 
2677
2687
  // src/sdk-version.ts
2678
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.106.0" : void 0) || "unknown";
2688
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.107.1" : void 0) || "unknown";
2679
2689
 
2680
2690
  // src/utils/open-url.ts
2681
2691
  var nodePrefix = "node:";
@@ -7968,6 +7978,13 @@ var ListConnectionsQuerySchema = connections.ListConnectionsQuerySchema.omit({
7968
7978
  // SDK specific property for pagination/iterable helpers
7969
7979
  cursor: zod.z.string().optional().describe("Cursor to start from")
7970
7980
  }).describe("List available connections with optional filtering");
7981
+ connections.ConnectionSchema.extend({
7982
+ is_stale: zod.z.boolean().optional(),
7983
+ is_shared: zod.z.boolean().optional(),
7984
+ members: zod.z.array(zod.z.record(zod.z.string(), zod.z.any())).optional(),
7985
+ customuser_id: zod.z.number().nullable().optional(),
7986
+ customuser_public_id: zod.z.string().nullable().optional()
7987
+ });
7971
7988
  function formatConnectionItem(item) {
7972
7989
  const details = [];
7973
7990
  const appKey = item.app_key ?? "unknown";
@@ -8279,6 +8296,76 @@ var getAppPlugin = kitcore.defineMethod({
8279
8296
  throw new ZapierAppNotFoundError("App not found", { appKey });
8280
8297
  }
8281
8298
  });
8299
+
8300
+ // src/normalizers/shared.ts
8301
+ function fastifyToString(value) {
8302
+ if (value === void 0) {
8303
+ return void 0;
8304
+ }
8305
+ if (typeof value === "string") {
8306
+ return value;
8307
+ }
8308
+ if (value === null) {
8309
+ return "";
8310
+ }
8311
+ if (value instanceof Date) {
8312
+ return value.toISOString();
8313
+ }
8314
+ if (value instanceof RegExp) {
8315
+ return value.source;
8316
+ }
8317
+ try {
8318
+ return String(value.toString());
8319
+ } catch {
8320
+ return "[unserializable]";
8321
+ }
8322
+ }
8323
+
8324
+ // src/normalizers/connection.ts
8325
+ function normalizeConnectionItem({
8326
+ connection,
8327
+ appKey: providedAppKey,
8328
+ appVersion: providedAppVersion,
8329
+ adaptError
8330
+ }) {
8331
+ let appKey = providedAppKey;
8332
+ let appVersion = providedAppVersion;
8333
+ if (connection.selected_api && typeof connection.selected_api === "string") {
8334
+ const [extractedAppKey, extractedVersion] = splitVersionedKey(
8335
+ connection.selected_api
8336
+ );
8337
+ if (!appKey) {
8338
+ appKey = extractedAppKey;
8339
+ }
8340
+ if (!appVersion) {
8341
+ appVersion = extractedVersion;
8342
+ }
8343
+ }
8344
+ const {
8345
+ selected_api: selectedApi,
8346
+ customuser_id: profileId,
8347
+ id,
8348
+ account_id: accountId,
8349
+ ...restOfConnection
8350
+ } = connection;
8351
+ const normalized = {
8352
+ ...restOfConnection,
8353
+ id: String(id),
8354
+ account_id: String(accountId),
8355
+ implementation_id: selectedApi,
8356
+ title: connection.title || connection.label || void 0,
8357
+ is_stale: fastifyToString(connection.is_stale),
8358
+ is_expired: fastifyToString(connection.is_stale),
8359
+ is_shared: fastifyToString(connection.is_shared),
8360
+ members: fastifyToString(connection.members),
8361
+ customuser_public_id: fastifyToString(connection.customuser_public_id),
8362
+ expired_at: connection.marked_stale_at,
8363
+ app_key: appKey,
8364
+ app_version: appVersion,
8365
+ profile_id: profileId != null ? String(profileId) : void 0
8366
+ };
8367
+ return kitcore.createValidator(connections.ConnectionItemSchema, { adaptError })(normalized);
8368
+ }
8282
8369
  var GetConnectionDescription = "Get details for a specific connection";
8283
8370
  var GetConnectionSchema = zod.z.object({
8284
8371
  connection: ConnectionPropertySchema
@@ -8300,7 +8387,7 @@ var GetConnectionInputSchema = zod.z.union([
8300
8387
  // src/plugins/getConnection/index.ts
8301
8388
  var getConnectionPlugin = kitcore.defineMethod({
8302
8389
  name: "getConnection",
8303
- imports: [apiPluginRef],
8390
+ imports: [apiPluginRef, kitcore.coreOptionsPluginRef],
8304
8391
  categories: ["connection"],
8305
8392
  itemType: "Connection",
8306
8393
  inputSchema: GetConnectionInputSchema,
@@ -8312,8 +8399,8 @@ var getConnectionPlugin = kitcore.defineMethod({
8312
8399
  run: async ({ imports, input }) => {
8313
8400
  const api = imports.api;
8314
8401
  const resolvedConnectionId = "connection" in input ? input.connection : "connectionId" in input ? input.connectionId : input.authenticationId;
8315
- const response = await api.get(
8316
- `/api/v0/connections/${encodeURIComponent(String(resolvedConnectionId))}`,
8402
+ const raw = await api.get(
8403
+ `/zapier/api/v4/authentications/${encodeURIComponent(String(resolvedConnectionId))}/`,
8317
8404
  {
8318
8405
  resource: {
8319
8406
  type: "connection",
@@ -8321,7 +8408,14 @@ var getConnectionPlugin = kitcore.defineMethod({
8321
8408
  }
8322
8409
  }
8323
8410
  );
8324
- return { data: transformConnectionItem(response.data) };
8411
+ return {
8412
+ data: transformConnectionItem(
8413
+ normalizeConnectionItem({
8414
+ connection: raw,
8415
+ adaptError: imports.coreOptions?.adaptError
8416
+ })
8417
+ )
8418
+ };
8325
8419
  }
8326
8420
  });
8327
8421