@zapier/zapier-sdk 0.82.1 → 0.83.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/AGENTS.md CHANGED
@@ -34,7 +34,7 @@ The easiest approach for local development. Run `npx zapier-sdk login` once, and
34
34
  const zapier = createZapierSdk();
35
35
  ```
36
36
 
37
- The CLI stores tokens in `~/.zapier-sdk/config.json`. The SDK checks for this file when no credentials are provided.
37
+ The CLI stores tokens in the OS keychain by default (with a config-file fallback). Non-secret login metadata lives in a config file managed by the `conf` library at a platform-specific path (run `npx zapier-sdk get-login-config-path` to see it). The SDK reads this login automatically when no credentials are provided.
38
38
 
39
39
  ### Production: Token String
40
40
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.83.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5f5f028: `createZapierSdk(options)` is unchanged in usage; the SDK is now built
8
+ entirely on the module plugin system internally.
9
+ - Deprecated SDK methods now log a runtime warning when called (once per
10
+ process).
11
+ - New: `disposeSdk(sdk)` releases the SDK's resources (telemetry timers,
12
+ event listeners) — call it when you're done with an SDK in a long-lived
13
+ process.
14
+ - New for plugin authors: `zapierSdkPlugin` (the SDK's root plugin),
15
+ `PluginSurface<typeof plugin>` (derive a plugin's surface type instead of
16
+ hand-writing it), `resolvePlugin`, `declareOptionalProperty`,
17
+ `SDK_OPTIONS_ID` / `sdkOptionsPluginRef`, explicit `MethodPlugin` /
18
+ `PropertyPlugin` / `AggregatePlugin` descriptor types, the
19
+ `PluginSummary` / `LeafSummary` ledger types and `EventTransport` (so a
20
+ package exporting plugins can emit their inferred types in declarations),
21
+ and `createController` with its `Controller*` types.
22
+
23
+ Changed: `getConnection` now requires a connection locator — `connection`
24
+ (or a deprecated `connectionId` / `authenticationId` alias) must be
25
+ provided. It was previously optional in the type, with nothing sensible to
26
+ fetch when omitted.
27
+
28
+ Removed without a deprecation cycle (pre-1.0 break):
29
+ - `createZapierSdkStack`, `createOptionsPlugin`, `createZapierCoreStack` —
30
+ use `createZapierSdk(options)`, or compose module plugins with `createSdk`.
31
+ - `dangerousContextPlugin` — import the specific plugin ref you need
32
+ (`apiPluginRef`, `sdkOptionsPluginRef`, ...), or use `resolvePlugin` on a
33
+ built sdk.
34
+ - The `authenticationIdResolver` / `authenticationIdGenericResolver` aliases —
35
+ use `connectionIdResolver` / `connectionIdGenericResolver`.
36
+
37
+ Changed: the exported resolvers (`appKeyResolver`, `connectionIdResolver`,
38
+ `inputsResolver`, ...) are now model resolvers — bag-form callbacks whose
39
+ imports bind at build — instead of objects with `fetch(sdk, params)`
40
+ callbacks. Attach them through a `defineMethod`'s `resolvers` map; they no
41
+ longer work on a legacy function plugin's `meta.resolvers`.
42
+
3
43
  ## 0.82.1
4
44
 
5
45
  ### Patch Changes
package/README.md CHANGED
@@ -1034,7 +1034,7 @@ Create new client credentials for the authenticated user
1034
1034
  **Example:**
1035
1035
 
1036
1036
  ```typescript
