@zapier/zapier-sdk 0.94.1 → 0.96.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.96.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2726599: Added `createForm` (experimental) to create Zapier Forms from a title, optional description, and typed field list. Forms publish by default and return a shareable `hosted_url`; pass `draft: true` to save without publishing. A complete `document` can be supplied for layouts the field list cannot express.
8
+
9
+ ## 0.95.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 80dc74a: Auto-mode approvals that are escalated to a human reviewer now open the approval URL in the browser automatically and continue polling until the reviewer decides.
14
+ - 6e5189c: Added a `manual` option (experimental) to `publishWorkflowVersion`, exposed in the CLI as `--manual` on `publish-workflow-version`. Pass `manual: true` to publish an on-demand, triggerless workflow version explicitly; pass `trigger` for a triggered one. The two are mutually exclusive — sending both is rejected with a 400.
15
+
3
16
  ## 0.94.1
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -63,6 +63,8 @@
63
63
  - [`waitForNewConnection`](#waitfornewconnection)
64
64
  - [HTTP Requests](#http-requests)
65
65
  - [`fetch`](#fetch)
66
+ - [Human Inputs (Experimental)](#human-inputs-experimental)
67
+ - [`createForm`](#createform--experimental)
66
68
  - [Tables](#tables)
67
69
  - [`createTable`](#createtable)
68
70
  - [`createTableFields`](#createtablefields)
@@ -2019,11 +2021,12 @@ Publish a new version of a durable workflow. Enables the workflow by default.
2019
2021
  | ​ ↳ `ignoreOpenDrafts` | `boolean` | ❌ | — | — | Publish even though the workflow has open draft(s). Without this, the API rejects a direct publish with a 409 while any draft is open, since publishing the draft later would ship its stale content over this version. |
2020
2022
  | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
2021
2023
  | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
2022
- | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows. |
2024
+ | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; for an on-demand, triggerless workflow, omit this and pass `manual: true` instead. |
2023
2025
  | ​   ↳ `selectedApi` | `string` | ❌ | — | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI'). Required when a trigger is configured. |
2024
2026
  | ​   ↳ `action` | `string` | ✅ | — | — | Trigger action key (e.g. 'new_row') |
2025
2027
  | ​   ↳ `authenticationId` | `string` | ❌ | — | — | Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier). |
2026
2028
  | ​   ↳ `params` | `object` | ❌ | — | — | Trigger parameters as a JSON object |
2029
+ | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this an on-demand, triggerless workflow version. Pass `manual: true` only when omitting `trigger`; passing both is a contradiction the API rejects with a 400. |
2027
2030
 
2028
2031
  **Returns:** `Promise<WorkflowVersionItem>`
2029
2032
 
@@ -2591,6 +2594,84 @@ Make authenticated HTTP requests to any API through Zapier. Pass a connectionId
2591
2594
  const result = await zapier.fetch("https://example.com", {});
2592
2595
  ```
2593
2596
 
2597
+ ### Human Inputs (Experimental)
2598
+
2599
+ > ℹ️ **Experimental.** Import from `"@zapier/zapier-sdk/experimental"` to use these methods. Methods and behavior may change.
2600
+
2601
+ #### `createForm` 🧪 _experimental_
2602
+
2603
+ Create a Zapier Form from a title and optional fields. Forms publish by default and return a shareable `hosted_url`; set `draft` to save without publishing.
2604
+
2605
+ **Parameters:**
2606
+
2607
+ | Name | Type | Required | Default | Possible Values | Description |
2608
+ | ------------------------- | ---------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2609
+ | `options` | `object` | ✅ | — | — | |
2610
+ | ​ ↳ `title` | `string` | ✅ | — | — | The title shown in the Forms UI and on the form. |
2611
+ | ​ ↳ `description` | `string` | ❌ | — | — | An optional description of the form. |
2612
+ | ​ ↳ `fields[]` | `object[]` | ❌ | — | — | Initial fields to add to the form. |
2613
+ | ​   ↳ `label` | `string` | ✅ | — | — | Human-readable label shown above the input. |
2614
+ | ​   ↳ `type` | `string` | ✅ | — | `short_text`, `long_text`, `email`, `number`, `yes_no`, `url`, `date`, `date_range`, `currency`, `phone_number`, `dropdown`, `integration_backed` | The type of field. |
2615
+ | ​   ↳ `required` | `boolean` | ❌ | — | — | Whether the field must be answered before the form can submit. |
2616
+ | ​   ↳ `disabled` | `boolean` | ❌ | — | — | When true, the field is rendered read-only — shown but not editable. A rendering hint only; it is not enforced during submission validation. |
2617
+ | ​   ↳ `variant` | `string` | ❌ | — | `checkbox`, `radio` | For `yes_no` fields: `checkbox` renders a single toggle, `radio` renders explicit yes/no buttons. Defaults to `checkbox`. |
2618
+ | ​   ↳ `multiUrl` | `boolean` | ❌ | — | — | For `url` fields: when true the field accepts a list of URLs, otherwise a single URL. Defaults to false. |
2619
+ | ​   ↳ `includeTime` | `boolean` | ❌ | — | — | For `date` and `date_range` fields: when true the picker also captures a time. Defaults to false. |
2620
+ | ​   ↳ `currencyFormat` | `string` | ❌ | — | — | For `currency` fields: ISO 4217 currency code (e.g. `usd`, `eur`). Controls the symbol shown in the form UI. |
2621
+ | ​   ↳ `decimals` | `literal` | ❌ | — | — | For `currency` fields: allowed decimal places. `0` for whole numbers, `2` for up to two decimal places. Defaults to `2`. |
2622
+ | ​   ↳ `defaultCountry` | `string` | ❌ | — | — | For `phone_number` fields: ISO 3166-1 alpha-2 code for the default selected country (e.g. `US`). Defaults to `US`. |
2623
+ | ​   ↳ `phoneNumberFormat` | `string` | ❌ | — | `national`, `international` | For `phone_number` fields: `national` omits the country-code prefix, `international` includes it. Defaults to `national`. |
2624
+ | ​   ↳ `acceptedCountries` | `array` | ❌ | — | — | For `phone_number` fields: restrict input to specific ISO 3166-1 alpha-2 country codes. Omit to allow all countries. |
2625
+ | ​   ↳ `options[]` | `object[]` | ❌ | — | — | For `dropdown` fields: the selectable options. At least one is required. |
2626
+ | ​     ↳ `value` | `string` | ✅ | — | — | The value submitted when this option is selected. |
2627
+ | ​     ↳ `label` | `string` | ✅ | — | — | Human-readable label shown to the user. |
2628
+ | ​   ↳ `multiSelect` | `boolean` | ❌ | — | — | For `dropdown` fields: when true the user may select multiple options. Defaults to false. |
2629
+ | ​   ↳ `dataSource` | `object` | ❌ | — | — | For `integration_backed` fields: where to fetch the field's options from at render time. |
2630
+ | ​     ↳ `app` | `string` | ✅ | — | — | Zapier app to pull options from. See `listApps` for the catalog. |
2631
+ | ​     ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk` | Whether the data source returns a single record (`read`) or a collection (`read_bulk`). |
2632
+ | ​     ↳ `resource` | `string` | ✅ | — | — | Resource name within the app — typically a trigger or search key from the app's definition. |
2633
+ | ​     ↳ `valueKey` | `string` | ❌ | — | — | Property on each returned record to use as the submitted option value. Defaults to `id`. |
2634
+ | ​     ↳ `labelKey` | `string` | ❌ | — | — | Property on each returned record to use as the displayed option label. Defaults to a sensible name field. |
2635
+ | ​ ↳ `draft` | `boolean` | ❌ | — | — | When true, save without publishing. Omit to publish immediately, making `hosted_url` live. |
2636
+ | ​ ↳ `confirmationTitle` | `string` | ❌ | — | — | Heading shown to the respondent after they submit. Omit to use the form renderer's default. |
2637
+ | ​ ↳ `confirmationMessage` | `string` | ❌ | — | — | Message shown to the respondent after they submit, below the confirmation title. Omit to use the form renderer's default. |
2638
+ | ​ ↳ `callbackUrl` | `string` | ❌ | — | — | Absolute http/https URL notified with the submission JSON each time the form is answered. |
2639
+ | ​ ↳ `consumerAuth` | `string` | ❌ | — | `none`, `zapier` | Who may open the published form. `none` (the default) leaves it public to anyone with the link; `zapier` requires the visitor to be signed in to Zapier on the form's owning account. |
2640
+ | ​ ↳ `document` | `object` | ❌ | — | — | Escape hatch: a complete form document tree, sent as-is. When supplied it replaces the document built from `fields`, and `title`, `description`, `confirmationTitle`, and `confirmationMessage` are ignored. Use only for structures the flat field list cannot express, such as approval decisions or multi-column row layout. |
2641
+ | ​   ↳ `id` | `string` | ✅ | — | — | |
2642
+ | ​   ↳ `type` | `string` | ✅ | — | `root` | |
2643
+ | ​   ↳ `attrs` | `object` | ✅ | — | — | |
2644
+ | ​     ↳ `schema_version` | `number` | ✅ | — | — | |
2645
+ | ​     ↳ `title` | `string` | ✅ | — | — | |
2646
+ | ​   ↳ `children` | `array` | ❌ | — | — | |
2647
+
2648
+ **Returns:** `Promise<FormItem>`
2649
+
2650
+ | Name | Type | Required | Possible Values | Description |
2651
+ | ----------------------- | --------- | -------- | --------------- | ----------- |
2652
+ | `data` | `object` | ✅ | — | |
2653
+ | ​ ↳ `id` | `string` | ✅ | — | |
2654
+ | ​ ↳ `title` | `string` | ✅ | — | |
2655
+ | ​ ↳ `description` | `string` | ❌ | — | |
2656
+ | ​ ↳ `hosted_url` | `string` | ✅ | — | |
2657
+ | ​ ↳ `submission_count` | `number` | ✅ | — | |
2658
+ | ​ ↳ `account_id` | `number` | ✅ | — | |
2659
+ | ​ ↳ `owner_id` | `string` | ✅ | — | |
2660
+ | ​ ↳ `created_at` | `string` | ✅ | — | |
2661
+ | ​ ↳ `updated_at` | `string` | ✅ | — | |
2662
+ | ​ ↳ `document` | `unknown` | ✅ | — | |
2663
+ | ​ ↳ `last_published_at` | `string` | ✅ | — | |
2664
+ | ​ ↳ `consumer_auth` | `unknown` | ✅ | — | |
2665
+ | ​ ↳ `callback_url` | `unknown` | ✅ | — | |
2666
+
2667
+ **Example:**
2668
+
2669
+ ```typescript
2670
+ const { data: form } = await zapier.createForm({
2671
+ title: "example-title",
2672
+ });
2673
+ ```
2674
+
2594
2675
  ### Tables
2595
2676
 
2596
2677
  #### `createTable`