@zapier/zapier-sdk 0.4.1 → 0.5.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 +13 -0
- package/README.md +343 -0
- package/dist/api/auth.d.ts +9 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +25 -0
- package/dist/api/client.d.ts +9 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +322 -0
- package/dist/api/debug.d.ts +13 -0
- package/dist/api/debug.d.ts.map +1 -0
- package/dist/api/debug.js +55 -0
- package/dist/api/index.d.ts +29 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +41 -0
- package/dist/api/polling.d.ts +16 -0
- package/dist/api/polling.d.ts.map +1 -0
- package/dist/api/polling.js +45 -0
- package/dist/api/schemas.d.ts +2473 -0
- package/dist/api/schemas.d.ts.map +1 -0
- package/dist/api/schemas.js +355 -0
- package/dist/api/types.d.ts +75 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +11 -0
- package/dist/auth.d.ts +34 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +47 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +9 -0
- package/dist/index.cjs +2108 -1379
- package/dist/index.d.mts +2440 -620
- package/dist/index.d.ts +17 -892
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.mjs +2093 -1362
- package/dist/plugins/api/index.d.ts +14 -0
- package/dist/plugins/api/index.d.ts.map +1 -0
- package/dist/plugins/api/index.js +21 -0
- package/dist/plugins/apps/index.d.ts +11 -0
- package/dist/plugins/apps/index.d.ts.map +1 -0
- package/dist/plugins/apps/index.js +91 -0
- package/dist/plugins/apps/types.d.ts +30 -0
- package/dist/plugins/apps/types.d.ts.map +1 -0
- package/dist/plugins/apps/types.js +2 -0
- package/dist/plugins/fetch/index.d.ts +21 -0
- package/dist/plugins/fetch/index.d.ts.map +1 -0
- package/dist/plugins/fetch/index.js +20 -0
- package/dist/plugins/findFirstAuthentication/index.d.ts +20 -0
- package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -0
- package/dist/plugins/findFirstAuthentication/index.js +24 -0
- package/dist/plugins/findFirstAuthentication/index.test.d.ts +2 -0
- package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +1 -0
- package/dist/plugins/findFirstAuthentication/index.test.js +171 -0
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +29 -0
- package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -0
- package/dist/plugins/findFirstAuthentication/schemas.js +18 -0
- package/dist/plugins/findUniqueAuthentication/index.d.ts +20 -0
- package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -0
- package/dist/plugins/findUniqueAuthentication/index.js +31 -0
- package/dist/plugins/findUniqueAuthentication/index.test.d.ts +2 -0
- package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +1 -0
- package/dist/plugins/findUniqueAuthentication/index.test.js +152 -0
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +29 -0
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -0
- package/dist/plugins/findUniqueAuthentication/schemas.js +18 -0
- package/dist/plugins/getAction/index.d.ts +23 -0
- package/dist/plugins/getAction/index.d.ts.map +1 -0
- package/dist/plugins/getAction/index.js +28 -0
- package/dist/plugins/getAction/index.test.d.ts +2 -0
- package/dist/plugins/getAction/index.test.d.ts.map +1 -0
- package/dist/plugins/getAction/index.test.js +186 -0
- package/dist/plugins/getAction/schemas.d.ts +23 -0
- package/dist/plugins/getAction/schemas.d.ts.map +1 -0
- package/dist/plugins/getAction/schemas.js +10 -0
- package/dist/plugins/getApp/index.d.ts +22 -0
- package/dist/plugins/getApp/index.d.ts.map +1 -0
- package/dist/plugins/getApp/index.js +39 -0
- package/dist/plugins/getApp/index.test.d.ts +2 -0
- package/dist/plugins/getApp/index.test.d.ts.map +1 -0
- package/dist/plugins/getApp/index.test.js +100 -0
- package/dist/plugins/getApp/schemas.d.ts +18 -0
- package/dist/plugins/getApp/schemas.d.ts.map +1 -0
- package/dist/plugins/getApp/schemas.js +10 -0
- package/dist/plugins/getAuthentication/index.d.ts +22 -0
- package/dist/plugins/getAuthentication/index.d.ts.map +1 -0
- package/dist/plugins/getAuthentication/index.js +41 -0
- package/dist/plugins/getAuthentication/index.test.d.ts +2 -0
- package/dist/plugins/getAuthentication/index.test.d.ts.map +1 -0
- package/dist/plugins/getAuthentication/index.test.js +205 -0
- package/dist/plugins/getAuthentication/schemas.d.ts +17 -0
- package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -0
- package/dist/plugins/getAuthentication/schemas.js +11 -0
- package/dist/plugins/getProfile/index.d.ts +23 -0
- package/dist/plugins/getProfile/index.d.ts.map +1 -0
- package/dist/plugins/getProfile/index.js +29 -0
- package/dist/plugins/getProfile/schemas.d.ts +13 -0
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -0
- package/dist/plugins/getProfile/schemas.js +5 -0
- package/dist/plugins/listActions/index.d.ts +28 -0
- package/dist/plugins/listActions/index.d.ts.map +1 -0
- package/dist/plugins/listActions/index.js +61 -0
- package/dist/plugins/listActions/index.test.d.ts +2 -0
- package/dist/plugins/listActions/index.test.d.ts.map +1 -0
- package/dist/plugins/listActions/index.test.js +467 -0
- package/dist/plugins/listActions/schemas.d.ts +29 -0
- package/dist/plugins/listActions/schemas.d.ts.map +1 -0
- package/dist/plugins/listActions/schemas.js +21 -0
- package/dist/plugins/listApps/index.d.ts +28 -0
- package/dist/plugins/listApps/index.d.ts.map +1 -0
- package/dist/plugins/listApps/index.js +62 -0
- package/dist/plugins/listApps/index.test.d.ts +2 -0
- package/dist/plugins/listApps/index.test.d.ts.map +1 -0
- package/dist/plugins/listApps/index.test.js +313 -0
- package/dist/plugins/listApps/schemas.d.ts +30 -0
- package/dist/plugins/listApps/schemas.d.ts.map +1 -0
- package/dist/plugins/listApps/schemas.js +23 -0
- package/dist/plugins/listAuthentications/index.d.ts +28 -0
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -0
- package/dist/plugins/listAuthentications/index.js +77 -0
- package/dist/plugins/listAuthentications/index.test.d.ts +2 -0
- package/dist/plugins/listAuthentications/index.test.d.ts.map +1 -0
- package/dist/plugins/listAuthentications/index.test.js +564 -0
- package/dist/plugins/listAuthentications/schemas.d.ts +38 -0
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -0
- package/dist/plugins/listAuthentications/schemas.js +28 -0
- package/dist/plugins/listInputFields/index.d.ts +28 -0
- package/dist/plugins/listInputFields/index.d.ts.map +1 -0
- package/dist/plugins/listInputFields/index.js +133 -0
- package/dist/plugins/listInputFields/index.test.d.ts +2 -0
- package/dist/plugins/listInputFields/index.test.d.ts.map +1 -0
- package/dist/plugins/listInputFields/index.test.js +325 -0
- package/dist/plugins/listInputFields/schemas.d.ts +38 -0
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -0
- package/dist/plugins/listInputFields/schemas.js +22 -0
- package/dist/plugins/registry/index.d.ts +11 -0
- package/dist/plugins/registry/index.d.ts.map +1 -0
- package/dist/plugins/registry/index.js +14 -0
- package/dist/plugins/request/index.d.ts +19 -0
- package/dist/plugins/request/index.d.ts.map +1 -0
- package/dist/plugins/request/index.js +62 -0
- package/dist/plugins/request/index.test.d.ts +2 -0
- package/dist/plugins/request/index.test.d.ts.map +1 -0
- package/dist/plugins/request/index.test.js +256 -0
- package/dist/plugins/request/schemas.d.ts +69 -0
- package/dist/plugins/request/schemas.d.ts.map +1 -0
- package/dist/plugins/request/schemas.js +42 -0
- package/dist/plugins/runAction/index.d.ts +28 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -0
- package/dist/plugins/runAction/index.js +86 -0
- package/dist/plugins/runAction/index.test.d.ts +2 -0
- package/dist/plugins/runAction/index.test.d.ts.map +1 -0
- package/dist/plugins/runAction/index.test.js +320 -0
- package/dist/plugins/runAction/schemas.d.ts +37 -0
- package/dist/plugins/runAction/schemas.d.ts.map +1 -0
- package/dist/plugins/runAction/schemas.js +22 -0
- package/dist/resolvers/actionKey.d.ts +9 -0
- package/dist/resolvers/actionKey.d.ts.map +1 -0
- package/dist/resolvers/actionKey.js +19 -0
- package/dist/resolvers/actionType.d.ts +9 -0
- package/dist/resolvers/actionType.d.ts.map +1 -0
- package/dist/resolvers/actionType.js +22 -0
- package/dist/resolvers/appKey.d.ts +7 -0
- package/dist/resolvers/appKey.d.ts.map +1 -0
- package/dist/resolvers/appKey.js +5 -0
- package/dist/resolvers/authenticationId.d.ts +9 -0
- package/dist/resolvers/authenticationId.d.ts.map +1 -0
- package/dist/resolvers/authenticationId.js +33 -0
- package/dist/resolvers/index.d.ts +40 -0
- package/dist/resolvers/index.d.ts.map +1 -0
- package/dist/resolvers/index.js +91 -0
- package/dist/resolvers/inputs.d.ts +8 -0
- package/dist/resolvers/inputs.d.ts.map +1 -0
- package/dist/resolvers/inputs.js +14 -0
- package/dist/schemas/Action.d.ts +243 -0
- package/dist/schemas/Action.d.ts.map +1 -0
- package/dist/schemas/Action.js +34 -0
- package/dist/schemas/App.d.ts +26 -0
- package/dist/schemas/App.d.ts.map +1 -0
- package/dist/schemas/App.js +22 -0
- package/dist/schemas/Auth.d.ts +161 -0
- package/dist/schemas/Auth.d.ts.map +1 -0
- package/dist/schemas/Auth.js +41 -0
- package/dist/schemas/Field.d.ts +144 -0
- package/dist/schemas/Field.d.ts.map +1 -0
- package/dist/schemas/Field.js +105 -0
- package/dist/schemas/UserProfile.d.ts +163 -0
- package/dist/schemas/UserProfile.d.ts.map +1 -0
- package/dist/schemas/UserProfile.js +29 -0
- package/dist/sdk.d.ts +10 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +94 -0
- package/dist/sdk.test.d.ts +2 -0
- package/dist/sdk.test.d.ts.map +1 -0
- package/dist/sdk.test.js +135 -0
- package/dist/types/domain.d.ts +36 -0
- package/dist/types/domain.d.ts.map +1 -0
- package/dist/types/domain.js +1 -0
- package/dist/types/domain.test.d.ts +2 -0
- package/dist/types/domain.test.d.ts.map +1 -0
- package/dist/types/domain.test.js +39 -0
- package/dist/types/errors.d.ts +143 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +187 -0
- package/dist/types/events.d.ts +38 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +7 -0
- package/dist/types/functions.d.ts +26 -0
- package/dist/types/functions.d.ts.map +1 -0
- package/dist/types/functions.js +4 -0
- package/dist/types/plugin.d.ts +61 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +9 -0
- package/dist/types/properties.d.ts +22 -0
- package/dist/types/properties.d.ts.map +1 -0
- package/dist/types/properties.js +50 -0
- package/dist/types/sdk.d.ts +43 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/types/sdk.js +4 -0
- package/dist/utils/array-utils.d.ts +31 -0
- package/dist/utils/array-utils.d.ts.map +1 -0
- package/dist/utils/array-utils.js +36 -0
- package/dist/utils/array-utils.test.d.ts +2 -0
- package/dist/utils/array-utils.test.d.ts.map +1 -0
- package/dist/utils/array-utils.test.js +107 -0
- package/dist/utils/domain-utils.d.ts +78 -0
- package/dist/utils/domain-utils.d.ts.map +1 -0
- package/dist/utils/domain-utils.js +218 -0
- package/dist/utils/domain-utils.test.d.ts +2 -0
- package/dist/utils/domain-utils.test.d.ts.map +1 -0
- package/dist/utils/domain-utils.test.js +192 -0
- package/dist/utils/function-utils.d.ts +45 -0
- package/dist/utils/function-utils.d.ts.map +1 -0
- package/dist/utils/function-utils.js +158 -0
- package/dist/utils/function-utils.test.d.ts +2 -0
- package/dist/utils/function-utils.test.d.ts.map +1 -0
- package/dist/utils/function-utils.test.js +110 -0
- package/dist/utils/pagination-utils.d.ts +37 -0
- package/dist/utils/pagination-utils.d.ts.map +1 -0
- package/dist/utils/pagination-utils.js +165 -0
- package/dist/utils/pagination-utils.test.d.ts +17 -0
- package/dist/utils/pagination-utils.test.d.ts.map +1 -0
- package/dist/utils/pagination-utils.test.js +461 -0
- package/dist/utils/schema-utils.d.ts +45 -0
- package/dist/utils/schema-utils.d.ts.map +1 -0
- package/dist/utils/schema-utils.js +65 -0
- package/dist/utils/validation.d.ts +4 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +30 -0
- package/dist/utils/validation.test.d.ts +2 -0
- package/dist/utils/validation.test.d.ts.map +1 -0
- package/dist/utils/validation.test.js +43 -0
- package/package.json +12 -3
- package/src/api/client.ts +394 -171
- package/src/api/debug.ts +10 -1
- package/src/api/index.ts +0 -2
- package/src/api/polling.ts +28 -7
- package/src/api/schemas.ts +387 -0
- package/src/api/types.ts +72 -136
- package/src/constants.ts +10 -0
- package/src/index.ts +40 -19
- package/src/plugins/api/index.ts +47 -0
- package/src/plugins/apps/index.ts +25 -19
- package/src/plugins/apps/types.ts +7 -11
- package/src/plugins/fetch/index.ts +48 -40
- package/src/plugins/findFirstAuthentication/index.test.ts +206 -0
- package/src/plugins/findFirstAuthentication/index.ts +55 -0
- package/src/plugins/findFirstAuthentication/schemas.ts +41 -0
- package/src/plugins/findUniqueAuthentication/index.test.ts +197 -0
- package/src/plugins/findUniqueAuthentication/index.ts +72 -0
- package/src/plugins/findUniqueAuthentication/schemas.ts +42 -0
- package/src/plugins/getAction/index.test.ts +239 -0
- package/src/plugins/getAction/index.ts +57 -0
- package/src/plugins/getAction/schemas.ts +33 -0
- package/src/plugins/getApp/index.test.ts +127 -0
- package/src/plugins/getApp/index.ts +66 -0
- package/src/plugins/getApp/schemas.ts +38 -0
- package/src/plugins/getAuthentication/index.test.ts +284 -0
- package/src/plugins/getAuthentication/index.ts +86 -0
- package/src/plugins/getAuthentication/schemas.ts +31 -0
- package/src/plugins/getProfile/index.ts +55 -0
- package/src/plugins/getProfile/schemas.ts +26 -0
- package/src/plugins/listActions/index.test.ts +582 -0
- package/src/plugins/listActions/index.ts +115 -0
- package/src/plugins/listActions/schemas.ts +54 -0
- package/src/plugins/listApps/index.test.ts +357 -0
- package/src/plugins/listApps/index.ts +121 -0
- package/src/plugins/listApps/schemas.ts +49 -0
- package/src/plugins/listAuthentications/index.test.ts +709 -0
- package/src/plugins/listAuthentications/index.ts +136 -0
- package/src/plugins/listAuthentications/schemas.ts +60 -0
- package/src/plugins/listInputFields/index.test.ts +408 -0
- package/src/plugins/listInputFields/index.ts +204 -0
- package/src/plugins/listInputFields/schemas.ts +56 -0
- package/src/plugins/registry/index.ts +30 -0
- package/src/plugins/request/index.test.ts +329 -0
- package/src/plugins/request/index.ts +103 -0
- package/src/{functions → plugins}/request/schemas.ts +20 -9
- package/src/plugins/runAction/index.test.ts +387 -0
- package/src/plugins/runAction/index.ts +176 -0
- package/src/plugins/runAction/schemas.ts +53 -0
- package/src/resolvers/actionKey.ts +6 -4
- package/src/resolvers/actionType.ts +7 -2
- package/src/resolvers/appKey.ts +1 -1
- package/src/resolvers/authenticationId.ts +12 -3
- package/src/resolvers/inputs.ts +3 -1
- package/src/schemas/Action.ts +18 -12
- package/src/schemas/App.ts +11 -19
- package/src/schemas/Auth.ts +18 -13
- package/src/schemas/Field.ts +106 -11
- package/src/schemas/UserProfile.ts +43 -0
- package/src/sdk.test.ts +212 -0
- package/src/sdk.ts +132 -102
- package/src/types/domain.test.ts +50 -0
- package/src/types/domain.ts +43 -75
- package/src/types/errors.ts +275 -0
- package/src/types/functions.ts +27 -0
- package/src/types/optional-zapier-sdk-cli-login.d.ts +37 -0
- package/src/types/plugin.ts +105 -0
- package/src/types/properties.ts +4 -3
- package/src/types/sdk.ts +70 -48
- package/src/utils/array-utils.test.ts +131 -0
- package/src/utils/array-utils.ts +41 -0
- package/src/utils/domain-utils.test.ts +239 -0
- package/src/utils/domain-utils.ts +283 -0
- package/src/utils/function-utils.test.ts +141 -0
- package/src/utils/function-utils.ts +245 -0
- package/src/utils/pagination-utils.test.ts +620 -0
- package/src/utils/pagination-utils.ts +242 -0
- package/src/utils/validation.test.ts +50 -0
- package/src/utils/validation.ts +44 -0
- package/tsconfig.build.json +16 -2
- package/tsconfig.json +3 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/tsup.config.ts +2 -0
- package/src/functions/bundleCode/index.ts +0 -78
- package/src/functions/bundleCode/info.ts +0 -9
- package/src/functions/bundleCode/schemas.ts +0 -30
- package/src/functions/findFirstAuthentication/index.ts +0 -24
- package/src/functions/findFirstAuthentication/info.ts +0 -9
- package/src/functions/findFirstAuthentication/schemas.ts +0 -50
- package/src/functions/findUniqueAuthentication/index.ts +0 -35
- package/src/functions/findUniqueAuthentication/info.ts +0 -9
- package/src/functions/findUniqueAuthentication/schemas.ts +0 -50
- package/src/functions/generateTypes/index.ts +0 -363
- package/src/functions/generateTypes/info.ts +0 -9
- package/src/functions/generateTypes/schemas.ts +0 -31
- package/src/functions/getAction/index.ts +0 -33
- package/src/functions/getAction/info.ts +0 -9
- package/src/functions/getAction/schemas.ts +0 -25
- package/src/functions/getApp/index.ts +0 -41
- package/src/functions/getApp/info.ts +0 -9
- package/src/functions/getApp/schemas.ts +0 -20
- package/src/functions/getAuthentication/index.ts +0 -50
- package/src/functions/getAuthentication/info.ts +0 -9
- package/src/functions/getAuthentication/schemas.ts +0 -29
- package/src/functions/listActions/index.ts +0 -149
- package/src/functions/listActions/info.ts +0 -9
- package/src/functions/listActions/schemas.ts +0 -30
- package/src/functions/listApps/index.ts +0 -60
- package/src/functions/listApps/info.ts +0 -9
- package/src/functions/listApps/schemas.ts +0 -32
- package/src/functions/listAuthentications/index.ts +0 -162
- package/src/functions/listAuthentications/info.ts +0 -9
- package/src/functions/listAuthentications/schemas.ts +0 -50
- package/src/functions/listFields/index.ts +0 -86
- package/src/functions/listFields/info.ts +0 -9
- package/src/functions/listFields/schemas.ts +0 -36
- package/src/functions/request/index.ts +0 -150
- package/src/functions/request/info.ts +0 -11
- package/src/functions/runAction/index.ts +0 -127
- package/src/functions/runAction/info.ts +0 -9
- package/src/functions/runAction/schemas.ts +0 -34
- package/src/plugins/apps/info.ts +0 -12
- package/src/plugins/fetch/types.ts +0 -2
- /package/src/{schema-utils.ts → utils/schema-utils.ts} +0 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# @zapier/zapier-sdk
|
|
2
|
+
|
|
3
|
+
<!-- Generated API Reference -->
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Quick Start](#quick-start)
|
|
9
|
+
- [Available Functions](#available-functions)
|
|
10
|
+
- [Actions](#actions)
|
|
11
|
+
- [`listActions`](#listactions)
|
|
12
|
+
- [`getAction`](#getaction)
|
|
13
|
+
- [`listInputFields`](#listinputfields)
|
|
14
|
+
- [`runAction`](#runaction)
|
|
15
|
+
- [Apps](#apps)
|
|
16
|
+
- [`listApps`](#listapps)
|
|
17
|
+
- [`getApp`](#getapp)
|
|
18
|
+
- [Authentication](#authentication)
|
|
19
|
+
- [`listAuthentications`](#listauthentications)
|
|
20
|
+
- [`getAuthentication`](#getauthentication)
|
|
21
|
+
- [`findFirstAuthentication`](#findfirstauthentication)
|
|
22
|
+
- [`findUniqueAuthentication`](#finduniqueauthentication)
|
|
23
|
+
- [HTTP Requests](#http-requests)
|
|
24
|
+
- [`request`](#request)
|
|
25
|
+
- [User & Profile](#user--profile)
|
|
26
|
+
- [`getProfile`](#getprofile)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install @zapier/zapier-sdk
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { createZapierSdk } from "@zapier/zapier-sdk";
|
|
38
|
+
|
|
39
|
+
const sdk = createZapierSdk({
|
|
40
|
+
token: "your_zapier_token_here", // or use ZAPIER_TOKEN env var
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// List all available apps
|
|
44
|
+
const apps = await sdk.listApps();
|
|
45
|
+
|
|
46
|
+
// Get information about a specific app
|
|
47
|
+
const slackApp = await sdk.getApp({ appKey: "slack" });
|
|
48
|
+
|
|
49
|
+
// Run an action
|
|
50
|
+
const result = await sdk.runAction({
|
|
51
|
+
appKey: "slack",
|
|
52
|
+
actionType: "write",
|
|
53
|
+
actionKey: "send_message",
|
|
54
|
+
inputs: { channel: "#general", message: "Hello World!" },
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Available Functions
|
|
59
|
+
|
|
60
|
+
### Actions
|
|
61
|
+
|
|
62
|
+
#### `listActions`
|
|
63
|
+
|
|
64
|
+
List all actions for a specific app
|
|
65
|
+
|
|
66
|
+
**Parameters:**
|
|
67
|
+
|
|
68
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
69
|
+
| ------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
70
|
+
| `appKey` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI') |
|
|
71
|
+
| `actionType` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type |
|
|
72
|
+
| `pageSize` | `number` | ❌ | — | — | Number of actions per page |
|
|
73
|
+
| `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
74
|
+
|
|
75
|
+
**Returns:** `Promise<PaginatedResult<ActionItem>>`
|
|
76
|
+
|
|
77
|
+
**Example:**
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const result = await sdk.listActions({
|
|
81
|
+
appKey: "example-key",
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### `getAction`
|
|
86
|
+
|
|
87
|
+
Get detailed information about a specific action
|
|
88
|
+
|
|
89
|
+
**Parameters:**
|
|
90
|
+
|
|
91
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
92
|
+
| ------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
93
|
+
| `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
94
|
+
| `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
95
|
+
| `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
96
|
+
|
|
97
|
+
**Returns:** `Promise<ActionItem>`
|
|
98
|
+
|
|
99
|
+
**Example:**
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const result = await sdk.getAction({
|
|
103
|
+
appKey: "example-key",
|
|
104
|
+
actionType: "read",
|
|
105
|
+
actionKey: "example-key",
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### `listInputFields`
|
|
110
|
+
|
|
111
|
+
Get the input fields required for a specific action
|
|
112
|
+
|
|
113
|
+
**Parameters:**
|
|
114
|
+
|
|
115
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
116
|
+
| ------------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
117
|
+
| `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
118
|
+
| `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
119
|
+
| `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
120
|
+
| `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
121
|
+
| `inputs` | `object` | ❌ | — | — | Current input values that may affect available fields |
|
|
122
|
+
| `pageSize` | `number` | ❌ | — | — | Number of input fields per page |
|
|
123
|
+
| `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
124
|
+
|
|
125
|
+
**Returns:** `Promise<PaginatedResult<ActionField>>`
|
|
126
|
+
|
|
127
|
+
**Example:**
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
const result = await sdk.listInputFields({
|
|
131
|
+
appKey: "example-key",
|
|
132
|
+
actionType: "read",
|
|
133
|
+
actionKey: "example-key",
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### `runAction`
|
|
138
|
+
|
|
139
|
+
Execute an action with the given inputs
|
|
140
|
+
|
|
141
|
+
**Parameters:**
|
|
142
|
+
|
|
143
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
144
|
+
| ------------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
145
|
+
| `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
146
|
+
| `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
147
|
+
| `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
148
|
+
| `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
149
|
+
| `inputs` | `object` | ❌ | — | — | Input parameters for the action |
|
|
150
|
+
| `pageSize` | `number` | ❌ | — | — | Number of results per page |
|
|
151
|
+
| `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
152
|
+
|
|
153
|
+
**Returns:** `Promise<ActionExecutionResult>`
|
|
154
|
+
|
|
155
|
+
**Example:**
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
const result = await sdk.runAction({
|
|
159
|
+
appKey: "example-key",
|
|
160
|
+
actionType: "read",
|
|
161
|
+
actionKey: "example-key",
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Apps
|
|
166
|
+
|
|
167
|
+
#### `listApps`
|
|
168
|
+
|
|
169
|
+
List all available apps with optional filtering
|
|
170
|
+
|
|
171
|
+
**Parameters:**
|
|
172
|
+
|
|
173
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
174
|
+
| ---------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
|
|
175
|
+
| `appKeys` | `array` | ❌ | — | — | Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
176
|
+
| `search` | `string` | ❌ | — | — | Search for apps by name |
|
|
177
|
+
| `pageSize` | `number` | ❌ | — | — | Number of apps per page |
|
|
178
|
+
| `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
179
|
+
|
|
180
|
+
**Returns:** `Promise<PaginatedResult<AppItem>>`
|
|
181
|
+
|
|
182
|
+
**Example:**
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
const result = await sdk.listApps();
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### `getApp`
|
|
189
|
+
|
|
190
|
+
Get detailed information about a specific app
|
|
191
|
+
|
|
192
|
+
**Parameters:**
|
|
193
|
+
|
|
194
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
195
|
+
| -------- | -------- | -------- | ------- | --------------- | --------------------------------------------- |
|
|
196
|
+
| `appKey` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI') |
|
|
197
|
+
|
|
198
|
+
**Returns:** `Promise<AppItem>`
|
|
199
|
+
|
|
200
|
+
**Example:**
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
const result = await sdk.getApp({
|
|
204
|
+
appKey: "example-key",
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Authentication
|
|
209
|
+
|
|
210
|
+
#### `listAuthentications`
|
|
211
|
+
|
|
212
|
+
List available authentications with optional filtering
|
|
213
|
+
|
|
214
|
+
**Parameters:**
|
|
215
|
+
|
|
216
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
217
|
+
| ------------ | -------- | -------- | ------- | --------------- | -------------------------------------------------------- |
|
|
218
|
+
| `appKey` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI') |
|
|
219
|
+
| `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
220
|
+
| `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
221
|
+
| `account_id` | `string` | ❌ | — | — | Filter by account ID |
|
|
222
|
+
| `owner` | `string` | ❌ | — | — | Filter by owner |
|
|
223
|
+
| `pageSize` | `number` | ❌ | — | — | Number of authentications per page |
|
|
224
|
+
| `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
225
|
+
|
|
226
|
+
**Returns:** `Promise<PaginatedResult<Authentication>>`
|
|
227
|
+
|
|
228
|
+
**Example:**
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
const result = await sdk.listAuthentications();
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### `getAuthentication`
|
|
235
|
+
|
|
236
|
+
Get a specific authentication by ID
|
|
237
|
+
|
|
238
|
+
**Parameters:**
|
|
239
|
+
|
|
240
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
241
|
+
| ------------------ | -------- | -------- | ------- | --------------- | ----------------------------- |
|
|
242
|
+
| `authenticationId` | `number` | ✅ | — | — | Authentication ID to retrieve |
|
|
243
|
+
|
|
244
|
+
**Returns:** `Promise<Authentication>`
|
|
245
|
+
|
|
246
|
+
**Example:**
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
const result = await sdk.getAuthentication({
|
|
250
|
+
authenticationId: 12345,
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### `findFirstAuthentication`
|
|
255
|
+
|
|
256
|
+
Find the first authentication matching the criteria
|
|
257
|
+
|
|
258
|
+
**Parameters:**
|
|
259
|
+
|
|
260
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
261
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
262
|
+
| `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
263
|
+
| `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
264
|
+
| `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
265
|
+
| `account_id` | `string` | ❌ | — | — | Filter by account ID |
|
|
266
|
+
| `owner` | `string` | ❌ | — | — | Filter by owner |
|
|
267
|
+
|
|
268
|
+
**Returns:** `Promise<Authentication | null>`
|
|
269
|
+
|
|
270
|
+
**Example:**
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
const result = await sdk.findFirstAuthentication();
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
#### `findUniqueAuthentication`
|
|
277
|
+
|
|
278
|
+
Find a unique authentication matching the criteria
|
|
279
|
+
|
|
280
|
+
**Parameters:**
|
|
281
|
+
|
|
282
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
283
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
284
|
+
| `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
285
|
+
| `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
286
|
+
| `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
287
|
+
| `account_id` | `string` | ❌ | — | — | Filter by account ID |
|
|
288
|
+
| `owner` | `string` | ❌ | — | — | Filter by owner |
|
|
289
|
+
|
|
290
|
+
**Returns:** `Promise<Authentication | null>`
|
|
291
|
+
|
|
292
|
+
**Example:**
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
const result = await sdk.findUniqueAuthentication();
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### HTTP Requests
|
|
299
|
+
|
|
300
|
+
#### `request`
|
|
301
|
+
|
|
302
|
+
Make authenticated HTTP requests through Zapier's Relay service
|
|
303
|
+
|
|
304
|
+
**Parameters:**
|
|
305
|
+
|
|
306
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
307
|
+
| ------------------------ | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
308
|
+
| `url` | `string` | ✅ | — | — | The URL to request (will be proxied through Relay) |
|
|
309
|
+
| `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method |
|
|
310
|
+
| `body` | `string` | ❌ | — | — | Request body as a string |
|
|
311
|
+
| `authenticationId` | `number` | ❌ | — | — | Zapier authentication ID to use for the request |
|
|
312
|
+
| `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
|
|
313
|
+
| `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
|
|
314
|
+
| `headers` | `string` | ❌ | — | — | Request headers |
|
|
315
|
+
| `relayBaseUrl` | `string` | ❌ | — | — | Base URL for Relay service |
|
|
316
|
+
|
|
317
|
+
**Returns:** `Promise<Response>`
|
|
318
|
+
|
|
319
|
+
**Example:**
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
const result = await sdk.request({
|
|
323
|
+
url: "https://example.com",
|
|
324
|
+
});
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### User & Profile
|
|
328
|
+
|
|
329
|
+
#### `getProfile`
|
|
330
|
+
|
|
331
|
+
Get current user's profile information
|
|
332
|
+
|
|
333
|
+
**Parameters:** None
|
|
334
|
+
|
|
335
|
+
**Returns:** `Promise<UserProfile>`
|
|
336
|
+
|
|
337
|
+
**Example:**
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
const result = await sdk.getProfile();
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
<!-- End Generated API Reference -->
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for handling authentication tokens,
|
|
5
|
+
* including JWT detection and authorization header generation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isJwt(token: string): boolean;
|
|
8
|
+
export declare function getAuthorizationHeader(token: string): string;
|
|
9
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/api/auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAW5C;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO5D"}
|
package/dist/api/auth.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for handling authentication tokens,
|
|
5
|
+
* including JWT detection and authorization header generation.
|
|
6
|
+
*/
|
|
7
|
+
export function isJwt(token) {
|
|
8
|
+
// JWT tokens have exactly 3 parts separated by dots
|
|
9
|
+
const parts = token.split(".");
|
|
10
|
+
if (parts.length !== 3) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
// Each part should be base64url encoded (no padding)
|
|
14
|
+
// Basic validation - each part should be non-empty and contain valid base64url characters
|
|
15
|
+
const base64UrlPattern = /^[A-Za-z0-9_-]+$/;
|
|
16
|
+
return parts.every((part) => part.length > 0 && base64UrlPattern.test(part));
|
|
17
|
+
}
|
|
18
|
+
export function getAuthorizationHeader(token) {
|
|
19
|
+
// Check if token is a JWT (has 3 parts separated by dots)
|
|
20
|
+
if (isJwt(token)) {
|
|
21
|
+
return `JWT ${token}`;
|
|
22
|
+
}
|
|
23
|
+
// Default to Bearer for other token types
|
|
24
|
+
return `Bearer ${token}`;
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Implementation
|
|
3
|
+
*
|
|
4
|
+
* This module contains the core API client implementation, including
|
|
5
|
+
* HTTP method handlers, response processing, and client factory functions.
|
|
6
|
+
*/
|
|
7
|
+
import type { ApiClient, ApiClientOptions } from "./types";
|
|
8
|
+
export declare const createZapierApi: (options: ApiClientOptions) => ApiClient;
|
|
9
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AA4bjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAqB3D,CAAC"}
|