1037
- const result = await zapier.createClientCredentials({
1037
+ const { data: clientCredentials } = await zapier.createClientCredentials({
1038
1038
  name: "example-name",
1039
1039
  });
1040
1040
  ```
@@ -1129,7 +1129,7 @@ Cancel a run-once durable run in initialized or started status. Returns 409 if t
1129
1129
  **Example:**
1130
1130
 
1131
1131
  ```typescript
1132
- const result = await zapier.cancelDurableRun({
1132
+ const { data: durableRun } = await zapier.cancelDurableRun({
1133
1133
  run: "example-run",
1134
1134
  });
1135
1135
  ```
@@ -1164,7 +1164,7 @@ Create a durable workflow container. Starts disabled with no version; publish a
1164
1164
  **Example:**
1165
1165
 
1166
1166
  ```typescript
1167
- const result = await zapier.createWorkflow({
1167
+ const { data: workflow } = await zapier.createWorkflow({
1168
1168
  name: "example-name",
1169
1169
  });
1170
1170
  ```
@@ -1217,7 +1217,7 @@ Disable a durable workflow so it stops accepting triggers
1217
1217
  **Example:**
1218
1218
 
1219
1219
  ```typescript
1220
- const result = await zapier.disableWorkflow({
1220
+ const { data: workflow } = await zapier.disableWorkflow({
1221
1221
  workflow: "example-workflow",
1222
1222
  });
1223
1223
  ```
@@ -1244,7 +1244,7 @@ Enable a durable workflow so it accepts triggers
1244
1244
  **Example:**
1245
1245
 
1246
1246
  ```typescript
1247
- const result = await zapier.enableWorkflow({
1247
+ const { data: workflow } = await zapier.enableWorkflow({
1248
1248
  workflow: "example-workflow",
1249
1249
  });
1250
1250
  ```
@@ -1696,7 +1696,7 @@ Publish a new version of a durable workflow. Enables the workflow by default.
1696
1696
  **Example:**
1697
1697
 
1698
1698
  ```typescript
1699
- const result = await zapier.publishWorkflowVersion({
1699
+ const { data: workflowVersion } = await zapier.publishWorkflowVersion({
1700
1700
  workflow: "example-workflow",
1701
1701
  sourceFiles: {},
1702
1702
  });
@@ -1737,7 +1737,7 @@ Run a workflow source file as a run-once durable run on sdkdurableapi (no deploy
1737
1737
  **Example:**
1738
1738
 
1739
1739
  ```typescript
1740
- const result = await zapier.runDurable({
1740
+ const { data: durableRun } = await zapier.runDurable({
1741
1741
  sourceFiles: {},
1742
1742
  });
1743
1743
  ```
@@ -1766,7 +1766,7 @@ Look up a workflow's trigger URL and fire it manually, as the authenticated acco
1766
1766
  **Example:**
1767
1767
 
1768
1768
  ```typescript
1769
- const result = await zapier.triggerWorkflow({
1769
+ const { data: workflowRun } = await zapier.triggerWorkflow({
1770
1770
  workflow: "example-workflow",
1771
1771
  });
1772
1772
  ```
@@ -1802,7 +1802,7 @@ Update a durable workflow's name and/or description
1802
1802
  **Example:**
1803
1803
 
1804
1804
  ```typescript
1805
- const result = await zapier.updateWorkflow({
1805
+ const { data: workflow } = await zapier.updateWorkflow({
1806
1806
  workflow: "example-workflow",
1807
1807
  });
1808
1808
  ```
@@ -1837,7 +1837,7 @@ This is the right command for most callers. Reach for the lower-level building b
1837
1837
  **Example:**
1838
1838
 
1839
1839
  ```typescript
1840
- const result = await zapier.createConnection({
1840
+ const { data: connection } = await zapier.createConnection({
1841
1841
  app: "example-app",
1842
1842
  });
1843
1843
  ```
@@ -1956,14 +1956,14 @@ const { data: connection } = await zapier.findUniqueConnection();
1956
1956
 
1957
1957
  #### `getConnection`
1958
1958
 
1959
- Execute getConnection
1959
+ Get details for a specific connection
1960
1960
 
1961
1961
  **Parameters:**
1962
1962
 
1963
1963
  | Name | Type | Required | Default | Possible Values | Description |
1964
1964
  | ---------------- | ---------------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1965
1965
  | `options` | `object` | ✅ | — | — | |
1966
- | ​ ↳ `connection` | `string, number` | | — | — | Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. |
1966
+ | ​ ↳ `connection` | `string, number` | | — | — | Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. |
1967
1967
 
1968
1968
  **Returns:** `Promise<ConnectionItem>`
1969
1969
 
@@ -2001,7 +2001,9 @@ Execute getConnection
2001
2001
  **Example:**
2002
2002
 
2003
2003
  ```typescript
2004
- const { data: connection } = await zapier.getConnection();
2004
+ const { data: connection } = await zapier.getConnection({
2005
+ connection: "example-connection",
2006
+ });
2005
2007
  ```
2006
2008
 
2007
2009
  #### `getConnectionStartUrl`
@@ -2040,7 +2042,7 @@ const { data: conn } = await zapier.waitForNewConnection({ app, startedAt });
2040
2042
  **Example:**
2041
2043
 
2042
2044
  ```typescript
2043
- const result = await zapier.getConnectionStartUrl({
2045
+ const { data: connectionStartUrl } = await zapier.getConnectionStartUrl({
2044
2046
  app: "example-app",
2045
2047
  });
2046
2048
  ```
@@ -2216,7 +2218,7 @@ Create a new table
2216
2218
  **Example:**
2217
2219
 
2218
2220
  ```typescript
2219
- const result = await zapier.createTable({
2221
+ const { data: table } = await zapier.createTable({
2220
2222
  name: "example-name",
2221
2223
  });
2222
2224
  ```
@@ -2254,7 +2256,7 @@ Create one or more fields in a table
2254
2256
  **Example:**
2255
2257
 
2256
2258
  ```typescript
2257
- const result = await zapier.createTableFields({
2259
+ const { data: fields } = await zapier.createTableFields({
2258
2260
  table: "example-table",
2259
2261
  fields: [
2260
2262
  {
@@ -2293,7 +2295,7 @@ Create one or more records in a table
2293
2295
  **Example:**
2294
2296
 
2295
2297
  ```typescript
2296
- const result = await zapier.createTableRecords({
2298
+ const { data: records } = await zapier.createTableRecords({
2297
2299
  table: "example-table",
2298
2300
  records: [
2299
2301
  {
@@ -2630,7 +2632,7 @@ Update one or more records in a table
2630
2632
  **Example:**
2631
2633
 
2632
2634
  ```typescript
2633
- const result = await zapier.updateTableRecords({
2635
+ const { data: records } = await zapier.updateTableRecords({
2634
2636
  table: "example-table",
2635
2637
  records: [
2636
2638
  {
@@ -2674,7 +2676,7 @@ Acknowledge messages from a lease. Acked messages are removed from the inbox; un
2674
2676
  **Example:**
2675
2677
 
2676
2678
  ```typescript
2677
- const result = await zapier.ackTriggerInboxMessages({
2679
+ const { data: triggerInboxAck } = await zapier.ackTriggerInboxMessages({
2678
2680
  inbox: "example-inbox",
2679
2681
  lease: "example-lease",
2680
2682
  });
@@ -2717,7 +2719,7 @@ Create a new trigger inbox subscription. Always creates a new inbox; use ensureT
2717
2719
  **Example:**
2718
2720
 
2719
2721
  ```typescript
2720
- const result = await zapier.createTriggerInbox({
2722
+ const { data: triggerInbox } = await zapier.createTriggerInbox({
2721
2723
  app: "example-app",
2722
2724
  action: "example-action",
2723
2725
  });
@@ -2785,7 +2787,7 @@ Drain an existing trigger inbox: lease currently-available messages, process eac
2785
2787
  **Example:**
2786
2788
 
2787
2789
  ```typescript
2788
- const result = await zapier.drainTriggerInbox({
2790
+ await zapier.drainTriggerInbox({
2789
2791
  inbox: "example-inbox",
2790
2792
  onMessage: async (message) => {
2791
2793
  /* process message */
@@ -2830,7 +2832,7 @@ Get-or-create a trigger inbox by key. Idempotent on (user, account, key): return
2830
2832
  **Example:**
2831
2833
 
2832
2834
  ```typescript
2833
- const result = await zapier.ensureTriggerInbox({
2835
+ const { data: triggerInbox } = await zapier.ensureTriggerInbox({
2834
2836
  key: "example-key",
2835
2837
  app: "example-app",
2836
2838
  action: "example-action",
@@ -2936,7 +2938,7 @@ Lease up to N messages from a trigger inbox. Returns messages plus a lease ID; a
2936
2938
  **Example:**
2937
2939
 
2938
2940
  ```typescript
2939
- const result = await zapier.leaseTriggerInboxMessages({
2941
+ const { data: triggerInboxLease } = await zapier.leaseTriggerInboxMessages({
2940
2942
  inbox: "example-inbox",
2941
2943
  });
2942
2944
  ```
@@ -3284,7 +3286,7 @@ Pause a trigger inbox; events stop being collected
3284
3286
  **Example:**
3285
3287
 
3286
3288
  ```typescript
3287
- const result = await zapier.pauseTriggerInbox({
3289
+ const { data: triggerInbox } = await zapier.pauseTriggerInbox({
3288
3290
  inbox: "example-inbox",
3289
3291
  });
3290
3292
  ```
@@ -3320,7 +3322,7 @@ Release messages from a lease back to the inbox without acknowledging them. Rele
3320
3322
  **Example:**
3321
3323
 
3322
3324
  ```typescript
3323
- const result = await zapier.releaseTriggerInboxMessages({
3325
+ const { data: triggerInboxRelease } = await zapier.releaseTriggerInboxMessages({
3324
3326
  inbox: "example-inbox",
3325
3327
  lease: "example-lease",
3326
3328
  });
@@ -3358,7 +3360,7 @@ Resume a paused trigger inbox; events resume being collected
3358
3360
  **Example:**
3359
3361
 
3360
3362
  ```typescript
3361
- const result = await zapier.resumeTriggerInbox({
3363
+ const { data: triggerInbox } = await zapier.resumeTriggerInbox({
3362
3364
  inbox: "example-inbox",
3363
3365
  });
3364
3366
  ```
@@ -3396,7 +3398,7 @@ Update settings on an existing trigger inbox
3396
3398
  **Example:**
3397
3399
 
3398
3400
  ```typescript
3399
- const result = await zapier.updateTriggerInbox({
3401
+ const { data: triggerInbox } = await zapier.updateTriggerInbox({
3400
3402
  inbox: "example-inbox",
3401
3403
  });
3402
3404
  ```
@@ -3426,7 +3428,7 @@ Continuously consume a trigger inbox: drain currently-available messages via onM
3426
3428
  **Example:**
3427
3429
 
3428
3430
  ```typescript
3429
- const result = await zapier.watchTriggerInbox({
3431
+ await zapier.watchTriggerInbox({
3430
3432
  inbox: "example-inbox",
3431
3433
  onMessage: async (message) => {
3432
3434
  /* process message */